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

pull/110720/head
jan iversen 2024-02-15 18:22:23 +01:00 committed by Franck Nijhof
parent e5db7278e1
commit 6f529a2c77
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
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."""