forked from home-assistant/core
Small fixes
This commit is contained in:
@@ -261,21 +261,19 @@ class StateVacuumEntity(
|
|||||||
method in cls.__dict__
|
method in cls.__dict__
|
||||||
for method in ("_attr_battery_level", "battery_level")
|
for method in ("_attr_battery_level", "battery_level")
|
||||||
):
|
):
|
||||||
# Integrations should use the 'activity' property instead of
|
# Integrations should use a separate battery sensor.
|
||||||
# setting the state directly.
|
|
||||||
cls.__vacuum_legacy_battery_level = True
|
cls.__vacuum_legacy_battery_level = True
|
||||||
if any(
|
if any(
|
||||||
method in cls.__dict__ for method in ("_attr_battery_icon", "battery_icon")
|
method in cls.__dict__ for method in ("_attr_battery_icon", "battery_icon")
|
||||||
):
|
):
|
||||||
# Integrations should use the 'activity' property instead of
|
# Integrations should use a separate battery sensor.
|
||||||
# setting the state directly.
|
|
||||||
cls.__vacuum_legacy_battery_icon = True
|
cls.__vacuum_legacy_battery_icon = True
|
||||||
|
|
||||||
def __setattr__(self, name: str, value: Any) -> None:
|
def __setattr__(self, name: str, value: Any) -> None:
|
||||||
"""Set attribute.
|
"""Set attribute.
|
||||||
|
|
||||||
Deprecation warning if setting '_attr_state' directly
|
Deprecation warning if setting state, battery icon or battery level
|
||||||
unless already reported.
|
attributes directly unless already reported.
|
||||||
"""
|
"""
|
||||||
if name == "_attr_state":
|
if name == "_attr_state":
|
||||||
self._report_deprecated_activity_handling()
|
self._report_deprecated_activity_handling()
|
||||||
|
Reference in New Issue
Block a user