From e1121446f8263c081d6db62d4688081383c4decf Mon Sep 17 00:00:00 2001 From: Christoph Date: Wed, 8 Jan 2025 11:29:57 +0100 Subject: [PATCH] vacuum.py - removed depricated usage of STATE_ partial fix for #2281 --- custom_components/xiaomi_miot/vacuum.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/custom_components/xiaomi_miot/vacuum.py b/custom_components/xiaomi_miot/vacuum.py index 0b0993a9ba..aa390113b4 100644 --- a/custom_components/xiaomi_miot/vacuum.py +++ b/custom_components/xiaomi_miot/vacuum.py @@ -5,17 +5,14 @@ from functools import partial from homeassistant.const import ( - STATE_IDLE, - STATE_PAUSED, +# STATE_IDLE, # should be also in component.vacuum ? +# STATE_PAUSED, # should be also in component.vacuum ? ) from homeassistant.components.vacuum import ( # noqa: F401 DOMAIN as ENTITY_DOMAIN, StateVacuumEntity, VacuumEntityFeature, # v2022.5 - STATE_CLEANING, - STATE_DOCKED, - STATE_RETURNING, - STATE_ERROR, + VacuumActivity, # v2025.1 ) from . import ( @@ -147,17 +144,17 @@ def state(self): 'Part Sweeping', 'Zone Sweeping', 'Select Sweeping', 'Spot Sweeping', 'Goto Target', 'Starting', 'Working', 'Busy', 'DustCollecting' ): - return STATE_CLEANING + return VacuumActivity.CLEANING elif val in self._prop_status.list_search('Idle', 'Sleep'): - return STATE_IDLE + return VacuumActivity.IDLE elif val in self._prop_status.list_search('Charging', 'Charging Completed', 'Fullcharge', 'Charge Done', 'Drying'): - return STATE_DOCKED + return VacuumActivity.DOCKED elif val in self._prop_status.list_search('Go Charging'): - return STATE_RETURNING + return VacuumActivity.RETURNING elif val in self._prop_status.list_search('Paused'): - return STATE_PAUSED + return VacuumActivity.PAUSED elif val in self._prop_status.list_search('Error', 'Charging Problem'): - return STATE_ERROR + return VacuumActivity.ERROR else: return self._prop_status.list_description(val) return None