Skip to content

Commit 8431cc4

Browse files
Fix deprecation warnings by replacing STATE_* constants with VacuumActivity. (#113)
1 parent 7e5ef88 commit 8431cc4

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

custom_components/robovac/vacuum.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@
3030
from homeassistant.components.vacuum import (
3131
StateVacuumEntity,
3232
VacuumEntityFeature,
33-
STATE_CLEANING,
34-
STATE_DOCKED,
35-
STATE_ERROR,
36-
STATE_IDLE,
37-
STATE_RETURNING,
33+
VacuumActivity,
3834
)
3935
from homeassistant.config_entries import ConfigEntry
4036
from homeassistant.core import HomeAssistant
@@ -208,15 +204,15 @@ def state(self) -> str | None:
208204
getErrorMessage(self.error_code)
209205
)
210206
)
211-
return STATE_ERROR
207+
return VacuumActivity.ERROR
212208
elif self.tuya_state == "Charging" or self.tuya_state == "completed":
213-
return STATE_DOCKED
209+
return VacuumActivity.DOCKED
214210
elif self.tuya_state == "Recharge":
215-
return STATE_RETURNING
211+
return VacuumActivity.RETURNING
216212
elif self.tuya_state == "Sleeping" or self.tuya_state == "standby":
217-
return STATE_IDLE
213+
return VacuumActivity.IDLE
218214
else:
219-
return STATE_CLEANING
215+
return VacuumActivity.CLEANING
220216

221217
@property
222218
def extra_state_attributes(self) -> dict[str, Any]:

0 commit comments

Comments
 (0)