I have an automation to turn off the exterior lights at 10pm if me and my wife are home. Here’s a snippet from it:
automation 2:
alias: Exterior lights Off at 10pm
hide_entity: True
trigger:
platform: time
after: '22:00:00'
condition:
condition: state
entity_id: group.all_devices
state: home
I only want this to fire if both me and my wife are home. As you may have noticed, this will fire if even just one of us is home, because then the state of the group will be home.
Is there any way to either change the group to only have the state of “home” if all devices are home, or more cleanly write a condition for all devices being home?
Naturally I could simply do this with an “and” condition for both me and my wife, but then in a decade I would have to modify the automation when I have kids.
Ah yes, that could do it! Instead of the input boolean, I suspect that I could have the lights off command inside of an if statement that checks if the number of people = total number of people. In looking at that script, in this case I’ll probably just use an “and” condition and no script, but, it might come in handy for another automation!
@billmi yes, but depending on how many children I have that could get cumbersome.
Using an input boolean means you’ve only got one automation to update when the number goes to 3, or 4, or… That’ll be particularly useful as you write more automations that use presence.