Generic trigger when device changes ANY zone?

Hello. Cany anyone please help me how to set trigger when device enters or leaves any defned zone? I have many zones, sometimes I change them and I do not want to explicitly list them in triggers.
How to set trigger when device leaves or enters any defined zone?
How to send name of zone in the notification?

Thanks very much, Jan

I assume you are talking about device trackers, as in mobile devices? If these trackers are listed under the person then you can simply trigger like this:

trigger:
  - platform: state
    entity_id: person.someone
condition:
  - condition: template
    value_template: '{{ trigger.from_state.state != trigger.to_state.state }}'

This will trigger each and every time the persons trackers enter and or leave a zone, note however this is also trigger when said person goes from a defined zone to an non defined zone (I.E. not_home), so not 100% sure this is exactly what you are looking for?

Thanks very much, it works. Can I also ask how to get value if state is entering or leaving? This does not work:

{{ trigger.from_state.state('device_tracker.someone') }}

I am not sure what you mean?

The above example I gave will trigger (and pass the condition) whenever the location changes from one to another, irrelevant of anything else.

If you want to know what zones were left and what zone was entered then you could use something like this:

- service: notify.telegram
  data_template:
    title: Location Update
    message: >-
       Location has changed from
       {{ trigger.from_state.state }} to 
       {{ trigger.to_state.state }}