Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vacuum.py - removed depricated usage of STATE_ #2289

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions custom_components/xiaomi_miot/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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
Expand Down