Tuya fan percentage fix (#65225)

This commit is contained in:
fOmey 2022-01-31 22:37:43 +11:00 committed by GitHub
parent 80da5c52ae
commit 9b5757dff5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -137,7 +137,7 @@ class TuyaFanEntity(TuyaEntity, FanEntity):
[
{
"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(
{
"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
@ -248,7 +248,7 @@ class TuyaFanEntity(TuyaEntity, FanEntity):
if self._speed is not None:
if (value := self.device.status.get(self._speed.dpcode)) is 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 (value := self.device.status.get(self._speeds.dpcode)) is None: