I’ve been working on developing a template to handle turning off groups of lights and switches when no motion has been detected for a certain amount of time. I’ve discovered that when using data_template and entity_id, you can only specify one entity.
My current code results in ERROR (MainThread) [homeassistant.components.homeassistant] homeassistant/turn_off cannot be called without entity_id when more than one entity is specified in the If/Elif logic
Searching the forums, I found the following two threads attempting something similar but finding no solution:
One thread seemed to solve the issue in two ways (the first being similar to my current code above), but these methods seem to no longer work and result in homeassistant/turn_off cannot be called without entity_id:
Is this a bug or no longer feasible? All code checks out in the Jinja editor in Home Assistant, just not when triggering an automation.
Most services, though, that take an entity_id parameter allow a comma separated list of entity_id 's.
Notice how I said “most services”, and that my example used the light.turn_off service. Unfortunately the homeassistant.turn_off service is not one of the services that accepts a comma separated list of entity_id’s.
EDIT: Is there a reason you don’t want to use the light.turn_off service instead which would work in your first automation?
EDIT2: Or maybe you could try creating a group of groups. E.g., if you created group.lr_kit_dr_lights that contained group.living_room_lights, group.kitchen_lights, group.dining_room_lights, then you could do:
You are correct, a group of groups would solve this as it creates one entity. The reason I was avoiding light.turn_off is because the groups contain a combination of lights (dimmable and color changeable) and switches (on/off only) and light.turn_off or switch.turn_off only turn off that domain.