Modbus openHAB2 binding available for alpha testing

What do you mean by “data are unavailable”?

In case of configuration errors, the thing status should tell what is the problem. You can use Paper UI to find check that one out.

Alternatively, checkout the logs for ERROR messages.

in PAPER UI all things are online.


thanx martin

sitemap PAPER UI

in Classic UI it works too, in HABmin - there are 2 sitemaps : my house - it is from BASIC no data from modbus, in home - configured in PAPER UI - all data are relevant

I can’t see the thing status from the pictures. The things are in Paper UI, Configuration / Things.

The pictures you pasted are 1) basic UI (see the URL) 2) Paper UI

Thanx for your reply. I wrote , all things are green online. thank you for your job in this, martin. if you mention what I have to send, please tell me. May be it is any basic, elemntary thing , Which I do not know. Last items and things are corrected as your last document at github

second one screenshot of things

maybe it is all.
thanx

Very good, thank you for the screenshots!

I can see the data as well for temp1, temp2, etc. in one of the screenshots. For example, temp5 is 268.

Perhaps there is some format error with S1 etc. labels? Try to remove the labels from sitemap, that is, having the following default.sitemap:

sitemap default label="My house" {
  Frame label="Temperatures" {
    //Text item=datum
    Text item=vychodS
    Text item=zapadS
    Text item=S1 icon="temperature"
    Text item=S2 icon="temperature"
    Text item=S3 icon="temperature"
    Text item=S4 icon="temperature"
    Text item=S5 icon="temperature"
    Text item=S6 icon="temperature"
  }
}

this same result. another thing will be wrong.

at the end I tried to delete all entries in default.sitemap.the web page was untouched. It was in Firefox and IE, after deleting history.

thanx Martin

Right. I’m afraid I don’t know what is the issue…it does sound like something basic with the sitemap & items.

I recommend posting a new thread, to Items & Sitemaps section. Since you can see the data (the second picture you posted here), the problem should not be in the binding.

Best,
Sami

thanx, I will look at this thread
Martin

it is solved.
the problem was en-coding of notepad++. default was ANSI. and in my PC was UTF-8 BOM.
I have to convert encoding for .items file - now works
thanx Martin

1 Like

Hi Sami,

I can’t get the TCP slave or polling service to work with your binding. I have installed both the transport bundle and the binding. I have stopped the Modbus 1.12.0 binding.

I create a TCP slave thing, and insert my modbus gw IP:port, and this is my error message:

2018-03-31 07:27:48.322 [WARN ] [ore.thing.internal.ThingRegistryImpl] - Cannot create thing. No binding found that supports creating a thing of type 'modbus:tcp'.

This is an overview of the bundles from karaf:

openhab> bundle:list | grep -i modbus
234 | Resolved |  80 | 1.12.0.201803300110    | openHAB ModbusTCP Master Binding
257 | Active   |  80 | 2.3.0.201803230608     | openHAB MODBUS Transport Bundle
258 | Active   |  80 | 2.3.0.201803230608     | Modbus Binding

This is the status of my slave in Paper ui:

And this is my config of the slave thing:

Thanks for reporting this!

Could you please try to remove the old binding and restart the openhab?

Best
Sami

So I’ve uninstalled the old binding and restarted OH2, and here is the log:

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

2018-03-31 19:05:11.250 [INFO ] [core.karaf.internal.FeatureInstaller] - Uninstalled 'openhab-binding-modbus1'

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

2018-03-31 19:05:11.257 [thome.event.ExtensionEvent] - Extension 'binding-modbus1' has been uninstalled.

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

2018-03-31 19:05:16.342 [INFO ] [b.core.service.AbstractActiveService] - Modbus Polling Service has been shut down

2018-03-31 19:09:36.486 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Modbus manager activated

2018-03-31 19:09:36.782 [INFO ] [modbus.internal.ModbusHandlerFactory] - Setting manager: org.openhab.io.transport.modbus.internal.ModbusManagerImpl@182182f

2018-03-31 19:09:37.082 [hingStatusInfoChangedEvent] - 'modbus:tcp:7c70c957' changed from UNINITIALIZED to UNINITIALIZED (HANDLER_REGISTERING_ERROR): org.eclipse.smarthome.core.thing.internal.ThingImpl cannot be cast to org.eclipse.smarthome.core.thing.Bridge

2018-03-31 19:09:37.081 [ERROR] [ome.core.thing.internal.ThingManager] - Exception occurred while calling thing handler factory 'org.openhab.binding.modbus.internal.ModbusHandlerFactory@1d06784': org.eclipse.smarthome.core.thing.internal.ThingImpl cannot be cast to org.eclipse.smarthome.core.thing.Bridge

	at org.openhab.binding.modbus.internal.ModbusHandlerFactory.createHandler(ModbusHandlerFactory.java:66) ~[?:?]

2018-03-31 19:09:37.377 [hingStatusInfoChangedEvent] - 'modbus:poller:791bca5f' changed from UNINITIALIZED to UNINITIALIZED (BRIDGE_UNINITIALIZED)

I tried to update the thing in Paper UI:

2018-03-31 19:11:59.253 [ERROR] [st.core.internal.thing.ThingResource] - Exception during HTTP PUT request for update config at 'things/modbus:tcp:7c70c957/config'

java.lang.IllegalStateException: Thing with UID modbus:tcp:7c70c957 has no handler attached.
1 Like

Thanks!

Please remove the thing and recreate it, it seems to be messed up and you have to start “fresh”

Best
Sami

Hi Sami,

Thanks for your time and help.
After several rounds of deleteing and recreating of things, I now got my slaves up and running :slight_smile:
Seems like the old binding also caused some issues when installed and stopped. So uninstalling as suggested was a good idea.

The binding work great now, and I have to congratulate you with a great job on this binding. Thanks!

1 Like

Hi,

I’m starting a project for my smart home with openhab2. I want to avoid wireless systems and use a wired network. I choose the RS485 Modbus. I will connect some arduinos on the modbus with sensors and switches.

I’m trying now to start with a simple example just for testing purposes of swithing a LED on the arduino throught a modbus connection between the arduino and the Raspberry Pi with Openhab2.

I have this material:

  • Raspberry Pi with Openhab2 (raspbian);
  • USB-to-RS485 FT232 FTDI Adapter (to connect the Raspberry pi to Modbus); IMG
  • MAX485 RS-485-TTL Module (to connect arduino to Modbus); IMG

Connection:
[Raspberry Pi] ----- [USB-to-RS485 FTDI Adapter] =========== [MAX485 RS-485-TTL Module] ------- Arduino

I connected everything in accordance with this image:
https://techsparx.com/energy-system/modbus/img/HTB1vCDNGFXXXXbCXVXXq6xXFXXXI.jpg

Can anyone explain how to make the example of making a LED blink on the arduino side using a switch on the Openhab?

I tried some examples from the internet but without success. I also tried with several USB adapters (I have 3 different).

I think It will be very useful for others to have this example as a wired way of connect things on openhab2.

Hello everyone…

i´m trying to get some data from a EPEVER/Tracer, but i only get errors :disappointed_relieved:

To see if “something” is working i first tried with QModBus over a virtual Com-Port:



what is working fine so far.

After this i tried to do the same thing with openhab:

Bridge modbus:tcp:endpointTCP [ host="192.168.125.128", port=502, id=1, reconnectAfterMillis=10 ] {
    Bridge poller input [ start=12544, length=20, refresh=30000, type="input" ] {
        Thing data do2 [ readStart="12544" , readValueType="uint16"]
        Thing data do3 [ readStart="12545", readValueType="int16"]
        Thing data do4 [ readStart="12546", readValueType="uint16"]
        Thing data do5 [ readStart="12547", readValueType="int16"]
    }
}

And it looks like the Binding does not connect to my USR:

2018-04-08 17:30:53.930 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute try 1/1 error: I/O exception: SocketTimeoutException Read timed out. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@1db070f (unit id 1 & transaction 111). Address: /192.168.125.128:502

2018-04-08 17:30:53.932 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute reached max tries 1, throwing last error: I/O exception: SocketTimeoutException Read timed out. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@1db070f (unit id 1 & transaction 111). Address: /192.168.125.128:502

2018-04-08 17:30:53.936 [ERROR] [rt.modbus.internal.ModbusManagerImpl] - Last try 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@1a48b4[slaveId=1,functionCode=READ_INPUT_REGISTERS,start=12544,length=20,maxTries=3]). Aborting. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 3eaf4848-d90d-470a-987e-8d4a985e01ff]

