Python plugin: Modbus RTU / ASCII / TCP/IP Topic is solved

Python and python framework

Moderator: leecollings

User avatar
Domoticx
Posts: 90
Joined: Sunday 07 January 2018 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Marienheem / The Netherlands
Contact:

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

Post by Domoticx »

@ palmipete

I also got some emails about this issue, it seems you need the python module six

https://stackoverflow.com/questions/139 ... -named-six

six info: https://pypi.python.org/pypi/six
Six is a Python 2 and 3 compatibility library. It provides utility functions for smoothing over the differences between the Python versions with the goal of writing Python code that is compatible on both Python versions. See the documentation for more information on what is provided.
Six supports every Python version since 2.6. It is contained in only one Python file, so it can be easily copied into your project. (The copyright and license notice must be retained.)

To install:
1)

Code: Select all

sudo pip install six
(will install in /home/pi/.local/lib/python2.7/site-packages/)

2)

Code: Select all

sudo cp six.py /usr/lib/python3.5
(add six in path that is being used)

3)
Restart domoticz

Code: Select all

sudo service domoticz.sh restart
Domoticz should run fine after this...i got it confirmed...I will update the documentation about this!
My Domoticz plugins:
- Modbus RS485 RTU/ASCII/TCP

Maatwerk in: Domotica - Automatisering - Elektronica - 3D printing - Software ontwikkeling
Website / Webshop / Knowledge Center / Facebook (like de pagina en blijf op de hoogte!)
palmipete
Posts: 10
Joined: Thursday 25 January 2018 15:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by palmipete »

Great. I will try tomorrow morning. Thank you !!!
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

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

Post by McMelloW »

Try to get connected with SolarEdge TCP modbus port 502. Can't get it working. See error log six is installed as well. Working over this ip and port is NOT a RS485 protocol.

Code: Select all

2018-01-26 11:13:44.342 Error: (Modbus) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/modbus-read/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-01-26 11:13:44.342 Error: (SolarEdge ModBus) Module Import failed, exception: 'ImportError'
2018-01-26 11:13:44.343 Error: (SolarEdge ModBus) Module Import failed: ' Name: pymodbus'
2018-01-26 11:13:44.343 Error: (SolarEdge ModBus) Error Line details not available.
2018-01-26 11:13:56.881 Error: (Modbus) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/modbus-read/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-01-26 11:13:56.881 Error: (SolarEdge ModBus Read) Module Import failed, exception: 'ImportError'
2018-01-26 11:13:56.881 Error: (SolarEdge ModBus Read) Module Import failed: ' Name: pymodbus'
2018-01-26 11:13:56.881 Error: (SolarEdge ModBus Read) Error Line details not available.
2018-01-26 11:15:01.546 Error: SolarEdge ModBus Read hardware (9) thread seems to have ended unexpectedly
2018-01-26 11:15:30.554 Error: SolarEdge ModBus Read hardware (9) thread seems to have ended unexpectedly
2018-01-26 11:16:00.564 Error: SolarEdge ModBus Read hardware (9) thread seems to have ended unexpectedly
2018-01-26 11:16:30.573 Error: SolarEdge ModBus Read hardware (9) thread seems to have ended unexpectedly
2018-01-26 11:17:00.582 Error: SolarEdge ModBus Read hardware (9) thread seems to have ended unexpectedly
Greetings McMelloW
palmipete
Posts: 10
Joined: Thursday 25 January 2018 15:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by palmipete »

Hi,
I tried exactly as you described except that was too fast and did :
Spoiler: show
sudo pip3 install six
I think I should probably not have done that.
so I uninstalled it and copied the six.py at the place you mentioned.

the result is that the Domoticz webinterface does not load anymore at all.
I commented line : sys.path.append('/usr/local/lib/python3.4/dist-packages')
since I do not have it on the system.

without a modbus "hardware" configured it works.

when I configure one I get:
Spoiler: show
2018-01-26 11:41:17.924 (Tsupply) Started.
2018-01-26 11:41:18.335 (Tsupply) Entering work loop.
2018-01-26 11:41:18.336 (Tsupply) Initialized version 1.0.7, author 'S. Ebeltjes / domoticx.nl'
2018-01-26 11:41:18.390 (Tsupply) Modbus RS485 RTU/ASCII/TCP - Universal READ loaded.
but then nothing happens anymore.
the probllem is that I do not see any bug message and I did not get it work with telnet (I found comments on that ...)

any idea?
Peter
palmipete
Posts: 10
Joined: Thursday 25 January 2018 15:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by palmipete »

@McMello:
I had this message too, I think you have one line 98 in plugin.py a sys.path.append of a python version that you do not have on your system (in my case it was python 3.4)
User avatar
Domoticx
Posts: 90
Joined: Sunday 07 January 2018 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Marienheem / The Netherlands
Contact:

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

Post by Domoticx »

palmipete wrote: Friday 26 January 2018 11:58 @McMello:
I had this message too, I think you have one line 98 in plugin.py a sys.path.append of a python version that you do not have on your system (in my case it was python 3.4)
You can remove/comment the one path you don't need, because based on the stretch/jessie images there are more python versions e.g. 3.5 and 3.4

Wierd it generates and error :roll: , becasue i have both lines in there and no errors at all 8-)

....maybe i can let python look for the path to exist first before adding it?
Last edited by Domoticx on Friday 26 January 2018 14:18, edited 3 times in total.
My Domoticz plugins:
- Modbus RS485 RTU/ASCII/TCP

Maatwerk in: Domotica - Automatisering - Elektronica - 3D printing - Software ontwikkeling
Website / Webshop / Knowledge Center / Facebook (like de pagina en blijf op de hoogte!)
User avatar
Domoticx
Posts: 90
Joined: Sunday 07 January 2018 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Marienheem / The Netherlands
Contact:

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

Post by Domoticx »

palmipete wrote: Friday 26 January 2018 11:44 Hi,
I tried exactly as you described except that was too fast and did :
Spoiler: show
sudo pip3 install six
six should be installed for python2 not 3 thus:

Code: Select all

sudo pip install six
(Than copy .py to the python3 folder)
My Domoticz plugins:
- Modbus RS485 RTU/ASCII/TCP

Maatwerk in: Domotica - Automatisering - Elektronica - 3D printing - Software ontwikkeling
Website / Webshop / Knowledge Center / Facebook (like de pagina en blijf op de hoogte!)
palmipete
Posts: 10
Joined: Thursday 25 January 2018 15:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by palmipete »

I was not clear in what I wrote ...
I installed it in Python 2. with pip
and I also copied the six.py in the folder you told me ...
and everythings blocks in the Domoticz log after "onStart" (until there I get the log messages)
palmipete
Posts: 10
Joined: Thursday 25 January 2018 15:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by palmipete »

I started debugging using the log ...
the error (in my case) is:
- the indentation was false in many tries and excepts
- in the last "try" of "heartbeat" I still did not get it work: Devices[1].Update(0, value)
Is the value to be sent really a string? or the argument 0 in update?

Peter
User avatar
Domoticx
Posts: 90
Joined: Sunday 07 January 2018 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Marienheem / The Netherlands
Contact:

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

Post by Domoticx »

palmipete wrote: Friday 26 January 2018 15:12 I was not clear in what I wrote ...
I installed it in Python 2. with pip
and I also copied the six.py in the folder you told me ...
and everythings blocks in the Domoticz log after "onStart" (until there I get the log messages)
Wich domoticz version are you running? (you can also fill it in the user profile settings)
The guy that mailed me with the same problem has it fixed though... by doing these steps....
My Domoticz plugins:
- Modbus RS485 RTU/ASCII/TCP

Maatwerk in: Domotica - Automatisering - Elektronica - 3D printing - Software ontwikkeling
Website / Webshop / Knowledge Center / Facebook (like de pagina en blijf op de hoogte!)
User avatar
Domoticx
Posts: 90
Joined: Sunday 07 January 2018 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Marienheem / The Netherlands
Contact:

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

