Skip to content

Commit

Permalink
Merge pull request #1 from marcodutto/master
Browse files Browse the repository at this point in the history
Required corrections for compatibility with pymodbus 3.8.3
  • Loading branch information
martinssipenko authored Feb 13, 2025
2 parents c39e4b9 + eb4a153 commit 8dffc8f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pysmarty2/registers/registers.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ def update(self) -> bool:
def _update_holding_registers(self) -> bool:
"""Read Holding Registers."""
res1 = self._connection.client.read_holding_registers(
1, 37, slave=self._connection.slave)
1, count=37, slave=self._connection.slave)
res2 = self._connection.client.read_holding_registers(
200, 3, slave=self._connection.slave)
200, count=3, slave=self._connection.slave)
if res1.isError() or res2.isError():
return False
res = {k: v for k, v in zip(range(1, 37), res1.registers)}
Expand All @@ -81,7 +81,7 @@ def _update_holding_registers(self) -> bool:
def _update_coils(self) -> bool:
"""Update Coils."""
res1 = self._connection.client.read_coils(
1, 9, slave=self._connection.slave)
1, count=9, slave=self._connection.slave)
if res1.isError():
return False
res = {k: v for k, v in zip(range(1, 10), res1.bits)}
Expand All @@ -92,9 +92,9 @@ def _update_coils(self) -> bool:
def _update_discrete_inputs(self) -> bool:
"""Update Discrete Inputs."""
res1 = self._connection.client.read_discrete_inputs(
1, 67, slave=self._connection.slave)
1, count=67, slave=self._connection.slave)
res2 = self._connection.client.read_discrete_inputs(
188, 2, slave=self._connection.slave)
188, count=2, slave=self._connection.slave)
if res1.isError() or res2.isError():
return False
res = {k: v for k, v in zip(range(1, 67), res1.bits)}
Expand All @@ -106,9 +106,9 @@ def _update_discrete_inputs(self) -> bool:
def _update_input_registers(self) -> bool:
"""Update input registers"""
res1 = self._connection.client.read_input_registers(
1, 66, slave=self._connection.slave)
1, count=66, slave=self._connection.slave)
res2 = self._connection.client.read_input_registers(
67, 66, slave=self._connection.slave)
67, count=66, slave=self._connection.slave)
if res1.isError() or res2.isError():
return False
res = {k: v for k, v in zip(range(1, 132),
Expand Down

0 comments on commit 8dffc8f

Please sign in to comment.