This seems so simple to me that I think I may be thinking about it wrong. I have a ‘Christmas Time’ input boolean that we turn on when we get all the Christmas decorations out. I have a ‘lights out’ automation that turns some specific lights off at night. If the boolean is on, I want an entity included in the automation. Otherwise, I want it left out.
The below code will work when the boolean is on BUT not when it’s off. I get that. My question is how do I do what I want in THIS automation?
Use regular service calls for the entities you always want included and use a condition in the action section that checks that the boolean is on and calls the service for the Christmas entity below that.
The above suggestion is a good solution for this particular case. But to answer your question more directly, and for an example of what you might do in a more complex scenario, you can use something like the following, because the entity_id parameter will also accept a single string of entity_id’s separated by commas:
Cool. I’m using your solution instead. @pnbruckner, I couldn’t end up getting yours to work. For some reason, it’s not picking up the entities in the data template. I get an error saying that homeassistant/turn_off cannot be called without an entity_id. Not sure exactly what’s going on there. Ideas?
I’m guessing you didn’t enter it correctly. I’d be happy to point out what you might have done wrong, if you’re interested and you post exactly what you wrote. But, if not, that’s fine, too.