Modbus binding DI and AI config

Hi all,

I am running a Wago 750-881 PLC together with another homeautomation software. This combination works properly.

Now, in Openhab 2 I was able to ad the PLC as a slave and control my digital outputs. I went ahead with my DI and AI. I can’t get any information into Openhab. The DI’s are connected to my wall switches. AI 1 is connected to an lux sensor AI2 is connected to temp sensor.

My analogue adress starts at 0 for the first port and 2 for the second port.
My DO adresses start at 512
My DI adresses start at 0

The items and things all show status “online”. I have not created any items files, all is done via paper ui.
The logs do not show any incoming information for the DI’s or the AI.

Log shows: modbus:data:b6624c8d’ changed from OFFLINE (BRIDGE_OFFLINE): Poller modbus:poller:47378821 ‘tempsensor’ has no poll task to ONLINE

I started with my DO’s, they worked immidiatly (they switch relais).
The inputs do not work, but they are online. For the AI I also created a poller.

I am a little stuck at this point.

Welcome to the Community!

For the inputs, you may need to use a transformation service like jsonpath but it will depend on how the info is sent.

It’s Modbus, it doesn’t do JSON (or any kind of text).

OP needs to figure out where his target data is held on his PLC - what type of registers, what addresses. DI, AI etc. are Wago references, not modbus.

There are a few posts here about Wago.

1 Like

Thanks for the info @rossko57 and glad you joined in. :+1: I do not have Modbus so I was only guessing at a possible solution. :neutral_face:

Hi rossko57, DI=Digital input. Unit=1 bit, Function= Read Coils = 1, address= 8 (in this case)

For the AI=Analogue input it is Unit= short 16bit signed, Function=Read Holding Registers, address= 1(in this case)

That is how it is configured in my current setup (Symcon).

That seems to be everything you need to configure two pollers and associated channels. But beware of the usual start from 0 / start from 1 modbus addressing issues.

to be sure, physical port 1 = address 0. That is what you mean, right?

Ok. So I created a modbusdata and a regular poll for the AI on the second physical port (I have only 2 ports).

The datathing:
Bridge=modbuspoller (for this tempsensor)
readaddress=1
read valuetype=16bit int signed
The rest is empty or left default

The poller:
Bridge=PLC
start=1
length=15 (tried different settings here)
type=input register

This is the result:
2020-04-13 21:54:48.407 [hingStatusInfoChangedEvent] - ‘modbus:data:b6624c8d’ changed from OFFLINE (BRIDGE_OFFLINE): Poller modbus:poller:47378821 ‘tempsensor’ has no poll task to ONLINE

No idea what that means. I think we need screenshots of poller Thing and data Thing, empty and default are wildly different in this context.
Not much will actually happen though, unless you link your data Thing to an Item. You’d probably want a Number type for a simple start.

I already created an items things temperature sensor. That is set to number indeed.

I will add some screenshots.

Looks reasonable, what does openhab.log have to say about things modbus?

These are the last entries.

==> /var/log/openhab2/openhab.log <==

2020-04-13 21:54:48.350 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Unregistering regular poll task BasicPollTaskImpl@168014c[request=ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@951976[slaveId=1,functionCode=READ_INPUT_REGISTERS,start=1,length=15,maxTries=3],endpoint=ModbusTCPSlaveEndpoint@132b926[address=192.168.188.20,port=502],callback=org.openhab.binding.modbus.internal.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator@94997bf6] (interrupting if necessary)

2020-04-13 21:54:48.355 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Poll task BasicPollTaskImpl@168014c[request=ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@951976[slaveId=1,functionCode=READ_INPUT_REGISTERS,start=1,length=15,maxTries=3],endpoint=ModbusTCPSlaveEndpoint@132b926[address=192.168.188.20,port=502],callback=org.openhab.binding.modbus.internal.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator@94997bf6] canceled

It’s normally the messages before that. that give some detail.

I did a restart of the openhab service. This is the complete log:

==> /var/log/openhab2/events.log <==

2020-04-14 19:50:57.421 [hingStatusInfoChangedEvent] - ‘modbus:poller:74a640c5’ changed from UNINITIALIZED to OFFLINE

2020-04-14 19:50:57.429 [hingStatusInfoChangedEvent] - ‘modbus:poller:74a640c5’ changed from OFFLINE to UNINITIALIZED (HANDLER_MISSING_ERROR)

2020-04-14 19:50:57.432 [hingStatusInfoChangedEvent] - ‘modbus:tcp:9689637b’ changed from ONLINE to UNINITIALIZED

2020-04-14 19:50:57.465 [hingStatusInfoChangedEvent] - ‘modbus:tcp:9689637b’ changed from UNINITIALIZED to UNINITIALIZED (HANDLER_MISSING_ERROR)

==> /var/log/openhab2/openhab.log <==

2020-04-14 19:50:57.646 [INFO ] [openhab.ui.paper.internal.PaperUIApp] - Stopped Paper UI

2020-04-14 19:50:57.710 [INFO ] [ebuilder.internal.HomeBuilderServlet] - Stopped Home Builder

2020-04-14 19:50:57.744 [INFO ] [panel.internal.HABPanelDashboardTile] - Stopped HABPanel

2020-04-14 19:50:57.820 [INFO ] [basic.internal.servlet.WebAppServlet] - Stopped Basic UI

2020-04-14 19:50:57.982 [INFO ] [.dashboard.internal.DashboardService] - Stopped Dashboard

==> /var/log/openhab2/events.log <==

2020-04-14 19:50:58.398 [temChannelLinkRemovedEvent] - Link ‘Spotjes_TV_Zone => modbus:data:8c880522:switch’ has been removed.

2020-04-14 19:50:58.405 [temChannelLinkRemovedEvent] - Link ‘Schakelaar_4 => modbus:data:644573fa:switch’ has been removed.

2020-04-14 19:50:58.409 [temChannelLinkRemovedEvent] - Link ‘Schakelaar_4 => modbus:data:68234031:switch’ has been removed.

2020-04-14 19:50:58.414 [temChannelLinkRemovedEvent] - Link ‘Temp_sensor => modbus:data:b6624c8d:number’ has been removed.

2020-04-14 19:50:58.419 [temChannelLinkRemovedEvent] - Link ‘Swicth => denonmarantz:avr:6c92bf45:general#power’ has been removed.

==> /var/log/openhab2/openhab.log <==

2020-04-14 19:51:18.925 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Time zone set to ‘Europe/Amsterdam’.

2020-04-14 19:51:18.968 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Location set to ‘50.83217854470013,5.841720919167815’.

2020-04-14 19:51:18.973 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Locale set to ‘nl_NL’.

2020-04-14 19:51:27.691 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘default.items’

2020-04-14 19:51:29.139 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model ‘default.sitemap’

2020-04-14 19:51:33.012 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007

2020-04-14 19:51:35.726 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://192.168.188.70:8080

2020-04-14 19:51:35.731 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://192.168.188.70:8443

2020-04-14 19:51:36.874 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel

2020-04-14 19:51:37.093 [INFO ] [ebuilder.internal.HomeBuilderServlet] - Started Home Builder at /homebuilder

2020-04-14 19:51:37.339 [INFO ] [openhab.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui

2020-04-14 19:51:37.489 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program “arping” (in directory “.”): error=2, No such file or directory)

2020-04-14 19:51:37.584 [WARN ] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program “arping” (in directory “.”): error=2, No such file or directory)

2020-04-14 19:51:38.075 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Modbus manager activated

==> /var/log/openhab2/events.log <==

2020-04-14 19:51:38.152 [hingStatusInfoChangedEvent] - ‘modbus:poller:74a640c5’ changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)

2020-04-14 19:51:38.166 [hingStatusInfoChangedEvent] - ‘modbus:data:d8c9e209’ changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)

2020-04-14 19:51:38.172 [hingStatusInfoChangedEvent] - ‘modbus:data:68234031’ changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)

2020-04-14 19:51:38.178 [hingStatusInfoChangedEvent] - ‘modbus:data:8c880522’ changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)

2020-04-14 19:51:38.184 [hingStatusInfoChangedEvent] - ‘modbus:data:b6624c8d’ changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)

2020-04-14 19:51:38.257 [hingStatusInfoChangedEvent] - ‘modbus:tcp:9689637b’ changed from UNINITIALIZED to INITIALIZING

2020-04-14 19:51:38.384 [hingStatusInfoChangedEvent] - ‘modbus:tcp:9689637b’ changed from INITIALIZING to ONLINE

2020-04-14 19:51:38.414 [hingStatusInfoChangedEvent] - ‘modbus:poller:47378821’ changed from UNINITIALIZED to INITIALIZING

2020-04-14 19:51:38.465 [hingStatusInfoChangedEvent] - ‘modbus:poller:47378821’ changed from INITIALIZING to ONLINE

2020-04-14 19:51:38.489 [hingStatusInfoChangedEvent] - ‘modbus:poller:74a640c5’ changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING

2020-04-14 19:51:38.537 [hingStatusInfoChangedEvent] - ‘modbus:poller:74a640c5’ changed from INITIALIZING to ONLINE

2020-04-14 19:51:38.612 [hingStatusInfoChangedEvent] - ‘modbus:data:8c880522’ changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING

2020-04-14 19:51:38.625 [hingStatusInfoChangedEvent] - ‘modbus:data:68234031’ changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING

2020-04-14 19:51:38.631 [hingStatusInfoChangedEvent] - ‘modbus:data:d8c9e209’ changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING

2020-04-14 19:51:38.636 [hingStatusInfoChangedEvent] - ‘modbus:data:b6624c8d’ changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING

2020-04-14 19:51:38.702 [hingStatusInfoChangedEvent] - ‘modbus:data:8c880522’ changed from INITIALIZING to ONLINE

2020-04-14 19:51:38.721 [hingStatusInfoChangedEvent] - ‘modbus:data:b6624c8d’ changed from INITIALIZING to ONLINE

2020-04-14 19:51:38.742 [hingStatusInfoChangedEvent] - ‘modbus:data:68234031’ changed from INITIALIZING to ONLINE

2020-04-14 19:51:38.749 [hingStatusInfoChangedEvent] - ‘modbus:data:d8c9e209’ changed from INITIALIZING to ONLINE

2020-04-14 19:51:39.051 [hingStatusInfoChangedEvent] - ‘denonmarantz:avr:6c92bf45’ changed from UNINITIALIZED to INITIALIZING

2020-04-14 19:51:39.094 [hingStatusInfoChangedEvent] - ‘denonmarantz:avr:6c92bf45’ changed from INITIALIZING to UNKNOWN

2020-04-14 19:51:39.119 [hingStatusInfoChangedEvent] - ‘denonmarantz:avr:0005cdbd2de2’ changed from UNINITIALIZED to INITIALIZING

2020-04-14 19:51:39.187 [hingStatusInfoChangedEvent] - ‘denonmarantz:avr:6c92bf45’ changed from UNKNOWN to ONLINE

2020-04-14 19:51:39.256 [hingStatusInfoChangedEvent] - ‘denonmarantz:avr:0005cdbd2de2’ changed from INITIALIZING to UNKNOWN

2020-04-14 19:51:39.263 [vent.ItemStateChangedEvent] - Swicth changed from NULL to OFF

2020-04-14 19:51:39.287 [hingStatusInfoChangedEvent] - ‘denonmarantz:avr:0005cdbd2de2’ changed from UNKNOWN to ONLINE

The only thing we haven’t seen is your TCP Bridge, but it’s hard to imagine how that might be messed up.
I’ll speculate your poller Thing is linked to a broken TCP Thing in some fashion.

You’ll probably want to follow the next step in the Troubleshooting doc and enable verbose DEBUG messages

Ok, I found out how that works. I will have a look at all the information. It is showing a lot output.

Filtered on the poller:
2020-04-14 22:36:19.215 [DEBUG] [handler.ModbusPollerThingHandlerImpl] - Thing modbus:poller:47378821 received registers RegisterArrayWrappingInputRegister(00 d2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00) for request ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@3c652d[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=1,length=15,maxTries=3]

2020-04-14 22:36:19.754 [DEBUG] [handler.ModbusPollerThingHandlerImpl] - Thing modbus:poller:47378821 received registers RegisterArrayWrappingInputRegister(00 d2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00) for request ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@3c652d[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=1,length=15,maxTries=3]

Okay, that seems to be polling 15 registers as instructed.

Yeah, but I can’t find any answer. I will have a better deeper look at the logs, see if I can find anything.

Found this (below). If I read it correctly, there is a response. (trace is a little messy, I did a search on FC=03 as well)

2020-04-15 21:24:55.834 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Executing task BasicPollTaskImpl@1bbbaa8[request=ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@b924bb[slaveId=1,functionCode=READ_INPUT_DISCRETES,start=8,length=1,maxTries=3],endpoint=ModbusTCPSlaveEndpoint@163e0a5[address=192.168.188.20,port=502],callback=org.openhab.binding.modbus.internal.handler.ModbusPollerThingHandlerImpl$ReadCallbackDelegator@7bf93c50] (oneOff=false)! Connection received in 5 ms [operation ID 36c1dc37-6b28-4a44-801e-bc17cc492e2e]
020-04-15 21:24:48.700 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Response for read request (FC=3, transaction ID=16918): 42 16 00 00 00 21 01 03 1e 00 da 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [operation ID 45d8e216-1885-477c-83fd-2ec1f203e4ad]

2020-04-15 21:24:49.253 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Response for read request (FC=3, transaction ID=16922): 42 1a 00 00 00 21 01 03 1e 00 da 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [operation ID f1ab25fc-a30c-4bb7-bbc3-bbf61704fa8c]

2020-04-15 21:24:49.834 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Response for read request (FC=3, transaction ID=16926): 42 1e 00 00 00 21 01 03 1e 00 da 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [operation ID a466e40c-3735-4176-a623-43278a1c915b]

2020-04-15 21:24:50.461 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Response for read request (FC=3, transaction ID=16931): 42 23 00 00 00 21 01 03 1e 00 da 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [operation ID bad3f708-cb91-468f-9f84-5ecbc2106e60]

2020-04-15 21:24:51.018 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Response for read request (FC=3, transaction ID=16935): 42 27 00 00 00 21 01 03 1e 00 da 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [operation ID f808e7cf-9fba-428f-844b-8c60856e589f]

2020-04-15 21:24:51.672 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Response for read request (FC=3, transaction ID=16940): 42 2c 00 00 00 21 01 03 1e 00 da 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [operation ID e7369f54-6140-4a78-8113-13d853558d1e]

2020-04-15 21:24:52.317 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Response for read request (FC=3, transaction ID=16945): 42 31 00 00 00 21 01 03 1e 00 da 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [operation ID eb7d87a0-a1af-4fc0-a51a-5f8d01b03a9d]

2020-04-15 21:24:52.879 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Response for read request (FC=3, transaction ID=16949): 42 35 00 00 00 21 01 03 1e 00 da 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [operation ID 2f2edea5-0caf-46a5-bd2e-d8eaed313986]

2020-04-15 21:24:53.506 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Response for read request (FC=3, transaction ID=16954): 42 3a 00 00 00 21 01 03 1e 00 da 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [operation ID 119681b8-9f86-4e90-bda7-cdee469d3428]

2020-04-15 21:24:54.132 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Response for read request (FC=3, transaction ID=16959): 42 3f 00 00 00 21 01 03 1e 00 da 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [operation ID 388ade41-1f72-434a-b00f-69a528245f5e]

2020-04-15 21:24:54.674 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Response for read request (FC=3, transaction ID=16963): 42 43 00 00 00 21 01 03 1e 00 da 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [operation ID aa71c99b-d7c3-4238-ad06-e316aa53c47e]

2020-04-15 21:24:55.304 [TRACE] [rt.modbus.internal.ModbusManagerImpl] - Response for read request (FC=3, transaction ID=16968): 42 48 00 00 00 21 01 03 1e 00 da 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [operation ID ca79b61a-6f5c-46b0-8af1-92b29040e225]

Yes, it is polling 15 registers as you configured.
What else do you think should happen?
We seem to be back at -

I have a temp thing configured for this. But it is not showing any data.

Yes. Is it linked to your modbus data Thing in some way?
If you click on your modbus data Thing to show its channels, any Items linked by PaperUI should show there. (Items linked by xxx.items file definitions will not show)

It’s so much easier walking through this stuff with file based configs :crazy_face: