You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
而 MiotFanEntity 的 set_percentage 会走到 turn_on 的开头,判断 if not self.is_on: 就先打开电源...
classFanEntity(ToggleEntity):
...
asyncdefasync_set_percentage(self, percentage: int) ->None:
"""Set the speed of the fan, as a percentage."""ifpercentage==0:
awaitself.async_turn_off() # <-- 1: 关闭awaitself.hass.async_add_executor_job(self.set_percentage, percentage) # <-- 2: percentage is 0
...
Device model / 设备型号
dmaker.fan.p8 (很多同类风扇都有这个问题)
Component version / 插件版本
0.7.10
HA core version / HA版本
2023.7.2
Integrated mode / 集成方式
Automatic (自动模式)
The problem / 问题详情
在 HA 2023.4 新版的 Fan 界面上点击关闭,会执行关闭然后立刻启动
观察日志发现,似乎内部调用的是
fan.set_percentage(0)
看
FanEntity
的代码,它在percentage == 0
的时候先执行了async_turn_off
然后再调用了组件的set_percentage
而
MiotFanEntity
的set_percentage
会走到turn_on
的开头,判断if not self.is_on:
就先打开电源...https://github.com/home-assistant/core/blob/3b501fd2d7495b0336a5e254dc0c508daec189a1/homeassistant/components/fan/__init__.py#L199C1-L203C80
https://github.com/al-one/hass-xiaomi-miot/blob/15a626678ef64624b557f83b88bdbf8d7880798d/custom_components/xiaomi_miot/fan.py#L143C1-L176C19
Entity attributes / 实体属性
Home Assistant Logs / 系统日志
米家落地扇 Fan 已开启 由服务触发 fan.set_percentage
22:25:56 - 19分钟前 -
米家落地扇 Fan 已关闭 由服务触发 fan.set_percentage
22:25:56 - 20分钟前 -
The text was updated successfully, but these errors were encountered: