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

Python and python framework

Moderator: leecollings

Sprokkie
Posts: 13
Joined: Friday 22 June 2018 10:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Sprokkie »

i have jessie beacause my apple homekit plugin did not wok on strech.
got it working now, afraid to update to strech.

can i have second raspberry run the modbus software and then send the data to domoticz running on jessie ?
User avatar
gizmocuz
Posts: 2352
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

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

Post by gizmocuz »

You should be able to get your apple homekit to run on stretch, else they should update their library.
You do not want to stay on that old system forever....
Quality outlives Quantity!
Sprokkie
Posts: 13
Joined: Friday 22 June 2018 10:05
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Sprokkie »

its the software bridge that runs on the pi.
I tried an install on strech that didn'r work....
The apple is up to date.

but what about the -U optopn for th einstall command, that is the problem i ran in to.
Or is that also jessie related ?
malp
Posts: 10
Joined: Thursday 11 January 2018 8:36
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by malp »

dear ...
I have synology and domoticz (Python support) there. Python is installed.
I added the modbus device in the hardware, but I see the following issues (looks like the same like some people before) in the log:

2018-08-21 23:33:38.790 Status: (Modbus-1) Started.
2018-08-21 23:33:38.884 Error: (Modbus) failed to load 'plugin.py', Python Path used was '/usr/local/domoticz/var/plugins/modbus-read/:/volume1/@appstore/py3k/usr/local/lib/python35.zip:/volume1/@appstore/py3k/usr/local/lib/python3.5/:/volume1/@appstore/py3k/usr/local/lib/python3.5/plat-linux:/volume1/@appstore/py3k/usr/local/lib/python3.5/lib-dynload'.
2018-08-21 23:33:38.885 Error: (Modbus-1) Module Import failed, exception: 'ImportError'
2018-08-21 23:33:38.885 Error: (Modbus-1) Module Import failed: ' Name: pymodbus'
2018-08-21 23:33:38.885 Error: (Modbus-1) Error Line details not available.
2018-08-21 23:35:00.924 Error: Modbus-1 hardware (5) thread seems to have ended unexpectedly
pymodbus and pymodbusTCP are installed:

Solution:
I added the following in the script:
sys.path.append('/usr/lib/python2.7/site-packages')
sys.path.append('/usr/local/lib/python2.7/site-packages')
sys.path.append('/usr/local/lib/python3.5/dist-packages')

just specified the path where serial, pymodbus etc are located (in my case)

On windows it works without issues.
rusu3
Posts: 1
Joined: Sunday 26 August 2018 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by rusu3 »

Hello everyone :)

I em new in domoticz i have installation on rpi2. I was able to install this modbus read and write plugin. I want to connect by this write plugin to a zamel rxm-01. this is a modbus rtu/asci converter to closed Zamel system.To switch on my device i need to send "on " command 01 05 00 00 FF 00 8C 3A I don,t know how to connect switch in domoticz with that plugin. I will be gratefull for any help.
Zrzutekranuz2018-08-2719-25-16.png
Zrzutekranuz2018-08-2719-25-16.png (130.55 KiB) Viewed 5692 times
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 RTU / ASCII / TCP/IP

Post by Domoticx »

@rusu3

To break down the command: 01 05 00 00 FF 00 8C 3A

SLAVE ID: 01
FUNCTION: 05 (write single coil)
REGISTER: 0 (00 00)
DATA: FF 00 (DEC = 65280)
CHECkSUM: info (8C 3A)
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!)
MaikelK
Posts: 41
Joined: Saturday 01 November 2014 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by MaikelK »

Hi Domoticx,

Could you explain me how you are reading out the SDM120C ?

What did you use to connect it to the RPi?

And whats needed to read it via ESP?

Thanks!
malp
Posts: 10
Joined: Thursday 11 January 2018 8:36
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by malp »

I have to following issues with Modbus RTU (via USB).
I have Win10 and domoticz there + "Modbus RTU/ASCII/TCP - READ v1.1.2" plugin. For Modbus RS485 bus I use USB-RS485 converter that actually works quite good.

I have one sensor than sends data via RS485.
When I use Modbus READ plugin in RTU mode, that within 1st request plugin reads the data (I see in LOG) and update the values, but with the following reads it shows smth like that

2018-10-02 00:18:45.705 (USB - modbus (reg1)) Modbus error communicating! (RTU/ASCII/RTU over TCP), check your settings!
2018-10-02 00:18:45.705 (USB - modbus (reg1)) Updating device from 0:'1415' to have values 0:'0'.
2018-10-02 00:18:45.713 (USB - modbus (reg1)) Modbus error decoding or recieved no data (RTU/ASCII/RTU over TCP)!, check your settings!
2018-10-02 00:18:45.714 (USB - modbus (reg1)) Updating device from 0:'0' to have values 0:'0'.

I tested the sensor with CAS Modbus scanner and it gets the data via modbus regulary.

Does anyone meet the same issue?

The sensor is made on Arduino and follows the following implementation http://domoticx.com/arduino-modbus-rs485-rtu-slave/ (from the 1st page)
malp
Posts: 10
Joined: Thursday 11 January 2018 8:36
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by malp »

solution for my previous message (after the debugging), so probably will be helpfull:

it is solved with the statement client.close after the data reading for RTU
line 263
Devices[1].Update(0, value) # Update value in Domoticz
try: - here is my code
client.close() - here is my code
except: - here is my code
Domoticz.Log("Error closing Serial interface on "+Parameters["SerialPort"]) - here is my code

except:
Domoticz.Log("Modbus error decoding or recieved no data (RTU/ASCII/RTU over TCP)!, check your settings!")
Devices[1].Update(0, "0") # Update value in Domoticz

###################################
# pymodbusTCP section
###################################
Koploper
Posts: 2
Joined: Sunday 14 October 2018 17:48
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Contact:

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

Post by Koploper »

Hi ,

I also installed an Eastron SDM120 to monitor my solar energy production and like to integrate it into domoticz. I have a Modbus to USB dongle (https://www.hobbyelectronica.nl/product ... catie-usb/), installed the plugin but I can't seem to get the datatransfer working. Also I am not sure what exacly to fill in when setting up the hardware in Domoticz. When I set it up, I get a new device, which is identified as a Light/Switch. I am somewhat experienced with Domoticz, but am completely new to modbus.

Does someone know how I can set up the communication?

I'm running V4.9700 on an RPI.

Thanks!
thefox154
Posts: 1
Joined: Tuesday 16 October 2018 19:50
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.9700
Location: Netherlands
Contact:

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

Post by thefox154 »

I have the same problem, different device.
When i try to read out sensor readings from a Hitachi Modbus module (temperatures), this is added as a Light Switch device in domotiz :?:

edit: My eastron SDM530 also shows up as a light switch..
Last edited by thefox154 on Tuesday 16 October 2018 21:06, edited 1 time in total.
MaikelK
Posts: 41
Joined: Saturday 01 November 2014 13:51
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by MaikelK »

Koploper wrote: Sunday 14 October 2018 18:24 Hi ,

I also installed an Eastron SDM120 to monitor my solar energy production and like to integrate it into domoticz. I have a Modbus to USB dongle (https://www.hobbyelectronica.nl/product ... catie-usb/), installed the plugin but I can't seem to get the datatransfer working. Also I ........
I would love to know the same, i bought the same (looking) adapter from Aliexpress.

You connected it to a Rpi too?
laulau
Posts: 2
Joined: Saturday 27 September 2014 10:03
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

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

Post by laulau »

Hi,
I'm testing this plugin and encountered some problems.

I' ve defined two hardware devices, one for F1(Read coil) fonction and an other for F3(Read holding register) fonction.


But both device are shown as Light/Switch ! :o

This seem ok for F1 fonction (binary) but F3 should read a Custom sensor ?
Laurent
butyl
Posts: 1
Joined: Friday 19 October 2018 12:58
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by butyl »

Hi Domoticx,
are you still working on the modbus plugin? Have you updated it on Domoticz v4.x?
I need to read some regier values from the new modbus device.

Can you update the plugin for Domoticz v4.x, please?
Thank you.
Butyl
calderopapas
Posts: 1
Joined: Sunday 04 November 2018 23:47
Target OS: Linux
Domoticz version:
Contact:

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

Post by calderopapas »

Hello Domoticx,

I install your plug in, works fine, but i have a problem.

I use a modbus gateway between RTU and TCP. When add a MODBUS TCP device in domoticz, cant select address of modbus RTU device, only ip adress of gateway.

i use it in scadabr and works fine, how can select slave address in your plugin?

Scheme: modbus RTU bus(rs485)----------- modbus gateway (RTU-TCP)------ LAN
|
|
L device 1.
|
L device 2...

i attach and image of scadaLTS.
Attachments
Anotación.png
Anotación.png (111.14 KiB) Viewed 5085 times
RonaldSl
Posts: 1
Joined: Monday 05 November 2018 1:04
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by RonaldSl »

Hallo,

I installed the plugins and after clean installation of Raspbian and Domoticz it works so far.
I am trying to read a coil from PLC over TCP and in debug mode. When I switched the register from on to off I see in debug mode:
2018-11-04 23:09:43.297 (Read MB20 - ModbusDEV-READ) Updating device from 1:'False' to have values 0:'False'.
2018-11-04 23:09:43.312 (Read MB20 - ModbusDEV-READ) Updating device from 0:'False' to have values 1:'False'.

When I switched from off to on in debug mode:
2018-11-04 23:10:53.304 (Read MB20 - ModbusDEV-READ) Updating device from 1:'True' to have values 0:'True'.
2018-11-04 23:10:53.319 (Read MB20 - ModbusDEV-READ) Updating device from 0:'True' to have values 1:'True'.

So far so good. Only thing is that when I switched that device, the device stay's on.
modbustcp.jpg
modbustcp.jpg (78.2 KiB) Viewed 5081 times
When I change the data type to INT instead of no conversion the device stay's off.

The ModBus-WRITE plugin the write coil function is working verry good with payload on=1 and off=0.

Can you please help me with the read plugin?
Mankan
Posts: 20
Joined: Wednesday 23 November 2016 6:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by Mankan »

Hi!

I need help to install Modbus Plugin, both Read and write

Ive downloaded plugins from,
https://github.com/DomoticX/domoticz-modbus

And I have placed it under

/home/pi/domoticz/plugins/modbus-write/plugin.py
/home/pi/domoticz/plugins/modbus-read/plugin.py

And then i made restart.

The log says,
2018-11-07 16:01:48.361 Error: PluginList: Parsing '/home/pi/domoticz/plugins/modbus-read/', 'Error document empty.' at line 0 column 0 in XML ''.

2018-11-07 16:01:48.361 Error: PluginList: Parsing '/home/pi/domoticz/plugins/modbus-write/', 'Error document empty.' at line 0 column 0 in XML ''.

Ive tried to run this to,
sudo pip3 install -U pymodbus

in hardware it looks like the attached file.

does anybody know what im doin wrong??
Attachments
PS.PNG
PS.PNG (27.42 KiB) Viewed 5039 times
rvdgaag
Posts: 2
Joined: Saturday 16 June 2018 11:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

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

Post by rvdgaag »

I upgraded to the read 1.1.3 and it has issues now connecting to the TCPIP device which was working fine with 1.1.2.

Any ideas where I can find the previous version ?
dzjr
Posts: 45
Joined: Monday 02 July 2018 23:35
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.100xx
Location: Alkmaar, The Netherlands
Contact:

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

Post by dzjr »

Hello @Domoticx,

Thank you for this plug-in.
I use it together whit a Janitza UMG103 Universal measurement device, i can read all the measurements i want.

Only sometimes i get a bad reading, value = 0, but that is 1 times in two day's, it can also some bad wire-ring.


i tried to connect thru TCP/IP but that i can't get it working......
else i had tryed to connect it thru Ethernet.

Thank you for the plugin!
NUC Proxmox VM Stable & Raspberry Pi-3 Domoticz Beta
Tradfri Pluging by Moroen, Home made MySensors, Luftdaten, Home & Garden automatisation.
APC Back-UPS XS 700U, Modbus RTU & Janitza UMG103, RF-Link
Sonos plugins
VHK17
Posts: 11
Joined: Tuesday 31 January 2017 9:10
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

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

Post by VHK17 »

Hello,
Is it possible to use the raspberry as a slave modbus device ?

I have a home automation plc for heating and so on and want to use the raspberry as a slave for the lights.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest