Page 8 of 21

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Wednesday 21 March 2018 15:41
by Jan Jansen
Even with help from Google, I can not figure it out. I would like to use a Modbus RS-485 slave (RTU) with 4 outputs (Nano> ULN2003> power relay) and 4 inputs (contacts).

I can turn a LED on and off by using the sketch as described in http://domoticx.com/arduino-modbus-rs485-rtu-slave/. But after a few days of struggling, I come to the conclusion that I need help in making the desired sketch.

Thanks in advance.

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Saturday 24 March 2018 12:07
by Tonio16
Hello

I received today my modbus usb cable. In order to plug it to my ventillation, I would like to confirm a point.
Vent: rs232 -USB Adap
5 v <=====> 5 v
Tx <=====> Rx
Rx <=====> Tx
Gnd <=====> Gnd

Could you confirm sme that I have to plug the 5 V? Tx and Rx should be plug as described?

Tx

Antoine
PS: I hope to come back soon with hapy news.

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Sunday 25 March 2018 10:28
by Tonio16
Hello Domoticx

Do you think that it would be possible to have only the device in the material list. The plugin is actualy listing a material for each registers.
For my zwave dongle, I see the it in material and the device are listed in setting.

I made some first trials with the plugin this morning to have the info of my ventilation but no success until now.
(VMC_chauffe_eau_temp) Initialized version 1.1.1, author 'S. Ebeltjes / domoticx.nl'
2018-03-25 10:39:33.214 (VMC_chauffe_eau_temp) Debug log level set to: 'true'.
2018-03-25 10:39:33.215 (VMC_chauffe_eau_temp) Creating device 'ModbusDEV-READ'.
2018-03-25 10:39:33.222 (VMC_chauffe_eau_temp) 'Mode2':'115200'
2018-03-25 10:39:33.222 (VMC_chauffe_eau_temp) 'HomeFolder':'/home/pi/domoticz/plugins/modbus-read/'
2018-03-25 10:39:33.223 (VMC_chauffe_eau_temp) 'Address':'140'
2018-03-25 10:39:33.224 (VMC_chauffe_eau_temp) 'HardwareID':'10'
2018-03-25 10:39:33.224 (VMC_chauffe_eau_temp) 'SerialPort':'/dev/ttyUSB10'
2018-03-25 10:39:33.224 (VMC_chauffe_eau_temp) 'Mode1':'rtu'
2018-03-25 10:39:33.224 (VMC_chauffe_eau_temp) 'Name':'VMC_chauffe_eau_temp'
2018-03-25 10:39:33.225 (VMC_chauffe_eau_temp) 'Mode6':'uint16'
2018-03-25 10:39:33.225 (VMC_chauffe_eau_temp) 'Port':'0'
2018-03-25 10:39:33.225 (VMC_chauffe_eau_temp) 'Password':'212'
2018-03-25 10:39:33.225 (VMC_chauffe_eau_temp) 'Mode4':'debug'
2018-03-25 10:39:33.225 (VMC_chauffe_eau_temp) 'Key':'Modbus'
2018-03-25 10:39:33.226 (VMC_chauffe_eau_temp) 'Version':'1.1.1'
2018-03-25 10:39:33.226 (VMC_chauffe_eau_temp) 'Mode5':'div0'
2018-03-25 10:39:33.226 (VMC_chauffe_eau_temp) 'Author':'S. Ebeltjes / domoticx.nl'
2018-03-25 10:39:33.226 (VMC_chauffe_eau_temp) 'Mode3':'S1B8PN'
2018-03-25 10:39:33.227 (VMC_chauffe_eau_temp) 'Username':'4'
2018-03-25 10:39:33.227 (VMC_chauffe_eau_temp) Device count: 1
2018-03-25 10:39:33.227 (VMC_chauffe_eau_temp) Device: 1 - ID: 69, Name: 'VMC_chauffe_eau_temp - ModbusDEV-READ', nValue: 0, sValue: ''
2018-03-25 10:39:33.227 (VMC_chauffe_eau_temp) Device ID: '69'
2018-03-25 10:39:33.228 (VMC_chauffe_eau_temp) Device Name: 'VMC_chauffe_eau_temp - ModbusDEV-READ'
2018-03-25 10:39:33.228 (VMC_chauffe_eau_temp) Device nValue: 0
2018-03-25 10:39:33.229 (VMC_chauffe_eau_temp) Device sValue: ''
2018-03-25 10:39:33.229 (VMC_chauffe_eau_temp) Device LastLevel: 0
2018-03-25 10:39:33.229 (VMC_chauffe_eau_temp) Modbus RTU/ASCII/TCP - Universal READ loaded.
2018-03-25 10:39:42.656 (VMC_chauffe_eau_temp) Calling message handler 'onHeartbeat'.
2018-03-25 10:39:42.656 (VMC_chauffe_eau_temp) MODBUS DEBUG USB SERIAL HW - Port=/dev/ttyUSB10, BaudRate=115200, StopBits=1, ByteSize=8 Parity=N
2018-03-25 10:39:42.657 (VMC_chauffe_eau_temp) MODBUS DEBUG USB SERIAL CMD - Method=rtu, Address=140, Register=212, Function=4, Data type=uint16
2018-03-25 10:39:42.730 (VMC_chauffe_eau_temp) MODBUS DEBUG RESPONSE: Exception Response(224, 96, None)
2018-03-25 10:39:42.731 (VMC_chauffe_eau_temp) Modbus error decoding or recieved no data (RTU/ASCII/RTU over TCP)!, check your settings!
2018-03-25 10:39:42.731 (VMC_chauffe_eau_temp - ModbusDEV-READ) Updating device from 0:'' to have values 0:'0'.
Do you have some hints on how to undertsand the reason of a failure?

Regards

Antoine

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Sunday 25 March 2018 18:37
by Viper75
Hello domoticx,

very great job! I have been waiting for a Modbus support for a long time, because I use thermostats with Modbus protocols. But I do not manage to address a device's register via an RTU to TCP gateway. :roll: Can you send me the settings as an example of a device :?:

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Wednesday 28 March 2018 12:25
by zefranc
Great plugin !!!!

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Wednesday 28 March 2018 19:28
by Domoticx
Tonio16 wrote: Saturday 24 March 2018 12:07 Hello

I received today my modbus usb cable. In order to plug it to my ventillation, I would like to confirm a point.
Vent: rs232 -USB Adap
5 v <=====> 5 v
Tx <=====> Rx
Rx <=====> Tx
Gnd <=====> Gnd

Could you confirm sme that I have to plug the 5 V? Tx and Rx should be plug as described?

Tx

Antoine
PS: I hope to come back soon with hapy news.
1) So RS232 must have ground connected, sometimes the +5V is not needed (if you have a RS485 then you only have 2 pins A+B)
2) RX/TX connection depends on manufactor specs, sometimes they give a description what the FUNCTION of the pin is, sometimes they write WHAT TO CONNECT to the pin...maybe swapping RX/TX can help....

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Wednesday 28 March 2018 19:32
by Domoticx
Viper75 wrote: Sunday 25 March 2018 18:37 Hello domoticx,

very great job! I have been waiting for a Modbus support for a long time, because I use thermostats with Modbus protocols. But I do not manage to address a device's register via an RTU to TCP gateway. :roll: Can you send me the settings as an example of a device :?:
Hi,

I have not tested it on a RTU <> TCP gateway yet...but some examples you can find in a lot of first posts on this topic (you have to browse from page 1)

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Wednesday 28 March 2018 19:43
by Domoticx
Tonio16 wrote: Sunday 25 March 2018 10:28 Hello Domoticx

Do you think that it would be possible to have only the device in the material list. The plugin is actualy listing a material for each registers.
For my zwave dongle, I see the it in material and the device are listed in setting.

I made some first trials with the plugin this morning to have the info of my ventilation but no success until now.
Do you have some hints on how to undertsand the reason of a failure?

Regards

Antoine
1) This is a universal plugin a device for every register value is created, i think you need some specific plugin for your hardware to readout multiple registers?
2) Are you using HW RS 485RTU?
3) The error is unknown to me, could be python issue?

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Thursday 29 March 2018 11:22
by Tonio16
Domoticx wrote: Wednesday 28 March 2018 19:43
Tonio16 wrote: Sunday 25 March 2018 10:28 Hello Domoticx

Do you think that it would be possible to have only the device in the material list. The plugin is actualy listing a material for each registers.
For my zwave dongle, I see the it in material and the device are listed in setting.

I made some first trials with the plugin this morning to have the info of my ventilation but no success until now.
Do you have some hints on how to undertsand the reason of a failure?

Regards

Antoine
1) This is a universal plugin a device for every register value is created, i think you need some specific plugin for your hardware to readout multiple registers?
2) Are you using HW RS 485RTU?
3) The error is unknown to me, could be python issue?
Domoticx, thank you for your answer.
1) it looks so. But I have no python programming skills or Modbus knodledges. I thought that the int32 would do the job of reading two registers.
2) I am using a RS232 Modbus RTU from the ventilation supplier. I didn't plug the 5V to my USB adaptor. I will check if I put Rx with Rx and Tx with Tx.
3) which error are speaking about, here?

Cheers

Antoine

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Thursday 29 March 2018 18:49
by Domoticx
Tonio16 wrote: Thursday 29 March 2018 11:22 Domoticx, thank you for your answer.
1) it looks so. But I have no python programming skills or Modbus knodledges. I thought that the int32 would do the job of reading two registers.
2) I am using a RS232 Modbus RTU from the ventilation supplier. I didn't plug the 5V to my USB adaptor. I will check if I put Rx with Rx and Tx with Tx.
3) which error are speaking about, here?

Cheers

Antoine
Hi Antoine,

1) Yes, 2 registers are read for int32, you can look it up here how many registers are read for specific integer etc...
https://github.com/DomoticX/domoticz-mo ... in.py#L172
3) The one you posted above in your LOG:

Code: Select all

2018-03-25 10:39:42.730 (VMC_chauffe_eau_temp) MODBUS DEBUG RESPONSE: Exception Response(224, 96, None)

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Sunday 15 April 2018 16:57
by marcus54
Hello
I installed the plug-in to communicate with a solar tracer (epever).
It runs and I have the values in Domoticz.
My problem is that the query is done every second and suddenly it greatly increases the CPU consumption

Is it possible to interrogate every 60 s?

Thank you (sorry for my English, I'm French)

Code: Select all

2018-04-15 16:54:04.624 (Tracer_Solaire_CH_I) Calling message handler 'onHeartbeat'.
2018-04-15 16:54:04.626 (Tracer_Solaire_CH_I) MODBUS DEBUG USB SERIAL HW - Port=/dev/ttyUSB2, BaudRate=115200, StopBits=1, ByteSize=8 Parity=N
2018-04-15 16:54:04.631 (Tracer_Solaire_CH_I) MODBUS DEBUG USB SERIAL CMD - Method=rtu, Address=1, Register=12557, Function=4, Data type=int16
2018-04-15 16:54:04.686 (Tracer_Solaire_CH_I) MODBUS DEBUG RESPONSE: ReadRegisterResponse (1)
2018-04-15 16:54:04.688 (Tracer_Solaire_CH_I) MODBUS DEBUG VALUE: 220
2018-04-15 16:54:04.689 (Charge Intensité) Updating device from 0:'2.18' to have values 0:'2.2'.
2018-04-15 16:54:04.879 (Tracer_Solaire_Batt_I) Calling message handler 'onHeartbeat'.
2018-04-15 16:54:04.880 (Tracer_Solaire_Batt_I) MODBUS DEBUG USB SERIAL HW - Port=/dev/ttyUSB2, BaudRate=115200, StopBits=1, ByteSize=8 Parity=N
2018-04-15 16:54:04.880 (Tracer_Solaire_Batt_I) MODBUS DEBUG USB SERIAL CMD - Method=rtu, Address=1, Register=13083, Function=4, Data type=int16
2018-04-15 16:54:04.914 (Tracer_Solaire_Batt_I) MODBUS DEBUG RESPONSE: ReadRegisterResponse (1)
2018-04-15 16:54:04.915 (Tracer_Solaire_Batt_I) MODBUS DEBUG VALUE: -107
2018-04-15 16:54:04.916 (Batterie Intensité) Updating device from 0:'-1.15' to have values 0:'-1.07'.
2018-04-15 16:54:05.166 EventSystem: Script event triggered: /home/pi/domoticz/scripts/lua/script_time_import_Thingspeak2.lua
2018-04-15 16:54:05.417 (Tracer_Solaire_PV_I) Calling message handler 'onHeartbeat'.
2018-04-15 16:54:05.417 (Tracer_Solaire_PV_I) MODBUS DEBUG USB SERIAL HW - Port=/dev/ttyUSB2, BaudRate=115200, StopBits=1, ByteSize=8 Parity=N
2018-04-15 16:54:05.418 (Tracer_Solaire_PV_I) MODBUS DEBUG USB SERIAL CMD - Method=rtu, Address=1, Register=12545, Function=4, Data type=int16
2018-04-15 16:54:05.447 (Tracer_Solaire_PV_I) MODBUS DEBUG RESPONSE: ReadRegisterResponse (1)
2018-04-15 16:54:05.449 (Tracer_Solaire_PV_I) MODBUS DEBUG VALUE: 103
2018-04-15 16:54:05.450 (Intensité panneau) Updating device from 0:'1.06' to have values 0:'1.03'.
2018-04-15 16:54:06.908 (Tracer_Solaire) Calling message handler 'onHeartbeat'.
2018-04-15 16:54:06.910 (Tracer_Solaire) MODBUS DEBUG USB SERIAL HW - Port=/dev/ttyUSB2, BaudRate=115200, StopBits=1, ByteSize=8 Parity=N
2018-04-15 16:54:06.910 (Tracer_Solaire) MODBUS DEBUG USB SERIAL CMD - Method=rtu, Address=1, Register=12548, Function=4, Data type=int16
2018-04-15 16:54:06.939 (Tracer_Solaire) MODBUS DEBUG RESPONSE: ReadRegisterResponse (1)
2018-04-15 16:54:06.941 (Tracer_Solaire) MODBUS DEBUG VALUE: 1277
2018-04-15 16:54:06.941 (Tension Batterie) Updating device from 0:'12.78' to have values 0:'12.77'.
2018-04-15 16:54:07.555 (Tracer_Solaire_CH_P) Calling message handler 'onHeartbeat'.
2018-04-15 16:54:07.556 (Tracer_Solaire_CH_P) MODBUS DEBUG USB SERIAL HW - Port=/dev/ttyUSB2, BaudRate=115200, StopBits=1, ByteSize=8 Parity=N
2018-04-15 16:54:07.557 (Tracer_Solaire_CH_P) MODBUS DEBUG USB SERIAL CMD - Method=rtu, Address=1, Register=12558, Function=4, Data type=uint16
2018-04-15 16:54:07.583 (Tracer_Solaire_CH_P) MODBUS DEBUG RESPONSE: ReadRegisterResponse (1)
2018-04-15 16:54:07.585 (Tracer_Solaire_CH_P) MODBUS DEBUG VALUE: 2773
2018-04-15 16:54:07.586 (Puissance Charge) Updating device from 0:'27.73' to have values 0:'27.73'.
2018-04-15 16:54:08.142 (Tracer_Solaire_PV_P) Calling message handler 'onHeartbeat'.
2018-04-15 16:54:08.143 (Tracer_Solaire_PV_P) MODBUS DEBUG USB SERIAL HW - Port=/dev/ttyUSB2, BaudRate=115200, StopBits=1, ByteSize=8 Parity=N
2018-04-15 16:54:08.143 (Tracer_Solaire_PV_P) MODBUS DEBUG USB SERIAL CMD - Method=rtu, Address=1, Register=12546, Function=4, Data type=int16
2018-04-15 16:54:08.173 (Tracer_Solaire_PV_P) MODBUS DEBUG RESPONSE: ReadRegisterResponse (1)
2018-04-15 16:54:08.174 (Tracer_Solaire_PV_P) MODBUS DEBUG VALUE: 1354
2018-04-15 16:54:08.175 (Puissance panneau) Updating device from 0:'14.18' to have values 0:'13.54'.

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Saturday 21 April 2018 18:09
by marcus54
Hello
No one ?
How to add a timer in this script?

Re: [Released] Python plugin: Modbus RS485 RTU/ASCII/TCP

Posted: Monday 30 April 2018 21:35
by ViktorSmilenko
Hi McMelloW, I have the same problem ((Tell me how to fix modbus to work.

Code: Select all

2018-04-30 19:03:53.147 Error: (Modbus) failed to load 'plugin.py', Python Path used was ':/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-04-30 19:03:53.147 Error: (555) Module Import failed, exception: 'ImportError'
2018-04-30 19:03:53.147 Error: (555) Module Import failed: ' Name: plugin'
2018-04-30 19:03:53.147 Error: (555) Error Line details not available
McMelloW wrote: Thursday 08 March 2018 16:52 @ Domoticx

Tried it again with the 06-03-2018 update.
Installed the plugin dicrectorie from github in /home/pi/domoticz/plugins
Restarted Domoticz.
Add a Mobus Read for TCP/IP
As soon as I add the hardware domoticz hangs.
After removed the mudbus pligin directories and restarted Domomticz I received the following errors

Code: Select all

2018-03-08 16:43:05.691 Error: (Modbus) failed to load 'plugin.py', Python Path used was ':/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-03-08 16:43:05.699 Error: (ModbusTCP) Module Import failed, exception: 'ImportError'
2018-03-08 16:43:05.699 Error: (ModbusTCP) Module Import failed: ' Name: plugin'
2018-03-08 16:43:05.699 Error: (ModbusTCP) Error Line details not available.
2018-03-08 16:44:30.971 Error: ModbusTCP hardware (9) thread seems to have ended unexpectedly
2018-03-08 16:45:01.544 Error: ModbusTCP hardware (9) thread seems to have ended unexpectedly
2018-03-08 16:45:30.558 Error: ModbusTCP hardware (9) thread seems to have ended unexpectedly
The mesaages are different from the previous trial

Re: [Released] Python plugin: Modbus RS485 RTU/ASCII/TCP

Posted: Monday 30 April 2018 22:07
by McMelloW
ViktorSmilenko wrote: Monday 30 April 2018 21:35 Hi McMelloW, I have the same problem ((Tell me how to fix modbus to work.

Code: Select all

2018-04-30 19:03:53.147 Error: (Modbus) failed to load 'plugin.py', Python Path used was ':/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-04-30 19:03:53.147 Error: (555) Module Import failed, exception: 'ImportError'
2018-04-30 19:03:53.147 Error: (555) Module Import failed: ' Name: plugin'
2018-04-30 19:03:53.147 Error: (555) Error Line details not available
Did not fixed it. Removed the plugin. it does not work at all in my configuration

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Wednesday 02 May 2018 10:52
by ViktorSmilenko
hello, HELP PLEASE ((Writes such an error and can not make the plugin work ...
If modbus is running modbus, make a messenger an image of raspberry, and if possible ask the developer to make a pure domoticz image with a modbus built-in module, like in BETA Raspberry Pi SD Card Image. What could be deployed and used. ALL THANKS FOR HELP WHO A RESPONSE.

Code: Select all

2018-04-30 19:03:53.147 Error: (Modbus) failed to load 'plugin.py', Python Path used was ':/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-04-30 19:03:53.147 Error: (555) Module Import failed, exception: 'ImportError'
2018-04-30 19:03:53.147 Error: (555) Module Import failed: ' Name: plugin'
2018-04-30 19:03:53.147 Error: (555) Error Line details not available

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Thursday 03 May 2018 13:07
by Tonio16
Are you sure of the name of the file for the plugin is well written? no mistakes like a space or upper case.
Did you do the chmod +x plugin.py

Regards

Antoine

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Friday 22 June 2018 10:10
by Sprokkie
Hi,

trying to get this working i have a problem
installing the dependancies is not working

i type in putty sudo install -U pymodbus pymodbusTCP
the response from the pi is: sudo install -U pymodbus pymodbusTCP install: invalid option -- 'U'
Try 'install --help' for more information.

if i try --help i do not see the --U option,

any thoughts ??

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Sunday 24 June 2018 9:32
by bonebuster
Hi
since V4.9703 update MODBUS plugin seems to crash domoticz
raspbian jessie

any other have this crash ?

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Sunday 24 June 2018 9:44
by gizmocuz
Try it on stretch...

Re: [RELEASED] Python plugin: Modbus RTU / ASCII / TCP/IP

Posted: Sunday 24 June 2018 13:51
by bonebuster
OK! Thanks

works fine with fresh install on stretch