Good catch about the AND for the NOT expression to work.
Final question, is it “trigger.from_state.state != …” or simply “trigger.from_state != …” to provide the previous zone of the trigger device_tracker?
FWIW, I don’t use zones much but I think you can condense that down by using a Zone trigger and using an in test in the template condition.
Your original And condition wasn’t actually doing anything, because conditions act as And by design.
For both Device and Zone triggers, trigger.from_state.state will return the previous state of the entity specified in the trigger. In both these cases if the state was a defined zone other than home, the state will be the name/friendly_name of the zone. So if the zone’s name is “Work”, trigger.from_state.state will return “Work” not “zone.work”.
trigger:
- platform: zone
entity_id: device_tracker.gpsmobiledevice
zone:
- zone.1
- zone.2
- zone.3
event: enter
condition:
- condition: numeric_state
entity_id: device_tracker.gpsmobiledevice
attribute: speed
above: 3
- condition: template
value_template: >-
{{ trigger.from_state.state not in ["home", "1", "2", "3"] }}
action:
I can’t get this work HA Home Assistant 2022.9.1. For trigger - zone, the list of zones does not seem to work. However I can create a list of entity_id, i.e.
One thing to keep in mind for all of these is that these will probably only work with active zones because they rely on the state of the trigger entity. Passive zones don’t give their name to the state of the device tracker, so there’s no way to check if the device was just in a passive zone.