I have a notifier set up to email me when a door trigger opens. I’m using a Gmail account I created specifically to send notifications from HA. This is my notify code in configuration.yaml
Your configuration and automation look correct. Are there any errors related to loading or starting the component or registering the service? E.g., if I do this:
grep notify home-assistant.log
I see this:
2018-08-01 11:03:24 INFO (MainThread) [homeassistant.loader] Loaded notify from homeassistant.components.notify
2018-08-01 11:03:24 INFO (MainThread) [homeassistant.loader] Loaded notify.smtp from homeassistant.components.notify.smtp
2018-08-01 11:03:24 INFO (MainThread) [homeassistant.setup] Setting up notify
2018-08-01 11:03:26 INFO (MainThread) [homeassistant.components.notify] Setting up notify.smtp
2018-08-01 11:03:26 INFO (MainThread) [homeassistant.components.notify] Setting up notify.smtp
2018-08-01 11:03:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=notify, service=sms_phil>
2018-08-01 11:03:27 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_registered[L]: domain=notify, service=email_phil>
2018-08-01 11:03:27 INFO (MainThread) [homeassistant.setup] Setup of domain notify took 2.8 seconds.
I dug further into my logs and found this. I assume this is a related issue.
SMTP server not found (smtp.gmail.com:587). Please check the IP address or hostname of your SMTP server
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/notify/smtp.py", line 120, in connection_is_valid
server = self.connect()
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/notify/smtp.py", line 106, in connect
self._server, self._port, timeout=self._timeout)
File "/usr/local/lib/python3.6/smtplib.py", line 251, in __init__
(code, msg) = self.connect(host, port)
File "/usr/local/lib/python3.6/smtplib.py", line 336, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/local/lib/python3.6/smtplib.py", line 307, in _get_socket
self.source_address)
File "/usr/local/lib/python3.6/socket.py", line 704, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "/usr/local/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Try again
Are you using hass.io, or docker or something like that? If so, I’m not sure what restrictions that puts on HA’s ability to connect to an external server. FWIW, I’m running HA in a Python virtual environment (venv) on Raspbian, and I have the same basic config as you for the gmail server and port, and it works ok for me.
EDIT: From the ssh command line, can you ping smtp.gmail.com?
I found the problem. It looks like Google must have blocked it, presumably from sending too many emails too fast. I entered a different email account in the config and it worked. I ended up deleting the Gmail account I setup for HA and making a new one. It works now.
I thought that was just if I have 2-step verification, which I don’t.
I tried to set an app password and received an error from Google. I tried navigating to it directly via account>apps with account access>Manage Apps but it didn’t give me an option to add anything.
This is very strange. I get the same thing now. In trying to find the apps password page, after Googling and trying different things, I did once stumble across the page where my current app password was acknowledged and it gave me the option to create another. But when I tried to reproduce the steps to tell you, I couldn’t, after many, many tries!
In case someone runs across this conversation in the future, I just wanted to correct what I said. I’m using the SMTP notify platform with a gmail account, but I’m not using an “app password”. I’m just using the account’s normal password. But, this account does not use 2-Step Verification, so an app password is not only not needed, it’s not possible to create one for it. I do have other gmail accounts that do use 2-Step Verification, and for those you can create an “app password.”