Post by Domoticx »

palmipete wrote: Friday 26 January 2018 16:18 I started debugging using the log ...
the error (in my case) is:
- the indentation was false in many tries and excepts
- in the last "try" of "heartbeat" I still did not get it work: Devices[1].Update(0, value)
Is the value to be sent really a string? or the argument 0 in update?

Peter
Hi palmipete,

1) In wich line is the indentation false?
2) the 'value' is the value you see in the dashboard
(should be passed as string (hence the str(value) by the dividing section, in one try as plain integer it did not work therefore i used str and it is succesfull)
My Domoticz plugins:
- Modbus RS485 RTU/ASCII/TCP

Maatwerk in: Domotica - Automatisering - Elektronica - 3D printing - Software ontwikkeling
Website / Webshop / Knowledge Center / Facebook (like de pagina en blijf op de hoogte!)
User avatar
Domoticx
Posts: 90
Joined: Sunday 07 January 2018 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Marienheem / The Netherlands
Contact:

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

Post by Domoticx »

McMelloW wrote: Friday 26 January 2018 11:19 Try to get connected with SolarEdge TCP modbus port 502. Can't get it working. See error log six is installed as well. Working over this ip and port is NOT a RS485 protocol.

Code: Select all

2018-01-26 11:13:44.342 Error: (Modbus) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/modbus-read/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-01-26 11:13:44.342 Error: (SolarEdge ModBus) Module Import failed, exception: 'ImportError'
2018-01-26 11:13:44.343 Error: (SolarEdge ModBus) Module Import failed: ' Name: pymodbus'
2018-01-26 11:13:44.343 Error: (SolarEdge ModBus) Error Line details not available.
2018-01-26 11:13:56.881 Error: (Modbus) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/modbus-read/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-01-26 11:13:56.881 Error: (SolarEdge ModBus Read) Module Import failed, exception: 'ImportError'
2018-01-26 11:13:56.881 Error: (SolarEdge ModBus Read) Module Import failed: ' Name: pymodbus'
2018-01-26 11:13:56.881 Error: (SolarEdge ModBus Read) Error Line details not available.
2018-01-26 11:15:01.546 Error: SolarEdge ModBus Read hardware (9) thread seems to have ended unexpectedly
2018-01-26 11:15:30.554 Error: SolarEdge ModBus Read hardware (9) thread seems to have ended unexpectedly
2018-01-26 11:16:00.564 Error: SolarEdge ModBus Read hardware (9) thread seems to have ended unexpectedly
2018-01-26 11:16:30.573 Error: SolarEdge ModBus Read hardware (9) thread seems to have ended unexpectedly
2018-01-26 11:17:00.582 Error: SolarEdge ModBus Read hardware (9) thread seems to have ended unexpectedly
Hi McMelloW,

From the log it seems that pymodbus is not installed, you need some dependancies (read @ github) ;)

Code: Select all

2018-01-26 11:13:56.881 Error: (SolarEdge ModBus Read) Module Import failed: ' Name: pymodbus'
My Domoticz plugins:
- Modbus RS485 RTU/ASCII/TCP

Maatwerk in: Domotica - Automatisering - Elektronica - 3D printing - Software ontwikkeling
Website / Webshop / Knowledge Center / Facebook (like de pagina en blijf op de hoogte!)
palmipete
Posts: 10
Joined: Thursday 25 January 2018 15:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by palmipete »

I had the same message mith module pymodbus, but this was due to the double import of python3.4 and 3.5 (it stoped there ...)

concerning my problem:
if I put "pass" instead of Devices[1].Update(0, value) everything works now.
so the error MUST be in this line.
domoticz is v3.8849
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

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

Post by McMelloW »

Domoticx wrote: Friday 26 January 2018 16:29
Hi McMelloW,

From the log it seems that pymodbus is not installed, you need some dependancies (read @ github) ;)

Code: Select all

2018-01-26 11:13:56.881 Error: (SolarEdge ModBus Read) Module Import failed: ' Name: pymodbus'
Re-installed pymobus. I tis OK still receiving errors after activating Modbus Read hardware

Code: Select all

2018-01-26 17:35:30.828 Error: SolarEdge Modbus Read hardware (9) thread seems to have ended unexpectedly
2018-01-26 17:35:35.030 Error: (Modbus) failed to load 'plugin.py', Python Path used was '/home/pi/domoticz/plugins/modbus-read/:/usr/lib/python35.zip:/usr/lib/python3.5:/usr/lib/python3.5/plat-arm-linux-gnueabihf:/usr/lib/python3.5/lib-dynload'.
2018-01-26 17:35:35.031 Error: (SolarEdge Modbus Read) Module Import failed, exception: 'ImportError'
2018-01-26 17:35:35.031 Error: (SolarEdge Modbus Read) Module Import failed: ' Name: pymodbus'
2018-01-26 17:35:35.031 Error: (SolarEdge Modbus Read) Error Line details not available.
plugin.py is present in ~/domoticz/plugins/modbus-read see below

Code: Select all

pi@mcmellow-pi:~/domoticz/plugins/modbus-read $ ls
plugin.py  __pycache__
pi@mcmellow-pi:~/domoticz/plugins/modbus-read $
Greetings McMelloW
palmipete
Posts: 10
Joined: Thursday 25 January 2018 15:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by palmipete »

Hi,
I found the problem:
at the end of heartbeat in the try of updating the value in Domoticz I changed:
Devices[1].Update(0,value)

to

Devices[1].Update(nValue=Devices[1].nValue, sValue=value, TimedOut=1)

now it works perfectly, so again: Great work.

I am not sure if the indentations were really the problem, but in any case they were strange (allover de heartbeat def)

Peter
User avatar
papoo
Posts: 126
Joined: Friday 22 January 2016 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10
Location: France
Contact:

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

Post by papoo »

