Exception during event data update
vikramgorla opened this issue · comments
Hello,
I am facing an issue in home assistant (which is using this module) with update of sensors.
Did some investigation, and below is what is happening
-
When does this exception occur : this issue occurs when an update of binary sensor in homeassistant happens on a camera which does not have any event in
['homes'][i]['events']
, note that not all events appear here, only latest 30 events are in this node. -
When does this exception dissapear : as soon as a event is seen in
['homes'][i]['events']
node (new event on the camera, part of latest 30 events of the home) -
Expected behavior : As there is no event linked to the checked sensors (which are linked to outdoormotionDetected, animalDetected, carDetected,. functions), they should return default
False
and not raise exceptions.
Update for binary_sensor.driveway_outdoor_vehicle fails Traceback (most recent call last): File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state await self.async_device_update() File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/lib/python3.5/asyncio/futures.py", line 380, in __iter__ yield self # This tells Task to wait for completion. File "/usr/lib/python3.5/asyncio/tasks.py", line 304, in _wakeup future.result() File "/usr/lib/python3.5/asyncio/futures.py", line 293, in result raise self._exception File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run result = self.fn(*self.args, **self.kwargs) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/binary_sensor/netatmo.py", line 157, in update self._data.update_event() File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/util/__init__.py", line 324, in wrapper result = method(*args, **kwargs) File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/netatmo.py", line 119, in update_event home=self.home, cameratype=self.camera_type) File "/srv/homeassistant/lib/python3.5/site-packages/smart_home/Camera.py", line 256, in updateEvent self.outdoor_events[e['camera_id']][e['time']] = e KeyError: '70:ee:50:26:b5:56'
Is this still an issue with the latest version?
yes, these exceptions are still raised (I have latest ones in my HA instance today)
Hi @vikramgorla, can you test if #67 fixes the issue?
@vikramgorla Are you still around? ;-)
Hi @cgtobi , wandering during summer :)
It looks like this fix will handle those exceptions, I am bit stuck with how to test.
I am using hassio, struggling to find the directory to edit pyatmo, do you know which directory within docker container has pyatmo so that I can modify code with this commit and test?
In /usr/local/lib/python3.7/site-packages/smart_home/
you should find Camera.py
.
Thank you (I was looking at pyatmo, I see it is called smart_home!)
I have modified Camera.py file with these updates and restarted HA, no errors until now, will wait for some time to see if exceptions resurface and let you know.
Best,
3 days down the lane, there are no new errors, looks like the issue is resolved with this fix!
Thanks a lot.