Data_template not working in notify service - Resolved

I am not sure what I am doing wrong here but no matter how I try I can no longer get my notify service (which sends an email to my gmail account) to work with data_template to send the entity ID of what motion sensor was tripped.

This all started when I moved all my automation’s to the automations.yaml file so I can utilize the GUI. I keep getting block mapping errors when I take out data and just use data_template or the expected dict for dictionary value error and the last one I get is invalid service data for extra keys not allowed.

Can someone provide an example of a working automation with the notify service which includes data_template? As an fyi all my other automations are working properly.


I hope is this you’re looking for ! It’s an action to have a random notifications

    - service: notify.pushbullet
        title: "Bidule"
        message: >
          {% if is_state('sensor.random_depart_pluie', '0') %}
            N'oubliez pas votre parapluie !
          {% elif is_state('sensor.random_depart_pluie', '1') %}
            Il faut prendre votre parapluie !
          {% endif %}

An other example without random messages:

    - service: notify.pushover
        message: 'Batterie faible : {{ states.sensor.low_batteries.state }}'
1 Like

Thank you thats what I needed. I realized I had formatting issues.