Automation condition template - how to set up?

Hi there,

I’m trying to configure an automation for my Netatmo Welcome indoor camera. The trigger and action work: it sends me a notification with the name of the known face detected. However, now I want to only send a notification if the name is ‘John’. This is where I struggle as I cannot get the condition to work. It’s probably easy, but I just started with HA and am completely new to coding.

Many thanks for the help!

  alias: Test Netatmo welcome
  description: ''
  trigger:
  - event_data:
      type: person
    event_type: netatmo_event
    platform: event
  condition:
    data_template: >
    {% if trigger.event.data["data"]["name"] == john %}
      True
    {% else %}
      False
    {% endif %}
  action:
  - data_template: >
      message: {{ trigger.event.data["data"]["name"] }}
      title: Netatmo event
    service: notify.mobile_app_oneplus_a3003
condition:
  condition: template
  value_template: >
    {{ trigger.event.data["data"]["name"] == 'john' }}
1 Like

Thank you, that seems to have done it.

1 Like

Hi, I try this condition in an automation, the code returns the values of true or false in “tools for developers” → “models”, but if I do the verification, it gives me an error in the notifications.
This is the code:

- id: riconoscimento_facciale
  alias: riconoscimento_facciale
  trigger:
    - platform: event
      event_type: image_processing.detect_face
      event_data:
        entity_id: image_processing.volti_riconosciuti
  condition:
    condition: template
    value_template: '{{ ((states.image_processing.volti_riconosciuti.attributes.faces[0].confidence) | int) > 90  }}'
  action:
    - service: notify.giuliano_tel
      data:
        message: Ho riconosciuto la persona
        title: Riconoscimento facciale
  mode: single  

help please