2018-04-08 17:30:53.957 [ERROR] [odbus.handler.ModbusDataThingHandler] - Thing modbus:data:endpointTCP:input:do2 'Modbus data' had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: SocketTimeoutException Read timed out', cause=null)

2018-04-08 17:30:53.964 [ERROR] [odbus.handler.ModbusDataThingHandler] - Thing modbus:data:endpointTCP:input:do3 'Modbus data' had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: SocketTimeoutException Read timed out', cause=null)

2018-04-08 17:30:53.978 [ERROR] [odbus.handler.ModbusDataThingHandler] - Thing modbus:data:endpointTCP:input:do4 'Modbus data' had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: SocketTimeoutException Read timed out', cause=null)

2018-04-08 17:30:53.986 [ERROR] [odbus.handler.ModbusDataThingHandler] - Thing modbus:data:endpointTCP:input:do5 'Modbus data' had ModbusSlaveIOExceptionImpl error on read: ModbusSlaveIOException(cause=ModbusIOException, EOF=false, message='I/O exception: SocketTimeoutException Read timed out', cause=null)

2018-04-08 17:31:26.958 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute try 1/1 error: I/O exception: SocketTimeoutException Read timed out. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@159089a (unit id 1 & transaction 112). Address: /192.168.125.128:502

2018-04-08 17:31:26.965 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute reached max tries 1, throwing last error: I/O exception: SocketTimeoutException Read timed out. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@159089a (unit id 1 & transaction 112). Address: /192.168.125.128:502

2018-04-08 17:31:26.968 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 1 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@1a48b4[slaveId=1,functionCode=READ_INPUT_REGISTERS,start=12544,length=20,maxTries=3]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 6e6d441b-a093-4c52-b404-bbea609dfbab]

2018-04-08 17:31:30.039 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute try 1/1 error: I/O exception: SocketTimeoutException Read timed out. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@12f9359 (unit id 1 & transaction 113). Address: /192.168.125.128:502

2018-04-08 17:31:30.042 [ERROR] [wimpi.modbus.io.ModbusTCPTransaction] - execute reached max tries 1, throwing last error: I/O exception: SocketTimeoutException Read timed out. Request: net.wimpi.modbus.msg.ReadInputRegistersRequest@12f9359 (unit id 1 & transaction 113). Address: /192.168.125.128:502

2018-04-08 17:31:30.045 [WARN ] [rt.modbus.internal.ModbusManagerImpl] - Try 2 out of 3 failed when executing request (ModbusPollerThingHandlerImpl.ModbusPollerReadRequest@1a48b4[slaveId=1,functionCode=READ_INPUT_REGISTERS,start=12544,length=20,maxTries=3]). Will try again soon. Error was I/O error, so reseting the connection. Error details: net.wimpi.modbus.ModbusIOException I/O exception: SocketTimeoutException Read timed out [operation ID 6e6d441b-a093-4c52-b404-bbea609dfbab]

Can somebody see my error?!

Thank you very much - Greetings Tom

Ok, I found my error - i only had to switch the USR to “ModbusTCP” - that was all.

But this brings me to my next problem:
If i only use one poller i am able to get data every second.
If i use more than one poller i get my Timeout-Problems again - as far as i understand the EPEVER/Tracer i am not allowed to have more than one request at the same time.

After many tries i´m nearly giving up - how can i execute a pollar if the previous pollar is finished?

Hope anybody can help… Tom

Hi,

The binding makes sure only one connection is established at a time. So even if you have many pollers defined, they will wait each other.

That said, perhaps the interval between requests is too short for your serial device? In Modbus RTU, there should be enough silent period between the messages. To control this, check out the advanced parameters of your tcp thing.

Or perhaps there is some parameter in the “USR IOT” device that could help?

I think I have seen the USR IOT dashboard also before. By opening a new thread, you might be able to get help more easily – perhaps someone has had similar issues.

Best,
Sami

Hello @ssalonen, thank you for your answer.

I just found out, that changing/saving the configuration is messing the Tracer up.
If i restart the Tracer each time i made a change it is running quite well.
Can the binding head off that somehow?

Looking for the perfect timing now…