mirror of
https://github.com/home-assistant/core.git
synced 2025-08-05 13:45:12 +02:00
Simplify FanEntity preset_mode shorthand attributes (#130930)
This commit is contained in:
@@ -235,8 +235,8 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
|||||||
_attr_current_direction: str | None = None
|
_attr_current_direction: str | None = None
|
||||||
_attr_oscillating: bool | None = None
|
_attr_oscillating: bool | None = None
|
||||||
_attr_percentage: int | None
|
_attr_percentage: int | None
|
||||||
_attr_preset_mode: str | None
|
_attr_preset_mode: str | None = None
|
||||||
_attr_preset_modes: list[str] | None
|
_attr_preset_modes: list[str] | None = None
|
||||||
_attr_speed_count: int
|
_attr_speed_count: int
|
||||||
_attr_supported_features: FanEntityFeature = FanEntityFeature(0)
|
_attr_supported_features: FanEntityFeature = FanEntityFeature(0)
|
||||||
|
|
||||||
@@ -538,9 +538,7 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
|||||||
|
|
||||||
Requires FanEntityFeature.SET_SPEED.
|
Requires FanEntityFeature.SET_SPEED.
|
||||||
"""
|
"""
|
||||||
if hasattr(self, "_attr_preset_mode"):
|
return self._attr_preset_mode
|
||||||
return self._attr_preset_mode
|
|
||||||
return None
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def preset_modes(self) -> list[str] | None:
|
def preset_modes(self) -> list[str] | None:
|
||||||
@@ -548,9 +546,7 @@ class FanEntity(ToggleEntity, cached_properties=CACHED_PROPERTIES_WITH_ATTR_):
|
|||||||
|
|
||||||
Requires FanEntityFeature.SET_SPEED.
|
Requires FanEntityFeature.SET_SPEED.
|
||||||
"""
|
"""
|
||||||
if hasattr(self, "_attr_preset_modes"):
|
return self._attr_preset_modes
|
||||||
return self._attr_preset_modes
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
# These can be removed if no deprecated constant are in this module anymore
|
# These can be removed if no deprecated constant are in this module anymore
|
||||||
|
Reference in New Issue
Block a user