Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public API: Attempt to decode JSON with unexpected mimetype: text/html #108

Closed
jjl109 opened this issue Dec 29, 2022 · 10 comments · Fixed by bigbadblunt/lightwave2#6
Closed

Comments

@jjl109
Copy link

jjl109 commented Dec 29, 2022

I have been using the Public API for a number of weeks with no issues.

Today I restarted HA (after installing a new dimmer) and the lightwave2 integration failed to start:

Logger: homeassistant.config_entries
Source: custom_components/lightwave2/__init__.py:84
Integration: Lightwave v2 (Smart Series) custom component (documentation)
First occurred: 3:20:22 PM (1 occurrences)
Last logged: 3:20:22 PM

Error setting up entry ************** for lightwave2
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/lightwave2/__init__.py", line 84, in async_setup_entry
    await link.async_get_hierarchy()
  File "/usr/local/lib/python3.10/site-packages/lightwave2/lightwave2.py", line 610, in async_get_hierarchy
    await self.async_update_featureset_states()
  File "/usr/local/lib/python3.10/site-packages/lightwave2/lightwave2.py", line 697, in async_update_featureset_states
    req = await self._async_postrequest("features/read", body)
  File "/usr/local/lib/python3.10/site-packages/lightwave2/lightwave2.py", line 559, in _async_postrequest
    return await req.json()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://publicapi.lightwaverf.com/v1/features/read')

On a second attempt, the URL shown in the error was a different one:

Logger: homeassistant.config_entries
Source: custom_components/lightwave2/__init__.py:100
Integration: Lightwave v2 (Smart Series) custom component (documentation)
First occurred: 3:24:24 PM (1 occurrences)
Last logged: 3:24:24 PM

Error setting up entry ****************** for lightwave2
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 372, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/lightwave2/__init__.py", line 100, in async_setup_entry
    await link.async_register_webhook_all(url, LIGHTWAVE_WEBHOOK, overwrite = True)
  File "/usr/local/lib/python3.10/site-packages/lightwave2/lightwave2.py", line 656, in async_register_webhook_all
    req = await self._async_postrequest("events", payload)
  File "/usr/local/lib/python3.10/site-packages/lightwave2/lightwave2.py", line 559, in _async_postrequest
    return await req.json()
  File "/usr/local/lib/python3.10/site-packages/aiohttp/client_reqrep.py", line 1103, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html', url=URL('https://publicapi.lightwaverf.com/v1/events')

On a third attempt, it was back to the first error.

After enabling the debug logs, I see this entry:

2022-12-29 15:40:13.389 DEBUG (MainThread) [lightwave2.lightwave2] async_postrequest: Sending API POST request to features/read: {'features': [{'featureId': '61dc5c2c18685a0a5f6a4f02-18-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-19-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-20-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-21-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-22-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-23-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-24-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-25-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-26-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-27-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-28-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-29-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-34-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-35-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-36-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-37-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-38-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-39-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-40-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-41-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-42-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-43-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-44-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-45-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-46-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-131-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-132-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-133-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-134-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-135-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-136-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-137-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-138-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-139-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-140-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-141-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-142-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-143-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-195-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-196-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-197-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-198-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-199-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-200-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-201-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-202-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-203-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-204-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-205-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-206-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-30-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-31-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-32-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-33-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-72-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-73-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-74-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-47-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-48-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-49-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-50-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-51-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-52-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-53-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-54-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-159-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-160-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-161-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-162-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-163-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-164-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-165-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-166-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-167-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-168-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-169-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-170-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-63-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-64-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-65-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-66-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-67-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-68-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-213-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-214-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-215-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-216-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-217-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-218-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-219-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-220-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-221-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-222-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-223-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-224-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-255-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-256-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-257-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-258-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-259-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-260-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-261-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-262-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-263-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-264-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-265-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-266-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-267-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-268-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-269-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-270-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-271-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-272-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-273-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-274-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-104-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-105-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-106-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-107-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-108-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-109-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-171-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-172-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-173-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-174-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-175-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-176-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-177-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-178-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-179-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-180-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-181-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-182-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-234-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-235-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-236-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-237-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-238-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-239-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-240-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-241-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-242-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-243-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-244-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-75-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-76-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-77-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-78-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-79-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-80-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-81-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-82-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-83-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-84-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-85-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-86-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-87-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-92-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-93-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-94-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-95-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-96-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-97-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-98-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-144-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-145-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-146-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-147-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-148-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-149-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-153-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-154-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-155-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-278-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-279-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-280-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-281-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-282-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-283-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-284-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-285-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-286-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-287-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-288-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-289-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-290-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-291-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-292-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-293-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-294-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-295-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-296-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-297-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-88-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-89-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-90-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-91-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-113-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-114-3157344058+1'}, {'featureId': '61dc5c2c18685a0a5f6a4f02-115-3157344058+1'}]}
2022-12-29 15:40:13.504 DEBUG (MainThread) [lightwave2.lightwave2] async_postrequest: Received API response 500 ((b'Date', b'Thu, 29 Dec 2022 15:40:13 GMT'), (b'Content-Type', b'text/html'), (b'Content-Length', b'177'), (b'Connection', b'keep-alive'), (b'Server', b'nginx/1.20.0')) <html>
<head><title>500 Internal Server Error</title></head>
<body>
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx/1.20.0</center>
</body>
</html>

