Unable to get notify example to work

I am trying to setup the example notify to notify me when a new version of HA is available.
I have tried with the automation portion in automations.yaml as well as in configuration.yaml.

Both cases the config check flags the data: line with the error: Error loading /config/configuration.yaml: mapping values are not allowed here
Config:

    notify:
      - name: email_notify
        platform: smtp
        sender: <Sender_email>
        recipient: <receiver_email>
        server: <smtp_server>
        username: <smtp_user>
        password: <smtp_pass>
        sender_name: Home Assistant

    automation:
      - alias: Update notifications
        trigger:
          - platform: state
            entity_id: updater.updater
        action:
          service: notify.email_notify
            data:
              title: 'New Release'
              message: 'Home Assistant version {{ states.updater.updater.status }} is now available!'

Thanks in advance for your help

At the very least you have data (and the items below it) indented too much. But you should also change data to data_template. And I think states.updater.updater.status is wrong. Try:

    notify:
      - name: email_notify
        platform: smtp
        sender: <Sender_email>
        recipient: <receiver_email>
        server: <smtp_server>
        username: <smtp_user>
        password: <smtp_pass>
        sender_name: Home Assistant

    automation:
      - alias: Update notifications
        trigger:
          - platform: state
            entity_id: updater.updater
        action:
          service: notify.email_notify
          data_template:
            title: 'New Release'
            message: "Home Assistant version {{ states('updater.updater') }} is now available!"

EDIT: Fixed indentation error (notify was only indented three spaces instead of four like automation.)

I am still getting the same error.
How many spaces should there be? In the actual config there is 2 spaces for each indent level which is consistent with the rest of the config file.

I am running 0.97.3 in a docker container. The config was in use in an older syste however I do not recall the previous version.

The exact indentation is not as critical as lining things up properly. The convention is to indent two spaces for each level. E.g., I just noticed in my suggestion I didn’t line up notify and automation. D’oh! :blush: I’ll edit it. If that doesn’t fix your problem then you’ll just have to examine your config file(s) more closely since we’re only dealing with a snippet here.

I can paste the full file once I am at a computer.
Commenting out data_template, title and message causes the file to pass validation.

Got it.
I had an extra space before title and message.
Thanks for your help!

1 Like