Coder Social home page Coder Social logo

ha-bestway's Introduction

Bestway

GitHub Release GitHub Activity License hacs

This custom component integrates with the Bestway cloud API, providing control of devices such as Lay-Z-Spa hot tubs and Flowclear pool filters.

Required Account

You must have an account with the Bestway mobile app (Android/iOS). Lay-Z-Spa app credentials will not work. Both apps appear to have identical feature sets.

Bestway uses different API endpoints for EU and US. If you get an error stating account could not be found, try using the other endpoint. If this does not help, then create a new account under a supported country.

Device Support

A Wi-Fi enabled model is required. No custom hardware is required.

See the supported devices list for more details.

Installation

This integration is delivered as a HACS custom repository.

  1. Download and install HACS.
  2. Add a custom repository in HACS. You will need to enter the URL of this repository when prompted: https://github.com/cdpuk/ha-bestway.

Configuration

Ensure you can control your device using the Bestway mobile app. At time of writing, there was also a Lay-Z-Spa branded app, but despite this being the recommended app in the installation manual, the spa could not be added. The Bestway app worked flawlessly.

  • Go to Configuration > Devices & Services > Add Integration, then find Bestway in the list.
  • Enter your Bestway username and password when prompted.

Update speed

Any changes made to the spa settings via the Bestway app or physical controls can take a short amount of time to be reflected in Home Assistant. This delay is typically under 30 seconds, but can sometimes extend to a few minutes.

Improvement ideas

Achieve faster (or even local) updates.

  • Capture more traffic from the mobile app to work out how it receives updates so quickly.
  • The integration currently has to poll, but the mobile app is able to reflect changes based on physical button presses within a fraction of a second.
  • A brief recent attempt suggested that the Android app may have certificate pinning enabled, making this slightly harder than expected. Perhaps decompilation is an easier route.
  • We know the spa talks directly to the cloud using MQTT. Traffic captures against the Android app appeared to show only HTTPS traffic.

Acknowledgements

Contributing

If you want to contribute to this please read the Contribution Guidelines.

ha-bestway's People

Contributors

cdpuk avatar jannylund avatar thecadams avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha-bestway's Issues

How to change Username and Password?

My Bestway password expired and I had to set a new one. Everything works fine with the App itself.

However, I don't find a way in HA, where I can change the Username and Password without removing and reinstalling the device. Which I don't like, as this would remove all my bindings to entities.

Airjet_V01 Support

It appears that I have a different version of the AirJet, identified as "Airjet_V01". The status values are different, but it appears that I have most(all?) of the values defined in BestwaySpaDeviceStatus. Is there a preferred method of adding support? I can try to add a new BestwayDeviceType.AIRJET_V01_SPA and do a pull request. Or I can provide a proposed mapping of values to function names (turn on feature, observe change, turn off feature, repeat)? Another method, somewhere in between?

Thank you for writing this integration! It appears well setup to abstract to an additional type.

The log message is: Status for unknown device type 'Airjet_V01' returned: {"E19": 0, "E18": 0, "E32": 0, "E31": 0, "E30": 0, "E11": 0, "E10": 0, "E13": 0, "E12": 0, "E15": 0, "E14": 0, "E17": 0, "E16": 0, "word5": 792, "word4": 0, "word7": 34, "word6": 0, "word1": 0, "word0": 0, "E29": 0, "word2": 792, "option6": 10244, "ver": 1174, "E22": 0, "jet": 0, "E23": 0, "power": 1, "Tnow": 93, "option7": 10260, "option4": 0, "option5": 27182, "option2": 0, "option3": 30, "option0": 59940, "option1": 59940, "E24": 0, "E25": 0, "E26": 0, "E27": 0, "E20": 0, "E21": 0, "E08": 0, "E09": 0, "E06": 0, "E07": 0, "E04": 0, "E05": 0, "E02": 0, "E03": 0, "E01": 0, "bit7": 1, "heat": 3, "Tunit": 0, "wave": 0, "word3": 0, "Tset": 104, "filter": 2, "E28": 0, "bit6": 1, "bit5": 0, "bit4": 0, "bit3": 0, "bit2": 1}

My guess on some of the mappings (untested & not methodical, just looking at the names to start) is:
spa_power: power
temp_now: Tnow
temp_set: Tset
temp_set_unit: Tunit
heat_power: heat
heat_temp_reach:
filter_power: filter
wave_power: wave
locked:
errors:
earth_fault:

Layz Spa Hawaii - no longer seems to work

Version of the custom_component

v1.5.0

Bestway device

