Yes. If a condition “fails,” the automation just stops dead. You should add a not condition for both device tracker a and device tracker b (assuming you want the automation only to fire if no one is in zona_alarme). If you want it to fire when both of you are in zona_alarme, and just one leaves, you would use a “not” condition with an “or” condition.
Edit: I don’t think the script does anything for you. Scripts are just the action portion of an automation. I typically use them if I want to use the same sequence with multiple automations, or want a button to fire the automation manually as I see fit.
i want the action to activate when the two are out for 30 seconds (zone.zona_alarme). if the time does not reach 30 seconds, the action is not activated.
this is automation:
alias: Alarme auto-on
description: ''
trigger:
- platform: zone
entity_id: device_tracker.iphone1
zone: zone.zona_alarme
event: leave
- platform: zone
entity_id: device_tracker.iphone2
zone: zone.zona_alarme
event: leave
condition:
- condition: state
entity_id: device_tracker.iphone1
state: not_home
- condition: state
entity_id: device_tracker.iphone2
state: not_home
action:
- service: switch.turn_on
target:
entity_id: switch.alarme_418
mode: single
can you paste what your complete example looks like for me to try it out, please?
Finally! That one was way harder than I expected.
I’m glad that it worked out. Some automations with much more complex logic than that are easier to figure out.