Skip to content

Commit

Permalink
Fix deprecation warnings by replacing STATE_* constants with VacuumAc…
Browse files Browse the repository at this point in the history
…tivity. (#113)
  • Loading branch information
arminfabritzek authored Feb 17, 2025
1 parent 7e5ef88 commit 8431cc4
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions custom_components/robovac/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@
from homeassistant.components.vacuum import (
StateVacuumEntity,
VacuumEntityFeature,
STATE_CLEANING,
STATE_DOCKED,
STATE_ERROR,
STATE_IDLE,
STATE_RETURNING,
VacuumActivity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
Expand Down Expand Up @@ -208,15 +204,15 @@ def state(self) -> str | None:
getErrorMessage(self.error_code)
)
)
return STATE_ERROR
return VacuumActivity.ERROR
elif self.tuya_state == "Charging" or self.tuya_state == "completed":
return STATE_DOCKED
return VacuumActivity.DOCKED
elif self.tuya_state == "Recharge":
return STATE_RETURNING
return VacuumActivity.RETURNING
elif self.tuya_state == "Sleeping" or self.tuya_state == "standby":
return STATE_IDLE
return VacuumActivity.IDLE
else:
return STATE_CLEANING
return VacuumActivity.CLEANING

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

0 comments on commit 8431cc4

Please sign in to comment.