Handle missing fields from Roomba (#107893)

Add default values to mission_stats and run_stats
This commit is contained in:
Xitee 2024-01-12 21:35:09 +01:00 committed by GitHub
parent d0e9e54f26
commit 86e608d04f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -105,12 +105,12 @@ class IRobotEntity(Entity):
@property @property
def run_stats(self): def run_stats(self):
"""Return the run stats.""" """Return the run stats."""
return self.vacuum_state.get("bbrun") return self.vacuum_state.get("bbrun", {})
@property @property
def mission_stats(self): def mission_stats(self):
"""Return the mission stats.""" """Return the mission stats."""
return self.vacuum_state.get("bbmssn") return self.vacuum_state.get("bbmssn", {})
@property @property
def battery_stats(self): def battery_stats(self):