Skip to content

Commit

Permalink
Fix the missing error key
Browse files Browse the repository at this point in the history
  • Loading branch information
MelleD authored and CodeFoodPixels committed Jan 13, 2024
1 parent 19aefa8 commit 8e6e311
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions custom_components/robovac/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,13 @@ def update_entity_values(self):
CONSUMABLE_CODE in self.tuyastatus
and self.tuyastatus.get(CONSUMABLE_CODE) is not None
):
self._attr_consumables = ast.literal_eval(
consumables = ast.literal_eval(
base64.b64decode(self.tuyastatus.get(CONSUMABLE_CODE)).decode(
"ascii"
)
)["consumable"]["duration"]
)
if "consumable" in consumables and "duration" in consumables:
self._attr_consumables = consumables["consumable"]["duration"]

async def async_locate(self, **kwargs):
"""Locate the vacuum cleaner."""
Expand Down

0 comments on commit 8e6e311

Please sign in to comment.