Deprecation fix: use VacuumActivity
This fixes the following reported issue: STATE_DOCKED was used from localtuya, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.DOCKED instead, please report it to the author of the 'localtuya' custom integration STATE_ERROR was used from localtuya, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.ERROR instead, please report it to the author of the 'localtuya' custom integration STATE_IDLE was used from localtuya, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.IDLE instead, please report it to the author of the 'localtuya' custom integration STATE_PAUSED was used from localtuya, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.PAUSED instead, please report it to the author of the 'localtuya' custom integration STATE_RETURNING was used from localtuya, this is a deprecated constant which will be removed in HA Core 2026.1. Use VacuumActivity.RETURNING instead, please report it to the author of the 'localtuya' custom integration
This commit is contained in:
committed by
rospogrigio
parent
2217b09286
commit
9eabc43da2
@@ -5,13 +5,7 @@ from functools import partial
|
||||
import voluptuous as vol
|
||||
from homeassistant.components.vacuum import (
|
||||
DOMAIN,
|
||||
STATE_CLEANING,
|
||||
STATE_DOCKED,
|
||||
STATE_ERROR,
|
||||
STATE_IDLE,
|
||||
STATE_PAUSED,
|
||||
STATE_RETURNING,
|
||||
StateVacuumEntity, VacuumEntityFeature,
|
||||
StateVacuumEntity, VacuumActivity, VacuumEntityFeature,
|
||||
)
|
||||
|
||||
from .common import LocalTuyaEntity, async_setup_entry
|
||||
@@ -207,15 +201,15 @@ class LocaltuyaVacuum(LocalTuyaEntity, StateVacuumEntity):
|
||||
state_value = str(self.dps(self._dp_id))
|
||||
|
||||
if state_value in self._idle_status_list:
|
||||
self._state = STATE_IDLE
|
||||
self._state = VacuumActivity.IDLE
|
||||
elif state_value in self._docked_status_list:
|
||||
self._state = STATE_DOCKED
|
||||
self._state = VacuumActivity.DOCKED
|
||||
elif state_value == self._config[CONF_RETURNING_STATUS_VALUE]:
|
||||
self._state = STATE_RETURNING
|
||||
self._state = VacuumActivity.RETURNING
|
||||
elif state_value == self._config[CONF_PAUSED_STATE]:
|
||||
self._state = STATE_PAUSED
|
||||
self._state = VacuumActivity.PAUSED
|
||||
else:
|
||||
self._state = STATE_CLEANING
|
||||
self._state = VacuumActivity.CLEANING
|
||||
|
||||
if self.has_config(CONF_BATTERY_DP):
|
||||
self._battery_level = self.dps_conf(CONF_BATTERY_DP)
|
||||
@@ -241,7 +235,7 @@ class LocaltuyaVacuum(LocalTuyaEntity, StateVacuumEntity):
|
||||
if self.has_config(CONF_FAULT_DP):
|
||||
self._attrs[FAULT] = self.dps_conf(CONF_FAULT_DP)
|
||||
if self._attrs[FAULT] != 0:
|
||||
self._state = STATE_ERROR
|
||||
self._state = VacuumActivity.ERROR
|
||||
|
||||
|
||||
async_setup_entry = partial(async_setup_entry, DOMAIN, LocaltuyaVacuum, flow_schema)
|
||||
|
Reference in New Issue
Block a user