Hello
(I think I read many post but wasn’t able to solve yet)
I’m tryong to connect to my WAGO 750-842 via modbus. Via software like “Modbus Poll” I can access my coils and read and write to them (FC 1 and 5 rispectively)
My openhab.cfg is:
modbus:tcp.slave1.connection=192.168.0.10:502
modbus:tcp.slave1.id=1
modbus:tcp.slave1.type=coil
modbus:tcp.slave1.start=514
modbus:tcp.slave1.length=8
Here my demo.items:
Switch MySwitch0 “My Modbus Switch0” (ALL) {modbus=“slave1:0”}
Switch MySwitch1 “My Modbus Switch1” (ALL) {modbus=“slave1:1”}
Switch MySwitch2 “My Modbus Switch2” (ALL) {modbus=“slave1:2”}
Switch MySwitch3 “My Modbus Switch3” (ALL) {modbus=“slave1:3”}
Switch MySwitch4 “My Modbus Switch4” (ALL) {modbus=“slave1:4”}
The demo.sitemap:
Switch item=MySwitch0 label=“modbus=slave1:0”
Switch item=MySwitch1 label=“modbus=slave1:1”
Switch item=MySwitch2 label=“modbus=slave1:2”
Switch item=MySwitch3 label=“modbus=slave1:3”
Switch item=MySwitch4 label=“modbus=slave1:4”
And here my log:
22:48:12.844 [DEBUG] [modbus.internal.ModbusTcpSlave:68 ] - ModbusSlave: Error
connecting to master: Connection timed out: connect
22:48:12.844 [INFO ] [.b.modbus.internal.ModbusSlave:262 ] - ModbusSlave not co
nnected
Here the log when I turn on/off the switches on the GUI:
22:51:05.979 [INFO ] [runtime.busevents :22 ] - MySwitch0 received
command OFF
22:51:07.274 [INFO ] [runtime.busevents :22 ] - MySwitch1 received
command OFF
If someone has suggestions … thank you !
Here is an example of mine for different devices. you might want to make sure the port and ip address are correct.
modbus:poll=1000
modbus:tcp.slave1.connection=192.168.1.200:502:rtu
modbus:tcp.slave1.type=holding
modbus:tcp.slave1.start=39
modbus:tcp.slave1.length=1
#modbus:tcp.slave1.valuetype=uint16
#ADAM 6060 12-Channel Digital I/O Module
modbus:tcp.slave2.connection=192.168.1.106:502
modbus:tcp.slave2.type=coil
modbus:tcp.slave2.start=16
modbus:tcp.slave2.length=6
modbus:tcp.slave2.valuetype=bit
modbus:tcp.slave3.connection=192.168.1.106:502
modbus:tcp.slave3.type=discrete
modbus:tcp.slave3.start=0
modbus:tcp.slave3.length=5
modbus:tcp.slave3.valuetype=bit
modbus:tcp.slave5.connection=192.168.1.106:502
modbus:tcp.slave5.type=input
modbus:tcp.slave5.start=0
modbus:tcp.slave5.length=2
#modbus:tcp.slave5.valuetype=bit
#ADAM 6024 12-Channel Universal I/O Module
modbus:tcp.slave4.connection=192.168.1.105:502
modbus:tcp.slave4.type=input
modbus:tcp.slave4.start=0
modbus:tcp.slave4.length=6
#Watlow F4
modbus:tcp.slave6.connection=192.168.1.104:502
modbus:tcp.slave6.type=input
modbus:tcp.slave6.start=100
modbus:tcp.slave6.length=16
modbus:tcp.slave7.connection=192.168.1.104:502
modbus:tcp.slave7.type=input
modbus:tcp.slave7.start=200
modbus:tcp.slave7.length=64
modbus:tcp.slave8.connection=192.168.1.104:502
modbus:tcp.slave8.type=holding
modbus:tcp.slave8.start=300
modbus:tcp.slave8.length=64
Hello David,
thank you for your reply.
About the IP address, no doubt about it.
Can the port for modbus over tcp be different than 502 ? So far I’ve found that only 502 is used for modbus around (even if scanning the PLC I found only the port 80 open).
It would be helpful for me if you (or someone else)would have some suggestions for debugging …
Thanks and regards
Lorenzo
what happens when you point your web browser to the module ip address? it should give you a status page.
Hello !
seems I got the connection.
I’m using now the following .cfg:
modbus:tcp.slave1.connection=192.168.0.10:502:rtu
modbus:tcp.slave1.id=1
modbus:tcp.slave1.type=coil
modbus:tcp.slave1.start=512
modbus:tcp.slave1.length=8
The only difference is the :rtu at the end of .connection
Thank you David for your time.
Hi David,
do you have some modbus config for PoKeys57E device?
PoKeys57E is Ethernet CNC controller, flight simulator interface or universal Ethernet I/O controller. Buy now from stock with express shipping!
Estimated reading time: 4 minutes
Thank you.
Frantisek