I’m trying to use a template to list all the “on” devices within an area as devices under device_id for an automation action. What is the proper syntax to do this?
FWIW, it is usually better to reserve use of Areas for actual areas like rooms or small groups of rooms. A Label would be more appropriate for a sub-grouping like “living_room_lights”. There is an analogous function label_entities() which you would use instead of area_entities().
I tried without the loop as well and it didn’t like it. The automation doesn’t really tell you why it doesn’t work so I’m just guessing. What does proper syntax look like in this case?
Apparently the automation didn’t like that despite getting the exact same result as yours when put in the template editor.
Also, the debug trace was where I was getting the error. All it was telling me was: Error: Template rendered invalid entity IDs: - light.living_room_light_1_light - light.living_room_light_2_light_2 - light.living_room_light_3_light_3
I’m going to leave this open for right now, but thanks for the help. I think it’s doing what I want.