fix: integer value step (#1388)

This commit is contained in:
Li Shuzhen
2025-08-29 17:35:46 +08:00
committed by GitHub
parent 0f65635342
commit 073cdf2dcb

View File

@ -601,7 +601,10 @@ class MIoTSpecProperty(_MIoTSpecBase):
if value is None: if value is None:
return None return None
if self.format_ == int: 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: if self.format_ == float:
return round(value, self.precision) return round(value, self.precision)
if self.format_ == bool: if self.format_ == bool: