I already use a light-by-light approach to see if a particular light is already on, but can I do this group/area/label-based? Only apply a scene to those lights which are already on?
If this is the service ‘Scene Apply’, may I have an example of what the yaml would look like… Thanks!
You can certainly select only the lights that are on in an area, group or with certain labels with a template. Scenes do not support templates though. So you would have to use a script instead.
I recently changed all my scenes to scripts. It simplified my automations considerably.
Here’s an example of a service call that turns off all lights that are on in three areas. If you’re dealing with labels instead of areas, use label_entities instead of area_entities.
Template for a Light Group. For a legacy Group (the kind defined in YAML exclusively) replace light.test_light_group with the entity_id of your legacy Group.
I’ve found that calling the service to labelled entities no longer ‘requires’ the selector in the first place.
for lights and switches , I didnt bother anymore since some time, but media_players tend to be unavailable here because of main power not being on, so I had that templated.
otherwise the volume setting, or playing a file on those would return an error.
using those services to labelled entities no longer requires that, so those selectors have become even simpler
Thanks. So using your example, it’s ’ | selectattr(‘state’, ‘eq’, ‘on’)’ that is determining whether the light is on or not. I’ll see if I can integrate that into what I’m trying to do.
I think you’re missing the point of my inquiry… I want to change the bulb color of only those lights that are presently on and labelled with a specific label. If I send the scene to all, all lights will be turned on.
Funny thing is… I actually had several ‘Scenes’ created, but didn’t realize, not one was active If they had more options, I would probably want to integrate them. Since I have a limited number of actual devices routinely used, not sure how it matters the number of service calls made.