Skip to content

Commit

Permalink
fix(sensor): catch keyerror on update
Browse files Browse the repository at this point in the history
  • Loading branch information
alandtse committed Sep 27, 2019
1 parent 5e1870d commit 29e98c1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion custom_components/alexa_media/sensor.py
Expand Up @@ -248,7 +248,11 @@ async def async_update(self):
pass
account_dict = (self.hass.data[DATA_ALEXAMEDIA]['accounts']
[self._account])
self._n_dict = account_dict['notifications'][self._dev_id][self._type]
try:
self._n_dict = (account_dict['notifications'][self._dev_id]
[self._type])
except KeyError:
self._n_dict = None
self._all = (sorted(self._n_dict.items(),
key=lambda x: x[1][self._sensor_property])
if self._n_dict else [])
Expand Down

0 comments on commit 29e98c1

Please sign in to comment.