Note, I don’t have use zones so I can’t test this, but try it out and see how it works. You might have to change trigger.zone
to trigger.zone.attributes.friendly_name
or trigger.zone.attributes.name
.
Also, you will have to find/replace the names of each device_tracker name and zone name.
- alias: Notify When Someone Enters Zone
trigger:
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone1
event: enter
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone2
event: enter
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone3
event: enter
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone4
event: enter
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone5
event: enter
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone6
event: enter
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone7
event: enter
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone8
event: enter
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone9
event: enter
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone10
event: enter
action:
service: notify.notify
data_template:
message: >
{{ trigger.entity_id.attributes.friendly_name }} Entered {{ trigger.zone }}
- alias: Notify When Someone Leaves Zone
trigger:
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone1
event: leave
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone2
event: leave
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone3
event: leave
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone4
event: leave
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone5
event: leave
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone6
event: leave
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone7
event: leave
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone8
event: leave
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone9
event: leave
- platform: zone
entity_id: device_tracker.mqtt_occupant1, device_tracker.mqtt_occupant2, device_tracker.mqtt_occupant3, device_tracker.mqtt_occupant4
zone: zone.zone10
event: leave
action:
service: notify.notify
data_template:
message: >
{{ trigger.entity_id.attributes.friendly_name }} Left {{ trigger.zone }}