Automation: trigger.from to tag and area

Hi everybody,

I was wondering whether this is possible, and -if so- how. I would like to create an automation triggered by all motion sensors. Each one is assigned an area.

If motion is detected (and/or the area is clear again), I would like to switch the lights accordingly. But not always all lights assigned to an area need to be switched when motion is detected.

So I thought I could tag those lights “motionlights”; then, if motion is detected in the bathroom, switch only those lights in the bathroom that are tagged as “motionlights”.

Currently, I have an automation that triggers per room, then has a trigger id, then switches hard-coded lights. So if motion detected in kitchen, turn on kitchen1, kitchen3; but that requires me to change the automation, if lights are added, renamed, etc.

If it was possible to go by area and tag, I could simply tag new lights as “motionlights” and assign the appropriate area (which I always to when adding new devices, anyway), and they would automatically be included in this automation.

Thanks in advance for your ideas :slight_smile:

You might look at labels.

An automation can act on all the entities with the same label. Also, an entity can have more than one label, so you could have lights belonging to more than one group.

Sorry, that’s what I meant. Label everything relevant as “motionlight”, then add those entities to their appropriate areas.

Then trigger on all motion sensors in the relevant areas, then automatically turn on those lights. So if triggered in kitchen, turn on all entities labeled “motionlight” in area kitchen, if triggered in livingroom, same but with living room.

I could have one label “motion_kitchen”, another “motion bathroom” etc. and manually do this, but I thought a general automation would be simpler. Turn on “motionlight” in whatever area the trigger object is located in. Sorry, perhaps I am not explaining this very well… not a native speaker.