Skip to content

Commit c9c518e

Browse files
authored
Improve IntegerTypeData scaling in Tuya (home-assistant#156507)
1 parent 214731e commit c9c518e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

homeassistant/components/tuya/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def scale_value(self, value: float) -> float:
6161

6262
def scale_value_back(self, value: float) -> int:
6363
"""Return raw value for scaled."""
64-
return int(value * (10**self.scale))
64+
return round(value * (10**self.scale))
6565

6666
def remap_value_to(
6767
self,

tests/components/tuya/test_climate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ async def test_set_temperature(
6868
blocking=True,
6969
)
7070
mock_manager.send_commands.assert_called_once_with(
71-
mock_device.id, [{"code": "temp_set", "value": 22}]
71+
mock_device.id, [{"code": "temp_set", "value": 23}]
7272
)
7373

7474

0 commit comments

Comments
 (0)