Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Required corrections for compatibility with pymodbus 3.8.3 #1

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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