rootnegativ1 / unifi-wifi

Home Assistant integration to change wireless passwords on UniFi Network controllers
MIT License
3 stars 0 forks source link

Component timeout when fetching data #11

Closed rootnegativ1 closed 9 months ago

rootnegativ1 commented 9 months ago

Multiple times a night I get the following error connecting to my UDM:

2023-12-13 21:46:57.545 DEBUG (MainThread) [custom_components.unifi_wifi.coordinator] Finished fetching myhouse data in 1.410 seconds (success: True)
2023-12-13 21:57:07.135 ERROR (MainThread) [custom_components.unifi_wifi.coordinator] Timeout fetching myhouse data
2023-12-13 21:57:07.135 DEBUG (MainThread) [custom_components.unifi_wifi.coordinator] Finished fetching myhouse data in 10.001 seconds (success: False)
2023-12-13 22:07:12.393 INFO (MainThread) [custom_components.unifi_wifi.coordinator] Fetching myhouse data recovered
2023-12-13 22:07:12.393 DEBUG (MainThread) [custom_components.unifi_wifi.coordinator] Finished fetching myhouse data in 5.259 seconds (success: True)

Short-term fix: increase the coordinator timeout in _async_update_data() Long-term fix: still investigating . . .

rootnegativ1 commented 9 months ago

https://community.ui.com/questions/Change-API-rate-limit-UDM-Pro/6db5f968-6d7c-4552-831c-6f933a763bcc#answer/2b09bf95-800d-4ae1-9616-87f760b81a1e

https://community.ui.com/questions/Unifi-API-Rate-Limited/ba82a718-9418-46b0-8f2f-235bfc647f9b#answer/0761c014-a393-432c-a792-48defcef3f5e

It's possible there are too many login attempts. This may be due to running two instances of HA with this component accessing my UDM (1 production; 1 testing). Following the above posts, the default rate limits are:

# http rate limit (Limit 20 requests per second)
http.limit.second = 1
http.limit.count = 20
# success login rate limit (limit 5 request pre minute)
success.login.limit.count = 5

Still debating the next move . . .

rootnegativ1 commented 9 months ago

I've added a YAML option to configure the coordinator timeout in https://github.com/rootnegativ1/unifi-wifi/pull/13

rootnegativ1 commented 9 months ago

After upgrading my UDM to 3.2.9 (currently in EA), I haven't had any component timeouts. This may be related to the following change: "Fixed an issue where some system logs filled up the disk space completely".