Modbus openHAB2 binding available for alpha testing

So I thought I had it, but reconnectAfterMillis=0 even tho I have it set to 600000. Even restarted the binding:

modbus.log:

grep reconnectAfterMillis *
modbus.log:28-Jan-2018 14:52:27.582 [TRACE] [.internal.pooling.ModbusSlaveConnectionFactoryImpl] - (passivate) Connection TCPMasterConnection@46825a29[socket=Socket[addr=/10.88.64.46,port=502,localport=46658]] (endpoint ModbusTCPSlaveEndpoint@6c96f183[address=10.88.64.46,port=502]) age 11ms is over the reconnectAfterMillis=0ms limit or has been connection time (1517169147571) is after the "disconnectBeforeConnectedMillis"=-1 -> disconnecting.
modbus.log:28-Jan-2018 14:52:27.582 [TRACE] [.internal.pooling.ModbusSlaveConnectionFactoryImpl] - (passivate) Connection TCPMasterConnection@3e3dab37[socket=Socket[addr=/10.88.64.45,port=502,localport=57990]] (endpoint ModbusTCPSlaveEndpoint@1f608048[address=10.88.64.45,port=502]) age 18ms is over the reconnectAfterMillis=0ms limit or has been connection time (1517169147564) is after the "disconnectBeforeConnectedMillis"=-1 -> disconnecting.
modbus.log:28-Jan-2018 14:52:28.631 [TRACE] [.internal.pooling.ModbusSlaveConnectionFactoryImpl] - (passivate) Connection TCPMasterConnection@3e3dab37[socket=Socket[addr=/10.88.64.45,port=502,localport=57994]] (endpoint ModbusTCPSlaveEndpoint@1f608048[address=10.88.64.45,port=502]) age 3ms is over the reconnectAfterMillis=0ms limit or has been connection time (1517169148628) is after the "disconnectBeforeConnectedMillis"=-1 -> disconnecting.

modbus.things:

Bridge modbus:tcp:water [ host="10.88.64.45", port=502, id=1 ] {
  Bridge poller coils [ start=0, length=55, refresh=100, reconnectAfterMillis=600000, connectTimeoutMillis=1200, type="coil" ] {
    Thing data 00 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
    Thing data 01 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
  }
}

Bridge modbus:tcp:basement [ host="10.88.64.46", port=502, id=2 ] {
  Bridge poller coils [ start=0, length=55, refresh=100, reconnectAfterMillis=600000, connectTimeoutMillis=1200, type="coil" ] {
    Thing data 00 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
    Thing data 01 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
    Thing data 02 [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
    Thing data 03 [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
    Thing data 04 [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
    Thing data 05 [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
    Thing data 06 [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
    Thing data 07 [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]
    Thing data 08 [ readStart="8", readValueType="bit", writeStart="8", writeValueType="bit", writeType="coil" ]
    Thing data 09 [ readStart="9", readValueType="bit", writeStart="9", writeValueType="bit", writeType="coil" ]
    Thing data 10 [ readStart="10", readValueType="bit", writeStart="10", writeValueType="bit", writeType="coil" ]
    Thing data 11 [ readStart="11", readValueType="bit", writeStart="11", writeValueType="bit", writeType="coil" ]
    Thing data 12 [ readStart="12", readValueType="bit", writeStart="13", writeValueType="bit", writeType="coil" ]
    Thing data 13 [ readStart="13", readValueType="bit", writeStart="14", writeValueType="bit", writeType="coil" ]
    Thing data 14 [ readStart="14", readValueType="bit", writeStart="14", writeValueType="bit", writeType="coil" ]
    Thing data 15 [ readStart="15", readValueType="bit", writeStart="15", writeValueType="bit", writeType="coil" ]
    Thing data 16 [ readStart="16", readValueType="bit", writeStart="16", writeValueType="bit", writeType="coil" ]
    Thing data 17 [ readStart="17", readValueType="bit", writeStart="17", writeValueType="bit", writeType="coil" ]
    Thing data 18 [ readStart="18", readValueType="bit", writeStart="18", writeValueType="bit", writeType="coil" ]
    Thing data 29 [ readStart="19", readValueType="bit", writeStart="19", writeValueType="bit", writeType="coil" ]
    Thing data 20 [ readStart="20", readValueType="bit", writeStart="20", writeValueType="bit", writeType="coil" ]
    Thing data 21 [ readStart="21", readValueType="bit", writeStart="21", writeValueType="bit", writeType="coil" ]
    Thing data 49 [ readStart="49", readValueType="bit", writeStart="49", writeValueType="bit", writeType="coil" ]
    Thing data 50 [ readStart="50", readValueType="bit", writeStart="50", writeValueType="bit", writeType="coil" ]
    Thing data 51 [ readStart="51", readValueType="bit", writeStart="51", writeValueType="bit", writeType="coil" ]
    Thing data 52 [ readStart="52", readValueType="bit", writeStart="52", writeValueType="bit", writeType="coil" ]
    Thing data 53 [ readStart="53", readValueType="bit", writeStart="53", writeValueType="bit", writeType="coil" ]
  }
  Bridge poller ponet [ start=2072, length=8, refresh=100, reconnectAfterMillis=600000, connectTimeoutMillis=1200, type="coil" ] {
    Thing data 00 [ readStart="2072", readValueType="bit", writeStart="2072", writeValueType="bit", writeType="coil" ]
    Thing data 01 [ readStart="2073", readValueType="bit", writeStart="2073", writeValueType="bit", writeType="coil" ]
    Thing data 02 [ readStart="2074", readValueType="bit", writeStart="2074", writeValueType="bit", writeType="coil" ]
    Thing data 03 [ readStart="2075", readValueType="bit", writeStart="2075", writeValueType="bit", writeType="coil" ]
    Thing data 04 [ readStart="2076", readValueType="bit", writeStart="2076", writeValueType="bit", writeType="coil" ]
    Thing data 05 [ readStart="2077", readValueType="bit", writeStart="2077", writeValueType="bit", writeType="coil" ]
    Thing data 06 [ readStart="2078", readValueType="bit", writeStart="2078", writeValueType="bit", writeType="coil" ]
    Thing data 07 [ readStart="2079", readValueType="bit", writeStart="2079", writeValueType="bit", writeType="coil" ]
  }
}

Bridge modbus:tcp:first [ host="10.88.64.47", port=502, id=3 ] {
  Bridge poller coils [ start=0, length=55, refresh=100, reconnectAfterMillis=600000, connectTimeoutMillis=1200, type="coil" ] {
    Thing data 00 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
    Thing data 01 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
    Thing data 02 [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
    Thing data 03 [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
    Thing data 04 [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
    Thing data 05 [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
    Thing data 06 [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
    Thing data 07 [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]
    Thing data 08 [ readStart="8", readValueType="bit", writeStart="8", writeValueType="bit", writeType="coil" ]
    Thing data 09 [ readStart="9", readValueType="bit", writeStart="9", writeValueType="bit", writeType="coil" ]
    Thing data 10 [ readStart="10", readValueType="bit", writeStart="10", writeValueType="bit", writeType="coil" ]
    Thing data 11 [ readStart="11", readValueType="bit", writeStart="11", writeValueType="bit", writeType="coil" ]
    Thing data 12 [ readStart="12", readValueType="bit", writeStart="13", writeValueType="bit", writeType="coil" ]
    Thing data 13 [ readStart="13", readValueType="bit", writeStart="14", writeValueType="bit", writeType="coil" ]
    Thing data 14 [ readStart="14", readValueType="bit", writeStart="14", writeValueType="bit", writeType="coil" ]
    Thing data 15 [ readStart="15", readValueType="bit", writeStart="15", writeValueType="bit", writeType="coil" ]
    Thing data 16 [ readStart="16", readValueType="bit", writeStart="16", writeValueType="bit", writeType="coil" ]
    Thing data 17 [ readStart="17", readValueType="bit", writeStart="17", writeValueType="bit", writeType="coil" ]
    Thing data 18 [ readStart="18", readValueType="bit", writeStart="18", writeValueType="bit", writeType="coil" ]
    Thing data 29 [ readStart="19", readValueType="bit", writeStart="19", writeValueType="bit", writeType="coil" ]
    Thing data 20 [ readStart="20", readValueType="bit", writeStart="20", writeValueType="bit", writeType="coil" ]
    Thing data 21 [ readStart="21", readValueType="bit", writeStart="21", writeValueType="bit", writeType="coil" ]
    Thing data 22 [ readStart="22", readValueType="bit", writeStart="22", writeValueType="bit", writeType="coil" ]
    Thing data 23 [ readStart="23", readValueType="bit", writeStart="23", writeValueType="bit", writeType="coil" ]
    Thing data 24 [ readStart="24", readValueType="bit", writeStart="24", writeValueType="bit", writeType="coil" ]
    Thing data 25 [ readStart="25", readValueType="bit", writeStart="25", writeValueType="bit", writeType="coil" ]
    Thing data 26 [ readStart="26", readValueType="bit", writeStart="26", writeValueType="bit", writeType="coil" ]
  }
  Bridge poller ponet [ start=2072, length=8, refresh=100, reconnectAfterMillis=600000, connectTimeoutMillis=1200, type="coil" ] {
    Thing data 00 [ readStart="2072", readValueType="bit", writeStart="2072", writeValueType="bit", writeType="coil" ]
    Thing data 01 [ readStart="2073", readValueType="bit", writeStart="2073", writeValueType="bit", writeType="coil" ]
    Thing data 02 [ readStart="2074", readValueType="bit", writeStart="2074", writeValueType="bit", writeType="coil" ]
    Thing data 03 [ readStart="2075", readValueType="bit", writeStart="2075", writeValueType="bit", writeType="coil" ]
    Thing data 04 [ readStart="2076", readValueType="bit", writeStart="2076", writeValueType="bit", writeType="coil" ]
    Thing data 05 [ readStart="2077", readValueType="bit", writeStart="2077", writeValueType="bit", writeType="coil" ]
    Thing data 06 [ readStart="2078", readValueType="bit", writeStart="2078", writeValueType="bit", writeType="coil" ]
    Thing data 07 [ readStart="2079", readValueType="bit", writeStart="2079", writeValueType="bit", writeType="coil" ]
  }
}

Bridge modbus:tcp:second [ host="10.88.64.48", port=502, id=4 ] {
  Bridge poller coils [ start=0, length=55, refresh=100, reconnectAfterMillis=600000, connectTimeoutMillis=1200, type="coil" ] {
    Thing data 00 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
    Thing data 01 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
    Thing data 02 [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
    Thing data 03 [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
    Thing data 04 [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
    Thing data 05 [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
    Thing data 06 [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
    Thing data 07 [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]
    Thing data 08 [ readStart="8", readValueType="bit", writeStart="8", writeValueType="bit", writeType="coil" ]
    Thing data 09 [ readStart="9", readValueType="bit", writeStart="9", writeValueType="bit", writeType="coil" ]
    Thing data 10 [ readStart="10", readValueType="bit", writeStart="10", writeValueType="bit", writeType="coil" ]
    Thing data 11 [ readStart="11", readValueType="bit", writeStart="11", writeValueType="bit", writeType="coil" ]
    Thing data 12 [ readStart="12", readValueType="bit", writeStart="13", writeValueType="bit", writeType="coil" ]
    Thing data 13 [ readStart="13", readValueType="bit", writeStart="14", writeValueType="bit", writeType="coil" ]
    Thing data 14 [ readStart="14", readValueType="bit", writeStart="14", writeValueType="bit", writeType="coil" ]
    Thing data 15 [ readStart="15", readValueType="bit", writeStart="15", writeValueType="bit", writeType="coil" ]
    Thing data 16 [ readStart="16", readValueType="bit", writeStart="16", writeValueType="bit", writeType="coil" ]
    Thing data 17 [ readStart="17", readValueType="bit", writeStart="17", writeValueType="bit", writeType="coil" ]
    Thing data 18 [ readStart="18", readValueType="bit", writeStart="18", writeValueType="bit", writeType="coil" ]
    Thing data 29 [ readStart="19", readValueType="bit", writeStart="19", writeValueType="bit", writeType="coil" ]
    Thing data 20 [ readStart="20", readValueType="bit", writeStart="20", writeValueType="bit", writeType="coil" ]
    Thing data 21 [ readStart="21", readValueType="bit", writeStart="21", writeValueType="bit", writeType="coil" ]
    Thing data 22 [ readStart="22", readValueType="bit", writeStart="22", writeValueType="bit", writeType="coil" ]
    Thing data 23 [ readStart="23", readValueType="bit", writeStart="23", writeValueType="bit", writeType="coil" ]
    Thing data 24 [ readStart="24", readValueType="bit", writeStart="24", writeValueType="bit", writeType="coil" ]
    Thing data 25 [ readStart="25", readValueType="bit", writeStart="25", writeValueType="bit", writeType="coil" ]
    Thing data 26 [ readStart="26", readValueType="bit", writeStart="26", writeValueType="bit", writeType="coil" ]
    Thing data 27 [ readStart="27", readValueType="bit", writeStart="27", writeValueType="bit", writeType="coil" ]
    Thing data 28 [ readStart="28", readValueType="bit", writeStart="28", writeValueType="bit", writeType="coil" ]
    Thing data 29 [ readStart="29", readValueType="bit", writeStart="29", writeValueType="bit", writeType="coil" ]
    Thing data 30 [ readStart="30", readValueType="bit", writeStart="30", writeValueType="bit", writeType="coil" ]
    Thing data 31 [ readStart="31", readValueType="bit", writeStart="31", writeValueType="bit", writeType="coil" ]
    Thing data 32 [ readStart="32", readValueType="bit", writeStart="32", writeValueType="bit", writeType="coil" ]
    Thing data 51 [ readStart="51", readValueType="bit", writeStart="51", writeValueType="bit", writeType="coil" ]
    Thing data 52 [ readStart="52", readValueType="bit", writeStart="52", writeValueType="bit", writeType="coil" ]
  }
  Bridge poller ponet [ start=2072, length=8, refresh=100, reconnectAfterMillis=600000, connectTimeoutMillis=1200, type="coil" ] {
    Thing data 00 [ readStart="2072", readValueType="bit", writeStart="2072", writeValueType="bit", writeType="coil" ]
    Thing data 01 [ readStart="2073", readValueType="bit", writeStart="2073", writeValueType="bit", writeType="coil" ]
    Thing data 02 [ readStart="2074", readValueType="bit", writeStart="2074", writeValueType="bit", writeType="coil" ]
    Thing data 03 [ readStart="2075", readValueType="bit", writeStart="2075", writeValueType="bit", writeType="coil" ]
    Thing data 04 [ readStart="2076", readValueType="bit", writeStart="2076", writeValueType="bit", writeType="coil" ]
    Thing data 05 [ readStart="2077", readValueType="bit", writeStart="2077", writeValueType="bit", writeType="coil" ]
    Thing data 06 [ readStart="2078", readValueType="bit", writeStart="2078", writeValueType="bit", writeType="coil" ]
    Thing data 07 [ readStart="2079", readValueType="bit", writeStart="2079", writeValueType="bit", writeType="coil" ]
  }
}

Bridge modbus:tcp:shed [ host="10.88.64.49", port=502, id=5 ] {
  Bridge poller coils [ start=0, length=55, refresh=100, reconnectAfterMillis=600000, connectTimeoutMillis=1200, type="coil" ] {
    Thing data 00 [ readStart="0", readValueType="bit", writeStart="0", writeValueType="bit", writeType="coil" ]
    Thing data 01 [ readStart="1", readValueType="bit", writeStart="1", writeValueType="bit", writeType="coil" ]
    Thing data 02 [ readStart="2", readValueType="bit", writeStart="2", writeValueType="bit", writeType="coil" ]
    Thing data 03 [ readStart="3", readValueType="bit", writeStart="3", writeValueType="bit", writeType="coil" ]
    Thing data 04 [ readStart="4", readValueType="bit", writeStart="4", writeValueType="bit", writeType="coil" ]
    Thing data 05 [ readStart="5", readValueType="bit", writeStart="5", writeValueType="bit", writeType="coil" ]
    Thing data 06 [ readStart="6", readValueType="bit", writeStart="6", writeValueType="bit", writeType="coil" ]
    Thing data 07 [ readStart="7", readValueType="bit", writeStart="7", writeValueType="bit", writeType="coil" ]
    Thing data 08 [ readStart="8", readValueType="bit", writeStart="8", writeValueType="bit", writeType="coil" ]
    Thing data 09 [ readStart="9", readValueType="bit", writeStart="9", writeValueType="bit", writeType="coil" ]
    Thing data 10 [ readStart="10", readValueType="bit", writeStart="10", writeValueType="bit", writeType="coil" ]
  }
  Bridge poller ponet [ start=2072, length=8, refresh=100, reconnectAfterMillis=600000, connectTimeoutMillis=1200, type="coil" ] {
    Thing data 00 [ readStart="2072", readValueType="bit", writeStart="2072", writeValueType="bit", writeType="coil" ]
    Thing data 01 [ readStart="2073", readValueType="bit", writeStart="2073", writeValueType="bit", writeType="coil" ]
    Thing data 02 [ readStart="2074", readValueType="bit", writeStart="2074", writeValueType="bit", writeType="coil" ]
    Thing data 03 [ readStart="2075", readValueType="bit", writeStart="2075", writeValueType="bit", writeType="coil" ]
    Thing data 04 [ readStart="2076", readValueType="bit", writeStart="2076", writeValueType="bit", writeType="coil" ]
    Thing data 05 [ readStart="2077", readValueType="bit", writeStart="2077", writeValueType="bit", writeType="coil" ]
    Thing data 06 [ readStart="2078", readValueType="bit", writeStart="2078", writeValueType="bit", writeType="coil" ]
    Thing data 07 [ readStart="2079", readValueType="bit", writeStart="2079", writeValueType="bit", writeType="coil" ]
  }
}

Looks like I had it in the wrong section of the config, it goes on the first line, not the poller.

1 Like

@ssalonen

in general, is there a way to do a “scan/poll” of the register (-s) and know it’s type? Asking such to know how I could use it further more connecting an ‘undocumented’ unit [I have a pellet boiler where the manufacturer does not want to share this information].

p.s. it has RS485 over TCP and I’m starting to play around with it.

Thanks

Generally speaking there is no way to know the types on data items by just using modbus. Furthermore, even scanning can be complicated, devices might have their individual restrictions that prevent reading the register data easily (non continuous registers)

The address space in modbus is quite large so without any knowledge this can be hard if not impossible.

At least this my understanding…

I would try really hard to find reverse engineered specs. Or perhaps you can spy / listen modbus traffic with HMI device or something similar…

Have you tested this with expire binding?

Switch    Garage_Door_A_Relay                 "Garage Door A"                                         <garagedoor>    (Garage)                                {channel="modbus:data:basement:coils:51:switch", expire="1s, command=OFF", autoupdate="false"}
Contact   Garage_Door_A                       "Garage Door A [MAP(en.map):%s]"                        <garagedoor>    (Garage, Entry)                         {channel="modbus:data:basement:coils:17:contact"}
Switch    Garage_Door_B_Relay                 "Garage Door B"                                         <garagedoor>    (Garage)                                {channel="modbus:data:basement:coils:52:switch", expire="1s, command=OFF", autoupdate="false"}
Contact   Garage_Door_B                       "Garage Door B [MAP(en.map):%s]"                        <garagedoor>    (Garage, Entry)                         {channel="modbus:data:basement:coils:18:contact"}
Switch    Garage_Door_C_Relay                 "Garage Door C"                                         <garagedoor>    (Garage)                                {channel="modbus:data:basement:coils:53:switch", expire="1s, command=OFF", autoupdate="false"}
Contact   Garage_Door_C                       "Garage Door C [MAP(en.map):%s]"                        <garagedoor>    (Garage, Entry)                         {channel="modbus:data:basement:coils:15:contact"}

If I look at events.log it looks normal:

2018-01-30 14:05:24.170 [vent.ItemStateChangedEvent] - Garage_Door_A_Relay changed from NULL to ON
2018-01-30 14:05:24.170 [vent.ItemStateChangedEvent] - Garage_Door_A changed from NULL to OPEN
2018-01-30 14:05:24.194 [.ItemChannelLinkAddedEvent] - Link 'Garage_Door_A_Relay-modbus:data:basement:coils:51:switch' has been added.
2018-01-30 14:05:24.197 [.ItemChannelLinkAddedEvent] - Link 'Garage_Door_A-modbus:data:basement:coils:17:contact' has been added.
2018-01-30 14:05:46.710 [ome.event.ItemCommandEvent] - Item 'Garage_Door_A_Relay' received command OFF
2018-01-30 14:05:58.457 [vent.ItemStateChangedEvent] - Garage_Door_A_Relay changed from ON to OFF

However, expire sees the binding updating the current state OFF like crazy:

expire.log:30-Jan-2018 14:09:16.953 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:17.074 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:17.194 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:17.309 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:17.430 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:17.555 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:17.675 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:17.794 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:17.913 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:18.034 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:18.159 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:18.275 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:18.686 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:18.753 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:18.874 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:18.997 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:19.120 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:19.236 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:19.360 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:19.483 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:19.609 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:19.722 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:19.842 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:19.966 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:20.086 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.
expire.log:30-Jan-2018 14:09:20.204 [DEBUG] [org.openhab.binding.expire.internal.ExpireBinding ] - Item Garage_Door_A_Relay received update 'OFF'; stopping any future expiration.

If I stop the modbus binding, the flood to expire stops.

Hi,

Perhaps the event log just shows state changes?

It is true that thing channels and item states are updated on every poll, even when the value is not changed. Is this not the case you want to have?

With the old binding, at least using openHAB1, this increased CPU usage quite a lot. For this purpose, a configuration parameter was introduced to disable state updates when the value is unchanged from previous poll (updateunchangeditems). See PRs #4291 and #4339 for the original discussion regarding this topic.

Unfortunately, the feature has its downsides, and the item state can get out of sync of the polled data, see this comment (especially this chain of events).

As far I understood from the “openHAB philosophy”, the binding should update the states, whenever new data is available. It is said that binding is “stateless” in this sense. However, the CPU usage was considered such a downside, that it was well founded to limit the updates (see the PRs for the discussions).

I am curious to know how the CPU usage is with openHAB2 (pinging high frequency modbus poller @mbs38) . With openHAB1, the CPU usage was due to the internal state update events inside openHAB itself, the actual polling does not require much CPU.

Note that one can always react on state changes only (instead of all updates). However, it looks like expire binding does not allow this, and makes no distinction between the updates. In fact, they even have disclaimer in the docs about this:

If another binding is repeatedly updating the state of the item to be the same state it already was, the expiration timer will continue to be reset into the future. Dedicating an item to the expiration function (so it doesn’t receive repeated updates from another binding) would avoid unwanted behavior, should it apply in your case.

I wonder if such improvements are possible in expire binding, or if it has been discussed here in community forums? At least there is some new version of expire binding in the works, see here.

The good side with the current behaviour is that you can detect if the data just stop updating, e.g. when the slave goes down. On the other hand, there are now dedicated diagnostics channels(“last error” and “last read”) for this purpose, and using expire binding is perhaps more complicated than necessary.

Best,
Sami

Ah. Behaviour with expire binding is of future interest to me. This one would have caught me out.

Currently in OH1 I have many coil outputs working like pushbuttons; rule commands ON and after a while expire sets back OFF again. Saves a whole lot of rules and timers.
Some at least I could set up as modbus write-only, that should allow same behaviour using expire.

I guess philosophically I’m subverting the original purpose of the expire binding as a dead man’s switch. It’s convenient in this (ab)use, but not essential as other means are available.
It does not feel like an issue that needs to be addressed by breaking OH guidelines (barring performance effects !!).

I assume a failed write-only slave would be detectable via “last error” channel? Which represents an improvement over using expire for fault detecting purpose.

Thanks for the detailed explanation! I just moved from expire to a rule that turns them off for now.

I’ll take a look.
Max

1 Like

Current situation:

The Schneider M221 PLC (see config attached) controls my lights. I’ve switches on the inputs of the PLC. Some of the outputs direct activates my lights and some outputs control some 5V relays.
I’ve had help programming the PLC, so my knowledge about PLC and Modbus is very poor.

OH 2.2 is running on an micro PC with Win10.

Also i’ve some z-wave devices up and running (dimmers and multi-sensor)

Problem:

I want to keep using my plc to control the lighting in case OH stops running.
OH has to control the outputs of the PLC and also use the inputs.
The ouput of the plc can be triggered by a switch or an sensor (Rules)
Actions on OH can be triggered by input of the PLC (switch) (all active lights off)
I like to combine the functionality of both OH and PLC

I’ve tried an setup with modbus tools slave simulator on other laptop and succeeded in read/write coils and read digital inputs.

Only if I change to the M221 plc nothing happens (with correct settings). Does anyone has some experience with Schneider PLC and modbus?

I’m using the binding of Sami Salonen and tried to program via PaperUI.

@Jakke17, I think you are more likely to find help by opening a new thread regarding this topic. Sounds like you have sorted out the binding but having trouble with the plc.

What do you think?

Best
Sami

@ssalonen, I’ve already tried twice but no reaction. The binding works fine but indeed the M221 plc doesn’t react to the binding. I will try again

Best Jan

[SOLVED] I’m trying to do write to FC16 using the binding but can’t make it work.
I’ve tried sending this raw string from a console program: hex:1E1003EA0001020002+CRC which sets the control parameter to the requested value.

Then I setup my modbus.things file, I made a unique write data thing:

Bridge modbus:serial:nilanCombiPolar [ port="/dev/ttyUSB-48503", baud=19200, id=30, stopBits="1", parity="even",dataBits=8, echo=false, encoding="rtu", flowControlIn="none", flowControlOut="none", receiveTimeoutMillis=1500 ] {
	Bridge poller controlOutput[ start=1000, length=8, refresh=60000, type="holding" ] {
		Thing data outputType   [ readStart="1000", readValueType="int16" ]
		Thing data outputRunSet [ readStart="1001", readValueType="int16" ]
		Thing data outputModeSet  [ readStart="1002", readValueType="int16"]
		Thing data outputVentSet   [ readStart="1003", readValueType="int16" ]
		Thing data outputTempSet  [ readStart="1004", readValueType="int16" ]
		Thing data outputServiceMode  [ readStart="1005", readValueType="int16" ]
		Thing data outputServicePct   [ readStart="1006", readValueType="int16" ]
		Thing data outputPreset  [ readStart="1007", readValueType="int16" ]
	}
	Thing data writeOutputModeSet [ writeStart="1002", writeValueType="int16", writeType="holding", writeMultipleEvenWithSingleRegisterOrCoil=true ]
}
Number ventilationModeSet "Mode set [%d]" { channel="modbus:data:nilanCombiPolar:controlOutput:outputModeSet:number" }
Number ventilationWriteModeSet "Mode write set [%d]" { channel="modbus:data:nilanCombiPolar:writeOutputModeSet:number" }

I then set the ventilationWriteModeSet to 2 using the REST API and the log says that value has changed but nothing happens to the modbus slave when I check its control panel. No errors in the openhab log either. I have no problem reading data.
What is wrong?

Seems the modbus binding doesn’t react to changes in the REST API, when I use the Paper UI it changes.

Regarding REST not having an impact: I recommend posting a new general thread about this. It sounds like it might be a general issue (or even intended feature) with things configured via file.

Would you like to post the solution for your previous issue with writing? Perhaps it helps others

Best
Sami

Trying new binding (2.3) yesterday and i have observed problem with things in paper ui - they didnt appear after put them in modbus.things file.

Do you have all the required addons installed? Serial feature, modbus transport and modbus binding.

You can verify bundles from openhab console and using bundle:list command.

Please post logs for further diagnostics.

When testing my rule to set ventilationWriteModeSet I used the REST API as I thougth it was the easiest ui. I assume the result I got was expected.

I did learn than I need to use ventilationWriteModeSet.sendCommand(2) instead of ventilationWriteModeSet.postUpdate(2) in the rule to make it send a Modbus command value of 2.

Still learning openhab…

Thanks for the clarifiication. That is how it should work indeed (regarding your rule example).

There is a whole section regarding state vs commands in openHAB docs if I remember correctly.

Perhaps you have wrong REST call? (analogous to your sendCommand vs postUpdate finding)

Hi,

I have two questions:

  1. Is there a mechanism to ensure consistency of data across registers if they are related? The way I understand the documentation, I will have to collect the values from 10 separate data things if I am doing a read starting at address 1 with length 20. I know that all of them are related and only consistent within the full read operation, which means whenever I analyse the data, the full set of 10 data things need to be taken into account. Is there a trigger that tells me all 10 data things are populated completely? Can I be sure that it is locked until I transfer it into e.g. a variable from within a rule? Is there potentially a way to grab the “list of registers” (directly from read step 1.)?
  2. Is there an issue if I use the same base address with multiple length values for FC16 transfers?

Thanks!