Brand new and requesting help with an idea for Philips Hue lighting "scenes"

As far as I know… None! @Sticks18 has been working lately on new stuff. Right? I typically create scenes with third party apps and when ST triggers the lights, they will of course pick up that scene… Or I use the Philips dimmer remotes to activate a scene or the old taps. But nothing in the ST world that I have used. I like OnSwitch app on iOS which has several holiday related as well as other themes.

1 Like

Thank you, Bobby,

I saw that one and saw that it came close, but from what little I understand, I worried a bit about how it recycles scenes.

I guess one follow up question I have is this: is what I’m hoping to do super complex? I don’t want it to poll what states the bulbs are already in, or only have them stay on for 5 minutes, or anything like that. But since I don’t know anything about coding, I don’t know if I’m asking for something super simple or super complex. I had imagined it would look like this:

{fancy technical code stuff
name of scene: Afternoon Light

{device: Living Room-Fan
set switch: on
set color to: C58ABwhatever
set level to: 44
set saturation to: 15
set hue to: 22

{device: Living Room-Desk
set switch: off

{more fancy code stuff that tells SmartThings to do its stuff, that it did a good job, and that it gets a cookie

And then I could take that, copy and paste the bulb code for whatever other bulbs I wanted in that scene, change the values to which ones I want soft light and which ones bright white and which ones blue, and save it as “Afternoon Light”. And then copy and paste the whole thing to make different scenes just like that one, but using different lights and different settings.

I know it will take me a lot of time to do that, but I was hoping the building blocks might already exist somewhere and then I could do the legwork.

It’s not complex at all, I think no one cared enough about it. I actually spent some time this weekend decoding Hue API, because I wanted to get the scene values to try to replicate them in ST. This is definitely my next ST project :smile:

Tagging Bruce @bravenel to see if he would be interested in expending the new Trigr app to allow setting color, hue and saturation for individual bulbs…

1 Like

Thanks, Bobby!
And when you’re done, if you feel like sharing what you write, know that it will be appreciated! :smile:

1 Like

It’s already there. …

Technically I believe it’s the Hue API that recycles the scenes. It’s just the way Hue set it up because the bulbs can only hold so many scenes. @CyrilPeponnet just pulls them in from Hue.

This type of app is not too tough to build, but it’s hard to make it user friendly. That’s a lot to input for a user and most of the values won’t mean anything to a user. I haven’t done much with scenes because of this. That said, it has been tackled in various forms.

Here’s one based on triggering scenes from a button controller that could be adapted to use virtual momentary buttons instead:

There’s also this great scene app that grabs the current state of the selected devices and stores it as a scene that can be recalled. That way you can fine tune the colors/dim levels in the environment, then easily recreate it.

1 Like

Not quite there yet :slight_smile: What I was thinking is to allow inputs for individual values (color, hue, saturation) not predefined color schemes. But like @Sticks18 said:

Are you meaning the hex value for a color? That would be doable, but would it be useful?

Bobby, I think that’s ideally what I would like. Rather than hard-coding the values in (color, hue, saturation, and I’d include level), I’d prefer a field where I can tweak them later through the interface, rather than directly in the code. But… I assumed that would be more complex. And as a novice, I worry that the more complex a code, the more chance of it breaking and becoming unsupported when the author has moved on to a new system, etc.

And Scott,
that’s kind of my feelings on those you offered. They both look like they’d come very close to doing exactly what I want, and I’m so glad you shared them! They may be my best choice. But I still worry that if I choose a complex solution for a simple need, I’m running more of a risk of things breaking that I can’t fix.

It would most certainly be, to “some” of us, who’d like to replicate Hue scenes directly in ST. You already have the color capabilities, just need to allow users to pass through the “hueColor” and “saturation” variables…

We could really use the ability to access the Color Wheel from the SmartApp input screens. I’m actually not a fan of the color wheel because of fat-finger syndrome; but I can’t think of a better way to select a color.

Hi Sebastian, Bobby is talking about a field to input those values in the SmartApp. Creating input fields in SmartApps is actually very easy, and they can be dynamic, so you can use the same code input with different values for each bulb if you get a little creative.

I think I can put this in as an alternate “Bulb color?” selection, an HREF to a page that lets you set the hex color and saturation. I’ll poke at that…


That would be awesome…

Ahh, thanks Scott! And yeah, that sounds perfect. I spent a lot of time making scenes that do beautiful things, and being able to recreate them so they can be triggered in other ways will be wonderful!

Did you find a quick way to get the settings for the scenes you’ve created on Hue hub? The API route is possible, but is not clean…

The only way I would know to do it is to set a scene through the Hue app, wait for SmartThings to poll the status of my devices, and use the information it gives me. Then do it again for my second scene, third, and all the rest. Is that the API route?

API is easier, because you get a list of the 3 variables for each bulb at once. But I am looking for a better alternative, because both of them are pretty painful.

I added “Custom color” to the color selections. Then you input the hex for the color and a saturation value; level is already there also. Please check this out and let me know if it works right. It appears to work. @Sticks18?

Github for Rule:


I’m at work so can’t test, but I think the color value should just be 0-100 like saturation since you pass it into the hue field of the color map.

The hex color value that you get from the color wheel combines hue and saturation into one by using 6 digits like #RRGGBB where RR is a two digit hex representation of the red concentration (0-255), same with GG for green and BB for blue. That could give you hexToInt conversions well over 100.

For individual hue and sat values, the wheel passes a value from 0-100 that gets converted by the individual deviceTypes based on what range the device accepts. For instance, the Hue bulbs do a 0-100 to 0-255 conversion for hue and saturation, then passes those values through the Hue API.

1 Like

OK, I didn’t understand how this works. I will blow off the hex input, and just make the color a number.


1 Like