Fjaraskupan stop on 0 percentage (#79367)
* Make sure fan turns off on 0 percentage * Remember old percentage
This commit is contained in:
parent
6694d06b37
commit
5cdf4220ee
1 changed files with 11 additions and 4 deletions
|
@ -82,10 +82,17 @@ class Fan(CoordinatorEntity[Coordinator], FanEntity):
|
|||
|
||||
async def async_set_percentage(self, percentage: int) -> None:
|
||||
"""Set speed."""
|
||||
|
||||
# Proactively update percentage to mange successive increases
|
||||
self._percentage = percentage
|
||||
|
||||
async with self.coordinator.async_connect_and_update() as device:
|
||||
if percentage == 0:
|
||||
await device.send_command(COMMAND_STOP_FAN)
|
||||
else:
|
||||
new_speed = percentage_to_ordered_list_item(
|
||||
ORDERED_NAMED_FAN_SPEEDS, percentage
|
||||
)
|
||||
async with self.coordinator.async_connect_and_update() as device:
|
||||
await device.send_fan_speed(int(new_speed))
|
||||
|
||||
async def async_turn_on(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue