This blueprint can turn off multiple automations when a person’s state is “not_home”, it will also turn these automations back on when the state is “home”.
You can also invert the entire thing
blueprint:
name: Presence Automations
description: >
Disable automation(s) when someone arrives. Re-enable them when they leave.
domain: automation
input:
person:
name: Person
description: Select the person to be home.
selector:
entity:
domain: person
automation:
name: Automation
description: Select the automation(s) that need to be turned off.
selector:
target:
entity:
domain: automation
inverted:
name: Invert Blueprint
description: 'This will cause the selected automations to enable when the person comes home, instead of disabling them as per default.
This will in turn disable the automation when the person leaves.'
default: false
selector:
boolean: {}
trigger:
- platform: state
entity_id: !input 'person'
condition: []
variables:
inverted: !input 'inverted'
action:
- choose:
- conditions:
- condition: state
entity_id: !input 'person'
state: home
sequence:
- choose:
- conditions: '{{ inverted }}'
sequence:
- service: automation.turn_on
data: {}
target: !input 'automation'
default:
- service: automation.turn_off
data: {}
target: !input 'automation'
- conditions:
- condition: state
entity_id: !input 'person'
state: not_home
sequence:
- choose:
- conditions: '{{ inverted }}'
sequence:
- service: automation.turn_off
data: {}
target: !input 'automation'
default:
- service: automation.turn_on
data: {}
target: !input 'automation'
default: []
The idea is what I’m looking for, but it’s not very useful unless you can select multiple people or groups of people. Most automations need to keep running when only I leave the house and others remain…
I’ve had this wish as well, but we’re currently limited by the entity selector not being usable in a trigger ( yet?). The Workaround for this has been covered in other blueprints, what they do is give you a fixed size list of people to populate, and then do lights/switches based on (collective) presence.
I dont like this fixed approach so i stuck with other methods and this single-person blueprint. Lets hope homeassistant can soon trigger on entity selector targets!
This blueprint only switches on/off specific automation entities. So for example if you had an automation that does " turn on light when motion detected in hallway", you could turn that automation logic on/off based on presence with this blueprint.
But a problem with blueprints and multiple people is that i cant easily give (dynamically sized) list to the blueprint to trigger with. So selecting multiple specific people is a no-no for now unless you want to put up with an ugly blueprint with a fixed size list which never works for everyone.
However for your usecase (turn on lights if EITHER gets home and turn off when BOTH away), i would suggest creating a Group (of person entities) to turn on/off your lights. This group will be in ON state if any of the people are at home, and will be in OFF state when both are away.
It should then be a matter of a simple automation, or perhaps a modified version of my blueprint. Let me know if you would like that and ill see if i can find the time.
yes, i read again and my mind finally read automation, but then i read that multiple people are not very well supported in HA to begin with (Ha must have been written by a single )
So i think i will wait for that to be supported and then just use the app to turn on the lights when i’m about to get home. and turn them off when i leave