-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entities unavailable every night (connection refused) #20
Comments
Maybe we can reduce the number of API calls when there is only one coordinator - #19. Hopefully this will help. |
Great work on moving to one coordinator for the API calls, but it doesn't seem to have any effect. I don't think this local API would be rate limited (or at least not at the number of calls we're doing). It still seems to do exactly the same thing on exactly the same time:
So two different errors but always at the same time of 03:16 and 03:48. I'm starting to wonder if the Alpha Home Gateway and Controller have some built-in reset or reboot every night at these times. That said, if nobody else sees this behaviour it might have something to do with my specific installation. Is anybody seeing something similar? |
Yes, I see the same behavior as well. Never noticed it, I’m usually asleep during that time. ;-) But I see it in the HA logbook that the devices become unavailable for a couple of seconds. Any way I can help debug? |
If there is a rate limit, then we will see this behavior throughout the day. The coordinator updates every minute. Maybe one of you can run a ping to the gateway/controller for a night? |
I checked it with a ping sensor for two nights. No timeouts whatsoever to the heatpump, controller or gateway. |
Confirmed, I see the same things in my logs. Did a ping cycle on all three, all kept giving responses in the <500 ms range. I was even awake for one of the cycles (don't ask) and saw the gateway and controller were both on. So it seems a software thing that does a nightly cycle. The Alpha Home software isn't great, so I'm not surprised that they're using hacky solutions like this. I don't think we can solve the issue other than building in a little more leeway before the entities become unavailable. So maybe do something like a 90 second timeout (3 refresh cycles) for these specific errors. They normally recover within a minute, so 90 seconds should work just fine. If more than 90 seconds have passed we probably have an actual issue. |
Is it possible that one of you pulls the latest version from the main branch? I added a retry strategy. |
Thanks, have just installed it here, will see what happens overnight and report back |
Looking very promising, I do see a 'failed to get data; entry in the log (attached below), but the actual entities do not show the errors in the logbook and do not become unknown right away. This removes a lot of unnecessary clutter and errors from the logbook and logs, so I would say this is a success.
|
It does seem that in some cases a connection error still renders the entities unavailable. I have attached the log file for an event that rendered the entities unavailable. The second time the connection was refused I do see some errors in the log, but the entities did not become unavailable. This rendered the climate entities unavailable:
This did not:
|
Ah, in this case we received a response from the API, but not a response that contains JSON. |
I decided to do a bit more digging yesterday. I added a few more error logging statements to the api and coordinator code, and found this error when the connection drops: 2024-10-28 08:18:32.115 ERROR (SyncWorker_49) [custom_components.alpha_innotec.gateway_api] [api/gateway/allmodules] - API call unsuccessful: {'success': False, 'message': 'Currently there is no connection between Gateway and Control Box. Without a connection radio components can not be operated.', 'loginRejected': False, 'language': 'en', 'performance': 0.284}
2024-10-28 08:18:32.116 ERROR (SyncWorker_49) [custom_components.alpha_innotec.gateway_api] Error fetching all modules: Failed to get data from API endpoint: api/gateway/allmodules
2024-10-28 08:18:32.118 ERROR (MainThread) [custom_components.alpha_innotec.coordinator] Exception in coordinator update: Failed to get data from API endpoint: api/gateway/allmodules
Traceback (most recent call last):
File "/config/custom_components/alpha_innotec/coordinator.py", line 35, in _async_update_data
all_modules: dict = await self.hass.async_add_executor_job(self.gateway_api.all_modules)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alpha_innotec/gateway_api.py", line 94, in all_modules
response = self.call("api/gateway/allmodules")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alpha_innotec/gateway_api.py", line 72, in call
raise Exception('Failed to get data from API endpoint: {}'.format(endpoint))
Exception: Failed to get data from API endpoint: api/gateway/allmodules
2024-10-28 08:18:32.122 ERROR (MainThread) [custom_components.alpha_innotec.coordinator] Unexpected error fetching Alpha Innotec data
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alpha_innotec/coordinator.py", line 35, in _async_update_data
all_modules: dict = await self.hass.async_add_executor_job(self.gateway_api.all_modules)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alpha_innotec/gateway_api.py", line 94, in all_modules
response = self.call("api/gateway/allmodules")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/alpha_innotec/gateway_api.py", line 72, in call
raise Exception('Failed to get data from API endpoint: {}'.format(endpoint))
Exception: Failed to get data from API endpoint: api/gateway/allmodules It seems to me that HA can connect to the gateway just fine, but the gateway cannot reach the control box. A minute later, the sensors update just fine again. I updated my ping sensors to ping more often and check if the control box drops off during these times of unavailability. |
I can see all entities of this integration go to status 'Unavailable' for a few minutes every night. It's always around 04:00, so curious to find out if this is something others are seeing this as well.
The logs show a few things, but the most important seems to be:
The full logs with all relevant lines is below, but it seems the integration cannot connect with the Gateway. As far as I can see the Gateway is available at that time. The Gateway also runs the latest firmware available (2.2.39533).
So not sure why the Gateway would refuse the connection every night at around 4 AM.
Full logs below:
The text was updated successfully, but these errors were encountered: