Skip to content

Commit

Permalink
Roborock: Add clean_percent
Browse files Browse the repository at this point in the history
Note: Only newer models have this (Q Revo is the only one I know of).  HA shows the sensor as `unknown` for other models; I don't know how to exclude it.
  • Loading branch information
SLaks committed Mar 19, 2024
1 parent f08017f commit 356c6c0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions miio/integrations/roborock/vacuum/vacuumcontainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,14 @@ def vacuum_state(self) -> VacuumState:
"""Return vacuum state."""
return STATE_CODE_TO_VACUUMSTATE.get(self.state_code, VacuumState.Unknown)

@property
@sensor("Cleaning Progress", icon="mdi:progress-check", unit="%")
def clean_percent(self) -> Optional[int]:
"""Return progress of the current clean."""
if "clean_percent" in self.data:
return int(self.data["clean_percent"])
return None

@property
@sensor(
"Error code",
Expand Down

0 comments on commit 356c6c0

Please sign in to comment.