Modbus, allow received int to be a float. (#110648)

pull/110663/head
jan iversen 2024-02-15 18:22:23 +01:00 committed by GitHub
parent 1372cf5a18
commit 286c98d70f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -199,6 +199,8 @@ class BaseStructPlatform(BasePlatform, RestoreEntity):
self._precision = config.get(CONF_PRECISION, 2)
else:
self._precision = config.get(CONF_PRECISION, 0)
if self._precision > 0 or self._scale != int(self._scale):
self._value_is_int = False
def _swap_registers(self, registers: list[int], slave_count: int) -> list[int]:
"""Do swap as needed."""