forked from home-assistant/core
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:
committed by
Paulus Schoutsen
parent
2dac92df0c
commit
e454c6628a
@@ -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:
|
||||||
|
Reference in New Issue
Block a user