From f9a52d19e00aa46c8974c5c3c1a5e02b5c4c8380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Strandberg?= Date: Mon, 23 Dec 2024 21:16:39 +0000 Subject: [PATCH] Change to VacuumActivity --- custom_components/miele/vacuum.py | 33 +++++++++++++------------------ 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/custom_components/miele/vacuum.py b/custom_components/miele/vacuum.py index d70330f4..9083a47c 100644 --- a/custom_components/miele/vacuum.py +++ b/custom_components/miele/vacuum.py @@ -10,14 +10,9 @@ from homeassistant.components.vacuum import ( ATTR_STATUS, - STATE_CLEANING, - STATE_DOCKED, - STATE_ERROR, - STATE_IDLE, - STATE_PAUSED, - STATE_RETURNING, StateVacuumEntity, StateVacuumEntityDescription, + VacuumActivity, VacuumEntityFeature, ) from homeassistant.core import HomeAssistant @@ -139,24 +134,24 @@ def __init__( self._attr_fan_speed_list = FAN_SPEEDS @property - def state(self): + def activity(self) -> VacuumActivity | None: """Map state.""" if self.coordinator.data[self._ent]["state|status|value_raw"] == 6: - return STATE_PAUSED + return VacuumActivity.STATE_PAUSED self._phase = self.coordinator.data[self._ent]["state|programPhase|value_raw"] if self._phase in (5903, 5904): - return STATE_DOCKED - elif self._phase in (5889, 5892): - return STATE_CLEANING - elif self._phase == 5890: - return STATE_RETURNING - elif self._phase in (5893, 5894, 5895, 5896, 5897, 5898, 5899, 5900): - return STATE_ERROR - elif self._phase in (5891, 5910): - return STATE_PAUSED - elif self._phase == 0: - return STATE_IDLE + return VacuumActivity.STATE_DOCKED + if self._phase in (5889, 5892): + return VacuumActivity.STATE_CLEANING + if self._phase == 5890: + return VacuumActivity.STATE_RETURNING + if self._phase in (5893, 5894, 5895, 5896, 5897, 5898, 5899, 5900): + return VacuumActivity.STATE_ERROR + if self._phase in (5891, 5910): + return VacuumActivity.STATE_PAUSED + if self._phase == 0: + return VacuumActivity.STATE_IDLE return self._phase