Skip to content
Snippets Groups Projects
Commit a29be545 authored by John Arild Berentsen's avatar John Arild Berentsen
Browse files

Fix unit and wrong errorhandling

parent c584b6b2
No related branches found
No related tags found
No related merge requests found
...@@ -128,10 +128,7 @@ class VerisureMouseDetection(Entity): ...@@ -128,10 +128,7 @@ class VerisureMouseDetection(Entity):
@property @property
def unit_of_measurement(self): def unit_of_measurement(self):
""" Unit of measurement of this entity """ """ Unit of measurement of this entity """
if verisure.MOUSEDETECTION_STATUS[self._id].count >= 1: return "Mice"
return "Mice"
else:
return "Mouse"
def update(self): def update(self):
""" update sensor """ """ update sensor """
......
...@@ -164,7 +164,7 @@ def update_component(get_function, status): ...@@ -164,7 +164,7 @@ def update_component(get_function, status):
for overview in get_function(): for overview in get_function():
try: try:
status[overview.id] = overview status[overview.id] = overview
except IndexError: except AttributeError:
status[overview.deviceLabel] = overview status[overview.deviceLabel] = overview
except (ConnectionError, VERISURE_ERROR) as ex: except (ConnectionError, VERISURE_ERROR) as ex:
_LOGGER.error('Caught connection error %s, tries to reconnect', ex) _LOGGER.error('Caught connection error %s, tries to reconnect', ex)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment