Skip to content

Commit

Permalink
🪭 improve for fan entity (#1806)
Browse files Browse the repository at this point in the history
  • Loading branch information
al-one committed Aug 16, 2024
1 parent d625086 commit b5573df
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions custom_components/xiaomi_miot/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ def __init__(self, config: dict, miot_service: MiotService, **kwargs):
self._prop_direction = miot_service.get_property('horizontal_angle', 'vertical_angle')
self._prop_oscillate = miot_service.get_property('horizontal_swing', 'vertical_swing')

if self._prop_power:
if hasattr(FanEntityFeature, 'TURN_ON'): # v2024.8
self._supported_features |= FanEntityFeature.TURN_ON
if hasattr(FanEntityFeature, 'TURN_OFF'):
self._supported_features |= FanEntityFeature.TURN_OFF

self._fan_control = miot_service.spec.get_service('fan_control')
if self._fan_control:
if not self._prop_speed:
Expand Down

1 comment on commit b5573df

@al-one
Copy link
Owner Author

@al-one al-one commented on b5573df Aug 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please # to comment.