[SOLVED] Openhab modbus not sending value


I have multiple modbus items in my openhab configuration. Reading works fine on all of them but when i send data it does not send it to IP gateway. Even on wireshark there is no modbus send data.


Number operating_mode_preselection "Operating mode preselection" {modbus="termostat1_holding:0"}

So if i write to this item with Rest API i get status 202 which means that data is accepted and item value actually changes but nothing happens on wireshark or modbus thermostat.

I can normally read/write data with Modbus Poll.

With best regards,

Are you sure that read and write is in the same holding register ?
what is the valuetype? docs
Did you enable verbose logging ?
Check this tutorial for writing data
MBlogic helped me a lot to understand my Modbus setup. Mb-Probe

1 Like

I’m using Modbus Poll instead of Mb-Probe but i’ll check it out.
Well the dat adoes not even leave openhab. Item changes but openhab does not send any data over ethernet.

And yes, it is in the same holding register.

Here is some code where everything was working just fine few months ago and now it’s not working ok.

// Soba 1
Number trenutna_temperatura "Trenutna temperatura [%.1f °C]" <temperature> {modbus="<[termostat1_input:0:transformation=JS(divide10.js)]"}
Number temp_act "Zeljena temperatura [%.1f °C]" <temperature> (soba1) {modbus=">[termostat1_holding:0:transformation=JS(multiply10.js)], >[termostat1_holding:0:trigger=UP, transformation=1], >[termostat1_holding:0:trigger=DOWN, transformation=-1], <[termostat1_holding:0:transformation=JS(divide10.js)]"}
Number heatcool "Gretje/Hlajenje" {modbus="termostat1_holding:1"}
Number hitrost_ventilatorja "Hitrost ventilatorja [%d]" <signal> {modbus="termostat1_holding:2"}
Number hitrost_ventilatorja "Hitrost ventilatorja [%d]" <signal> {modbus="termostat1_holding:2"}
Number trenutna_hitrost_ventilatorja "Trenutna hitrost [%d Hitrost]" <signal> {modbus="termostat1_input:1"}
Number termostat1_onoff "Vklop/Izklop" {modbus="termostat1_coil:0"}

Number termostat1_status_okna "Okno [%d]" <window> {modbus="termostat1_discrete:0"}
String termostat1_status_okna_p "Okno [%s]" <window>

Number termostat1_prisotnost "Prisotnost. [%d]" {modbus="termostat1_discrete:2"}
String termostat1_prisotnost_p "Prisotnost. [%s]"

I’m normally recieving data but i cannot send anything. When i send something using built-in REST API item value changes but nothing goes over the ethernet.

In Basic UI things are working fine but over API not… strange.


Number termostat1_onoff "Vklop/Izklop" {modbus="termostat1_coil:0"}

Why use a Number item when your item name has on/off included. Why not a switch?

1 Like

Whops, i missed that.

Thanks :slight_smile:

Did you make any progress?

No, it still does not write to items.

I still have this problem and i’m sure that my code is written in right way because it was working ok one one of my previous projects.

So again i have a thermostat connected over Modbus TCP/IP protocol connected to Moxa TCP/IP gateway.
I can easily read from specific modbus address but i cannot write into it.

Same cofiguration was working three months ago and now it’s not working. I even copied modbus config file from old project and alo items.


Number temp_set "Temperature Setpoint [%.1f]" (ALL) {modbus=">[termostat1_holding:0:transformation=JS(multiply10.js)], <[termostat1_holding:0:transformation=JS(divide10.js)]"}

I was also watching my network connection with wireshark and all i can sse are modbus read packets so openhab does not even send any write requests.

For modbus testing i’m using Modbus Poll application and i can successfuly read and write to that modbus address.

Connection to Moxa with Modbus Poll


I’m also attaching Moxa mGate settings for Moxa Modbus IP gateway


Ok now everything now works.

I was doing a mistake when using Openhab REST service.

I was doing PUT /items/{itemname}/state request instead of POST /items/{itemname} request.

Case closed :slight_smile: