Modbus Installation steps and Example

Hi

I have installed openHabian on Raspi3 successfully. Now I want to install modbus bindings and use some mock up modus simulator device to check integration with openhab

Can someone provide me some example and steps for the same?

I went through the doc but it is not helping

I have used ModBusPal and it is generating values but I can’t see any data coming to openhab

2019-09-21 16:16:12.406 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@1a9ac6a[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=0,length=1,maxTries=3]). Aborting. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 2 [operation ID 099f1237-0578-47f2-8286-6d253cba7bae]

Issue got resolved

But for Modbus Data I am getting
OFFLINE - CONFIGURATION_ERROR
Don’t know what is the reason

You’ll have to give us a bit more to work with. Your Things configuration?

Hi

I was told that latest version has this bug in github open issues.

Also I am not able to access basic UI in latest version. It says 404.

Can you provide as sample to configure Items , things, channels for modubus slave

Who told you about latest version of what, and what bug?

Please identify what version you are talking about.
The Modbus binding will not have anything to do with that.

Nope. I know nothing about your slave. I would know a little bit if you shared the configuration that you already made that nearly worked. But you didn’t.

@rossko57

Thanks for assistance

I took some configuration and now modbus data is working
I am using openHAB 2.4.0 Release Build

Atleast now everything is green now.

// Modbus to Smart-House
Bridge modbus:tcp:SH2WEB [ host=“192.168.1.3”, port=502, id=1 ] {
// smart-house (Fx) Sovrum 4 (Kontor) - Ljusfunktion Tak_Status
Bridge poller P1 [ start=4000, length=1, refresh=1000, type=“holding” ] {
Thing data D1 [ readStart=“0”, readValueType=“uint16”, writeStart=“0”, writeValueType=“uint16”, writeType=“holding” ]
}

}

But still I am not bale to see the values read or project them on UI .
Can you let me know what are the steps to follow now to see the values coming from slave simulator ?

Also I am not able to access basic UI and I get 404 error page and it is not visible in Dashboard.
There are no items link avaialble

If you have any working example to share Things, Channels ,Items for Modnus

@rossko57
Also it seems when I give readValueType as float32 . I start getting Configuration error

Yes, you would. float32 datatype uses two 16-bit Modbus registers, but your poller Thing is only configured to fetch one register.

Can we keep to one thread?

Maybe it needs installing. Have you got ClassicUI?

I will be now using this thread for further comminication.

I did not see any Classical UI on Openahab Web page

My requirement is to see the live data read from modbus slave on UI. What is the Control Option available on UI?

All the items are correctly loaded and showing on Control Tab where on item shoes lastreadSuccess

Now I have changed the things to read 32 float data

Two register:
4000-4001

Bridge modbus:tcp:SH2WEB [ host=“192.168.1.3”, port=502, id=1 ] {
// smart-house (Fx) Sovrum 4 (Kontor) - Ljusfunktion Tak_Status
Bridge poller P1 [ start=4000, length=2, refresh=1000, type=“holding” ] {
Thing data D1 [ readStart=“4000”, readValueType=“float32”, writeStart=“0”, writeValueType=“uint16”, writeType=“holding” ]
Thing data D2 [ readStart=“4001”, readValueType=“float32”, writeStart=“0”, writeValueType=“uint16”, writeType=“holding” ]

}

But Again I am getting configuration error

2019-09-22 10:54:42.495 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@107871[slaveId=1,functionCode=READ_MULTIPLE_REGISTERS,start=4000,length=2,maxTries=3]). Aborting. Error was: net.wimpi.modbus.ModbusSlaveException Error Code = 2 [operation ID b56f425b-5e1f-4d4f-956d-c151b56c260d]

2019-09-22 10:54:42.498 [ERROR] [ernal.handler.ModbusDataThingHandler] - Thing modbus:data:SH2WEB:P1:D1 ‘Modbus data’ had ModbusSlaveErrorResponseExceptionImpl error on read: ModbusSlaveErrorResponseException(error=2)

It is working now for following configuuration:
// Modbus to Smart-House
Bridge modbus:tcp:SH2WEB [ host=“192.168.1.3”, port=502, id=1 ] {
// smart-house (Fx) Sovrum 4 (Kontor) - Ljusfunktion Tak_Status
Bridge poller P1 [ start=4000, length=1, refresh=1000, type=“holding” ] {
Thing data D1 [ readStart=“4000”, readValueType=“uint16”, writeStart=“0”, writeValueType=“uint16”, writeType=“holding” ]
Thing data D2 [ readStart=“4001”, readValueType=“uint16”, writeStart=“0”, writeValueType=“uint16”, writeType=“holding” ]

}

}

But for D2 it is showing error message even though data is coming in correct manner

Modbus data OFFLINE - CONFIGURATION_ERROR

Modbus data

modbus:data:SH2WEB:P1:D2

Data data is showing on Control Tab but I want specific UI to show case all devices live data

Yes, your poller Thing is still only configured to fetch one register from your slave.

If you want it to fetch a second register from your slave as well, you would need length=2

If your slave is returning two registers in response to a request for only one, it is broken.

I want to show live data feed on UI so what is the best possible options available
Please find the attached snapshot which shows data on control tab

As in when I do change length =2 every thing shows communication error with errorStatus code =2
What this errorStatus code =2 signify

You’d probably want to install BasicUI, and use a sitemap to control what it displays.

Modbus Exception Code 02 means that your slave has rejected the request because it doesn’t like the addresses it has been asked to supply.

Perhaps your slave is configured to only send one register.

Please let me know how to steps/install basic UI and use sitemap

@rossko57

Does openhab support Modbus binding using Wi Fi instead of ethernet?