Tuya correct scaling (#69348)

This commit is contained in:
starkillerOG 2022-04-27 01:49:11 +02:00 committed by GitHub
parent 09a7116efc
commit d418df5f75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -45,11 +45,11 @@ class IntegerTypeData:
def scale_value(self, value: float | int) -> float:
"""Scale a value."""
return value * self.step / (10**self.scale)
return value / (10**self.scale)
def scale_value_back(self, value: float | int) -> int:
"""Return raw value for scaled."""
return int((value * (10**self.scale)) / self.step)
return int(value * (10**self.scale))
def remap_value_to(
self,