diff --git a/custom_components/xiaomi_home/miot/miot_spec.py b/custom_components/xiaomi_home/miot/miot_spec.py index 9cabdcb..7f6a5b2 100644 --- a/custom_components/xiaomi_home/miot/miot_spec.py +++ b/custom_components/xiaomi_home/miot/miot_spec.py @@ -601,7 +601,10 @@ class MIoTSpecProperty(_MIoTSpecBase): if value is None: return None if self.format_ == int: - return int(round(value)) + if self.value_range is None: + return int(round(value)) + return int( + round(value / self.value_range.step) * self.value_range.step) if self.format_ == float: return round(value, self.precision) if self.format_ == bool: