Commands for string-type items

Tags: #<Tag:0x00007fe73280c908> #<Tag:0x00007fe73280c728>

Hello, I’m pretty new to OpenHAB so it’s very possible this question is founded in misconception, but here’s the issue I’m running into: I have OpenHAB set up with a Hue bridge and I have all the lights and etc. available as items. What I am particularly interested in, though, is working with scenes as they are predefined on the Hue bridge. I have access to a String-type item for each group (or systemwide) that works for selecting scenes, and in HABPanel I can set up a “selection” widget that correctly lists all of the scenes available and lets you choose one, which it then activates.

What I’d really like, though, is a HABPanel widget that directly activates one of the scenes. It seems like this ought to be possible with the “Button” widget, which requires specifying a command. I’m having a hard time finding any good reference on commands in general. https://www.openhab.org/docs/concepts/items.html seems to say that a String-type item should accept commands of the “String” type, but I can’t find anywhere that says what the actual commands are for each command type (this goes for e.g. OnOff command type as well, although I can infer from examples that ON and OFF are accepted OnOff commands).

Looking at the JavaDocs for the StringType item, I’m not even sure that it implements sendCommand()… so, here’s my question: if StringType items accept commands, what’s the command syntax to set the string to a value? If they don’t, is there an alternate approach to this problem using e.g. a rule?

The example at https://daryl.one/development/home-automation.html almost seems to suggest that just sending a value as a command to a String item should work, but in my case it doesn’t seem to.

Thanks in advance!

Embarassingly, through messing around a little more I figured this out about one minute after I posted the question, although I think there are definitely still some gaps in my understanding.

The Hue bridge and binding uses IDs for scenes, alphanumeric strings that look like “bFviqNNXSprFptH”. It looks like these IDs are actually the values used by the String item for selecting scenes (you can get them with hue [bridge thing id] scenes in the console). Somehow the Selection widget is getting the “human-readable” names for these scenes (I’m not sure how), but if you want to directly set a scene via command you need to use the internal ID.

And commands for string-type items do indeed work the naive way, the command is the new value for the string. So in my case I added a button that sends the scene item a scene ID as a command, and that works to activate the scene.