How to implement trigger.entity_id ==

Hi all,

i have diferent automations for example when the washing machine or wasdryer are ready.
Now me and my wife both receive an notification. But i only want to sent a notification to the persons that are in the zone named Home.

Now i try to fix this in my automations

service: notify.mobile_app_phone1
data:
  conditions: '{{ trigger.entity_id == ''device_tracker.person1'' }}'
  message: Haal de was uit de wasmachine.
  title: Wasmachine klaar!
service: notify.mobile_app_phone2
data:
  conditions: '{{ trigger.entity_id == ''device_tracker.person2'' }}'
  message: Haal de was uit de wasmachine.
  title: Wasmachine klaar!

What can i use to implement in al my geo based automations that are sending notifcations

You can’t use conditions within the service call like you have. One option is to use a Choose action:

action:
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ trigger.entity_id == "device_tracker.person1" }}'
        sequence:
          - service: notify.mobile_app_phone1
            data:
              message: Haal de was uit de wasmachine.
              title: Wasmachine klaar!
      - conditions:
          - condition: template
            value_template: '{{ trigger.entity_id == "device_tracker.person2" }}'
        sequence:
          - service: notify.mobile_app_phone2
            data:
              message: Haal de was uit de wasmachine.
              title: Wasmachine klaar!

How does the about script see if someone is in the zone named Home?

Donny, there seems to be a mismatch between your post title, the configuration you included, and the goal of your automation… in the future please include the entire automation.

What are you using as the trigger for these automations? My answer assumed that you were triggering off the device trackers’ state (i.e. someone coming home) since your example using trigger variables was checking for specific device trackers… If you are triggering off completion of the wash/dry cycle then the triggering entity will never be a device tracker.

This is my full automation:

- id: '1643309393765'
  alias: 'Wasdroger: Klaar melding'
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.wasdroger_power
    below: '2'
    for:
      hours: 0
      minutes: 1
      seconds: 0
  condition: []
  action:
  - service: notify.mobile_app_person1
    data:
      title: Wasdroger klaar!
      message: Haal de was uit de wasdroger.
  - service: notify.mobile_app_pseron2
    data:
      message: Haal de was uit de wasdroger.
      title: Wasdroger klaar!
  mode: single

For that automation, one option is to use two Choose actions.

- id: '1643309393765'
  alias: 'Wasdroger: Klaar melding'
  description: ''
  trigger:
  - platform: numeric_state
    entity_id: sensor.wasdroger_power
    below: '2'
    for:
      hours: 0
      minutes: 1
      seconds: 0
  condition: []
  action:
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ is_state("device_tracker.person1", "home") }}'
        sequence:
          - service: notify.mobile_app_phone1
            data:
              message: Haal de was uit de wasmachine.
              title: Wasmachine klaar!
  - choose:
      - conditions:
          - condition: template
            value_template: '{{ is_state("device_tracker.person2", "home") }}'
        sequence:
          - service: notify.mobile_app_phone2
            data:
              message: Haal de was uit de wasmachine.
              title: Wasmachine klaar!
  mode: single

Another option is to use a single service call by templating the service and creating a notify group