So it's receiving a 500 error from Lightwave.

Today I added a new dimmer to Lightwave, and I don't know whether that is the cause, or whether there is a general issue with the Public API at the moment (and I just haven't restarted HA in a while).

Using v3.5.16 of the integration.

If anyone else can confirm whether the Public API is working for them at the moment, I will know whether it's likely to be the addition of the new dimmer that is at fault.

The integration is starting fine using the websocket method.

@jjl109
Copy link
Author

jjl109 commented Dec 29, 2022

I've tried making the same request manually using Postman https://publicapi.lightwaverf.com/v1/features/read with the same body as that shown in the logs above, and it works fine. But HA consistently gets the 500 error.

@bigbadblunt
Copy link
Owner

It's working for me.

This makes no sense! I assume all the previous calls to the API work, and it's just failing on the features\read call? I don't know why that would happen, or why it would work when you do it separately. There is a problem with requests that are too long, but (a) I'm pretty sure that a request that is too long returns a 404 error, and (b) it works when you do it manually. I'm not sure where to go with this.

@bigbadblunt
Copy link
Owner

Have you tried removing the dimmer?

@jjl109
Copy link
Author

jjl109 commented Dec 29, 2022

Indeed, very strange.

I will try removing the dimmer next (annoying as I have some automations within Lightwave itself that I will need to remove the dimmer from manually first) and report back.

@jjl109
Copy link
Author

jjl109 commented Dec 29, 2022

This makes no sense! I assume all the previous calls to the API work, and it's just failing on the features\read call? I don't know why that would happen, or why it would work when you do it separately. There is a problem with requests that are too long, but (a) I'm pretty sure that a request that is too long returns a 404 error, and (b) it works when you do it manually. I'm not sure where to go with this.

Yes the previous calls work. However as mentioned, on one of my attempts to restart, it was the /v1/events endpoint that had the 500 error instead.

Using Postman I haven't been able to reproduce the raw html 500 error from Nginx.
I've tried messing up the headers, the Json body, give invalid Json etc etc and I only ever get a nice JSON response from Lightwave with a 400 error.

@jjl109
Copy link
Author

jjl109 commented Dec 29, 2022

I have removed the new dimmer and the error still occurs.
Glad to have eliminated that as the cause.

Will have to try and intercept the HTTP request that it is making and see if there is anything odd there.

@jjl109
Copy link
Author

jjl109 commented Dec 29, 2022

I have found a solution but am still puzzled.

Things I tried:

  • I managed to hack the integration so that for this call it called my own web server where I could inspect the exact headers and body being sent. I found nothing unusual. I used these header values to construct a request in Postman that looked exactly the same. The request worked in Postman consistently with no errors, even though the exact same request failed consistently from HA.
  • Tried adding in a small delay before the request in case it was the proximity to the previous request to get the structure details that was causing the problem. Made no difference.
  • Finally, I reduced the max number of features bundled in one request from 200 to 100 - bingo. I then increased to 150 and found that also works.

So it's still a mystery why:

  • The error you previously had from requesting too many feature states at once was different to my error
  • Why the behaviour is different depending on where I am calling from. All I can think of is some low level HTTP or network quirk.

Have submitted bigbadblunt/lightwave2#6 which fixes it for me, and presumably eventually someone else would have stumbled across this too!

@bigbadblunt
Copy link
Owner

I'm also confused. But I've merged the PR and updated the component to use the updated library. Thanks!

@robcos
Copy link

robcos commented Jan 16, 2023

I'm getting this in v3.5.19beta3. Is it expected?

@jjl109
Copy link
Author

jjl109 commented Jan 16, 2023

I've also been getting this today, although seems intermittent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants