Python plugin: Modbus RTU / ASCII / TCP/IP Topic is solved
Moderator: leecollings
-
- Posts: 1
- Joined: Monday 30 October 2017 10:36
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
Hi,
I have an issue with using modbus plugin. Right now I have PLC for controlling lights and heating. I would like to use Domoticz for visualisation.
I have found plugin for Modbus TCP. I tried to install like it is showed in manual, but there is an issue with (i thnink) python version.
2018-12-31 10:19:20.889 Error: (Modbus) failed to load 'plugin.py', Python Path used was '/home/jacek/domoticz/plugins/modbus-read/:/usr/lib/python36.zip:/usr/lib/python3.6:/usr/lib/python3.6:/usr/lib/python3.6/lib-dynload'.
2018-12-31 10:19:20.889 Error: (testowy) Module Import failed, exception: 'ModuleNotFoundError'
2018-12-31 10:19:20.889 Error: (testowy) Module Import failed: ' Name: pymodbus'
2018-12-31 10:19:20.889 Error: (testowy) Error Line details not available.
(Python 3.6.7, Ubuntu 18.04.1 server, Domoticz 4.9701)
I have an issue with using modbus plugin. Right now I have PLC for controlling lights and heating. I would like to use Domoticz for visualisation.
I have found plugin for Modbus TCP. I tried to install like it is showed in manual, but there is an issue with (i thnink) python version.
2018-12-31 10:19:20.889 Error: (Modbus) failed to load 'plugin.py', Python Path used was '/home/jacek/domoticz/plugins/modbus-read/:/usr/lib/python36.zip:/usr/lib/python3.6:/usr/lib/python3.6:/usr/lib/python3.6/lib-dynload'.
2018-12-31 10:19:20.889 Error: (testowy) Module Import failed, exception: 'ModuleNotFoundError'
2018-12-31 10:19:20.889 Error: (testowy) Module Import failed: ' Name: pymodbus'
2018-12-31 10:19:20.889 Error: (testowy) Error Line details not available.
(Python 3.6.7, Ubuntu 18.04.1 server, Domoticz 4.9701)
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
I`m trying to setup the READ plugin to pull an output from a WAGO PLC. I still learning the basics of the PLC but i got a working Node-RED setup using this youtube video https://www.youtube.com/watch?v=fV78MQks6BI
But when i want to read the value using the plugin it is not working yet. I have 3 input cards four ports so it should be registere 0 - 15 if is stand correct. Seems to be verified by fiddling around with node-red.
But no go so far using READ plugin.
I`m recieving the following error
2019-01-05 01:26:01.380 (DI_01) Modbus error decoding or recieved no data (TCP/IP)!, check your settings!
But when i want to read the value using the plugin it is not working yet. I have 3 input cards four ports so it should be registere 0 - 15 if is stand correct. Seems to be verified by fiddling around with node-red.
But no go so far using READ plugin.
I`m recieving the following error
2019-01-05 01:26:01.380 (DI_01) Modbus error decoding or recieved no data (TCP/IP)!, check your settings!
Code: Select all
Version: 4.10311
Build Hash: e588266e
Compile Date: 2019-01-01 16:54:11
dzVents Version: 2.4.9
Python Version: 3.6.7 (default, Oct 22 2018, 11:32:17) [GCC 8.2.0]
-
- Posts: 1
- Joined: Tuesday 29 January 2019 13:52
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
Hi!
Ive downloaded and install Modbus Plugin but I get error:
Error: PluginList: Parsing '/home/pi/domoticz/plugins/modbus-write/', 'Error document empty.' at line 0 column 0 in XML
does anybody know what is wrong?
domoticz Version: 4.9700
python Version: 3.5.3
Ive downloaded and install Modbus Plugin but I get error:
Error: PluginList: Parsing '/home/pi/domoticz/plugins/modbus-write/', 'Error document empty.' at line 0 column 0 in XML
does anybody know what is wrong?
domoticz Version: 4.9700
python Version: 3.5.3
-
- Posts: 20
- Joined: Saturday 20 April 2019 14:03
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
I corrected a little the script for Modbus RTU TCP and Modbus TCP that was giving decoding errors, you can find test version here:
https://github.com/DomoticX/domoticz-modbus/issues/12
https://github.com/DomoticX/domoticz-modbus/issues/12
-
- Posts: 2
- Joined: Monday 25 January 2016 10:53
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
Has anybody got the PZEM-016 energy measure device working?
I'm using the latest version 1.2 of the read plugin on a raspberry pi with latest stable Domoticz build
Here is a link to the manual http://kimgrity.com/ac-communication-mo ... OTsA6T-uUk
How can I activated more advanced logging, or try to see more debug information?
I tried different settings but I cannot read any data, in the log no errors except check you settings.The PZEM-014/016 can measure Ac voltage V, current A, active power W, frequency Hz, power factor pf and used energy Wh. You can read all these values from the PZEM with the help of a Rs-485 Half duplex bus. The protocol they used is the well known modbus protocol.
I'm using the latest version 1.2 of the read plugin on a raspberry pi with latest stable Domoticz build
Here is a link to the manual http://kimgrity.com/ac-communication-mo ... OTsA6T-uUk
How can I activated more advanced logging, or try to see more debug information?
-
- Posts: 20
- Joined: Saturday 20 April 2019 14:03
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
Try to verify if modbus on the device side is set correcty using PC (eg. Modbus Poll). Once you know it's ok then you can troubleshoot the python.
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
@Domoticx, or anyone else
could you help me to read my energy meter with RTU Modbus produced in Poland?
https://www.fif.com.pl/en/index.php?con ... hment=1334
How should i configure Modbus Plugin to read "Active energy" in kWh ? I have added Modbus read and write plugins.
Unfortunately, I do not have experience in this kind of communication and devices but I would like to be able to read the parameters of this power meter in my domoticz.
I would be very grateful for your help.
could you help me to read my energy meter with RTU Modbus produced in Poland?
https://www.fif.com.pl/en/index.php?con ... hment=1334
How should i configure Modbus Plugin to read "Active energy" in kWh ? I have added Modbus read and write plugins.
Unfortunately, I do not have experience in this kind of communication and devices but I would like to be able to read the parameters of this power meter in my domoticz.
I would be very grateful for your help.
-
- Posts: 5
- Joined: Monday 15 July 2019 21:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
Hi,
Thank you for this plugin! It works like a charm. I have now 2 boards with relays with lights on.
My questions. It is possible to read the state of the relays from the board? The board is the exact model that you used. If yes could you please tell me the settings? I tried all
Thank you for this plugin! It works like a charm. I have now 2 boards with relays with lights on.
My questions. It is possible to read the state of the relays from the board? The board is the exact model that you used. If yes could you please tell me the settings? I tried all
-
- Posts: 16
- Joined: Saturday 30 March 2019 20:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9
- Location: Beesd, The Netherlands
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
I could use some help. I have an Domoticz running on RPI3B without issues.
I have installed solar panels with an Solar edge inverter which I try to read data from using modbus TCP. I have tested the modbus read option using an simulator on the PC and I can read the requested addresses.
On domoticz installed the modbus option including the dependancies. I have configured the modbus read but whatever I do I get the same error message: "Can't convert 'int' object to str implicitly"
Can someone help me with what I'm doing wrong.
See below:
Configuration:
I have installed solar panels with an Solar edge inverter which I try to read data from using modbus TCP. I have tested the modbus read option using an simulator on the PC and I can read the requested addresses.
On domoticz installed the modbus option including the dependancies. I have configured the modbus read but whatever I do I get the same error message: "Can't convert 'int' object to str implicitly"
Can someone help me with what I'm doing wrong.
See below:
Code: Select all
2019-07-16 19:39:52.330 Status: (Solaredge) Stopped.
2019-07-16 19:39:56.887 (Solaredge) onStart called
2019-07-16 19:39:56.887 (Solaredge) Debug logging mask set to: NONE
2019-07-16 19:39:56.887 (Solaredge) Sensor Type: Custom
2019-07-16 19:39:56.888 (Solaredge) Modbus RTU/ASCII/TCP - Universal READ loaded.
2019-07-16 19:39:56.525 Status: (Solaredge) Started.
2019-07-16 19:39:56.883 Status: (Solaredge) Entering work loop.
2019-07-16 19:39:56.885 Status: (Solaredge) Initialized version 1.2.0, author 'S. Ebeltjes / domoticx.nl'
2019-07-16 19:40:06.906 Error: (Solaredge) 'onHeartbeat' failed 'TypeError':'Can't convert 'int' object to str implicitly'.
2019-07-16 19:40:06.906 Error: (Solaredge) ----> Line 489 in '/home/pi/domoticz/plugins/modbus-read/plugin.py', function onHeartbeat
2019-07-16 19:40:06.906 Error: (Solaredge) ----> Line 297 in '/home/pi/domoticz/plugins/modbus-read/plugin.py', function onHeartbeat
-
- Posts: 5
- Joined: Monday 15 July 2019 21:16
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
Anyone?grasuoare wrote: ↑Monday 15 July 2019 22:30 Hi,
Thank you for this plugin! It works like a charm. I have now 2 boards with relays with lights on.
My questions. It is possible to read the state of the relays from the board? The board is the exact model that you used. If yes could you please tell me the settings? I tried all
-
- Posts: 3
- Joined: Tuesday 23 July 2019 0:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
hi guys,
i have excactly the same problem :
2019-07-23 00:08:57.565 Error: (lecture modbus) 'onHeartbeat' failed 'TypeError':'Can't convert 'int' object to str implicitly'.
2019-07-23 00:08:57.565 Error: (lecture modbus) ----> Line 489 in /home/pi/domoticz/plugins/modbus-read/plugin.py, function onHeartbeat
i have raspberry pi3b+
installed dependencies
i have tested it with modbus simulator and always the same message
domoticz v4.97000
modbus read v1.2
i use modbus tcp-ip
i have made a lot of test and nothing is working is the v1.2 has a bug ? is the version 4.97 is not working fine?
thank you so mush for your helping
michael
i have excactly the same problem :
2019-07-23 00:08:57.565 Error: (lecture modbus) 'onHeartbeat' failed 'TypeError':'Can't convert 'int' object to str implicitly'.
2019-07-23 00:08:57.565 Error: (lecture modbus) ----> Line 489 in /home/pi/domoticz/plugins/modbus-read/plugin.py, function onHeartbeat
i have raspberry pi3b+
installed dependencies
i have tested it with modbus simulator and always the same message
domoticz v4.97000
modbus read v1.2
i use modbus tcp-ip
i have made a lot of test and nothing is working is the v1.2 has a bug ? is the version 4.97 is not working fine?
thank you so mush for your helping
michael
-
- Posts: 3
- Joined: Tuesday 23 July 2019 0:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
ahjwinth wrote: ↑Tuesday 16 July 2019 19:45 hi same problem is that working when you use modbus slave simulator instead of your solar system ? it is not clear for me?
I could use some help. I have an Domoticz running on RPI3B without issues.
I have installed solar panels with an Solar edge inverter which I try to read data from using modbus TCP. I have tested the modbus read option using an simulator on the PC and I can read the requested addresses.
On domoticz installed the modbus option including the dependancies. I have configured the modbus read but whatever I do I get the same error message: "Can't convert 'int' object to str implicitly"
Can someone help me with what I'm doing wrong.
See below:Configuration:Code: Select all
2019-07-16 19:39:52.330 Status: (Solaredge) Stopped. 2019-07-16 19:39:56.887 (Solaredge) onStart called 2019-07-16 19:39:56.887 (Solaredge) Debug logging mask set to: NONE 2019-07-16 19:39:56.887 (Solaredge) Sensor Type: Custom 2019-07-16 19:39:56.888 (Solaredge) Modbus RTU/ASCII/TCP - Universal READ loaded. 2019-07-16 19:39:56.525 Status: (Solaredge) Started. 2019-07-16 19:39:56.883 Status: (Solaredge) Entering work loop. 2019-07-16 19:39:56.885 Status: (Solaredge) Initialized version 1.2.0, author 'S. Ebeltjes / domoticx.nl' 2019-07-16 19:40:06.906 Error: (Solaredge) 'onHeartbeat' failed 'TypeError':'Can't convert 'int' object to str implicitly'. 2019-07-16 19:40:06.906 Error: (Solaredge) ----> Line 489 in '/home/pi/domoticz/plugins/modbus-read/plugin.py', function onHeartbeat 2019-07-16 19:40:06.906 Error: (Solaredge) ----> Line 297 in '/home/pi/domoticz/plugins/modbus-read/plugin.py', function onHeartbeat
-
- Posts: 16
- Joined: Saturday 30 March 2019 20:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9
- Location: Beesd, The Netherlands
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
Hi Michael,
Good to hear I’m not the only one. I still have not found the answer to the issue and trying different things without results. For my work I often deal with modbus in industrial control systems. But I don’t have knowledge about python code to troubleshoot the script.
Regards, Alex
Good to hear I’m not the only one. I still have not found the answer to the issue and trying different things without results. For my work I often deal with modbus in industrial control systems. But I don’t have knowledge about python code to troubleshoot the script.
Regards, Alex
michaelz wrote: ↑Tuesday 23 July 2019 0:14 hi guys,
i have excactly the same problem :
2019-07-23 00:08:57.565 Error: (lecture modbus) 'onHeartbeat' failed 'TypeError':'Can't convert 'int' object to str implicitly'.
2019-07-23 00:08:57.565 Error: (lecture modbus) ----> Line 489 in /home/pi/domoticz/plugins/modbus-read/plugin.py, function onHeartbeat
i have raspberry pi3b+
installed dependencies
i have tested it with modbus simulator and always the same message
domoticz v4.97000
modbus read v1.2
i use modbus tcp-ip
i have made a lot of test and nothing is working is the v1.2 has a bug ? is the version 4.97 is not working fine?
thank you so mush for your helping
michael
-
- Posts: 3
- Joined: Tuesday 23 July 2019 0:04
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
hi,
ok i have find the problem
on tcp-ip you need to put the ID
example : 192.168.3.10/1
i can read value in a schneider m241 data settings int16 is working fine
next step writing value
thanks a lot to the author of this plugin
good day
michael z
ok i have find the problem
on tcp-ip you need to put the ID
example : 192.168.3.10/1
i can read value in a schneider m241 data settings int16 is working fine
next step writing value
thanks a lot to the author of this plugin
good day
michael z
-
- Posts: 16
- Joined: Saturday 30 March 2019 20:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9
- Location: Beesd, The Netherlands
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
Thanks Michael,
I also now got the modbus connection working. The trick with the ID did it.
I didn't notice this since in the example screenshot on Github this was not implemented yet.
Thanks for your tip and many thanks for the developer putting all the efforts in to make the program.
I also now got the modbus connection working. The trick with the ID did it.
I didn't notice this since in the example screenshot on Github this was not implemented yet.
Thanks for your tip and many thanks for the developer putting all the efforts in to make the program.
-
- Posts: 8
- Joined: Sunday 01 April 2018 17:30
- Target OS: Linux
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
Hi
Im trying modbus first time. I use domoticz v4.11024@Python 3.5.3
I just upload an example to my arduino and try to read something trough modbus RTU
Unfortunately I always get the error that ot depend of payload or register number.
On the other side I can read data with modbus poll simulator
What am I doing wrong? Thx.
PS there is no any information what should be a payload for common purpose in domoticz (sensors, buttons etc).
Im trying modbus first time. I use domoticz v4.11024@Python 3.5.3
I just upload an example to my arduino and try to read something trough modbus RTU
Code: Select all
#include <ModbusRtu.h>
// assign the Arduino pin that must be connected to RE-DE RS485 transceiver
#define TXEN 2
// data array for modbus network sharing
uint16_t au16data[16] = {
3, 1415, 9265, 4, 2, 7182, 28182, 8, 0, 0, 0, 0, 0, 0, 1, -1 };
/**
* Modbus object declaration
* u8id : node id = 0 for master, = 1..247 for slave
* u8serno : serial port (use 0 for Serial)
* u8txenpin : 0 for RS-232 and USB-FTDI
* or any pin number > 1 for RS-485
*/
Modbus slave(1,0,TXEN); // this is slave @1 and RS-485
void setup() {
slave.begin( 9600 );
}
void loop() {
slave.poll( au16data, 16 );
}
Code: Select all
2019-07-24 19:53:25.632 (test_device) Modbus error decoding or received no data (RTU/ASCII/RTU over TCP)!, check your settings!
What am I doing wrong? Thx.
PS there is no any information what should be a payload for common purpose in domoticz (sensors, buttons etc).
- Attachments
-
- 3.JPG (29.92 KiB) Viewed 4534 times
-
- 2.JPG (34.46 KiB) Viewed 4534 times
-
- 1.JPG (60.54 KiB) Viewed 4534 times
-
- Posts: 16
- Joined: Saturday 30 March 2019 20:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9
- Location: Beesd, The Netherlands
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
Try to use function 3, read holding register in combination with data type int16
Antikillerbm wrote: ↑Wednesday 24 July 2019 19:04 Hi
Im trying modbus first time. I use domoticz v4.11024@Python 3.5.3
I just upload an example to my arduino and try to read something trough modbus RTUUnfortunately I always get the error that ot depend of payload or register number.Code: Select all
#include <ModbusRtu.h> // assign the Arduino pin that must be connected to RE-DE RS485 transceiver #define TXEN 2 // data array for modbus network sharing uint16_t au16data[16] = { 3, 1415, 9265, 4, 2, 7182, 28182, 8, 0, 0, 0, 0, 0, 0, 1, -1 }; /** * Modbus object declaration * u8id : node id = 0 for master, = 1..247 for slave * u8serno : serial port (use 0 for Serial) * u8txenpin : 0 for RS-232 and USB-FTDI * or any pin number > 1 for RS-485 */ Modbus slave(1,0,TXEN); // this is slave @1 and RS-485 void setup() { slave.begin( 9600 ); } void loop() { slave.poll( au16data, 16 ); }
On the other side I can read data with modbus poll simulatorCode: Select all
2019-07-24 19:53:25.632 (test_device) Modbus error decoding or received no data (RTU/ASCII/RTU over TCP)!, check your settings!
What am I doing wrong? Thx.
PS there is no any information what should be a payload for common purpose in domoticz (sensors, buttons etc).
-
- Posts: 8
- Joined: Sunday 01 April 2018 17:30
- Target OS: Linux
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
Every functions gives same error
I even tried to use discrete output slave, but error still the same
Have nothing here
I even tried to use discrete output slave, but error still the same
Have nothing here
- Attachments
-
- Снимок.PNG (32.96 KiB) Viewed 4513 times
-
- Posts: 8
- Joined: Sunday 01 April 2018 17:30
- Target OS: Linux
- Domoticz version:
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
I tried example script as well
But the error looks like same with domoticz plugin
Slave device answering nothing to any read requests
Code: Select all
#!/usr/bin/env python
from pymodbus.client.sync import ModbusSerialClient
client = ModbusSerialClient(method="rtu", port="/dev/ttyUSB0", stopbits=1, bytesize=8, parity="N", baudrate=9600, timeout=1, retries=2)
data = client.read_input_registers(0, 4, unit=12) # FUNCTIE 04 - Lees register (start=0, lengte=4, unitid=12)
client.close()
print data
print "waarde_0:", data.registers[0]
print "waarde_1:", data.registers[1]
print "waarde_2:", data.registers[2]
print "waarde_3:", data.registers[3]
Code: Select all
root@orangepipcplus:/home/anti# python3 mbtest.py
Modbus Error: [Input/Output] Modbus Error: [Invalid Message] Incomplete message received, expected at least 2 bytes (0 received)
Traceback (most recent call last):
File "mbtest.py", line 8, in <module>
print("waarde_0:", data.registers[0])
AttributeError: 'ModbusIOException' object has no attribute 'registers'
Slave device answering nothing to any read requests
-
- Posts: 16
- Joined: Saturday 30 March 2019 20:14
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 4.9
- Location: Beesd, The Netherlands
- Contact:
Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP
Hi I see in the below script you use unit ID 12. Were in the previous screenshots from the windows tool you use function 3 and unit ID 1.
Antikillerbm wrote: ↑Thursday 25 July 2019 22:40 I tried example script as wellBut the error looks like same with domoticz pluginCode: Select all
#!/usr/bin/env python from pymodbus.client.sync import ModbusSerialClient client = ModbusSerialClient(method="rtu", port="/dev/ttyUSB0", stopbits=1, bytesize=8, parity="N", baudrate=9600, timeout=1, retries=2) data = client.read_input_registers(0, 4, unit=12) #[b] FUNCTIE 04[/b] - Lees register (start=0, lengte=4,[b] unitid=12)[/b] client.close() print data print "waarde_0:", data.registers[0] print "waarde_1:", data.registers[1] print "waarde_2:", data.registers[2] print "waarde_3:", data.registers[3]
Code: Select all
root@orangepipcplus:/home/anti# python3 mbtest.py Modbus Error: [Input/Output] Modbus Error: [Invalid Message] Incomplete message received, expected at least 2 bytes (0 received) Traceback (most recent call last): File "mbtest.py", line 8, in <module> print("waarde_0:", data.registers[0]) AttributeError: 'ModbusIOException' object has no attribute 'registers'
Slave device answering nothing to any read requests
Who is online
Users browsing this forum: No registered users and 1 guest