In Hubitat I have used both the “set colour” command at the zone level and the colour wheel accessed from the zone button on the dashboard to set the colour.
I have also set the colour for the zone by calling a scene setup in the hue app and bought in via Cocohue and also by using the hue app colour wheel.
The most reliable for reporting in Hubitat is going to be setting things from Hubitat via "Set Color" (or "Set Color Temperature " or similar color commands) on the specific device you are trying to capture. By this, I mean not a room or zone the device is in unless the device you're capturing is that room or zone (there is nothing wrong with that).
If you make changes from outside Hubitat, you'll need either the experimental v2/eventstream API option enabled or to wait for the next poll to happen (the default interval is 1 minute). Alternatively, you can run a "Refresh" command on the Bridge device (not the actual light) and avoid the wait.
As long as your bulbs report hue/saturation or CT, that should work. I've seen Hue not repot this in a few cases, scene recall being one (one reason I recommended setting things directly from Hubitat). Debug logs from the device in question will show the actual data it's working with from a poll/refresh or eventstream data and would be the most helpful thing for figuring out more if none of the above helps.
Thanks Bert, so I modified my test rig and ran a number of different scenarios, your suggestion/advise is the only one which seems to work.
So I have concluded that the initial scene has to be created by each individual light being set to the required colour using the set colour command in Hubitat, it then works.
The colour it changes to can be set at the zone level and the capture and restore can also be done at a zone level the important thing is how the scene being captured and restored are initially set. Working with Rooms or Zones does not seem to work.
I also could not get refreshing the bridge to work the colour restores back to a shade of white.
The reason I was trying to do things at a zone level was to make it easier if I wanted to add devices (just add into the zone via Hue). The reason I wanted Hue scenes was to make it easier to allow my wife to modify those scenes in the future (without me coding) and the ultimate flexibility was to be able to set a unique scene in the hue app for a special event.
I now need to think through and potentially modify my approach. Do you know if the apps such as 'Room Lighting' set scenes at a zone or individual device level, as I believe they allow current scenes to be grabbed (I assume to be then setup in the app) that could potentially provide a midpoint?
Room Lighting will just use whatever devices you've selected, which could be the room or zone or individual devices. "Scenes" RL can capture are not Hue scenes you'll see in the Hue app (if that's what you're wondering), just similar Hubitat capture mechanisms you'll see like in Rule Machine or Groups and Scenes. I think the important thing for your use case is to avoid getting the bulbs stuck in "xy" mode, which Hubitat doesn't deal with natively and the ways above are the best ways to avoid.
You can still use scenes and zones, it would just be coding things different and being intentional. You might need to use required expressions to help with the programming of the rules. For instance, say you are like me and use tropical twilight scene as your default summer lighting. Use a required expression of June 1 to August 31. Then have your rule just push buttons. Have the trigger be motion with your if illuminance still active. Then when the rule activates, push button 1 on daylight scene for the zone. Have a wait for no motion and stays for three minutes, then push button 1 for the tropical twilight scene on the zone.
Basically, just create this rule as many times as you need using required expressions to help. To help with one off occasions, you could add a virtual switch to the required expression. Allow it run normally only when that switch is off. If you turn on the virtual switch, it runs a different motion sensor rule. This new rule has a required expression of the virtual switch being on. Create a special occasion scene in hue that only runs when the virtual switch is active. This would allow you to modify the scene from the Hue app and not change the programming.
I haven't read through every post of this thread, but I wanted to share one mindset thing that I keep coming back to with Hubitat: Create rules that set the desired state, regardless of the current state. That is, don't capture and restore -- make motion time-out re-trigger the automation that sets the scene in the first place.
After all, if what it selected would have changed while the motion event was active, you still want that change to happen.
Say -- for illustration, not because you'd actually do this -- you have a rule or RM instance that sets your lights to pink between sunrise and sunset, but blue between sunset and sunrise. When there's motion, you want to make everything white.
You could make a single rule that says:
If motion, white
Else if after sunset, blue
Else pink
Then trigger on:
Sunrise
Sunset
Motion active
Motion inactive for X minutes
There's a lot of power in a rule that just sets the desired state and doesn't attempt to preserve old states, provided you're not usually setting the state manually.
Thanks for the input I recognise that scenario as that was where I ended up on my previous automation system.
For each room a virtual switch forced a hard coded scene and I used to set that virtual switch on every change of mode, after warnings and also a regular poll to fix some issues where all the lights didn’t’ consistently come on giving some persistence. It worked well but was a little inflexible if my wife fancied some different lighting. I think I can simplify that approach in Hubitat from what I have seen and the capture current scene in some apps could help to simplify.
So your idea is very aligned to my thinking but I will also probably treat different rooms / zones differently. I have four zones where I need to reload the previous scene., I also want to see if I need to code persistence once everything is up and running. I may also include a mode / scene / zone where my wife can play I just need to see what the possibilities are and think it through.