Modbus-Binding write issue

  • Platform information:
    • Hardware: hyper-v / intel core-i5
    • OS: ubuntu 18
    • Java Runtime Environment: dunno, according to installation guide
    • openHAB version: 3.4.3
  • Issue of the topic: cannot sent modbus data cylic

Hi there,
quite new to OpenHab, but getting along :slight_smile: is a “weird way” to program for me (used to program PLCs). Got Openhab running, with influx, some bindings, quite happy with the state, but currently I cannot figure out a solution to my problem, I hope someone can help me.
in my home I have a WAGO-PLC as a main actor for lamps / heating / switches etc. this is connected via Modbus to openHAB and 2 other communication-parties. It took me a while to figure out how the poller works, but in the end I got it working, and I can receive data from the PLC.

The issue is with sending data, which works partially (weird enough).
I made a switch item, with a channel “value to switch” to the “modbus data” which writes the state bit to the register 32000.0 . as soon as I flick the switch in the OpenHab GUI, the value in the PLC changes instantly. everything perfect.
OpenHab receives temperature data from shelly temperature sensors. I made a temperature-item, with 2 channels. one channel is from the shelly-binding, and the temperature is received and displayed. the second channel is to the modbus data, which should write the “value as number” in the register 32032. which never happens. I cannot figure out why this data is not written to the PLC. I have no errors in any bindings or config, the poller reads up to 32064. I tried writing without the poller, but directly, to no avail.

i even checked the modbus “last successful write” and “last erroring write” which are both NULL . I interpreted this as OpenHab not even trying to write?

how can I write the temperature cyclic (or with every update from shelly input) to the modbus register?

Several things.

Only commands sent to an Item get forwarded to the linked Channels.

Is this Item being updated or commanded by the Shelly binding? Since it’s a sensor it almost certainly being sent as an update. See Rules | openHAB for a discussion on the difference between a command and an update.

All is not lost though. Profiles are a way to intercept a value being sent from a Channel to an Item (can vice versa) and do something to it on the way (e.g. transform it). One of the Profiles is the follow profile.

If one device should “follow” the actions of another device, this can be used. The term “follow” in this case means that any state that is sent to an Item will be forwarded from this Item to any linked Channel with the follow Profile. It takes state updates on an Item and sends them as a command onto the Channel. In the direction from the ThingHandler towards the Item, this Profile ignores state updates.

That that means is when the Shelly channel sends an update to the Item, that update is captured by the follow Profile, converted to a command (so it can be seen by the binding) on the follow Channel.

And even without that, a rule and two separate Items could be used to command the Item linked to the modbus Channel when the Item linked to the shelly Channel changes state.

Hi Rich,

thank you for you prompt reply!
It seems I still have only a partial understanding on how OpenHab handles stuff, it is counterintuitive for me as I am used to cyclic PLC stuff, so thank you for your time.

I tried all combinations of “follow” in the profiles (shelly standard, modbus follow, shelly follow, modbus follow, etc. ) there was no write attempt done…

how would I attempt the version with 2 items and a command?
this all seems quite difficult for a simple forward a value task to me… :frowning:

Kind regards


what about typing

java --version

in your shell and paste the response.

Hello Hans-Jörg,

it it helps :slight_smile: :

openjdk 11.0.18 2023-01-17

A “forward” task isn’t a typical one for OH, though the follow profile is made to do this. Usually it’s OH that is receiving the value and doing something with it, not just blindly sending it on it’s way to some other system.

What do you see in events.log for the Item?

Do you see any errors in openhab.log?

The proper way to config it is to have the modbus Channel follow the shelly Channel as it’s the modbus Channel that needs the command.

  • Create an Item and link it to the Shelly Channel, I’ll call it “ShellyTemp”
  • Create an Item and link it to the Modbus Channel, I’ll call it “ModbusTemp”
  • Create a rule
  • Add a trigger for when ShellyTemp changes
  • Add a Script Action (“Run Script”). If you are not great at programming choose Blockly.


Replace “MyItem” with “ModbusTemp”.

Or if you prefer JavaScript (this is GraalVM JavaScript):


of in Rules DSL


hi @rlkoshak,

i want to thank you for your time helping me. when I started using openHAB I was quite fond of the program, sadly it seems it is not the solution I needed, for the tasks i had in mind.
I tried solving my tasks with nodered and it was more intuitive for me and worked quite quickly.
Maybe it’s just me, but for a Tool which can talk to everything a forward task seems like one of the most crucial things, maybe in a future version this could be implemented?

Anyway, thank you for your time!