Reading Gavazzi EM340 Modbus with Raspberry Pi 4B and pymodbus (Python 3.9.2) #1290
-
Hi. I hope this question finds you all well. I have Modbus/M-bus -enabled energymeter ( Gavazzi EM340, https://web.evishine.dk/wp-content/uploads/2019/11/EM340-ENG.pdf ) connected to Raspberry Pi 4B ( via RS422 / RS485 Serial HAT ( https://thepihut.com/products/rs422-rs485-serial-hat ). When booting the Rasp, it gives promising log entries:
However, I cannot read the energymeter via Rasp, using the pymodbus. Problem is that I cannot run the examples from ssh. (Rasp is headless) Output from one example gives:
Any help, or if anyone has a working example with reading /dev/ttyS0 it, would be highly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 3 replies
-
??? all examples are capable of being run in a normal shell, thus also with ssh. All my raspberry’s are headless and running ssh from another computer/table/phone works perfectly. Seems you did not clone pymodbus…if you clone pymodbus you will have a directory called “examples”. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the quick reply. The git clone died with connection. So I downloaded the 3.1.1 tar.gz and it has the example dir.
|
Beta Was this translation helpful? Give feedback.
-
Tried again, and the installation via instructions does not work:
However, I tried my luck with another URI:
I will try to follow the installation instructions again. |
Beta Was this translation helpful? Give feedback.
-
Installation process was (more) successful, followed the steps defined here ( https://pymodbus.readthedocs.io/en/latest/readme.html ). I am unsure where the virtual environment should point to. Instructions used
So now at least the error has changed. :-P |
Beta Was this translation helpful? Give feedback.
-
As documented you need so install pyserial. |
Beta Was this translation helpful? Give feedback.
-
I appreciate the help so far. :-) Now running the script ends up with
Here's the script:
PS. I am unsure what script I should use in order to access the Raspberry Pi 4B Serial HAT, which is available in |
Beta Was this translation helpful? Give feedback.
-
Google revealed the class in question:
Unfortunately there are other errors now, so perhaps this example I found is nonworking. |
Beta Was this translation helpful? Give feedback.
-
What example would allow me to read values from Gavazzi EM340 energy meter? Device is available via /dev/ttyAMA0
|
Beta Was this translation helpful? Give feedback.
-
client* examples, especially client_calls.py but of course you need to adapt it to your needs. |
Beta Was this translation helpful? Give feedback.
??? all examples are capable of being run in a normal shell, thus also with ssh. All my raspberry’s are headless and running ssh from another computer/table/phone works perfectly.
Seems you did not clone pymodbus…if you clone pymodbus you will have a directory called “examples”.