Skip to content

Commit

Permalink
fix negative minimal modbus integer readings
Browse files Browse the repository at this point in the history
  • Loading branch information
glynhudson committed Feb 6, 2023
1 parent 76d3742 commit ebbaa96
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/interfacers/EmonHubMinimalModbusInterfacer.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def read(self):
try:
if self.datatype == 'int':
time.sleep(0.1)
value = self._rs485.read_register(int(self._settings['meters'][meter]['registers'][i]), functioncode=3)
value = self._rs485.read_register(int(self._settings['meters'][meter]['registers'][i]), functioncode=3, signed=True)

elif self.datatype == 'float':
value = self._rs485.read_float(int(self._settings['meters'][meter]['registers'][i]), functioncode=4, number_of_registers=2)
Expand Down

1 comment on commit ebbaa96

@borpin
Copy link
Contributor

@borpin borpin commented on ebbaa96 Feb 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should be a new datatype of signed_int. Not all values will be signed.

Please sign in to comment.