LayZ Spa Hawaii - Airjet (newer version with freezeshield (squared) / EU region

Describe the bug

My Spa no longer seems to work properly, none of the components are available or updated.
The debugs show it may retrieve the correct detail but I assume this may not be parsed correctly.

image

image

Logs

[custom_components.bestway.bestway.api] Status for device type 'Airjet' returned: {"system_err2": 0, "wave_appm_min": 59940, "heat_timer_min": 0, "heat_power": 0, "earth": 0, "wave_timer_min": 59940, "system_err6": 0, "system_err7": 0, "system_err4": 0, "system_err5": 0, "heat_temp_reach": 0, "system_err3": 0, "system_err1": 0, "system_err8": 0, "system_err9": 0, "filter_timer_min": 0, "heat_appm_min": 0, "power": 1, "temp_set_unit": "\u6444\u6c0f", "filter_appm_min": 0, "temp_now": 20, "wave_power": 0, "locked": 1, "filter_power": 1, "temp_set": 37}
2024-05-14 14:57:04.301 DEBUG (MainThread) [custom_components.bestway.coordinator] Finished fetching Bestway API data in 0.289 seconds (success: True)

Data update failed, Bad Gateway

Version of the custom_component

v1.4.0

Bestway device

Lay-z Spa Dominica Hydrojet
https://www.bestwaycorp.com/Product/Item?id=1060165XXX23

Describe the bug

I am currently investigating why my Home Assistant is constantly crashing:

image

In this process I am visiting the home-assistant.log.1 regularly and find the log includes errors from the Bestway integration (see below). This error repeats every few hours.

Maybe this log entries are totally unrelated to my HA crashes. However, I want to report here the issue for further investigation.

FYI: Otherwise updating and controlling my Bestway device with the integration works quite well. No issues I was aware of until now.

Logs

2024-02-13 23:00:47.171 ERROR (MainThread) [custom_components.bestway.coordinator] Data update failed
Traceback (most recent call last):
  File "/config/custom_components/bestway/bestway/api.py", line 74, in _raise_for_status
    api_error = await response.json()
                ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/aiohttp_client.py", line 71, in json
    return await super().json(*args, loads=loads, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1166, in json
    raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/html; charset=utf-8', url=URL('https://euapi.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 138, in refresh_bindings
    device.device_id: device for device in await self._get_devices()
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/bestway/bestway/api.py", line 143, in _get_devices
    api_data = await self._do_get(f"{self._api_root}/app/bindings")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/bestway/bestway/api.py", line 430, in _do_get
    await _raise_for_status(response)
  File "/config/custom_components/bestway/bestway/api.py", line 76, in _raise_for_status
    response.raise_for_status()
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1060, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 502, message='Bad Gateway', url=URL('https://euapi.gizwits.com/app/bindings')
2024-02-13 23:00:47.202 ERROR (MainThread) [custom_components.bestway.coordinator] Error fetching Bestway API data: Error communicating with API: 502, message='Bad Gateway', url=URL('https://euapi.gizwits.com/app/bindings')

Missing Spa Locked from controls

Hi,

I have issues with the Spa Locked feature. At the moment it is not available in the controls. I just updated now to the latest version (v1.5.0) of the Bestway integration and the feature just dissapeared.
image

Could you help me in this issue? Maybe it is my fault that I'm not able to see this option. What should I change or turn on to be able to use this?

Thank you very much.

Have a nice day!
Regards,
Sanyi

Problem E32 when triggering changes to climate.set_temp through an automation

Bestway device

S100202 Wifi:Airjet v01

Describe the bug

Im getting a spa error "Problem E32" when triggering changes to climate.set_temp through an automation also it seems to lose the climate entity, eg dosent relfelect the app.

Logs

Automation setting temp to 20'c

2024-07-09 16:23:47.842 DEBUG (MainThread) [custom_components.bestway.bestway.api] Device list refreshed: {"devices": [{"protoc": 3, "ws_port": 8080, "port_s": 8883, "gw_did": null, "host": "eum2m.gizwits.com", "sleep_duration": 3600, "port": 1883, "mcu_soft_version": "D4H90227", "product_key": "", "state_last_timestamp": 1720538617, "role": "owner", "is_sandbox": false, "type": "normal", "product_name": "Airjet_V01", "is_disabled": false, "mcu_hard_version": "P4660011", "wifi_soft_version": "04X3000B", "dev_alias": "Lay z spa", "mesh_id": null, "is_online": true, "dev_label": [], "wss_port": 8880, "remark": "25", "did": "", "mac": "", "passcode": "", "wifi_hard_version": "0ESP32C3", "is_low_power": false}]}
2024-07-09 16:23:47.915 DEBUG (MainThread) [custom_components.bestway.bestway.api] New data received for device xxxxxxxxxxxxxxxxxxxxx
2024-07-09 16:23:47.915 DEBUG (MainThread) [custom_components.bestway.bestway.api] Status for device type 'Airjet_V01' returned: {"E19": 0, "E18": 0, "E32": 1, "E31": 0, "E30": 0, "E11": 0, "E10": 0, "E13": 0, "E12": 0, "E15": 0, "E14": 0, "E17": 0, "E16": 0, "word5": 1, "word4": 0, "word7": 37, "word6": 0, "word1": 0, "word0": 0, "E29": 0, "word2": 111, "option6": 10244, "ver": 1126, "E22": 0, "jet": 0, "E23": 0, "power": 1, "Tnow": 36, "option7": 10260, "option4": 0, "option5": 27178, "option2": 0, "option3": 30, "option0": 59940, "option1": 59940, "E24": 0, "E25": 0, "E26": 0, "E27": 0, "E20": 0, "E21": 0, "E08": 0, "E09": 0, "E06": 0, "E07": 0, "E04": 0, "E05": 0, "E02": 0, "E03": 0, "E01": 0, "bit7": 0, "heat": 6, "Tunit": 1, "wave": 0, "word3": 0, "Tset": 40, "filter": 2, "E28": 0, "bit6": 0, "bit5": 0, "bit4": 0, "bit3": 0, "bit2": 1}
2024-07-09 16:23:47.915 DEBUG (MainThread) [custom_components.bestway.coordinator] Finished fetching Bestway API data in 0.306 seconds (success: True)
2024-07-09 16:23:50.052 DEBUG (MainThread) [custom_components.bestway.bestway.api] Setting target temperature to 20
2024-07-09 16:23:50.234 DEBUG (MainThread) [custom_components.bestway.bestway.api] Device list refreshed: {"devices": [{"protoc": 3, "ws_port": 8080, "port_s": 8883, "gw_did": null, "host": "eum2m.gizwits.com", "sleep_duration": 3600, "port": 1883, "mcu_soft_version": "D4H90227", "product_key": "
", "state_last_timestamp": 1720538617, "role": "owner", "is_sandbox": false, "type": "normal", "product_name": "Airjet_V01", "is_disabled": false, "mcu_hard_version": "P4660011", "wifi_soft_version": "04X3000B", "dev_alias": "Lay z spa", "mesh_id": null, "is_online": true, "dev_label": [], "wss_port": 8880, "remark": "25", "did": "", "mac": "", "passcode": "", "wifi_hard_version": "0ESP32C3", "is_low_power": false}]}
2024-07-09 16:23:50.302 DEBUG (MainThread) [custom_components.bestway.bestway.api] Ignoring update for device xxxxxxxxxxxxxxxxxxxxx as local data is newer
2024-07-09 16:23:50.303 DEBUG (MainThread) [custom_components.bestway.coordinator] Finished fetching Bestway API data in 0.146 seconds (success: True)

Automation setting hvac to off

2024-07-09 16:24:19.817 DEBUG (MainThread) [custom_components.bestway.bestway.api] Device list refreshed: {"devices": [{"protoc": 3, "ws_port": 8080, "port_s": 8883, "gw_did": null, "host": "eum2m.gizwits.com", "sleep_duration": 3600, "port": 1883, "mcu_soft_version": "D4H90227", "product_key": "", "state_last_timestamp": 1720538630, "role": "owner", "is_sandbox": false, "type": "normal", "product_name": "Airjet_V01", "is_disabled": false, "mcu_hard_version": "P4660011", "wifi_soft_version": "04X3000B", "dev_alias": "Lay z spa", "mesh_id": null, "is_online": true, "dev_label": [], "wss_port": 8880, "remark": "25", "did": "", "mac": "", "passcode": "", "wifi_hard_version": "0ESP32C3", "is_low_power": false}]}
2024-07-09 16:24:19.888 DEBUG (MainThread) [custom_components.bestway.bestway.api] New data received for device xxxxxxxxxxxxxxxxxxxxx
2024-07-09 16:24:19.889 DEBUG (MainThread) [custom_components.bestway.bestway.api] Status for device type 'Airjet_V01' returned: {"E19": 0, "E18": 0, "E32": 1, "E31": 0, "E30": 0, "E11": 0, "E10": 0, "E13": 0, "E12": 0, "E15": 0, "E14": 0, "E17": 0, "E16": 0, "word5": 1, "word4": 0, "word7": 37, "word6": 0, "word1": 0, "word0": 0, "E29": 0, "word2": 111, "option6": 10244, "ver": 1126, "E22": 0, "jet": 0, "E23": 0, "power": 1, "Tnow": 36, "option7": 10260, "option4": 0, "option5": 27178, "option2": 0, "option3": 30, "option0": 59940, "option1": 59940, "E24": 0, "E25": 0, "E26": 0, "E27": 0, "E20": 0, "E21": 0, "E08": 0, "E09": 0, "E06": 0, "E07": 0, "E04": 0, "E05": 0, "E02": 0, "E03": 0, "E01": 0, "bit7": 0, "heat": 4, "Tunit": 1, "wave": 0, "word3": 0, "Tset": 20, "filter": 2, "E28": 0, "bit6": 0, "bit5": 0, "bit4": 0, "bit3": 0, "bit2": 1}
2024-07-09 16:24:19.889 DEBUG (MainThread) [custom_components.bestway.coordinator] Finished fetching Bestway API data in 0.280 seconds (success: True)
2024-07-09 16:24:20.361 DEBUG (MainThread) [custom_components.bestway.bestway.api] Setting heater mode to OFF
2024-07-09 16:24:20.611 DEBUG (MainThread) [custom_components.bestway.bestway.api] Device list refreshed: {"devices": [{"protoc": 3, "ws_port": 8080, "port_s": 8883, "gw_did": null, "host": "eum2m.gizwits.com", "sleep_duration": 3600, "port": 1883, "mcu_soft_version": "D4H90227", "product_key": "
", "state_last_timestamp": 1720538630, "role": "owner", "is_sandbox": false, "type": "normal", "product_name": "Airjet_V01", "is_disabled": false, "mcu_hard_version": "P4660011", "wifi_soft_version": "04X3000B", "dev_alias": "Lay z spa", "mesh_id": null, "is_online": true, "dev_label": [], "wss_port": 8880, "remark": "25", "did": "", "mac": "", "passcode": "", "wifi_hard_version": "0ESP32C3", "is_low_power": false}]}
2024-07-09 16:24:20.740 DEBUG (MainThread) [custom_components.bestway.bestway.api] Ignoring update for device xxxxxxxxxxxxxxxxxxxxx as local data is newer
2024-07-09 16:24:20.741 DEBUG (MainThread) [custom_components.bestway.coordinator] Finished fetching Bestway API data in 0.228 seconds (success: True)

Manually changing setpoint to 21'c

2024-07-09 16:24:39.059 DEBUG (MainThread) [custom_components.bestway.bestway.api] Setting target temperature to 21
2024-07-09 16:24:39.395 DEBUG (MainThread) [custom_components.bestway.bestway.api] Device list refreshed: {"devices": [{"protoc": 3, "ws_port": 8080, "port_s": 8883, "gw_did": null, "host": "eum2m.gizwits.com", "sleep_duration": 3600, "port": 1883, "mcu_soft_version": "D4H90227", "product_key": "********************************", "state_last_timestamp": 1720538677, "role": "owner", "is_sandbox": false, "type": "normal", "product_name": "Airjet_V01", "is_disabled": false, "mcu_hard_version": "P4660011", "wifi_soft_version": "04X3000B", "dev_alias": "Lay z spa", "mesh_id": null, "is_online": true, "dev_label": [], "wss_port": 8880, "remark": "25", "did": "", "mac": "", "passcode": "", "wifi_hard_version": "0ESP32C3", "is_low_power": false}]}
2024-07-09 16:24:39.478 DEBUG (MainThread) [custom_components.bestway.bestway.api] Ignoring update for device xxxxxxxxxxxxxxxxxxxxx as local data is newer
2024-07-09 16:24:39.478 DEBUG (MainThread) [custom_components.bestway.coordinator] Finished fetching Bestway API data in 0.170 seconds (success: True)

Data update failed

I'm getting this error a lot lately:

2023-08-02 14:16:31.324 ERROR (MainThread) [custom_components.bestway.coordinator] Data update failed
Traceback (most recent call last):
  File "/config/custom_components/bestway/bestway/api.py", line 392, in _do_get
    response = await self._session.get(url, headers=headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 560, in _request
    await resp.start(conn)
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 899, in start
    message, payload = await protocol.read()  # type: ignore[union-attr]
                       ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 616, in read
    await self._waiter
asyncio.exceptions.CancelledError

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 147, in _get_devices
    api_data = await self._do_get(f"{self._api_root}/app/bindings", headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/bestway/bestway/api.py", line 391, in _do_get
    async with async_timeout.timeout(_TIMEOUT):
  File "/usr/local/lib/python3.11/site-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.11/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
TimeoutError
2023-08-02 14:16:31.328 ERROR (MainThread) [custom_components.bestway.coordinator] Error fetching Bestway API data: Error communicating with API: 
2023-08-02 14:20:31.572 ERROR (MainThread) [custom_components.bestway.coordinator] Data update failed
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 147, in _get_devices
    api_data = await self._do_get(f"{self._api_root}/app/bindings", headers)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/bestway/bestway/api.py", line 393, in _do_get
    response.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1005, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 502, message='Bad Gateway', url=URL('https://euapi.gizwits.com/app/bindings')
2023-08-02 14:20:31.573 ERROR (MainThread) [custom_components.bestway.coordinator] Error fetching Bestway API data: Error communicating with API: 502, message='Bad Gateway', url=URL('https://euapi.gizwits.com/app/bindings')

I can not login with eu account

Hello,

Im trying to login to my best way account but it says my username( email) is not registered.

Been using the bestway app almost a year now. Seperatly from ha

Using climate.set_temperature to set temp and mode doesn't work

If I use climate.set_temperature when the climate entity is off will only set the temp but not do anything with the hvac_mode. The behavior I'd expect from this call is to set the temp to 100º and set the entity to heat. This is how other integrations (e.g., Ecobee) work.

Example service call

service: climate.set_temperature
data:
  temperature: 100
  hvac_mode: heat
target:
  entity_id: climate.spa_thermostat

Add support for Error codes

Would it be possible to add support for error codes from the pump unit. In particular the E02 Filter error. It's a common error when the filter needs replacing, the frustrating thing is you can't turn the unit off when it gets an E02 and the Bestway app doesn't notify you so the pool sits there beeping forever until you notice.

A Home Assistant sensor for this would be great as you could set up notifications and also track the time between errors and set up a reminder in HA to replace the filter before it errors.

device went offline and never recovered

i have been using an older version of this integration for months (since march-ish) and its worked flawlessly with my lazyspa milan. honestly this integration was the single best thing in the world!

Bestway device

lazy spa milan

Describe the bug

a few days ago i noticed that my automation that sets the spa temp and turns it on stopped working. Upon investigation i noticed that all the entities were offline. I checked for updates to the integration this morning and installed the latest version (1.2.0) this duplicated all my entities but they still show as offline.

i went ahead and removed all the devices within the integration and confirmed that my username and password were correct in the bestway mobile app.

i then added a new device entered my details and now have 1 device and 11 entities. (screenshot 1)

if i look at the entities themselves i can see they all have a warning status except for spa connected. (screenshot 2)

Logs

looking under logs and searching for bestway im not seeing any logging at all. i have enabled debug logging.

as i said before this was working perfectly for months. Im guessing something has changed with the spa or the api you call in bestway. happy to get some packet sniffing done or anything else to try and get to the bottom of it. but i would need some direction on how to do it.

thanks

James
screenshot 1
screenshot 2

Cant turn off heater from Thermostat Card heat icon

You can click the heat icon on the thermostat card to turn on the heater, however when you click again to turn the heating element off, I hear a beep on the spa but the heater stays on.
Workaround - click the 3 dots at top right of the thermostat card, in 'Operation' change the option to 'Off' and the heater goes off

Beta testing 2023.2 async_setup_platforms warning

Hi. I'm beta testing 2023.2 and noticed the following warning and thought I would share and raise it here.

Logger: homeassistant.helpers.frame
Source: helpers/frame.py:77

Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; 
this will fail in version 2023.3. Please report issue to the custom integration author for bestway 
using this method at custom_components/bestway/__init__.py, line 75: 
hass.config_entries.async_setup_platforms(entry, _PLATFORMS)

Thanks for a great integration btw! 🙌🏼

Climate fails to import v1.5.0

Bestway device

SaluSpa

Describe the bug

Upon updating to the latest 1.5.0 integration version, I am getting errors while importing climate related things. Everything else appears normal but the thermostat/climate is greyed out and does not work even after resetting up the integration. Reverting to 1.4.0 fixes the issue.

HA Core 2024.1.5

Logs


Logger: homeassistant.loader
Source: loader.py:842
First occurred: 07:01:47 (1 occurrences)
Last logged: 07:01:47

Unexpected exception importing platform custom_components.bestway.climate
Traceback (most recent call last):
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/loader.py", line 842, in get_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/loader.py", line 859, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/bestway/climate.py", line 25, in <module>
    | ClimateEntityFeature.TURN_OFF
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/enum.py", line 784, in __getattr__
    raise AttributeError(name) from None
AttributeError: TURN_OFF


Hydrojet support

Custom integration done in EU API server, with login/pass and reboot
I got that message : Error communicating with API: 'system_err1'

LOG

2023-04-24 08:18:05.269 ERROR (MainThread) [custom_components.bestway] Data update failed
Traceback (most recent call last):
File "/config/custom_components/bestway/init.py", line 140, in _async_update_data
return await self.api.fetch_data()
File "/config/custom_components/bestway/bestway.py", line 226, in fetch_data
if device_attrs[f"system_err{err_num}"] == 1:
KeyError: 'system_err1'
2023-04-24 08:18:05.289 WARNING (MainThread) [homeassistant.config_entries] Config entry 'd************@w********.fr' for bestway integration not ready yet: Error communicating with API: 'system_err1'; Retrying in background
2023-04-24 08:18:28.591 ERROR (MainThread) [custom_components.bestway] Data update failed
Traceback (most recent call last):
File "/config/custom_components/bestway/init.py", line 140, in _async_update_data
return await self.api.fetch_data()
File "/config/custom_components/bestway/bestway.py", line 226, in fetch_data
if device_attrs[f"system_err{err_num}"] == 1:
KeyError: 'system_err1'

Add LayZSpa to HomeAssistant no climate entity

Bestway device

Home Assistant 2023.8.2 Supervisor 2024.04.0 Operating System 10.4 Kezelőfelület 20230802.0 - latest
LayZSpa Helsinki

Describe the bug

After i added my Helsinki to Home Assistant, no climate entity.

Logs

Ez a hiba egy egyéni integrációból lett származtatva.

Logger: homeassistant.loader
Source: custom_components/bestway/climate.py:25
Integration: Bestway (documentation, issues)
First occurred: 15:04:52 (2 occurrences)
Last logged: 15:22:44

Unexpected exception importing platform custom_components.bestway.climate
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/loader.py", line 833, in get_platform
cache[full_name] = self._import_platform(platform_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/loader.py", line 850, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/config/custom_components/bestway/climate.py", line 25, in
| ClimateEntityFeature.TURN_OFF
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/enum.py", line 783, in getattr
raise AttributeError(name) from None
AttributeError: TURN_OFF

Bubbles Toggle Inconsistent

I updated to the latest version a few days ago. I notices that the filter and bubbles objects had changed to a v2.
I have the bobbles toggle on my dashboard and I've noticed that the new toggle operates in an odd way.
e.g. The toggle is off on my dashboard. I press the button and the bubbles come on as expected. However, the icon on the dashboard changes to 'on' then a few second later turns to off. The bubbles on the spa are still on.
I then have a difference where the spa is using the bubbles, but the dashboard says they are off.
I sometimes have to press the toggle a couple of times to eventually get the spa to respond and turn off the bubbles.

Turning on the bubbles on the spa's control is also not showing as ON on the dashboard. This is an issue for me especially as I'd written an automation to turn off bubbles after 10 minutes. That's not recognising the button press, so doesn't trigger the timer.

I had no issues with the previous version, but this new one is proving inconsistent.

Anyone else seeing the same?

User account does not exist

I registered a Bestway account in Finland and it works over the phone using the app. However, the integration reports "User account does not exist" under same credentials. I tried both the EU and US access points for the API. Most likely the nordic countries have their own AP.

Then following the instructions, I made another account in Germany, which definitely is in EU. However, I get the same error, "User account does not exist". And with the new account it works fine using the app on the phone.

  1. How can I determine the nordic API server location?
  2. Can I extract logs or help in some other way?

Deprecated Constants

Hi,
I found this in the HA logs so thought I would raise it as an issue.

Logger: homeassistant.const
Source: helpers/deprecation.py:197
First occurred: 13 June 2024 at 22:59:12 (2 occurrences)
Last logged: 13 June 2024 at 22:59:12

TEMP_CELSIUS was used from bestway, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.CELSIUS instead, please report it to the author of the 'bestway' custom integration
TEMP_FAHRENHEIT was used from bestway, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.FAHRENHEIT instead, please report it to the author of the 'bestway' custom integration

Worked flawlessly until a few days ago.

Bestway device

Airjet

Describe the bug

Worked flawlessly in HA for months, now doesn't show any entities. Have re-logged in, have re-added the spa to the Bestway App (spa is online and working fine from the app). Just not showing in HA.

Integration says it failed to initiate.

Logs


This error originated from a custom integration.

Logger: custom_components.bestway.coordinator
Source: custom_components/bestway/coordinator.py:37
Integration: Bestway (documentation, issues)
First occurred: 15:01:32 (13 occurrences)
Last logged: 15:22:22

Data update failed
Traceback (most recent call last):
  File "/config/custom_components/bestway/coordinator.py", line 37, in _async_update_data
    return await self.api.fetch_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/bestway/bestway/api.py", line 166, in fetch_data
    latest_data = await self._do_get(
                  ^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/bestway/bestway/api.py", line 418, in _do_get
    response.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1059, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://euapi.gizwits.com/app/devdata/qLb2LxnphLIV6TKuu6azCf/latest')


Entity None (<class 'custom_components.bestway.climate.SpaThermostat'>) implements HVACMode(s)

Version 1.3.1

Getting this in logs after update to HA 2024.2

Logs


Logger: homeassistant.components.climate
Source: components/climate/__init__.py:354
Integration: Climate (documentation, issues)
First occurred: 12:56:14 pm (1 occurrences)
Last logged: 12:56:14 pm

Entity None (<class 'custom_components.bestway.climate.SpaThermostat'>) implements HVACMode(s): off, heat and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please create a bug report at https://github.com/cdpuk/ha-bestway/issues

API not working for 2 days now

Version of the custom_component

1.5.0

Bestway device

St. Moritz

Describe the bug

Since 2 days the device is offline in homeassistant. But it's working via the app.

Logs


2024-05-20 08:43:02.954 DEBUG (MainThread) [custom_components.bestway.bestway.api] Status for device type 'Airjet' returned: {"system_err2": 0, "wave_appm_min": 59940, "heat_timer_min": 0, "heat_power": 0, "earth": 0, "wave_timer_min": 59940, "system_err6": 0, "system_err7": 0, "system_err4": 0, "system_err5": 0, "heat_temp_reach": 0, "system_err3": 0, "system_err1": 0, "system_err8": 0, "system_err9": 0, "filter_timer_min": 0, "heat_appm_min": 0, "power": 1, "temp_set_unit": "\u6444\u6c0f", "filter_appm_min": 0, "temp_now": 26, "wave_power": 0, "locked": 1, "filter_power": 0, "temp_set": 39}
2024-05-20 08:43:02.954 DEBUG (MainThread) [custom_components.bestway.coordinator] Finished fetching Bestway API data in 0.731 seconds (success: True)

HA Integration problems

When i try to install the Bestway Smart Home App with the custom repository in HA and i check the EU square i get "user does not exists".
when i tryed to switch to the US square the integration did install.
Can it be so nice and perfect so after brexit the englishmen did also get kicked out from the Bestway App lol

Data update and communication error

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')

Support Smart Touch Wifi Filter Pump

Hi! I can successfully onboard with my Bestway app credentials, but it looks like the integration is only for SPAs and not Bestway products in general, because I can't see the pump device I see in my app screen.

Is it the integration or the Bestway Cloud API doesn't expose anything else than SPAs?

This past week I've had so far 3 disconnections... possibly since update but could be coincidence?

About 2 days ago I found out my HA had lost connection with the hottub for 2 days, so no temp control occurred and so it went quite a lot colder. After restarting HA it seemed to connect ok and so put it down to a one off since I've been using this for a good few months now without issue.

Today I looked and realised it had got disconnected again at a time its last request was to heat to max.. so it's been maintaining 40 for 2 days.. a big cost problem if it reoccurs! Again a restart of HA got it working.

A little later I've just looked and it's gone again. I'm not over-familiar with HA but did look around for where logs are and found:

This error originated from a custom integration.

Logger: custom_components.bestway
Source: helpers/update_coordinator.py:168
Integration: Bestway (documentation, issues)
First occurred: January 8, 2023 at 10:17:11 PM (2 occurrences)
Last logged: January 8, 2023 at 11:21:55 PM

Error fetching Bestway API data: Error communicating with API:

Suggesting to me it's losing contact with bestway cloud system, not my hottub (as restart is reconnecting). This all seems to me to have started happening since the recent updates, although as per the title accept that could be coincidence. So need to figure out what's going on as I can't use this anymore if it's going to keep disconnecting and leaving the hot tub in last state.

Hydro Jet Pro Unit (SanFrancisco)

Hello, since i added the HydroJet Pro Pump to my bestway app, i got an api error. Is it possible to fix this? Many thanks

Here the message:

Setup erneut versuchen: Error communicating with API: 'system_err1'

No way to control the Bestway Saluspa Coronado WiFi

Version 1.3.0

Bestway device

Bestway Saluspa Coronado (WiFi model from Costco)

Describe the bug

I installed the integration through HACS and it installed fine. I was able to successfully sign in to my Bestway account through the US and it saw my hot tub. The problem is that all I see are 5 entities:

Bestway MCU Hardware Version
Bestway MCU Software Version
Bestway Protocol Version
Bestway Wi-Fi Hardware Version
Bestway Wi-Fi Software Version

I don't have any way of controlling the spa at all. I've attached a screenshot of what I get when the device is added.

Screen Shot 2023-11-03 at 12 55 12 PM

"Failed to Setup" Error

I just got back to my house with the hot tub and tried to use the integration again. But it wasn't working. I've tried deleting, re-adding, etc., but still no go.

I can successfully login with the Bestway app. Also, if I select the EU API instead of the US API, I get an unknown login error, so I think that the integration is successfully logging in to the US Bestway API.

The errors in the log indicate that there is an error related to the USER_TOKEN_EXPIRY (see below).

2022-12-19` 15:59:37.884 INFO (MainThread) [homeassistant.setup] Setting up bestway
2022-12-19 15:59:37.884 INFO (MainThread) [homeassistant.setup] Setup of domain bestway took 0.0 seconds
2022-12-19 15:59:37.886 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] for bestway
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/bestway/__init__.py", line 40, in async_setup_entry
    user_token_expiry = int(entry.data.get(CONF_USER_TOKEN_EXPIRY))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
2022-12-19 16:00:58.675 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] for bestway
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/bestway/__init__.py", line 40, in async_setup_entry
    user_token_expiry = int(entry.data.get(CONF_USER_TOKEN_EXPIRY))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
2022-12-19 16:02:27.986 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] for bestway
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/bestway/__init__.py", line 40, in async_setup_entry
    user_token_expiry = int(entry.data.get(CONF_USER_TOKEN_EXPIRY))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'
2022-12-19 16:04:19.451 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [email protected] for bestway
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/bestway/__init__.py", line 40, in async_setup_entry
    user_token_expiry = int(entry.data.get(CONF_USER_TOKEN_EXPIRY))
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

spa found but wont connect

fairly new to home assistant but have installed HACS and the bestway script and found my hottub but after logging in I cant control anything what am I doing wrong

![Screenshot ha issue](https://github.com/cdpuk/ha-bestway/assets/171022724/d3ee9c32-33ae-4d34-b323-30b20a1e9f18)
![Screenshot ha issue](https://github.com/cdpuk/ha-bestway/assets/171022724/38c56534-f619-468d-9871-5b08badcaead)

Websocket cloud server for up to date status and python library

I want to pre-empt this by saying my knowledge of python is very limited but I have started a library which is a wrapper for the Gizwits cloud API and their websocket server that allows you to receive updates from the server when status of devices change.
I have not implemented pushing updates to the server fully yet.
I was mosty inspired by the code here and getting it to work for an aquarium pump I have that uses the same API.

Fully open to pull requests, suggestions, etc.
https://pypi.org/project/pyGizwits
https://github.com/brendann993/pyGizwits

API Comm Problems (Hydrojet)

Home Assistant version: 2023.8.4
HACS version: 1.32.1
Bestway HACS custom component version: v1.2.0

Bestway Lay-Z Spa: Dominica HydroJet

WiFi: Setup and working
Bestway app: set up and working seamless

Location: Germany
API: EU

Problem

I have successfully installed the custom component into HACS and HA. The component seems to connect to the API and creates a devices with five entities:

Bildschirmfoto 2023-09-01 um 13 12 50

However, no further entities created.

Logs

While initially five entities are available....

Bildschirmfoto 2023-09-01 um 13 19 52

...
...... they become unavailable after a few minutes...

Bildschirmfoto 2023-09-01 um 13 15 10

Edit: Found some traces in the log…

Logs

This error originated from a custom integration.

Logger: custom_components.bestway.bestway.api
Source: custom_components/bestway/bestway/api.py:248
Integration: Bestway (documentation, issues)
First occurred: September 1, 2023 at 17:49:13 (1427 occurrences)
Last logged: 05:43:43

Status for unknown device type 'Hydrojet' returned: {"E19": 0, "E18": 0, "E32": 0, "E31": 0, "E30": 0, "E11": 0, "E10": 0, "E13": 0, "E12": 0, "E15": 0, "E14": 0, "E17": 0, "E16": 0, "word5": 0, "word4": 0, "word7": 27, "word6": 0, "word1": 0, "word0": 0, "E29": 0, "word2": 0, "option6": 10244, "ver": 982, "E22": 0, "jet": 0, "E23": 0, "power": 1, "Tnow": 27, "option7": 10260, "option4": 60, "option5": 27176, "option2": 0, "option3": 30, "option0": 59940, "option1": 59940, "E24": 0, "E25": 0, "E26": 0, "E27": 0, "E20": 0, "E21": 0, "E08": 0, "E09": 0, "E06": 0, "E07": 0, "E04": 0, "E05": 0, "E02": 0, "E03": 0, "E01": 0, "bit7": 0, "heat": 0, "Tunit": 1, "wave": 0, "word3": 0, "Tset": 38, "filter": 0, "E28": 0, "bit6": 0, "bit5": 0, "bit4": 0, "bit3": 0, "bit2": 1}
Status for unknown device type 'Hydrojet' returned: {"E19": 0, "E18": 0, "E32": 0, "E31": 0, "E30": 0, "E11": 0, "E10": 0, "E13": 0, "E12": 0, "E15": 0, "E14": 0, "E17": 0, "E16": 0, "word5": 0, "word4": 0, "word7": 27, "word6": 0, "word1": 0, "word0": 0, "E29": 0, "word2": 0, "option6": 10244, "ver": 982, "E22": 0, "jet": 0, "E23": 0, "power": 1, "Tnow": 26, "option7": 10260, "option4": 60, "option5": 27176, "option2": 0, "option3": 30, "option0": 59940, "option1": 59940, "E24": 0, "E25": 0, "E26": 0, "E27": 0, "E20": 0, "E21": 0, "E08": 0, "E09": 0, "E06": 0, "E07": 0, "E04": 0, "E05": 0, "E02": 0, "E03": 0, "E01": 0, "bit7": 0, "heat": 0, "Tunit": 1, "wave": 0, "word3": 0, "Tset": 38, "filter": 0, "E28": 0, "bit6": 0, "bit5": 0, "bit4": 0, "bit3": 0, "bit2": 1}
Status for unknown device type 'Hydrojet' returned: {"E19": 0, "E18": 0, "E32": 0, "E31": 0, "E30": 0, "E11": 0, "E10": 0, "E13": 0, "E12": 0, "E15": 0, "E14": 0, "E17": 0, "E16": 0, "word5": 0, "word4": 0, "word7": 26, "word6": 0, "word1": 0, "word0": 0, "E29": 0, "word2": 0, "option6": 10244, "ver": 982, "E22": 0, "jet": 0, "E23": 0, "power": 1, "Tnow": 26, "option7": 10260, "option4": 60, "option5": 27176, "option2": 0, "option3": 30, "option0": 59940, "option1": 59940, "E24": 0, "E25": 0, "E26": 0, "E27": 0, "E20": 0, "E21": 0, "E08": 0, "E09": 0, "E06": 0, "E07": 0, "E04": 0, "E05": 0, "E02": 0, "E03": 0, "E01": 0, "bit7": 0, "heat": 0, "Tunit": 1, "wave": 0, "word3": 0, "Tset": 38, "filter": 0, "E28": 0, "bit6": 0, "bit5": 0, "bit4": 0, "bit3": 0, "bit2": 1}
Status for unknown device type 'Hydrojet' returned: {"E19": 0, "E18": 0, "E32": 0, "E31": 0, "E30": 0, "E11": 0, "E10": 0, "E13": 0, "E12": 0, "E15": 0, "E14": 0, "E17": 0, "E16": 0, "word5": 0, "word4": 0, "word7": 26, "word6": 0, "word1": 0, "word0": 0, "E29": 0, "word2": 0, "option6": 10244, "ver": 982, "E22": 0, "jet": 0, "E23": 0, "power": 1, "Tnow": 25, "option7": 10260, "option4": 60, "option5": 27176, "option2": 0, "option3": 30, "option0": 59940, "option1": 59940, "E24": 0, "E25": 0, "E26": 0, "E27": 0, "E20": 0, "E21": 0, "E08": 0, "E09": 0, "E06": 0, "E07": 0, "E04": 0, "E05": 0, "E02": 0, "E03": 0, "E01": 0, "bit7": 0, "heat": 0, "Tunit": 1, "wave": 0, "word3": 0, "Tset": 38, "filter": 0, "E28": 0, "bit6": 0, "bit5": 0, "bit4": 0, "bit3": 0, "bit2": 1}
Status for unknown device type 'Hydrojet' returned: {"E19": 0, "E18": 0, "E32": 0, "E31": 0, "E30": 0, "E11": 0, "E10": 0, "E13": 0, "E12": 0, "E15": 0, "E14": 0, "E17": 0, "E16": 0, "word5": 0, "word4": 0, "word7": 25, "word6": 0, "word1": 0, "word0": 0, "E29": 0, "word2": 0, "option6": 10244, "ver": 982, "E22": 0, "jet": 0, "E23": 0, "power": 1, "Tnow": 25, "option7": 10260, "option4": 60, "option5": 27176, "option2": 0, "option3": 30, "option0": 59940, "option1": 59940, "E24": 0, "E25": 0, "E26": 0, "E27": 0, "E20": 0, "E21": 0, "E08": 0, "E09": 0, "E06": 0, "E07": 0, "E04": 0, "E05": 0, "E02": 0, "E03": 0, "E01": 0, "bit7": 0, "heat": 0, "Tunit": 1, "wave": 0, "word3": 0, "Tset": 38, "filter": 0, "E28": 0, "bit6": 0, "bit5": 0, "bit4": 0, "bit3": 0, "bit2": 1}

Further Logging

This error originated from a custom integration.

Logger: custom_components.bestway.coordinator
Source: custom_components/bestway/coordinator.py:35
Integration: Bestway (documentation, issues)
First occurred: 03:52:27 (1 occurrences)
Last logged: 03:52:27

Data update failed
Traceback (most recent call last):
File "/config/custom_components/bestway/coordinator.py", line 37, in _async_update_data
return await self.api.fetch_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/bestway/bestway/api.py", line 166, in fetch_data
latest_data = await self._do_get(
^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/bestway/bestway/api.py", line 392, in _do_get
response = await self._session.get(url, headers=headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 560, in _request
await resp.start(conn)
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 899, in start
message, payload = await protocol.read() # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/aiohttp/streams.py", line 616, in read
await self._waiter
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/config/custom_components/bestway/coordinator.py", line 35, in _async_update_data
async with async_timeout.timeout(10):
File "/usr/local/lib/python3.11/site-packages/async_timeout/init.py", line 129, in aexit
self._do_exit(exc_type)
File "/usr/local/lib/python3.11/site-packages/async_timeout/init.py", line 212, in _do_exit
raise asyncio.TimeoutError
TimeoutError

Lay z Spa San Fransisco shown offline

Hey, i currently installed this Integration into my ha instance for the Lay-Z-Spa Hydrojet Pro San Fransisco. The login worked but now it shows my device as offline but in the Bestway app it’s shown online and I can edit the settings as usual. Is there any workaround?

For Logs see next Post

Maldives support?

Is your feature request related to a problem? Please describe.
Hi! I have the Bestway Maldives spa and would really like to get it to appear, but I only see 5 sensors which are all unavailable. It does detect the device name though!

What's the best way to find out what's not happening? Going to look through HACS logs and see what I can find.

Describe the solution you'd like
I think the integration just needs to understand the server response for this spa, maybe there's a missing string somewhere.

Describe alternatives you've considered

Additional context

Heads-up - planned deprecation of constants

Version of the custom_component

Latest.

Bestway device

NA

Describe the bug

Testing 2024.1 Beta and caught this in the logs about planned deprecation of constants in 2025. Thanks for your work on this integration and HNY!

Logs


TEMP_FAHRENHEIT was used from bestway, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.FAHRENHEIT instead, please create a bug report at https://github.com/cdpuk/ha-bestway/issues

Lot of errors

integration works. but generates a lot of errors. what can be done about it?

Ten błąd pochodzi z niestandardowej integracji.

Rejestrator: custom_components.bestway.coordinator
Źródło: helpers/update_coordinator.py:344
integracja: Bestway (dokumentacja, Problemy)
Pierwsze zdarzenie: 26 lipca 2024 10:56:58 (130 zdarzenia)
Ostatnio zalogowany: 08:54:44

Error fetching Bestway API data: Error communicating with API: 502, message='Bad Gateway', url=URL('https://usapi.gizwits.com/app/bindings')
Error fetching Bestway API data: Error communicating with API: 502, message='Bad Gateway', url=URL('https://usapi.gizwits.com/app/devdata/vzWm6Jcv5NxUL20M3M8KwC/latest')
Error fetching Bestway API data: Error communicating with API:
Error fetching Bestway API data: Error communicating with API: 500, message='INTERNAL SERVER ERROR', url=URL('https://usapi.gizwits.com/app/devdata/vzWm6Jcv5NxUL20M3M8KwC/latest')


Ten błąd pochodzi z niestandardowej integracji.

Rejestrator: custom_components.bestway.coordinator
Źródło: custom_components/bestway/coordinator.py:37
integracja: Bestway (dokumentacja, Problemy)
Pierwsze zdarzenie: 26 lipca 2024 11:29:29 (67 zdarzenia)
Ostatnio zalogowany: 08:54:44

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/devdata/vzWm6Jcv5NxUL20M3M8KwC/latest')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/config/custom_components/bestway/coordinator.py", line 37, in _async_update_data
return await self.api.fetch_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/bestway/bestway/api.py", line 168, in fetch_data
latest_data = await self._do_get(
^^^^^^^^^^^^^^^^^^^
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/devdata/vzWm6Jcv5NxUL20M3M8KwC/latest')


Ten błąd pochodzi z niestandardowej integracji.

Rejestrator: custom_components.bestway.coordinator
Źródło: custom_components/bestway/coordinator.py:36
integracja: Bestway (dokumentacja, Problemy)
Pierwsze zdarzenie: 26 lipca 2024 10:56:58 (58 zdarzenia)
Ostatnio zalogowany: 08:39:45

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')

--

Ten błąd pochodzi z niestandardowej integracji.

Rejestrator: custom_components.bestway.coordinator
Źródło: custom_components/bestway/coordinator.py:35
integracja: Bestway (dokumentacja, Problemy)
Pierwsze zdarzenie: 26 lipca 2024 14:42:30 (16 zdarzenia)
Ostatnio zalogowany: 08:25:19

Data update failed
Traceback (most recent call last):
File "/config/custom_components/bestway/coordinator.py", line 37, in _async_update_data
return await self.api.fetch_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/bestway/bestway/api.py", line 168, in fetch_data
latest_data = await self._do_get(
^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/bestway/bestway/api.py", line 435, in _do_get
response = await self._session.get(url, headers=headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 608, in _request
await resp.start(conn)
File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 976, in start
message, payload = await protocol.read() # type: ignore[union-attr]
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/streams.py", line 640, in read
await self._waiter
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/config/custom_components/bestway/coordinator.py", line 35, in _async_update_data
async with asyncio.timeout(10):
File "/usr/local/lib/python3.12/asyncio/timeouts.py", line 115, in aexit
raise TimeoutError from exc_val
TimeoutError

Havana Airjet device climate missing

Hi,

From the app i can control climate temp and switch on/off the heating, but in HA the climate entity is missing and the on/off switch as well.

Thanks!

Feature Request: Power on/off

From bruces original code for the layzspa, it was possible to control the power on/off:

  - platform: template
    switches:
      hottub_power:
        availability_template: "{{ states('sensor.hottub_online') }}"
        friendly_name: Power
        unique_id: hottub_power
        value_template: "{% if state_attr('sensor.hottub_status', 'power') == 1 %}on{% else %}off{% endif %}"
        turn_on:
          - service: rest_command.hottub_command
            data:
              hottub_command: turn_on
          - delay: 00:00:05
          - service: homeassistant.update_entity
            entity_id: sensor.hottub_status
        turn_off:
          - service: rest_command.hottub_command
            data:
              hottub_command: turn_off
          - delay: 00:00:05
          - service: homeassistant.update_entity
            entity_id: sensor.hottub_status

Could this be added ?

All devices are diabled and can't enabled

Hello,
I cant' enable any Bestway devices on my system. There ist an error in the Logbook that says, the device is not available.
In the Log I found this:

ERROR (MainThread) [custom_components.bestway.bestway] Unexpected missing key ''system_err1'' while decoding device attributes {"E19": 0, "E18": 0, "E32": 0, "E31": 0, "E30": 0, "E11": 0, "E10": 0, "E13": 0, "E12": 0, "E15": 0, "E14": 0, "E17": 0, "E16": 0, "word5": 100, "word4": 0, "word7": 29, "word6": 0, "word1": 0, "word0": 0, "E29": 0, "word2": 100, "option6": 10244, "ver": 982, "E22": 0, "jet": 0, "E23": 0, "power": 1, "Tnow": 29, "option7": 10260, "option4": 60, "option5": 27176, "option2": 0, "option3": 30, "option0": 59940, "option1": 59940, "E24": 0, "E25": 0, "E26": 0, "E27": 0, "E20": 0, "E21": 0, "E08": 0, "E09": 0, "E06": 0, "E07": 0, "E04": 0, "E05": 0, "E02": 0, "E03": 0, "E01": 0, "bit7": 0, "heat": 3, "Tunit": 1, "wave": 0, "word3": 0, "Tset": 32, "filter": 2, "E28": 0, "bit6": 0, "bit5": 0, "bit4": 0, "bit3": 0, "bit2": 1}

Is this a bug or am I too stupid?

Sorry for my english, I know it's not the yellow from the egg :-)

Bad request 502

Version of the custom_component

Bestway device

Provide the model of your device. A link to the Bestway product page is sometimes useful.

Describe the bug

The integratiom has problem to retrieve data via API. Device is not available via HA

Logs

Device Offline in Bestway App

The integration documentation suggests that when adding the Spa into home assistant that it can still be controlled via the Bestway app. However, when I add the spa into HA, it immediately shows as offline in the Bestway app. Is this expected behaviour?
I just moved to the latest version of the integration, but this was the same on the previous version.

Also, (and maybe linked to the above) if the spa loses power, it does not reconnect into HA when the power is restored and due to the above issue, I have to delete the device in both HA and the Bestway app and re-add them (again going offline in Bestway app once added to HA).

Bestway no communication since restart Homeassistant

Version of the custom_component

Bestway device

Provide the model of your device. A link to the Bestway product page is sometimes useful.

Describe the bug

Logs

2024-01-02 12:25:48.084 ERROR (MainThread) [custom_components.bestway.coordinator] Data update failed
Traceback (most recent call last):
File "/config/custom_components/bestway/coordinator.py", line 37, in _async_update_data
return await self.api.fetch_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/bestway/bestway/api.py", line 166, in fetch_data
latest_data = await self._do_get(
^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/bestway/bestway/api.py", line 418, in _do_get
response.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1059, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://euapi.gizwits.com/app/devdata/4kk34e6xKrlo29Ma3zjxoN/latest')
2024-01-02 12:25:53.426 ERROR (MainThread) [custom_components.bestway.coordinator] Data update failed
Traceback (most recent call last):
File "/config/custom_components/bestway/coordinator.py", line 37, in _async_update_data
return await self.api.fetch_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/bestway/bestway/api.py", line 166, in fetch_data
latest_data = await self._do_get(
^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/bestway/bestway/api.py", line 418, in _do_get
response.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1059, in raise_for_status
raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 400, message='Bad Request', url=URL('https://euapi.gizwits.com/app/devdata/4kk34e6xKrlo29Ma3zjxoN/latest')
2024-01-02 12:26:01.416 ERROR (MainThread) [custom_components.bestway.coordinator] Data update failed
Traceback (most recent call last):
File "/config/custom_components/bestway/coordinator.py", line 37, in _async_update_data
return await self.api.fetch_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/bestway/bestway/api.py", line 166, in fetch_data
latest_data = await self._do_get(
^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/bestway/bestway/api.py", line 418, in _do_get
response.raise_for_status()
File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1059, in raise_for_status
raise ClientResponseError(

Add your logs here.

Local polling via MQTT to Home Assistant

Describe the solution you'd like
It would be nice if we could have local polling via MQTT to home assistant.

Reading the information, it looks like some work has been done already.
How can we as a community help the dev to implement this?

I'm happy to help with the development

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.