I have created widget (OpenHAB 3) and there is the button for mode selection. When I click on it, writing of value 0 to appropriate register should be done. Widget fragment:
After button clicking writing didn’t execute. But I have other button (other mode activation and writing other value - 1). There are no problems with writing number 1.
thing configuration of register:
Thing data Holding108 [ readStart=“108”, readValueType=“int16”, writeStart=“108”, writeValueType=“int16”, writeType=“holding”, updateUnchangedValuesEveryMillis=50000 ]
configuration of item:
Number test_mode_sel “Mode selection” [“Setpoint”] { channel=“modbus:data:localhostTCP:Holdings10:Holding108:number” }
Thus. I cannot only write value 0, with other values (1, 2, 3, 4) I have no problems with writing.
It seems to me the problem is with widget, because I can do it (write 0 value) via others OH visualisations (OpenHAB BasicUI).
So, you can forget the Modbus stuff altogether, and concentrate on what command gets sent to your Item from the UI.
You can see that in your events.log or developer sidebar.
What do you see? What is the pre-existing state of the Item?
I did’t see any useful information in events.log or developer sidebar. It seems to me OpenHAB system “does not see” button click when “actionCommand: 0”.
I suspect that the YAML parser is interpreting actionCommand: 0 as a false value (i.e., one to ignore). The command action is probably smart enough to properly convert types if you use actionCommand: "0" instead.