Created
June 25, 2024 16:01
-
-
Save jackphilippi/1357fc70cb28a039cb7432add1bc03fd to your computer and use it in GitHub Desktop.
HA Blueprint for geolocation trigger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Geolocation Trigger for HA | |
domain: automation | |
description: | |
This simple automation turns off specific defined lights when a given person has left home. | |
input: | |
person: | |
name: Person | |
description: | |
When the given Person has left the home zone, the given lights will turn off. | |
selector: | |
entity: | |
filter: | |
- domain: | |
- person | |
lights: | |
name: Lights | |
description: | |
The following lights will be turned off when the selected person leaves the zone. | |
default: [] | |
selector: | |
entity: | |
multiple: true | |
filter: | |
- domain: | |
- light | |
post_triggers: | |
name: Automations | |
description: The following Automations will start after the lights have turned off. | |
default: [] | |
selector: | |
entity: | |
multiple: true | |
filter: | |
- domain: | |
- automation | |
source_url: https://community.home-assistant.io/t/turn-off-lights-when-defined-people-are-not-at-home/600462 | |
variables: | |
lights: !input lights | |
trigger: | |
- platform: state | |
entity_id: !input person | |
to: not_home | |
action: | |
- service: group.set | |
data: | |
name: turn_off_when_person_not_home | |
entities: !input person | |
object_id: turn_off_when_person_not_home | |
- choose: | |
- conditions: | |
- condition: state | |
entity_id: group.turn_off_when_person_not_home | |
state: not_home | |
sequence: | |
- service: light.turn_off | |
target: | |
entity_id: | |
"{{ lights\n | | |
selectattr('state', 'eq', 'on') | map(attribute='entity_id') | list }}" | |
- service: automation.trigger | |
target: | |
entity_id: !input post_triggers | |
mode: single |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment