SMTP notify failed to call service notify/notifier_name(solved)

I had email notification via SMTP configured and working in HA v73. I am now trying to do the same in HA v87 but as soon as I call the service Developer Tools-Services I am receiving the following message

failed to call service notify/notifier_name

This is a copy of the relevant section of the configuration.yaml relating to notify:

notify:

  • name: NOTIFIER_NAME
    platform: smtp
    server: smtp.gmail.com
    port: 587
    timeout: 15
    sender: !secret gmail_user
    encryption: starttls
    username: !secret gmail_user
    password: !secret gmail_password
    recipient:
    • !secret gmail_user
      sender_name: My Home Assistant

The settings are exactly the same as they were for HA v73 so I am wondering if there is any additional settings that need to be added/edited to get the notify function working

Would it be possible for anyone who has this service working after the major upgrade to the authentication to paste a copy of their configuration.yaml here.

I’m particularly interested in the authentication section and the notify section. I just want to compare it with mine to see if there’s anything I’ve missed.

As I mentioned earlier this service was working perfectly in HA 73. I did a fresh install of HA 88 and copied over all my settings but still cannot get it to work. It’s acting like smtp notify is not installed or configured properly.

I’ve been using SMTP notifier via gmail for quite some time and haven’t made any changes for the new authentication system, etc. Of course I’m still on 0.84.6, so can’t really say for versions after that. But, FWIW, here is my redacted config:

notify:
  - name: email_me
    platform: smtp
    sender: [email protected]
    recipient: [email protected]
    server: smtp.gmail.com
    username: [email protected]
    password: password
    sender_name: Home Assistant

Note that [email protected] & password represent the e-mail account I use just for sending e-mail from HA, whereas [email protected] represents my personal e-mail address to receive the messages. (Obviously those are not the actual e-mail addresses.)

Exactly the same layout as mine.

Now it looks like notify is not the only service that I can’t call. Seems like I can’t call any external service.

Looks like the issue may be a missing key that is preventing me from calling these services.I wonder what yaml file this should be in in this case.

Can you expand on what you mean by that? Are you seeing an error, and if so, what is it? Do you see the service listed on the Services page? I don’t know what “key” you’re referring to.

The key I reckon is an api key

As far as I can see any of these service calls require some form of authorisation key.

I don’t have any of these issues on v73 so it has to be down to authentication.

Could you paste a full copy of your configuration.yaml so I can see what might be the problem. Don’t forget to redact the sensitive info.

There’s no API key. It’s using SMTP (Simple Mail Transfer Protocol), which only requires username and password.

I’ve already posted the yaml for configuring my smtp entity. My entire config is some 2600 lines. Not going to post that. :slight_smile:

Is notify.notifier_name listed on the Services page? If not, are there any config errors?

Ii’s just the section relating to authentication I was interested in. Are you using a long term access token. Are you still using legacy api password.

There’s something here thats blocking my access to these services.

Yes notify.notifier_name is listed on the Services page. When I call it issues that error message

I’m trying to imagine a 2600 line configuration.yaml file. Now I know why you didn’t post it.

This works for me on 0.87.1 (note: I have this as its own section in configuration.yaml - meaning notify: has no spaces in front of it)…

notify:
  - name: email-to-me
    platform: smtp
    server: smtp.gmail.com
    port: 587
    timeout: 15
    encryption: starttls
    username: !secret smtpuser
    password: !secret smtppass
    sender: [email protected]
    sender_name: My HASS Server
    recipient: [email protected]

Thats exactly how I have mine setup too.

I’ve used 73 for over a year without any problems but 87 really has me stumped.

No, I do not use any long term access tokens. Besides, that, and how I log into Home Assistant has nothing to do with how SMTP gets out of Home Assistant. At least, not that I see.

I’m asking about errors shown on the Info page and/or in home-assistant.log.

I tracked an error on the HA log with one of the service calls that indicated that a valid key was required.

I’ll need to do a little more testing on my setup. Everything else appears to be functioning correctly. I was even surprised to get HA Dashboard working on v87 with help from other users here.

I did try to do an update from v73 to v87 but that didn’t work too well. I actually found it easier to install v87 and move the various files like configuration.yaml, appdaemon.yaml and the various dash files over to the new install.

@pnbruckner I’ve tried everything possible to get SMTP Notify to work. When I call the service in Dev Tools Services all i’m getting is a message Failed to call service notify even though I’m providing a valid json message.

There’s no error messages showing up in the home-assistant.log to give me an idea where to look. It’s like notify is not installed/configured but it does show in the drop down list in Dev Tools Services.

It’s not the only service that is failing either. I wonder if something in v87 could be blocking it. As I mentioned notify is working perfectly in v73 so it can’t be blocked by my router or my ISP

Are you sure there’s nothing in home-assistant.log? Do you have logger set to debug (for everything)? I find it hard to believe that it’s not working, yet there’s no indication why in the log.

FWIW, here’s what I see in my log (with some details redacted and irrelevant details removed) at startup and when I use the notify.email_xxx service with service data = {"message": "test"}:

pi@raspberrypi:/home/homeassistant/.homeassistant $ grep notify home-assistant.log
2019-02-23 12:02:42 INFO (MainThread) [homeassistant.loader] Loaded notify.smtp from homeassistant.components.notify.smtp
2019-02-23 12:02:42 INFO (MainThread) [homeassistant.setup] Setting up notify
2019-02-23 12:02:48 INFO (MainThread) [homeassistant.components.notify] Setting up notify.smtp
2019-02-23 12:02:56 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=notify, service=email_xxx>
2019-02-23 12:02:56 INFO (MainThread) [homeassistant.setup] Setup of domain notify took 13.2 seconds.
2019-02-23 12:02:56 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=notify>
2019-02-23 12:06:21 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=notify, service=email_xxx, service_data=message=test>
2019-02-23 12:06:21 DEBUG (Thread-3) [homeassistant.components.notify.smtp] Building plain text email

@pnbruckner I thought I was going crazy till I came across this Github issue

https://github.com/home-assistant/home-assistant/issues/20026

I have a similar setup so now I’m wondering if I’m experiencing a similar problem

Well, even so, as you can see in that issue, there are clearly errors in home-assistant.log. Are you still sure you’re not seeing any?

Yes I see his log and it refers to smtp but I have checked the log again and there’s nothing referring to smtp.

I renamed my configuration.yaml to configuration.old. I powered down the Raspberry Pi3 and powered it back up creating a new configuration.yaml. I rebuilt the configuration.yaml and I finally have smtp notify working.

Thanks @pnbrucknerfor having a look at the problem.

1 Like