herikw / home-assistant-custom-components

Atag One Custom components for Home-Assistant
GNU General Public License v3.0
11 stars 5 forks source link

ATAG One frequently becomes unavailable #28

Closed dcvanduyn closed 1 year ago

dcvanduyn commented 1 year ago

While testing this ATAG One integration, I encountered the following issue. Is there a solution to this?

Home Assistant 2022.9.6 Supervisor 2022.09.1 Operating System 9.0 Frontend 20220907.2 – latest

After a first install of the "atagone" integration on HA, as prescribed, it frequently becomes unavailable. Here is the logbook over a period of about 75 minutes.

Logbook October 1, 2022 Atag One turned off 15:44:52 - 1 minute ago Atag One became unavailable 15:43:21 - 2 minutes ago Atag One turned off 15:43:01 - 3 minutes ago Atag One became unavailable 15:41:52 - 4 minutes ago Atag One turned off 15:40:52 - 5 minutes ago Atag One became unavailable 15:37:55 - 8 minutes ago Atag One turned off 15:37:24 - 2 minutes ago Atag One became unavailable 15:34:23 - 5 minutes ago Atag One turned off 15:33:21 - 6 minutes ago Atag One became unavailable 15:32:22 - 7 minutes ago Atag One turned off 15:32:00 - 7 minutes ago

"et cetera, et cetera"

Here are the (recent) entries in the system log, recorded after a HA restart:

Error requesting Atagone data: Server disconnected 15:51:09 – (ERROR) ATAG One (custom integration)

Error requesting Atagone data: Server disconnected 15:53:38 – (ERROR) ATAG One (custom integration)

This error originated from a custom integration. Logger: custom_components.atagone Source: helpers/update_coordinator.py:151 Integration: ATAG One (documentation) First occurred: 15:51:09 (1 occurrences) Last logged: 15:51:09 Error requesting Atagone data: Server disconnected

2022-10-01 15:50:34.114 DEBUG (MainThread) [atagoneapi] Open connection 2022-10-01 15:50:34.114 DEBUG (MainThread) [atagoneapi] async_update 2022-10-01 15:50:34.114 DEBUG (MainThread) [atagoneapi] _async_send_request 2022-10-01 15:51:06.001 DEBUG (MainThread) [atagoneapi] async_update 2022-10-01 15:51:06.001 DEBUG (MainThread) [atagoneapi] _async_send_request 2022-10-01 15:51:09.002 ERROR (MainThread) [custom_components.atagone] Error requesting Atagone data: Server disconnected 2022-10-01 15:51:36.739 DEBUG (MainThread) [atagoneapi] async_update 2022-10-01 15:51:36.739 DEBUG (MainThread) [atagoneapi] _async_send_request 2022-10-01 15:52:08.001 DEBUG (MainThread) [atagoneapi] async_update 2022-10-01 15:52:08.001 DEBUG (MainThread) [atagoneapi] _async_send_request 2022-10-01 15:52:36.740 DEBUG (MainThread) [atagoneapi] async_update 2022-10-01 15:52:36.740 DEBUG (MainThread) [atagoneapi] _async_send_request 2022-10-01 15:53:08.001 DEBUG (MainThread) [atagoneapi] async_update 2022-10-01 15:53:08.001 DEBUG (MainThread) [atagoneapi] _async_send_request 2022-10-01 15:53:36.741 DEBUG (MainThread) [atagoneapi] async_update 2022-10-01 15:53:36.741 DEBUG (MainThread) [atagoneapi] _async_send_request 2022-10-01 15:53:38.417 ERROR (MainThread) [custom_components.atagone] Error requesting Atagone data: Server disconnected

It seems that the ATAG One, for one reason or another, frequently refuses to connect to the "atagone".

The reason for this is unclear, perhaps a bad request, on which the ATAG one chokes. It originates in:

"update_coordinator.py:151"

herikw commented 1 year ago

Hi Dave

Maybe the timeout and update frequency is the issue in this case. What if have noticed is that the atag can not handle requests in a short time period. Timeout is currently set to 20 sec and the update interval is 30 sec.

Are you confident to change the values in init.py and update "async with async_timeout.timeout(20)" and set timeout to something like 50 and set the "update_interval=timedelta(seconds=30)" to 60? Just play around a bit with the values to see what is best in your case. Do not set the timeout value higher the the update interval.

Or do you want me to release a new version with these values?

dcvanduyn commented 1 year ago

No problem. I will play with the "async_timeout.timeout(20)" and the "update_interval=timedelta(seconds=60)", and see if I can prevent the One from choking. I will report back. On the other hand, I assume that all (sensor) values are retrieved from the One in just a single HTTP retrieve request resulting in a single JSON payload return (???), which is then parsed. And if that is indeed the case, an update interval of 60 seconds hardly seems like stressing the One. It would be different if each entity is separately retrieved. But as far as I know that is not even possible with the One. Reference: https://github.com/kozmoz/atag-one-api/wiki/Thermostat-Protocol Regards Dave