OpenHAB2 access to MODBUS RTU slave device

1.8k views Asked by At

Running OpenHab2 on my Windows10, I am not able to get OpenHAB2 to request holding register data from the serial port. No MODBUS request are seen on the port. I installed NTP-binding (ntp time) (it works), and tried the Modbus binding 1.12.0, seems though only valid for OpenHAB1.

My OpenHAB2 configuration is

.sitemap

    sitemap boiler label="My home" 
    {
        Frame label="Date" 
        {
          Text item=Date
          Text item=holding1501 label="Holding1501 out[%.1f °C]"
          Text item=holding1500 label="Holding1500 out[%.1f °C]"
        }
    }

.items

    DateTime Date  "Date [%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS]"  { channel="ntp:ntp:local:dateTime" }
    Number holding1501 "Holding1501 [%.1f]" <temperature> {channel="modbus:data:localSerial:holding:holding1501:number"}
    Number holding1500 "Holding1500 [%.1f]" <temperature> {channel="modbus:data:localSerial:holding:holding1500:number"}

and .things

    Bridge modbus:serial:localSerial [port="COM6", id=10, baud=19200, stopBits="1", parity="even", dataBits=8, encoding="rtu"]
    {
        Bridge poller holding [ start=1500, length=1, refresh=1000, type="holding" ] 
        {
            Thing data holding1500 [ readStart="1500", readValueType="int16", writeStart="1500", writeValueType="int16", writeType="holding" ]
            Thing data holding15011 [ readStart="1501", readValueType="int16", writeStart="1501", writeValueType="int16", writeType="holding" ] 
        }
        Thing data holding1500 [ readStart="1500", readValueType="int16", writeStart="1500", writeValueType="int16", writeType="holding" ]
        Thing data holding15011 [ readStart="1501", readValueType="int16", writeStart="1501", writeValueType="int16", writeType="holding" ] 
    }

What am I missing to get MODBUS going in OpenHAB2. References to some tutorials or working examples will be appreciated.

1

There are 1 answers

0
fanders On

Finally found the solution: OpenHAB 2.3.0 is not working for MODBUS v2.x. When using OpenHAB2 2.4.0 (snapshot) MODBUS RTU is working (used com0com to bridge OH2 to MOD_RSsim). Did not manage to get MODBUS/TCP to work, seemed like an IP port connection issue)