Skip to content

Commit 47cf4e3

Browse files
authored
Ensure Tuya scale and step are integers (home-assistant#156555)
1 parent 0ea0fc1 commit 47cf4e3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

homeassistant/components/tuya/models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ class IntegerTypeData(TypeInformation):
3636

3737
min: int
3838
max: int
39-
scale: float
40-
step: float
39+
scale: int
40+
step: int
4141
unit: str | None = None
4242

4343
@property
@@ -55,7 +55,7 @@ def step_scaled(self) -> float:
5555
"""Return the step scaled."""
5656
return self.step / (10**self.scale)
5757

58-
def scale_value(self, value: float) -> float:
58+
def scale_value(self, value: int) -> float:
5959
"""Scale a value."""
6060
return value / (10**self.scale)
6161

@@ -93,8 +93,8 @@ def from_json(cls, dpcode: DPCode, data: str) -> Self | None:
9393
dpcode,
9494
min=int(parsed["min"]),
9595
max=int(parsed["max"]),
96-
scale=float(parsed["scale"]),
97-
step=max(float(parsed["step"]), 1),
96+
scale=int(parsed["scale"]),
97+
step=int(parsed["step"]),
9898
unit=parsed.get("unit"),
9999
)
100100

0 commit comments

Comments
 (0)