Skip to content

Commit 073cdf2

Browse files
authored
fix: integer value step (#1388)
1 parent 0f65635 commit 073cdf2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

custom_components/xiaomi_home/miot/miot_spec.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,10 @@ def value_format(self, value: Any) -> Any:
601601
if value is None:
602602
return None
603603
if self.format_ == int:
604-
return int(round(value))
604+
if self.value_range is None:
605+
return int(round(value))
606+
return int(
607+
round(value / self.value_range.step) * self.value_range.step)
605608
if self.format_ == float:
606609
return round(value, self.precision)
607610
if self.format_ == bool:

0 commit comments

Comments
 (0)