ScottS
September 10, 2019, 11:00pm
1
I have the below Automation setup. It works, but I notice it executes twice (I receive two notifications of Everyone Away). I want the Actions executed when both devices Leave the Home Zone. Since Triggers are ‘OR’ I read to add both devices to the conditions. Is there a way to write this so the Actions are only executed once?
- id: '1567925877618'
alias: Everyone Away
trigger:
- entity_id: device_tracker.life360_s
event: leave
platform: zone
zone: zone.home
- entity_id: device_tracker.life360_j
event: leave
platform: zone
zone: zone.home
condition:
- condition: state
entity_id: device_tracker.life360_s
state: not_home
- condition: state
entity_id: device_tracker.life360_j
state: not_home
action:
- alias: ''
data:
message: Everyone Away
service: notify.notify
Tinkerer
(aka DubhAd on GitHub)
September 11, 2019, 6:25am
2
I’d create a group with both device trackers in it. That group then has the state of home
if either are home, and not_home
if none are home.
group:
my_people:
name: My people
entities:
- device_tracker.life360_s
- device_tracker.life360_j
automation:
alias: Everyone Away
trigger:
- platform: state
entity_id: group.my_people
to: 'not_home'
action:
- service: notify.notify
data:
message: Everyone Away
1 Like
ScottS
September 11, 2019, 2:34pm
3
Thank you. To confirm, I create this in groups.yaml. The Automations GUI is very limited, in this regard.
To look like this:
Tinkerer
(aka DubhAd on GitHub)
September 11, 2019, 4:09pm
4
Please, please , post code as code, not images.
That said, yes, that’s what goes in there, and yes, the automation editor is limited.
ScottS
September 11, 2019, 4:21pm
5
Thank you. Will do about the code. I wanted to picture it as I have it in that file.