Modbus binding: no events for changed holding registers


I have an OH2beta4-online with modbus binding 1.9.0 running on latest raspbian jessie.
Hardware is Raspberry Pi 3 Model B connected via USART to a custom AVR-based home controller.

Controller has some discrete inputs, coils and holding registers.

As for discretes and coils there are no problems, everything’s working like a charm.

But with holding registers I have an issue that items associated with registers do not change when registers are changed. They change only when I send commands to these registers via UI / script / rule but not when controller itself changes them.

I have traced logs and I see that modbus binding receives these updated values but does not generate any events (but does so for discrete and coil items):

18:56:51.090 [DEBUG] [] - Sent: 01 03 00 00 00 3d 84 1b
18:56:51.091 [TRACE] [] - Managed to read at least one byte
18:56:51.216 [DEBUG] [] - Response: 01 03 7a 00 01 00 04 …

18:56:56.509 [DEBUG] [] - Sent: 01 03 00 00 00 3d 84 1b
18:56:56.510 [TRACE] [] - Managed to read at least one byte
18:56:56.637 [DEBUG] [] - Response: 01 03 7a 00 02 00 04 …

Take a look at the response: 01 is slave address, 03 - “read holding registers” function, 7a - number of bytes to follow, and the next two bytes are the value of the first holding register. In the first response it is 00 01 and in the second it’s 00 02 which means there was a change but I cannot see this neither from UI (old value there), nor from events.log.

This issue takes place for all holding registers.

I have tried updateunchangeditems=true with no luck.

Here is my modbus.config:





Thanks in advance!


I assume there are no errors in the logs?

What kind of item configuration you have?


There appear to be missing “id” assignments in the config. It would default to 01, but is that you really want, when 02 is also defined apparently for your only slave hardware?

Yes, there are no errors in the logs.

Items are configured like this:

 Group SettingsOccupied "Occupied mode" (Settings)
        Number OccuLightsHall "Hall" 		(SettingsOccupied) {modbus="holding:1"}
        Number OccuLightsBathroom "Bathroom" 		(SettingsOccupied) {modbus="holding:2"}
        Number OccuFanBathroom "Fan" 	(SettingsOccupied) {modbus="holding:3"}
        Number OccuLightsKitchen "Kitchen" 		(SettingsOccupied) {modbus="holding:4"}
        Number OccuLightsCookZone "Kitchen LED" 	(SettingsOccupied) {modbus="holding:5"}
        Number OccuLightsBalcony "Balcony" 		(SettingsOccupied) {modbus="holding:6"}
        Number OccuLightsBigRoom "Big Room" 		(SettingsOccupied) {modbus="holding:9"}

ID 01 is fine and as I can see from trace it is assigned correctly.

ID 02 is used only where it should be 02.

Thanks for the response!

Really interesting case…

I have done some testing with openhab2 but nothing as thorough as with openhab1. Not sure though what could explain the different behavior you are seeing…

As far as I can tell the config looks good.

Can you reproduce this against a test server (diagslave)? You can use use pollmb tool to write the data to the register. Let’s see if the openhab picks it up then.

The wiki has the instructions in the very end how to use these tools.

In the meanwhile let’s see if someone else pitches in with their comments of openhab2+modbus


Thanks for your suggestion!

I could not compile diagslave for ARMHF due to the lack of some files in the sources so I’ve installed the latest openhab-offline on my Windows PC and decided to just run it with the same config I had on Raspbian. And it worked!

So I’ve just uninstalled 1.9.0.b4 modbus binding from my raspbian OH2 and dropped a 1.9.0-SNAPSHOT jar into addons directory and that has actually solved my problem.