Modbus TCP error when updated to latest version

I have been using Modbus TCP without issue until I updated to EmonHub ver 2.5.8.
Now on starting emonhub I get the following error

2023-09-09 18:30:23,712 ERROR MainThread Unable to create ‘ModbusTCP’ interfacer: cannot import name ‘ModbusTcpClient’ from ‘pymodbus.client’ (/usr/local/lib/python3.7/dist-packages/pymodbus/client/init.py)

I have not changed the config files though I have checked the format and dont see any changes that would need making.

Can anyone shed any light on this error please.

Before disappearing down any rabbit holes;

  1. Is this a standard install of emoncms?
  2. How did you update?
  3. Any errors in the update log?

[edit]
Can you SSH in and run the command

pip show pymodbus

And paste the output (Use Ctl-E to format correctly).

Hi Brian,

Its a standard emonbase install (oldschool jeelab classic firmware RFM69Pi) updated using the admin update option from the web interface.

No errors showing in the update.

pi@emonpi:~ $ pip3 show pymodbus
Name: pymodbus
Version: 2.5.3
Summary: A fully featured modbus protocol stack in python
Home-page: https://github.com/riptideio/pymodbus/
Author: Galen Collins
Author-email: [email protected]
License: BSD-3-Clause
Location: /usr/local/lib/python3.7/dist-packages
Requires: pyserial, six
Required-by: sdm-modbus

pip not found, pip3 works though…

Dave

Is this a fairly old base install?

I suspect some dependency has changed, so you may need to upgrade to a new base image. Trying to work out what has changed will be tricky.

https://docs.openenergymonitor.org/emoncms/import.html#update-sd-card-and-import-using-an-usb-sd-card-reader

Just be warned, emonhub config doesn’t always come across correctly. I’ll be interested if it does.

This won’t impact the firmware on the RFM Module.

Hi Brian, thanks for that,
The base is s a few years old now, and I modded the MinimalModBus Interfacer to support the Rayleigh Instuments meters about a year ago so have not been updating EmonHub for a while.
I was planning to move everything over the the latest Firmware with an RFM69SPI and the LPL radio format in the next few days anyway so I could do these at the same time if it makes sense or should I do it step by step ?
Dave

I’d do it step by step, new image first, import data and check it is all running.

If you have modified the

Then you will need to copy that across. Was it just the configuration, or the actual python file you modified?

If you cannot remember try

 git -C /opt/openenergymonitor/emonhub/ status

That worked, ModbusTCP now working again.
Everything seems to have been imported except for a background image file on the dashboard and the custom ModbusRTU interfacer- but I was expecting that so not a problem.
If I find anything else missing from the import I’ll let you know.

2 Likes