Skip to content

Commit

Permalink
Update dependency pymodbus to >=3.0.2,<3.6.0 (#67)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Alex Ruddick <[email protected]>
  • Loading branch information
renovate[bot] and alexrudd2 authored Aug 30, 2023
1 parent 3819a00 commit 0b01832
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
pymodbus-version: ["2.5.3", "3.0.2", "3.1.3", "3.2.2", "3.3.1", "3.4.1"]
pymodbus-version: ["2.5.3", "3.0.2", "3.1.3", "3.2.2", "3.3.1", "3.4.1", "3.5.0"]
exclude:
- python-version: "3.10"
pymodbus-version: "2.5.3"
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name="watlow",
version="0.6.0",
version="0.6.1",
description="Python driver for Watlow EZ-Zone temperature controllers.",
long_description=long_description,
long_description_content_type='text/markdown',
Expand All @@ -19,7 +19,7 @@
install_requires=[
'pymodbus>=2.4.0; python_version == "3.8"',
'pymodbus>=2.4.0; python_version == "3.9"',
'pymodbus>=3.0.2,<3.5.0; python_version >= "3.10"',
'pymodbus>=3.0.2,<3.6.0; python_version >= "3.10"',
"pyserial",
"crcmod"],
extras_require={
Expand Down
6 changes: 4 additions & 2 deletions watlow/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,14 @@ async def get(self, zone: int):
'setpoint': self.setpoint_address,
'output': self.output_address,
}
endian = Endian.BIG if self.pymodbus35plus else Endian.big # type: ignore[attr-defined]
for k, v in output.items():
address = (zone - 1) * self.modbus_offset + v
try:
result = await self.read_registers(address, 2)
output[k] = BinaryPayloadDecoder.fromRegisters(
result,
byteorder=Endian.Big
byteorder=endian
).decode_32bit_float()
except AttributeError:
output[k] = None
Expand All @@ -222,7 +223,8 @@ async def set_setpoint(self, zone: int, setpoint: float):
raise ValueError(f"Setpoint ({setpoint}) is not in the valid range from"
f" {self.setpoint_range[0]} to {self.setpoint_range[1]}")
address = (zone - 1) * self.modbus_offset + self.setpoint_address
builder = BinaryPayloadBuilder(byteorder=Endian.Big)
endian = Endian.BIG if self.pymodbus35plus else Endian.big # type: ignore[attr-defined]
builder = BinaryPayloadBuilder(byteorder=endian)
builder.add_32bit_float(setpoint)
await self.write_registers(address, builder.build(),
skip_encode=True)
1 change: 1 addition & 0 deletions watlow/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def _detect_pymodbus_version(self) -> None:
self.pymodbus30plus = int(pymodbus.__version__[0]) == 3
self.pymodbus32plus = self.pymodbus30plus and int(pymodbus.__version__[2]) >= 2
self.pymodbus33plus = self.pymodbus30plus and int(pymodbus.__version__[2]) >= 3
self.pymodbus35plus = self.pymodbus30plus and int(pymodbus.__version__[2]) >= 5

async def _connect(self):
"""Start asynchronous reconnect loop."""
Expand Down

0 comments on commit 0b01832

Please sign in to comment.