Scenes in 3.10.0

There’s a new Scenes feature in the 3.10.0 release.

The same sets of “Actions” that were previously only available to XAML pages can now be created outside of that context in a convenient folder.

These scenes can be triggered to run either manually or automatically.

1. Manual

You can create buttons or device tiles that execute scenes. Scenes are much like device objects, they can be assigned both a TileTemplate & a DetailsTemplate. In terms of control, they are all automatically given the Scene capability. Writing to the Scene attribute will execute the scene. In ScenesExample.hrp, this is demonstrated by clicking the “Scene #1” tile.

2. Automatic

Perhaps the biggest complaint received from the version 3 transition to device objects from variables was the lack of ability to run custom actions on device changes. Well that’s no longer the case. Devices can trigger these scenes too to run automatically.

Each Scene has a Triggers property. Each Trigger within that collection is a Binding to either a device or system attribute. These will be configured very similar to the way a MultiDataTrigger is configured on a XAML page. The only difference is that scenes include an additional option those don’t have: TriggersOperator.

TriggersOperator.All
This means all conditions must be satisfied to trigger the scene. In other words, a logical AND.

TriggersOperator.Any
This means any condition can trigger the scene. In other words, a logical OR.

In ScenesExample.hrp, this is demonstrated by turning on the “VirtualSwitch” device tile. The Scene in that project has a Trigger that will execute the scene when VirtualSwitch.Switch equals On.

ScenesExample.hrp (96.7 KB)

2 Likes

I really like the concept of scenes. I’m only missing two functionalities for my use case. I’m creating a home remote project (partly) around “activities”. So e.g. an activity called “Watch movie”. That would mean power on receiver, power on TV, switch to HDMI input etc. This can all be done nicely with Actions in a scene.

In order for everything to work correctly, however, I need to know the the state (on / off) of the activity / scene. So a switch capability for scenes would be nice.

As a workaround for now, I can use a virtual device to keep track of the state. Although I’d need a new virtual device for each scene.

The second issue is with the Action itself, so I’m not talking about the Conditions property for the scene. I’m a missing a condition property for an individual action. Something like the condition property under miscellaneous with a DataAction for an EventTrigger.

For scene state, I’m guessing you would like me to simply forward the state of the Conditions? So if the Conditions evaluate to True, set status to On. When they evaluate to False, set it to Off.

Yeah, I’m still considering adding conditions to the individual actions as well. Would you be able to provide an example use-case?

That is correct for when a scene is triggered automatically. But as you wrote above, a scene can also be triggered manually. In that case I would like to be able to set the state of the scene to On. I would like to be able to set the state of the scene to Off too. In all cases I want to be able to read the status of the scene in other parts of the project.

As for a use case for conditions of individual actions: that is especially useful when devices are used that don’t have discrete power on/off commands. So e.g. for my “Watch Movie” activity I could check if the TV is Off before sending a PowerToggle command.

For a Manual scene, how would we determine that the scene is On? I’m just wondering how exactly you envision this should work. Obviously we would set the status to On whenever it is triggered but when do we turn it Off?

OK. Good point.

As I see it, when I click on the Tile for the scene it would set the status for the scene to On and select the Details page for that specific scene. On the Details page I would have a button to end the scene and thus set the status to Off, power off the used devices and go back to the device browser page.

There could be another way to set the status to Off but I guess that will be a lot more difficult to implement. Whenever another scene is selected, the status of the scene that is On will be set to Off and user defined actions for the Off state of the old scene will be performed. And now the difficult part, that should only happen for scenes in the same group. Normally I would group my devices based on the devices in a specific room. So per group / room there can only be one specific scene active, There can be more then one scene active, but not in the same group / room.

Maybe we can put this idea about a status property on hold an you could prioritize the conditions for the individual actions. :slight_smile: With that functionality and the use of virtual devices I would be able to track the status of a scene. I could send you a project with that functionality implemented and you could review if a status property for a scene would be a better idea.

3.10.2 was published earlier today & it has support for Conditions on individual Actions. I also decided to rename Conditions on the actual Scene to Triggers.

Hi Bill
Is it possible for you post an example of the use of scenes, please?
Thanks

There’s an example in the top post.

Sorry my questions but I think of scenes like in Harmony Hub. When we turn the scene on, we need to turn it off for it to be off. Using THR, I trigger the scene, closed the app and open it again, and the scene starts always as “off”

You’re saying the scene is firing when it’s not supposed to? Look at your triggers. You’ve probably got a trigger condition that is still active.

Scenes are not like Harmony Activities. Multiple scenes can be triggered at any time.

Actually I did not understand the concept of scenes, sorry

I don’t know if it’s just me. Scene#1 is not turning the switch on in the SceneExample.hrp
Thanks in advance.

It’s not supposed to. That’s not what the example was trying to demonstrate. The only action in the scene is the “Hello World!” toast message. No device commands are sent.

The example was trying to show that this scene can be triggered manually by clicking the “Scene #1” button or automatically when the switch turns on. It’s the opposite of what you are suggesting. When you click the switch, it triggers the scene, not vice versa.

You can certainly create a scene that turns a switch on. I just wanted to show how scenes can be executed either manually or automatically.

Now I understand how it works. whoo~
Learning day by day

Thank you.

I believe I read in one of the posts (and I think I’m seeing it as I’m working on my old project) that a lot of the action functionality of variables is being depreciated in favor of scenes. That’s the kick I needed in order to start moving actions off variables, preferably this time avoiding scripts.

The thing I can’t figure out how to do within a scene, without a script, is set a device to another variable. I noticed in my password pin code variables (from one of Bill’s older templates) that previously you could use $HomeRemote.DEVICE.ATTRIBUTE.Value. I thought that would be my answer, but it doesn’t seem to work within scenes.

Is there any way to reference another device/variable’s value as the value to be set from within a scene?

I guess not without a ScriptAction. Bill wrote here: (Hubitat) How to send custom device commands (outside normal Capabilities) that there is no reference support for the DataAction value and I think this is also true within scenes.

1 Like

What I probably should do is make the Value property on the DataAction bindable. That will allow you to forward the value from 1 device into another. I can try & add that to the next release.

1 Like

Yes, beginning in version 3.17.0.0 you can reference another device’s value in a Scene’s DataAction.