with release version, plugin not crash. but it not works
2018-01-26 22:21:17.387 (EDV) Initialized version 1.0.7, author 'S. Ebeltjes / domoticx.nl'
2018-01-26 22:21:17.442 (EDV) Debug log level set to: 'true'.
2018-01-26 22:21:17.442 (EDV) 'Mode3':'S1B8PN'
2018-01-26 22:21:17.442 (EDV) 'Mode4':'debug'
2018-01-26 22:21:17.442 (EDV) 'SerialPort':'/dev/serial0'
2018-01-26 22:21:17.442 (EDV) 'Username':'4'
2018-01-26 22:21:17.443 (EDV) 'Version':'1.0.7'
2018-01-26 22:21:17.443 (EDV) 'Name':'EDV'
2018-01-26 22:21:17.443 (EDV) 'Mode1':'tcp'
2018-01-26 22:21:17.443 (EDV) 'Address':'192.168.1.21'
2018-01-26 22:21:17.443 (EDV) 'HardwareID':'2'
2018-01-26 22:21:17.443 (EDV) 'Mode6':'pass'
2018-01-26 22:21:17.443 (EDV) 'HomeFolder':'/home/pi/domoticz/plugins/modbus-read/'
2018-01-26 22:21:17.443 (EDV) 'Key':'Modbus'
2018-01-26 22:21:17.443 (EDV) 'Mode2':'9600'
2018-01-26 22:21:17.443 (EDV) 'Mode5':'divnone'
2018-01-26 22:21:17.443 (EDV) 'Author':'S. Ebeltjes / domoticx.nl'
2018-01-26 22:21:17.443 (EDV) 'Password':'1009'
2018-01-26 22:21:17.443 (EDV) 'Port':'502'
2018-01-26 22:21:17.443 (EDV) Device count: 1
2018-01-26 22:21:17.443 (EDV) Device: 1 - ID: 1, Name: 'EDV - ModbusDEV-READ', nValue: 0, sValue: '0'
2018-01-26 22:21:17.443 (EDV) Device ID: '1'
2018-01-26 22:21:17.443 (EDV) Device Name: 'EDV - ModbusDEV-READ'
2018-01-26 22:21:17.443 (EDV) Device nValue: 0
2018-01-26 22:21:17.443 (EDV) Device sValue: '0'
2018-01-26 22:21:17.444 (EDV) Device LastLevel: 0
2018-01-26 22:21:17.444 (EDV) Modbus RS485 RTU/ASCII/TCP - Universal READ loaded.
2018-01-26 22:21:26.916 (EDV) Calling message handler 'onHeartbeat'.
2018-01-26 22:21:26.916 (EDV) MODBUS DEBUG TCP CMD - Method=tcp, Address=192.168.1.21, Port=502, Register=1009, Data type=pass
2018-01-26 22:21:26.918 (EDV) Modbus error communicating!, check your settings!
2018-01-26 22:21:26.918 (EDV - ModbusDEV-READ) Updating device from 0:'0' to have values 0:'0'.
2018-01-26 22:21:26.921 (EDV) Modbus error decoding (or recieved no data)!, check your settings!
2018-01-26 22:21:26.921 (EDV - ModbusDEV-READ) Updating device from 0:'0' to have values 0:'0'.
i try another modbus meter in 16bitINT works whis pymodbus, but not with the plugin
2018-01-26 22:27:10.999 (EDV) Initialized version 1.0.7, author 'S. Ebeltjes / domoticx.nl'
2018-01-26 22:27:11.004 (EDV) Debug log level set to: 'true'.
2018-01-26 22:27:11.004 (EDV) 'Mode3':'S1B8PN'
2018-01-26 22:27:11.004 (EDV) 'Mode4':'debug'
2018-01-26 22:27:11.004 (EDV) 'SerialPort':'/dev/serial0'
2018-01-26 22:27:11.004 (EDV) 'Username':'4'
2018-01-26 22:27:11.005 (EDV) 'Version':'1.0.7'
2018-01-26 22:27:11.005 (EDV) 'Name':'EDV'
2018-01-26 22:27:11.005 (EDV) 'Mode1':'tcp'
2018-01-26 22:27:11.005 (EDV) 'Address':'192.168.1.20'
2018-01-26 22:27:11.005 (EDV) 'HardwareID':'2'
2018-01-26 22:27:11.005 (EDV) 'Mode6':'16int'
2018-01-26 22:27:11.005 (EDV) 'HomeFolder':'/home/pi/domoticz/plugins/modbus-read/'
2018-01-26 22:27:11.005 (EDV) 'Key':'Modbus'
2018-01-26 22:27:11.005 (EDV) 'Mode2':'9600'
2018-01-26 22:27:11.005 (EDV) 'Mode5':'divnone'
2018-01-26 22:27:11.005 (EDV) 'Author':'S. Ebeltjes / domoticx.nl'
2018-01-26 22:27:11.005 (EDV) 'Password':'204'
2018-01-26 22:27:11.005 (EDV) 'Port':'502'
2018-01-26 22:27:11.005 (EDV) Device count: 1
2018-01-26 22:27:11.005 (EDV) Device: 1 - ID: 1, Name: 'EDV - ModbusDEV-READ', nValue: 0, sValue: '0'
2018-01-26 22:27:11.005 (EDV) Device ID: '1'
2018-01-26 22:27:11.005 (EDV) Device Name: 'EDV - ModbusDEV-READ'
2018-01-26 22:27:11.005 (EDV) Device nValue: 0
2018-01-26 22:27:11.005 (EDV) Device sValue: '0'
2018-01-26 22:27:11.006 (EDV) Device LastLevel: 0
2018-01-26 22:27:11.006 (EDV) Modbus RS485 RTU/ASCII/TCP - Universal READ loaded.
2018-01-26 22:27:20.528 (EDV) Calling message handler 'onHeartbeat'.
2018-01-26 22:27:20.528 (EDV) MODBUS DEBUG TCP CMD - Method=tcp, Address=192.168.1.20, Port=502, Register=204, Data type=16int
2018-01-26 22:27:20.529 (EDV) Modbus error communicating!, check your settings!
2018-01-26 22:27:20.530 (EDV - ModbusDEV-READ) Updating device from 0:'0' to have values 0:'0'.
2018-01-26 22:27:20.533 (EDV) Modbus error decoding (or recieved no data)!, check your settings!
2018-01-26 22:27:20.533 (EDV - ModbusDEV-READ) Updating device from 0:'0' to have values 0:'0'.
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

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

Post by McMelloW »

On which location has pymodus to be installed. It is now at /home/pi/pymodbus. The plugin.py can not find it on this location
Greetings McMelloW
User avatar
papoo
Posts: 126
Joined: Friday 22 January 2016 22:14
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10
Location: France
Contact:

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

Post by papoo »

McMelloW wrote: Friday 26 January 2018 22:48 On which location has pymodus to be installed. It is now at /home/pi/pymodbus. The plugin.py can not find it on this location
mine is here

Code: Select all

/usr/local/lib/python3.4/dist-packages/pymodbus
install with the command

Code: Select all

sudo pip3 install -U pymodbus
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

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

Post by McMelloW »

Finally, after quit a bit of struggling, I have Modbus -Read hardware and a MobusDev-Read working. However, the result is with errors. See my log

Code: Select all

2018-01-27 16:23:24.707 (SolarEdge Modbus Read) Calling message handler 'onHeartbeat'.
2018-01-27 16:23:24.710 (SolarEdge Modbus Read) MODBUS DEBUG TCP CMD - Method=tcp, Address=192.168.xxx.yy, Port=502, Register=0, Data type=32uint
2018-01-27 16:23:24.711 (SolarEdge Modbus Read) Modbus error communicating!, check your settings!
2018-01-27 16:23:24.711 (SolarEdge - ModbusDEV-READ) Updating device from 0:'0' to have values 0:'0'.
2018-01-27 16:23:24.719 (SolarEdge Modbus Read) Modbus error decoding (or recieved no data)!, check your settings!
2018-01-27 16:23:24.719 (SolarEdge - ModbusDEV-READ) Updating device from 0:'0' to have values 0:'0'.
Some changes are needed in the setting. But I want to read 122 registers and I don't know this is possible with this configuration.

Code: Select all

SolarEdge has implemented two methods of the MODBUS request procedure:

MODBUS request with explicit register addressing - supported by all communication board CPU versions. For example:

-- Tx: 01 03 9C 40 00 7A EB AD –  Read 122 registers starting at protocol address 40000 (PLC address 40001).
 01 – Slave ID
 03 – Read Holding Register
 9C40 – Register address; notice that for both protocol addressing (40000) and PLC addressing (40001), the transmitted address is 0x9C40
 007A – Requested register number (122)
 EBAD - Checksum
 
-- Rx: 01 03 F4 53 75 … [Registers data] … FF FF 12 1B –
 01 – Slave ID
 03 – Read Holding Registers
 F4 – Byte size or response (244 bytes)
 Response payload
 121B – Checksum
Can I send the TX request to my SolarEdge and read the result from it and pick it up somewhere?
Greetings McMelloW
User avatar
Domoticx
Posts: 90
Joined: Sunday 07 January 2018 21:19
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Marienheem / The Netherlands
Contact:

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

Post by Domoticx »

Hi all,

1) TCP is untested by me, since i do not have any Modbus TCP hardware to test on, unless someone can lend me a device? :roll:
2) As stated, the plugin is written for the stable 3.8153

I noticed you all use different newer versions with each having a specific problem. :?

palmipete: v3.8849
McMelloW: v3.8795
papoo: Beta

So feel free to edit/fork the code on github and make it suitable for your version.

Ofcourse...i will try to update this plugin when the next stable release is out!

@McMelloW
No, this is a universal plugin for modbus, it can read 1-4 registers (depending on selected datatype)
It seems like you need a Modbus plugin (written) for your device!
My Domoticz plugins:
- Modbus RS485 RTU/ASCII/TCP

Maatwerk in: Domotica - Automatisering - Elektronica - 3D printing - Software ontwikkeling
Website / Webshop / Knowledge Center / Facebook (like de pagina en blijf op de hoogte!)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest