3.9.0
Connection parameters
This release introduces backend-neutral, frozen connection parameter objects:
ModbusTcpParamsModbusUdpParamsModbusTlsParamsModbusSerialParams
The recommended pattern for new code is to create one of these parameter objects and pass it to the canonical ModbusConnection class for the selected backend:
from modbus_connection import ModbusTcpParams
from modbus_connection.pymodbus import ModbusConnection
connection = ModbusConnection(
ModbusTcpParams(host="192.168.1.50", port=502)
)
await connection.connect()Keeping the connection details in a reusable object prepares the API for upcoming lazy-loading and auto-reconnect behavior, where a connection can retain everything it needs to establish the link when needed.
The existing connect_tcp, connect_udp, connect_tls, and connect_serial factories are not deprecated and remain supported. This release promotes the params-first connection constructors as the preferred API for new code. The existing PymodbusConnection and TmodbusConnection names also remain available as backward-compatible aliases.
What's Changed
- Make ModbusConnection a params-carrying base class that establishes its own link by @balloob in #61
- Add the Open Home Foundation AI Policy by @frenck in #64
- Format documentation Python snippets with Ruff by @balloob in #65
- Add SSL context to TLS params by @balloob in #66
- Select CLI backend per connection by @balloob in #67
- Recommend params-first connection construction by @balloob in #68
- Make backend ModbusConnection names canonical by @balloob in #70
- Validate framer names in connection params by @balloob in #69
Full Changelog: 3.8.1...3.9.0