Unlikely. You wouldn’t receive a timeout error if, e.g., the host or port you specified were wrong.
You don’t see anything in the SMTP server log, as I understand you’re self-hosting it?
Nothing, no trace on wireshark either.
I’ll try with a free email account.
I’m going to try with a free account from my ISP.
Here are the details on the setup page
Type of information | Settings to enter |
---|---|
Sending mail (SMTP) | |
SMTP server name | smtp.virginmedia.com |
SMTP SSL | Enabled |
SMTP port | 465 |
SMTP authentication | Enabled (or ‘Password’ on Macs) |
SMTP username | Full email address, e.g., [email protected] |
How do I input the “SMTP SSL” Enabled and “SMTP authentication” parts in HA?
I’m obviously missing something.
Using the information on these two links, what do I need to put in my Configuration.YAML to connect to a Virgin Media email account.
It’s the encryption:
option.
Should be tls
here, I think
username:
and password:
strangely
Virgin is telling you the username should be the email you specified at registering time + the password you are using.
Port 465 is usually for SMTP SSL and not TLS.
SSL is dead
It’s called TLS now, and that’s the option name in HA
HTTP SSL is sadly not dead and it is a different protocol than START TLS.
Using port 465 suggest it is in fact HTTP SSL.
START TLS is normally used on port 25 or port 587.
Yeah, exactly. Check the SMTP doc and you’ll see that you have to use the tls
keyword (seems we cannot post pictures, currently).
You have
none
tls
starttls
(usually port 587, indeed)
SSL 3.0 was the latest actual SSL version, and has been obsoleted since a while due to vulnerabilities (POODLE).
Using “SSL” is kind of generic, but everything is actually using TLS (1.3, ideally) nowadays.
I’ve finally found the solution.
notify:
- name: email_notification
platform: smtp
server: "smtp.myserver.com"
port: "465"
username: "[email protected]"
password: "Mypassword"
sender: "[email protected]"
sender_name: "Home Assistant"
recipient: "[email protected]"
encryption: tls
The problem was that I was using the wrong encryption settings.
HA loads these settings on boot, and if they’re not exactly right won’t recognize the existence of the notification service that you’re trying to set up. So it cannot trigger it.
Great you got it fixed.
I’m really grateful to everyone who helped, but also slightly frustrated about how long it took.
I think that my main takeaway from this is that anything that gets loaded into Configuration.YAML fails on boot, and can’t be called, rather than failing on use.
It is not Configuration.YAML. Case is important.
Yes yaml configurations often need a restart of HA, although some things can be reloaded. (see in dev-tools/yaml). But not a reboot.
I think that maybe you missed what I was saying.
I was expecting to see an error message when called the notification, not when I loaded the config file.
For example, in OG Windows if there was an incorrect path in an initialization file the Windows accept the ini file as it was, and you would only get an error message when you tried to use whatever function needed the path.
Arguing over soft reset vs hard reboot is just semantics. For this use case it’s irrelevant which you do as the error is the same.
It’s an abbreviation, it’s capitalized in normal text in the same way as HTML and XML are, even if they’re case sensitive in the OS.
Please can we stop with the nit picking, if it’s not important in the context of the discussion it doesn’t really need mentioning. That just creates division. We’re not righting technical documentation here.
The problem is solved, the config file bounced the mail server setting when it was restarted so the notification was never loaded, which is why the OS couldn’t find it during runtime.
I simply hadn’t expected HA to try to load the custom notification settings that early on, I was expecting them to be loaded when they were called for the first time as I was unfamiliar with how things were done. Now I know for next time.
Its not nit picking, its computer code, it requires precision. Every time you mis-type something, someone will read it and think its right and perpetuate the error.
FYI all configured integrations are loaded at HA startup.
Glad you got there and learned something.
I agree with you that what is happening with the smtp integration is not ideal. Let me try to explain how HA is structured:
HA is quite well segregated between the “integrations”, that provide the functionality (“smtp” is one of those in your case) and what we could call the “core”, which provides the “backend” services and framework to those integrations.
Integrations developers have a lot of freedom in how to code. In this specific instance, that smtp integration is trying to establish communication with the SMTP server at startup, for a reason that is not obvious to me, I must say.
It is indeed unfortunate that it fails semi-silently if that connection cannot be established.
Now, that integration was written a looong time ago (“was introduced in Home Assistant pre 0.7”), and that shows, e.g., by the fact that it cannot be configured by the GUI but through YAML only. Other integrations will be coded totally differently, and specifically avoid doing too much at HA startup time.
Bottom-line: You got a bad UX experience with that integration, but you shouldn’t make it a generality for HA as a whole.
Is this something that should be added to the documentation?
It would have saved me a lot of time as I was looking in the wrong place for both errors and debug
Not sure what documentation you think about, but the 1st step is always to look into the one and only log file of HA.
Now, at the end of the day, as Nick basically says, HA cannot “self-heal” if the parameters you set are wrong, being due to a typo or simply because the subtleties of the SMTP protocol are above an average HA user knowledge…
Not sure what documentation you think about,
It would have been useful if there was a troubleshooting section on the SMTP page that included some of the information that I’ve been told on this thread. Such as having to look in the HA Core log file for error messages rather than looking for them when trying to call the notification.
Or some help regarding which encryption types are most common with these ports.
I went round in circles for a while as some guide showed the strings in the config enclosed by quotes, and some didn’t, so I tried all kinds of different combinations.
at the end of the day, as Nick basically says, HA cannot “self-heal” if the parameters you set are wrong,
I’m not really sure where anyone got the idea that it could, that’s not something that I mentioned.
simply because the subtleties of the SMTP protocol are above an average HA user knowledge
Hence the need for some documentation to cover things like this.
I can’t speak for everyone, but my background is pretty much exclusively with netware and exchange. So I’m used to getting error message relating to configuration at the time that I try to perform the action that the configuration is for.
For example, if I want to send out a system notification via an independent SMTP server I can put any kind of garbage in the authentication settings. So long as it compiles to the default system validation (For example, all email addresses having the @ symbol in them), and the server won’t even look at those settings, let alone try to authenticate against them, until I try to send out the first message, at which time there will be an error.
Which is what I was expecting to happen here, and which is where I went wrong.
What I’d do - if I knew how - would be to write an add on for HA that presented the user with a dialog box that allowed them to enter all of the details for their SMTP service, and then would check them when the user pressed the submit button. If the settings were valid it would add them to the config for the user, and if they weren’t it would bring up some suggestions of what to do, such as checking the port types.
Based on my experience here, I think that trying anything to clever in HA is going to be too time consuming, and I’ll just stick with basic remote control. I’d like to get more invested but there seem to be too many idiosyncrasies due to there having been so many different people doing things differently for every different component.
Those are not specific to HA really.
Which protocols and ports used by SMTP can be googled.
Same goes for the general syntax of YAML (“when are double quotes required in yaml”).
Well, looking at the code, in this instance, the configuration is explicitely validated at instantiation. Once again, a choice of the developer
You are very young in the world of HA
That exists now, and is required for every new integrations, but not all older integrations (like this one) has been “GUI enabled”, yet.
If you read release notes (and you definitely should), you’ll see a list of old integrations that are have been GUI-enabled
Fair enough, and it’s definitely true HA needs involvement. HA itself is evolving at a fast pace every month.