How to set HUE scenes from rules

I have an Openhab 3 setup with Hue lights integrated. The scenes I have defined in the Hue bridge are showing up in the GUI and can be selected.

However, what I want to achieve is to select particular scenes from rules. When I select a scene I can see from the log that the command send to the scene item is kind of cryptic value tI58t57iuYYmCUm

How can I achieve to set a scene defined in the Hue bridge via rule?

Hi,
I don‘t use Hue, but I try to help you anyway.
Reading the documentation says:

Scene String channel

This channel activates the scene with the given ID String. The ID String of each scene is assigned by the Hue bridge.

And this:


To load a hue scene inside a rule for example, the ID of the scene will be required. You can list all the scene IDs with the following console commands: hue <bridgeUID> scenes and hue <groupThingUID> scenes

So you need a String item linked to your Scene channel.
Create a rule and as command you send the scene ID (see command above how to get the ID) to your string item.
Now your Hue Bridge should activate the scene.

Best regards
Dirk

1 Like

Thanks. Yes, that works. However, I was more looking toward a way using the textual description of the scene.

What do you mean exactly with textual description of the scene?

On the GUI, I am able to select the scene by its name, like “Tropendämmerung” or however they are named. Obviously, the name of the scene is just a label which cannot be directly used but need to be mapped to the ID.

Yes, but you can easily map this to a scene name.
Just add to the scene string item via the Gui the meta data state description and map your state to a name at the options field.
E.g.:

tI58t57iuYYmCUm=Tropendämmerung
1 Like

Ok. If I add this to the meta data state description. How could I then access that mapping from a rule?

I don‘t think you can use the state description for a rule. The state description is afaik for visualization, not for use in rules.
But why is there a problem to use the ID in the rule?

Well, it is not a real problem. But it just feels like a hack. First I need to figure out what the ID and in the code I have an ID which cannot not directly related to the scene name. For example, if I have tI58t57iuYYmCUm in the rule without a comment it is not clear what the related scene is.

But never mind, it at least works. Thx for helping.

Ok, just checked it… it is working.
If you create a rule via the GUI and select the string item you will see a state suggestion at the lower end.
If you click this suggestion the correct value (which you mapped at the state description) will be used as the command.

1 Like

Ok. Thanks. I’ll give it a try. :+1:

@tomkxy
follow this thread where i get reamed out at the end. but, he gives the working command that lists all the scenes

1 Like