Turn on lights in room where motion sensor is triggered

Hi, I’d like to turn on the light in the room in which motion is detected but I don’t want to write automations for each room.
Is it possible to extract the location / room from the triggered motion sensor and turn on the matching room?
I didnt find anything about it in the forums so I hope u can help me :smile:

Search for the word “motion” in the Blueprints Exchange section of the forum and you will get several solutions:

https://community.home-assistant.io/search?q=motion%20category%3A53

Thank you very much but I wanted to know if its possible to create “generic” automations and not having to create automations (even with blueprints) for every room seperately.

Extract it from where?

If you mean from the Area that you assigned to the motion detection entity, the answer is no. An entity’s Area is not currently accessible to an automation’s template.

If you mean the location/room is part of a custom attribute assigned to the entity or part of the entity’s name, then the answer is yes.