mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Fix Tuya v2 fan percentage (#56954)
* fix:Some fans do not have a fan_speed_percent key * fix comment format issue Co-authored-by: erchuan <jie.zheng@tuya.com>
This commit is contained in:
parent
06602e6cc5
commit
6c2a18c3e5
@ -211,7 +211,7 @@ class TuyaHaFan(TuyaHaEntity, FanEntity):
|
|||||||
return self.tuya_device.status[DPCODE_MODE]
|
return self.tuya_device.status[DPCODE_MODE]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def percentage(self) -> int:
|
def percentage(self) -> int | None:
|
||||||
"""Return the current speed."""
|
"""Return the current speed."""
|
||||||
if not self.is_on:
|
if not self.is_on:
|
||||||
return 0
|
return 0
|
||||||
@ -228,7 +228,8 @@ class TuyaHaFan(TuyaHaEntity, FanEntity):
|
|||||||
self.tuya_device.status[DPCODE_AP_FAN_SPEED_ENUM],
|
self.tuya_device.status[DPCODE_AP_FAN_SPEED_ENUM],
|
||||||
)
|
)
|
||||||
|
|
||||||
return self.tuya_device.status[DPCODE_FAN_SPEED]
|
# some type may not have the fan_speed_percent key
|
||||||
|
return self.tuya_device.status.get(DPCODE_FAN_SPEED)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def speed_count(self) -> int:
|
def speed_count(self) -> int:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user