Skip to content

Spurious API failures cause loss of functionality #86

@lingwooc

Description

@lingwooc

Version of the custom_component

1.6.2
Core 2025.1.2
Supervisor 2024.12.3
Operating System 14.1
Frontend 20250109.0

Bestway device

Lazy Spa Milan

Describe the bug

I don't suppose this is a bug in ha-bestway as such but it could handle it better.

It seems like the bestway api since about 1pm 9/1/25 has been wildly unreliable, throwing 400s for fun (see logs). Its possible its just me and I've a faulty pump but I can't tell that. The issue is that the integration interprets this as the device being unavailable which blocks automations when the post apis are probably up, or would be with a few retries.

I wonder if a bit of tollerance of the api being a bit flaky is in order. Maybe the BestwayUpdateCoordinator just keeps the current status unless there are 3 or 5 consecutive failures, then you pick up the genuine issues and longer lasting outages. If you still log the failed responsed then you still have visibility.

A don't know if the post api is having a moment too but a sensible retry approach to that might have value.

Logs

2025-01-10 09:53:44.546 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": "P151D102", "product_key": "********************************", "state_last_timestamp": 1736502644, "role": "owner", "is_sandbox": false, "type": "normal", "product_name": "Airjet", "is_disabled": false, "mcu_hard_version": "P150D100", "wifi_soft_version": "0402003A", "dev_alias": "Hot tub", "mesh_id": null, "is_online": true, "dev_label": [], "wss_port": 8880, "remark": "21", "did": "**********************", "mac": "************", "passcode": "**********", "wifi_hard_version": "00ESP826", "is_low_power": false}]}
2025-01-10 09:53:44.615 DEBUG (MainThread) [custom_components.bestway.bestway.api] New data received for device OkJNmZYM5wDNwE2AsyuTaJ
2025-01-10 09:53:44.616 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": 1, "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": 35, "wave_power": 0, "locked": 1, "filter_power": 1, "temp_set": 35}
2025-01-10 09:53:44.616 DEBUG (MainThread) [custom_components.bestway.coordinator] Finished fetching Bestway API data in 0.285 seconds (success: True)
2025-01-10 09:54:14.472 ERROR (MainThread) [custom_components.bestway.coordinator] Error requesting Bestway API data: 400, message='BAD REQUEST', url='https://euapi.gizwits.com/app/bindings'
2025-01-10 09:54:14.473 DEBUG (MainThread) [custom_components.bestway.coordinator] Finished fetching Bestway API data in 0.142 seconds (success: False)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions