You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From what I can deduce from the logs, my monitoring service hit a problem at 23:32:30 on 22 Sep. nginx in front of the tycomonitor service return 502 server error: bad gateway (usually that means an origin server has gone away). self.alarm.update_status() failed but didn't throw enough of an error, and eventually at line 358, in update_status, an attempt was made to unpack partitions that didn't exist (because the update_status had failed).
Subsequently, the code didn't notice that -- I am guessing -- the session id had got messed up, and every subsequent access failed. I didn't notice until 1900 on the 23rd, when I put the visonicalarm2 library onto another machine and checked that it all still worked with a simple access example (ie, that Tyco hadn't broken things at their end). After staring at the code for a bit, I came to the conclusion that the internal state of the alarm object was messed up, restarted Home Assistant and all was well.
Obviously, I'd like to help fix the code so that it can receover from this. My guess, and it really is only a guess, is that at a minimum line 153 in VisonicAlarm2/visonic/alarm.py the call to self.update_status() should be wrapped in a try/except block to make sure that if the hub.update() fails then the status is set to unknown or unavailable. And then "somewhere" if the hub is in state unavailable, a fresh attempt to get a session token should be made.
Happy to help, but don't want to make a mess of the code before I talk to others.
2024-09-22 23:32:30.564 ERROR (SyncWorker_26) [custom_components.visonicalarm] Update failed: 'NoneType' object is not subscriptable
2024-09-22 23:32:30.577 ERROR (MainThread) [homeassistant.helpers.entity] Update for alarm_control_panel.visonic_alarm fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1302, in async_device_update
await hass.async_add_executor_job(self.update)
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/visonicalarm/alarm_control_panel.py", line 153, in update
hub.update()
File "/usr/src/homeassistant/homeassistant/util/init.py", line 184, in wrapper
result = method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/visonicalarm/init.py", line 119, in update
self.alarm.update_status()
File "/usr/local/lib/python3.12/site-packages/visonic/alarm.py", line 358, in update_status
partition = status['partitions'][0]
~~~~~~^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
2024-09-22 23:32:40.837 ERROR (SyncWorker_3) [root] 403 Client Error: Forbidden for url: https://visonic.tycomonitor.com/rest_api/10.0/status
2024-09-22 23:32:40.838 ERROR (SyncWorker_3) [root]
2024-09-22 23:32:40.838 ERROR (SyncWorker_3) [custom_components.visonicalarm] Update failed: 'NoneType' object is not subscriptable
2024-09-22 23:32:40.841 ERROR (MainThread) [homeassistant.helpers.entity] Update for alarm_control_panel.visonic_alarm fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1302, in async_device_update
await hass.async_add_executor_job(self.update)
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/visonicalarm/alarm_control_panel.py", line 153, in update
hub.update()
File "/usr/src/homeassistant/homeassistant/util/init.py", line 184, in wrapper
result = method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/visonicalarm/init.py", line 119, in update
self.alarm.update_status()
File "/usr/local/lib/python3.12/site-packages/visonic/alarm.py", line 358, in update_status
partition = status['partitions'][0]
~~~~~~^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
The text was updated successfully, but these errors were encountered:
From what I can deduce from the logs, my monitoring service hit a problem at 23:32:30 on 22 Sep. nginx in front of the tycomonitor service return 502 server error: bad gateway (usually that means an origin server has gone away). self.alarm.update_status() failed but didn't throw enough of an error, and eventually at line 358, in update_status, an attempt was made to unpack partitions that didn't exist (because the update_status had failed).
Subsequently, the code didn't notice that -- I am guessing -- the session id had got messed up, and every subsequent access failed. I didn't notice until 1900 on the 23rd, when I put the visonicalarm2 library onto another machine and checked that it all still worked with a simple access example (ie, that Tyco hadn't broken things at their end). After staring at the code for a bit, I came to the conclusion that the internal state of the alarm object was messed up, restarted Home Assistant and all was well.
Obviously, I'd like to help fix the code so that it can receover from this. My guess, and it really is only a guess, is that at a minimum line 153 in VisonicAlarm2/visonic/alarm.py the call to self.update_status() should be wrapped in a try/except block to make sure that if the hub.update() fails then the status is set to unknown or unavailable. And then "somewhere" if the hub is in state unavailable, a fresh attempt to get a session token should be made.
Happy to help, but don't want to make a mess of the code before I talk to others.
2024-09-22 23:32:30.563 ERROR (SyncWorker_26) [root] 502 Server Error: Bad Gateway for url: https://visonic.tycomonitor.com/rest_api/10.0/status
<title>502 Bad Gateway</title>2024-09-22 23:32:30.564 ERROR (SyncWorker_26) [root]
502 Bad Gateway
nginx
2024-09-22 23:32:30.564 ERROR (SyncWorker_26) [root]
<title>502 Bad Gateway</title>502 Bad Gateway
nginx
2024-09-22 23:32:30.564 ERROR (SyncWorker_26) [custom_components.visonicalarm] Update failed: 'NoneType' object is not subscriptable
<title>403 Forbidden</title>2024-09-22 23:32:30.577 ERROR (MainThread) [homeassistant.helpers.entity] Update for alarm_control_panel.visonic_alarm fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1302, in async_device_update
await hass.async_add_executor_job(self.update)
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/visonicalarm/alarm_control_panel.py", line 153, in update
hub.update()
File "/usr/src/homeassistant/homeassistant/util/init.py", line 184, in wrapper
result = method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/visonicalarm/init.py", line 119, in update
self.alarm.update_status()
File "/usr/local/lib/python3.12/site-packages/visonic/alarm.py", line 358, in update_status
partition = status['partitions'][0]
~~~~~~^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
2024-09-22 23:32:40.837 ERROR (SyncWorker_3) [root] 403 Client Error: Forbidden for url: https://visonic.tycomonitor.com/rest_api/10.0/status
2024-09-22 23:32:40.838 ERROR (SyncWorker_3) [root]
403 Forbidden
nginx
2024-09-22 23:32:40.838 ERROR (SyncWorker_3) [root]
<title>403 Forbidden</title>403 Forbidden
nginx
2024-09-22 23:32:40.838 ERROR (SyncWorker_3) [custom_components.visonicalarm] Update failed: 'NoneType' object is not subscriptable
2024-09-22 23:32:40.841 ERROR (MainThread) [homeassistant.helpers.entity] Update for alarm_control_panel.visonic_alarm fails
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 942, in async_update_ha_state
await self.async_device_update()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1302, in async_device_update
await hass.async_add_executor_job(self.update)
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/visonicalarm/alarm_control_panel.py", line 153, in update
hub.update()
File "/usr/src/homeassistant/homeassistant/util/init.py", line 184, in wrapper
result = method(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/visonicalarm/init.py", line 119, in update
self.alarm.update_status()
File "/usr/local/lib/python3.12/site-packages/visonic/alarm.py", line 358, in update_status
partition = status['partitions'][0]
~~~~~~^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
The text was updated successfully, but these errors were encountered: