diff --git a/.gitignore b/.gitignore index cc99eaf..70ee172 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ *.pyc example.yaml spec.pdf +*.svg diff --git a/custom_components/solvis_modbus/coordinator.py b/custom_components/solvis_modbus/coordinator.py index bf809d0..b123241 100644 --- a/custom_components/solvis_modbus/coordinator.py +++ b/custom_components/solvis_modbus/coordinator.py @@ -5,6 +5,7 @@ import logging import async_timeout from pymodbus.client import ModbusTcpClient +from pymodbus.payload import BinaryPayloadDecoder, Endian from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordinator import ( @@ -76,7 +77,8 @@ async def _async_update_data(self): # Add data to return values if(len(result.registers) == 1): - parsed_data[register.name] = round(result.registers[0] * register.multiplier, 2) + d = BinaryPayloadDecoder.fromRegisters(result.registers, byteorder=Endian.BIG) + parsed_data[register.name] = round(d.decode_16bit_int() * register.multiplier, 2) except TimeoutError: self.logger.warning("Polling timed out")