Last active
February 21, 2022 00:34
-
-
Save joshp23/770bb214b5c905c467ec2172340c7067 to your computer and use it in GitHub Desktop.
Homeassistant: Zone Notification enter and leave via XMPP
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: Zone Notification - xmpp | |
description: Send a notification via xmpp_jp when a person leaves or arrives at a specific zone. | |
domain: automation | |
source_url: https://gist.github.com/joshp23/770bb214b5c905c467ec2172340c7067 | |
input: | |
person_entity: | |
name: Person | |
selector: | |
entity: | |
domain: person | |
zone_entity: | |
name: Zone | |
selector: | |
entity: | |
domain: zone | |
trigger: | |
platform: state | |
entity_id: !input person_entity | |
variables: | |
zone_entity: !input zone_entity | |
zone_state: "{{ states[zone_entity].name }}" | |
person_entity: !input person_entity | |
person_name: "{{ states[person_entity].name }}" | |
condition: | |
condition: template | |
value_template: "{{ zone_entity == 'zone.home' and trigger.to_state.state == 'home' and trigger.from_state.state != 'home' or zone_entity == 'zone.home' and trigger.from_state.state == 'home' and trigger.to_state.state != 'home' or trigger.to_state.state == zone_state and trigger.from_state.state != zone_state or trigger.from_state.state == zone_state and trigger.to_state.state != zone_state}}" | |
action: | |
## Change this to your configured XMPP service -> https://www.home-assistant.io/integrations/xmpp/ | |
- service: notify.xmpp_XXX | |
data: | |
message: | | |
{% if trigger.event == 'enter' %} | |
'{{ states[trigger.entity_id].name}} has arrived at {{ trigger.zone.attributes.friendly_name }}' | |
{% else %} | |
'{{ states[trigger.entity_id].name}} has left {{ trigger.zone.attributes.friendly_name }}' | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This will send an XMPP notification when an identified person enters or leaves a particular zone
Notes: