Release 3.0.0 is now available for general use. #1110
Replies: 4 comments 9 replies
-
Thanks for all your hard work! Is there a summary or list of the main API changes to quickly lift projects from 2.x to 3.x? |
Beta Was this translation helpful? Give feedback.
-
Starting to test the 3.0.0 Release on a ubuntu 22 I had to remove the anyway, I usually import in all my services the logging library for my own needs, and all the entries are duplicated
|
Beta Was this translation helpful? Give feedback.
-
The new forwarder is nice I had to change a few things to make it work with a serial rtu bus : #!/usr/bin/env python3
"""Pymodbus RTU Serial synchronous forwarder.
"""
import argparse
import logging
from pymodbus.client import ModbusSerialClient
from pymodbus.datastore import ModbusServerContext
from pymodbus.datastore.remote import RemoteSlaveContext
from pymodbus.server import StartTcpServer
def run_forwarder():
"""Run forwarder setup."""
port_server, port_client, slaves = get_commandline()
client = ModbusSerialClient(method='rtu', port=port_client, baudrate=9600)
if slaves:
store = {}
for i in slaves:
store[i] = RemoteSlaveContext(client, unit=i)
else:
store = RemoteSlaveContext(client)
context = ModbusServerContext(slaves=store, single=False)
# start forwarding client and server
client.connect()
StartTcpServer(context=context, address=("192.168.1.29", port_server), allow_reuse_address=True)
# loop forever
FORMAT = "%(asctime)-15s %(levelname)-8s %(module)-15s:%(lineno)-8s %(message)s"
logging.basicConfig(format=FORMAT)
_logger = logging.getLogger()
def get_commandline():
"""Read and validate command line arguments"""
parser = argparse.ArgumentParser(description="Command line options for examples")
parser.add_argument(
"--log",
choices=["critical", "error", "warning", "info", "debug"],
help='"critical", "error", "warning", "info" or "debug"',
type=str,
)
parser.add_argument(
"--port",
help="the port to use",
type=int,
)
parser.add_argument(
"--port_client",
help="the port to use",
type=str,
)
parser.add_argument(
"--slaves",
help="list of slaves to forward",
type=int,
nargs="+",
)
args = parser.parse_args()
# set defaults
_logger.setLevel(args.log.upper() if args.log else logging.INFO)
if not args.port:
args.port = 5020
if not args.port_client:
args.port_client = '/dev/ttyUSB0'
return args.port, args.port_client, args.slaves
if __name__ == "__main__":
run_forwarder() There is an error reported in mixin.py line 113. I just check the mixin.py file but nothing seem wrong...
|
Beta Was this translation helpful? Give feedback.
-
Thanks @janiversen for taking this on your shoulder. Apologies for not being much of help this time around. Well done. |
Beta Was this translation helpful? Give feedback.
-
We are pleased to announce the version 3.0.0 have finally after a long wait been released.
Please remark that there a number of incompatible changes in the API, but they are hopefully all documented.
We look forward to receive comments/suggestions and even better pull requests.
Beta Was this translation helpful? Give feedback.
All reactions