From 073cdf2dcb9c623cb72721c00f680092e3312ef8 Mon Sep 17 00:00:00 2001 From: Li Shuzhen Date: Fri, 29 Aug 2025 17:35:46 +0800 Subject: [PATCH] fix: integer value step (#1388) --- custom_components/xiaomi_home/miot/miot_spec.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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: