cdpuk / ha-bestway

Home Assistant integration for Bestway / Lay-Z-Spa hot tubs
MIT License
59 stars 15 forks source link

Data update and communication error #64

Open FunkeyMonkey opened 5 days ago

FunkeyMonkey commented 5 days ago

Version of the custom_component

Bestway device

Airjet V01 wifi model

Describe the bug

I've been getting these error logs for the last few days now

Logs


Logger: custom_components.bestway.coordinator
Source: helpers/update_coordinator.py:344
integration: Bestway ([documentation](https://github.com/cdpuk/ha-bestway), [issues](https://github.com/cdpuk/ha-bestway/issues))
First occurred: 8:06:32 AM (2 occurrences)
Last logged: 8:11:40 AM

Error fetching Bestway API data: Error communicating with API: 502, message='Bad Gateway', url=URL('https://usapi.gizwits.com/app/bindings')
Logger: custom_components.bestway.coordinator
Source: custom_components/bestway/coordinator.py:36
integration: Bestway ([documentation](https://github.com/cdpuk/ha-bestway), [issues](https://github.com/cdpuk/ha-bestway/issues))
First occurred: 8:06:32 AM (2 occurrences)
Last logged: 8:11:40 AM

Data update failed
Traceback (most recent call last):
  File "/config/custom_components/bestway/bestway/api.py", line 76, in _raise_for_status
    api_error = await response.json()
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 79, in json
    return await super().json(*args, loads=loads, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1176, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('https://usapi.gizwits.com/app/bindings')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/config/custom_components/bestway/coordinator.py", line 36, in _async_update_data
    await self.api.refresh_bindings()
  File "/config/custom_components/bestway/bestway/api.py", line 140, in refresh_bindings
    device.device_id: device for device in await self._get_devices()
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/bestway/bestway/api.py", line 145, in _get_devices
    api_data = await self._do_get(f"{self._api_root}/app/bindings")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/bestway/bestway/api.py", line 436, in _do_get
    await _raise_for_status(response)
  File "/config/custom_components/bestway/bestway/api.py", line 78, in _raise_for_status
    response.raise_for_status()
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1070, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 502, message='Bad Gateway', url=URL('https://usapi.gizwits.com/app/bindings')