Tuya fan percentage fix (#65225)

This commit is contained in:
fOmey 2022-01-31 22:37:43 +11:00 committed by Paulus Schoutsen
parent 73750d8a25
commit 2757976a5a

View File

@ -137,7 +137,7 @@ class TuyaFanEntity(TuyaEntity, FanEntity):
[ [
{ {
"code": self._speed.dpcode, "code": self._speed.dpcode,
"value": int(self._speed.remap_value_from(percentage, 0, 100)), "value": int(self._speed.remap_value_from(percentage, 1, 100)),
} }
] ]
) )
@ -178,7 +178,7 @@ class TuyaFanEntity(TuyaEntity, FanEntity):
commands.append( commands.append(
{ {
"code": self._speed.dpcode, "code": self._speed.dpcode,
"value": int(self._speed.remap_value_from(percentage, 0, 100)), "value": int(self._speed.remap_value_from(percentage, 1, 100)),
} }
) )
return return
@ -248,7 +248,7 @@ class TuyaFanEntity(TuyaEntity, FanEntity):
if self._speed is not None: if self._speed is not None:
if (value := self.device.status.get(self._speed.dpcode)) is None: if (value := self.device.status.get(self._speed.dpcode)) is None:
return None return None
return int(self._speed.remap_value_to(value, 0, 100)) return int(self._speed.remap_value_to(value, 1, 100))
if self._speeds is not None: if self._speeds is not None:
if (value := self.device.status.get(self._speeds.dpcode)) is None: if (value := self.device.status.get(self._speeds.dpcode)) is None: