Skip to content

Instantly share code, notes, and snippets.

@dbeltman
Last active January 4, 2021 23:32
Show Gist options
  • Save dbeltman/b90156effaaa0ea963642334934e541e to your computer and use it in GitHub Desktop.
Save dbeltman/b90156effaaa0ea963642334934e541e to your computer and use it in GitHub Desktop.
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: []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment