Add a stagger_time option to scene.turn_on

When the service call scene.turn_on is invoked in the basic case, either with a scene created in the UI or using scene.create with a list of entities, it is applied to all items at once. I would like the option to stagger the application to each entity. The entities would be activated in the order listed, the first immediately, the second after the specified stagger time, then the third after the same stagger time and so on. The stagger time should also apply at the end before the scene finished running.

If combined with transition (which it does not have to be), the stagger time is the delay period (in seconds or milliseconds) between the start of successive transitions. the stagger time may be lass than, equal to or greater than the transition time.

The default order would be as the entities are listed but it would be useful to have a reverse_order option so that I can use a list of entities from a blueprint in a scene.create but apply the scene in the reverse order (I generally use the forward order to turn them on and the reverse order to turn them off).

If this feature request is implemented, the YAML for activation might appear as follows:

    service: scene.turn_on
    target:
      entity_id: scene.romantic
    data:
      transition: 20           # optional, default 0  
      stagger_time: 5          # NEW optional, default 0
      order_reversal: false    # NEW optional, default false

It sounds like an interesting idea! :slight_smile:

I have to admit, I’m not working a lot with scenes, so I haven’t had a case where I’d have needed it, but I can think of some things, where it would make sense. :+1:

Looking forward to see, what others think! :slight_smile:

1 Like

It arose from a use-case where I want to slowly fade up lights along a path in a particular sequence when motion is detected at the start of the path, and fade them down again in reverse order when motion stops. Since there is currently no stagger time, I programmed it myself in the first draft.

That worked fine, but then I changed the requirement to not fade out when motion stops but to fade back to the original values, so that lights already turned on by hand are not affected by this automation. To store those values I use a dynamically-created scene snapshot (scene.create). However, in this scenario I can only fade them back all together.

See also the thread How to store a persistent global list/array/dictionary

I think the feature request will have a much wider range of application.

1 Like