Notification Run-time Warning

I am new to HA and I am trying to test smtp notifications by generating an email when I turn a lamp off. As I was trying to debug this error I eventually placed the following code in the configuration.yaml file.

notify:
name: NOTIFIER_NAME

automation:
action:
service: notify.NOTIFIER_NAME

The above passes the CHECK CONFIG validation test in HASSIO

After turning the light off and on in the HA GUI, no smtp notification is sent. When checking the log - I see the following warning:

Unable to find service notify/notifier_name

Any ideas as to what the problem is? The warning seems to be replacing my “.” with a “/”

Jay

I assume you have actually created the notification service?

Something similar to this for gmail:

notify:  
  - name: gmail_notify
    platform: smtp
    server: smtp.gmail.com
    port: 587
    timeout: 15
    sender:[email protected]
    encryption: starttls
    username: [email protected]
    password: !secret finity_password
    recipient: [email protected]
    sender_name: My Home Assistant

After finding a mistake in the gmail password, I reloaded and triggered the automation again. The new error message is:

Invalid service data for notify.notifier_name: required key not provided @ data[‘message’]. Got None

Here is the actual text (with the emails and password changes - of course) from the configuration:

notify:
name: NOTIFIER_NAME
platform: smtp
server: smtp.gmail.com
port: 587
timeout: 15
sender: [email protected]
encryption: starttls
username: [email protected]
password: mypassword
recipient: [email protected]
sender_name: My Home Assistant

automation:
trigger:
platform: state
entity_id: light.living_room_floor_lamp
from: ‘on’
to: ‘off’
action:
service: notify.NOTIFIER_NAME

Does the password have to be in a separate file, wrapped in quotes or can it simply be in-line?

Thanks,

Jay

BTW - I don’t know why my spaces (indents) are not showing in the blocks above but they are in my config.

Jay

The error is telling you what the problem is…

It says that it can’t find the “message” key. A notify service has to have a message to send. At least the SMTP does. You’re calling the service but not telling it what to send.

As for the indents you need to select all the code then click the </> button at the top of the window.

Thank you! I have added the following to the action and the notification now works as planned. This now provides me with a template to move forward.

data:
    title: 'Lighting Alert'
    message: 'Light Off'

Jay