I’m checking out the MODBUS binding to command my Wago 750-881 PLC from openHAB2.
My home-brew light blocks use a NOVRAM variable to store state information (state 0 = light is off, state 10 = light is on)
I managed to get everything up and running (full configuration details below), reading from the PLC work flawless all the time, but writing from openHAB to the PLC only works intermittently. There’s no perceivable pattern when it works and when it doesn’t, it’s random about 1 out of 2 to 4 times.
Any ideas how I can investigate this further ?
One strange thing: the log mentions a ‘slave1’ modbusSlave which is not defined anywhere in my configuration files. I did a thorough check on this. I’m certain ‘slave1’ in not in the files.
I’m running openHAB2 version 2.2.0 on Ubuntu 16.04 on Intel x64 hardware
version of the modbus binding
237 │ Active │ 80 │ 1.11.0 │ openHAB ModbusTCP Master Binding
modbus.cfg (12288 is the start of the NOVRAM holding register address space on the Wago PLCs)
tcp.wago1.connection= 192.168.0.41:502
tcp.wago1.type=holding
tcp.wago1.start=12288
tcp.wago1.length=10
tcp.wago1.valuetype=int16
Item configuration
Switch inkom_spots (gVerlichtingBeneden) {modbus=“<[wago1:4], >[wago1:4:transformation=MAP(simpleRelay.map)]”}
Typical log output when toggling the item state from within openHAB
18:56:37.151 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘inkom_spots’ received command ON
18:56:37.157 [DEBUG] [inding.modbus.internal.Transformation] - transformed response is ‘10’
18:56:37.171 [DEBUG] [inding.modbus.internal.Transformation] - Transformed item command ‘ON’ to a command 10. Command as string ‘ON’, transformed string ‘10’, transformation ‘MAP(simpleRelay.map)’
18:56:37.181 [DEBUG] [b.binding.modbus.internal.ModbusSlave] - ModbusSlave (wago1): FC6 ref=12292 value=10
18:56:41.025 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘inkom_spots’ received command OFF
18:56:41.026 [DEBUG] [inding.modbus.internal.Transformation] - transformed response is ‘0’
18:56:41.038 [INFO ] [smarthome.event.ItemStateChangedEvent] - inkom_spots changed from ON to OFF
18:56:41.043 [DEBUG] [inding.modbus.internal.Transformation] - Transformed item command ‘OFF’ to a command 0. Command as string ‘OFF’, transformed string ‘0’, transformation ‘MAP(simpleRelay.map)’
18:56:41.058 [DEBUG] [b.binding.modbus.internal.ModbusSlave] - ModbusSlave (wago1): FC6 ref=12292 value=0
18:56:43.085 [INFO ] [smarthome.event.ItemStateChangedEvent] - collectorGarageRetour_temp changed from 39.5 to 39.8
18:56:43.374 [DEBUG] [inding.modbus.internal.Transformation] - transformed response is ‘10’
18:56:43.382 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘inkom_spots’ received command ON
18:56:43.386 [DEBUG] [inding.modbus.internal.Transformation] - Transformed item command ‘ON’ to a command 10. Command as string ‘ON’, transformed string ‘10’, transformation ‘MAP(simpleRelay.map)’
18:56:43.391 [INFO ] [smarthome.event.ItemStateChangedEvent] - inkom_spots changed from OFF to ON
18:56:43.406 [DEBUG] [b.binding.modbus.internal.ModbusSlave] - ModbusSlave (wago1): FC6 ref=12292 value=10
18:56:45.048 [INFO ] [smarthome.event.ItemStateChangedEvent] - collectorRetour_bureauLinks changed from 45.6 to 45.8
18:56:45.962 [INFO ] [smarthome.event.ItemCommandEvent ] - Item ‘inkom_spots’ received command OFF
18:56:45.964 [DEBUG] [inding.modbus.internal.Transformation] - transformed response is ‘0’
18:56:45.971 [INFO ] [smarthome.event.ItemStateChangedEvent] - inkom_spots changed from ON to OFF
18:56:45.977 [DEBUG] [inding.modbus.internal.Transformation] - Transformed item command ‘OFF’ to a command 0. Command as string ‘OFF’, transformed string ‘0’, transformation ‘MAP(simpleRelay.map)’
18:56:45.991 [DEBUG] [b.binding.modbus.internal.ModbusSlave] - ModbusSlave (wago1): FC6 ref=12292 value=0
This is the log output after restarting the modbus binding
19:06:48.871 [DEBUG] [nding.modbus.internal.ModbusActivator] - Modbus binding has been stopped.
19:06:48.915 [DEBUG] [org.openhab.binding.modbus ] - BundleEvent STOPPED - org.openhab.binding.modbus
19:06:48.933 [DEBUG] [org.openhab.binding.modbus ] - BundleEvent STARTING - org.openhab.binding.modbus
19:06:48.947 [DEBUG] [nding.modbus.internal.ModbusActivator] - Modbus binding has been started.
19:06:48.970 [DEBUG] [g.modbus.internal.ModbusBindingConfig] - Since ‘[’ in item ‘inkom_spots’ config string ‘<[wago1:4], >[wago1:4:transformation=MAP(simpleRelay.map)]’, trying to parse it using extended parser
19:06:49.016 [DEBUG] [g.modbus.internal.ModbusBindingConfig] - Parsed IOConnection (read=true) for item ‘inkom_spots’: ItemIOConnection@3902a286[slaveName=wago1,index=4,type=STATE,trigger=default,transformation=Transformation@4e1f4cd0[tranformation=default,transformationServiceName=,transformationServiceParam=],valueType=default]
19:06:49.056 [INFO ] [ab.core.service.AbstractActiveService] - Modbus Polling Service has been shut down
19:06:49.089 [DEBUG] [g.modbus.internal.ModbusBindingConfig] - Parsed IOConnection (read=false) for item ‘inkom_spots’: ItemIOConnection@146aa47b[slaveName=wago1,index=4,type=COMMAND,trigger=default,transformation=Transformation@3914bd9[tranformation=MAP(simpleRelay.map),transformationServiceName=MAP,transformationServiceParam=simpleRelay.map],valueType=default]
19:06:49.172 [DEBUG] [g.modbus.internal.ModbusBindingConfig] - item ‘inkom_spots’ parsed
19:06:49.198 [DEBUG] [g.modbus.internal.ModbusBindingConfig] - Since no ‘[’ in item ‘modbusKeukenAanrecht’ config string ‘wago1:3’, trying to parse it using simple syntax parser
19:06:49.236 [DEBUG] [g.modbus.internal.ModbusBindingConfig] - item ‘modbusKeukenAanrecht’ parsed
19:06:49.267 [DEBUG] [org.openhab.binding.modbus ] - ServiceEvent REGISTERED - {org.osgi.service.cm.ManagedService, org.osgi.service.event.EventHandler}={event.topics=openhab/*, service.pid=org.openhab.modbus, component.name=org.openhab.binding.modbus, component.id=205, service.id=334, service.bundleid=237, service.scope=bundle} - org.openhab.binding.modbus
19:06:49.268 [DEBUG] [binding.modbus.internal.ModbusBinding] - modbusSlave ‘slave1’ instanciated
19:06:49.325 [DEBUG] [org.openhab.binding.modbus ] - ServiceEvent REGISTERED - {org.openhab.model.item.binding.BindingConfigReader, org.openhab.binding.modbus.ModbusBindingProvider}={component.name=org.openhab.binding.modbus.genericbindingprovider, component.id=206, service.id=332, service.bundleid=237, service.scope=bundle} - org.openhab.binding.modbus
19:06:49.333 [DEBUG] [binding.modbus.internal.ModbusBinding] - modbusSlave ‘wago1’ instanciated
19:06:49.383 [DEBUG] [org.openhab.binding.modbus ] - BundleEvent STARTED - org.openhab.binding.modbus
19:06:49.389 [DEBUG] [binding.modbus.internal.ModbusBinding] - Parsed the following slave->endpoint configurations: {wago1=EndpointPoolConfiguration@4e88a87b[passivateBorrowMinMillis=60,interConnectDelayMillis=0,connectMaxTries=3,reconnectAfterMillis=0,connectTimeoutMillis=0], slave1=EndpointPoolConfiguration@7e6d6ec3[passivateBorrowMinMillis=60,interConnectDelayMillis=0,connectMaxTries=3,reconnectAfterMillis=0,connectTimeoutMillis=0]}. If the endpoint is same, connections are shared between the instances.
19:06:49.445 [DEBUG] [binding.modbus.internal.ModbusBinding] - Parsed the following pool configurations: {ModbusTCPSlaveEndpoint@369a3cd3[address=192.168.0.41,port=502]=EndpointPoolConfiguration@7e6d6ec3[passivateBorrowMinMillis=60,interConnectDelayMillis=0,connectMaxTries=3,reconnectAfterMillis=0,connectTimeoutMillis=0]}
19:06:49.469 [DEBUG] [binding.modbus.internal.ModbusBinding] - config looked good
19:06:49.481 [INFO ] [ab.core.service.AbstractActiveService] - Modbus Polling Service has been started
19:06:52.719 [INFO ] [smarthome.event.ItemStateChangedEvent] - collectorLiftkokerAlle changed from 65.0 to 64.6