Oh-button component updating an Item without a Command

Another request for help…
In a custom widget, I’m using an oh-button component.
I can send a command when pressing the button ( action:command) and crate or update a variable (action:variable), but how would I update an Item state without sending a command?

Thanks so much!

You can’t. All interactions with an Item through the UI is a command. The UI is a way to control your home automation. To control things in OH requires commands.

Why do you want to send an update from the UI? Most likely there is another way to get the same result.

I was thinking of Commands as relating to Things (via Items).

How about Items that aren’t linked to a Thing? Like Items, I use in a Rule as a threshold (but I still want the user to be able to set through the UI).

I understand, it’s not ‘harmful’ to send a Command to these Items, it’s just semantically a little annoying not to be able to do that.

The other thing, is that I would like to use a tri-state Switch Item ON/OFF/UNDEF which the state is able to accommodate, but the Command (for good reasons) not.

Consider these two cases:

  1. Your Item that represents a threshold in a rule.
  2. A setpoint on a thermostat.

1 is an Item not linked to anything but 2 is an Item linked to a Channel on a Thing. But in both cases they represent the same thing, a threshold above or below which something is supposed to happen.

In order to change 2 one must send a command for the change to go out to the device. One could use an update for 1 but why make this behave differently? From the UI’s perspective, the fact that 1 isn’t linked to anything and 2 is is invisible and irrelevant. Both are a threshold that can be set, they should be interacted with the same way.

Put another way, the fact that an Item is linked or not to a Channel does not and should not change how one interacts with that Item. A Switch is a Switch whether it has a link or not.

You cannot use a Switch like this. If you have a tri-state you need to use a String or Number. UNDEF is a special type of state and it is not intended to be used in this way. That’s why you cannot send it as a command. Similarly NULL is also a special type of state and cannot be sent as a command.

Even is updates were supported from the UI, you wouldn’t want to use UNDEF/NULL like this.