As I build out my smart home systems, I have realized that I wanted to be able to push notifications from it to my phone. I have other services that do this through Email, so I wanted to set up something similar with home assistant. I have a list of a few things I would like notifications of, and getting one or two of them off the list will at least prove out my implementation and give me some more capability from my home assistant setup.
Some things to notify me of
- water leaks
- washing machine done
- chest freezer without power
T-Mobile provides an email address for each phone number that gets routed to the SMS system on their network. I’ve made use of this for sending SMS notifications to my phone from custom built and self hosted services (SMTP send capabilities are common in many tools). Some of the other cell carriers provide this as well, you’ll have to look up your carrier to see if it is available.
Sending Via SMS / Email
Home assistant has built in SMTP support for notifications that I made use of. Their documentation provides everything needed to get this setup. I used the documentation example as the basis for my notification setup. I set it up to use my notification Gmail account that I setup a long while ago for some other services to use. The gmail account used needs to be setup to allow authentication without 2FA. The setup is pretty straight forward to do (Google calls it app passwords). The default recipient is my cell phone, which will receive the notification as a SMS message.
notify: - name: "my.notifications" platform: smtp server: "smtp.gmail.com" port: 587 sender: "firstname.lastname@example.org" encryption: starttls username: "email@example.com" password: "password" recipient: - "firstname.lastname@example.org" sender_name: "HASS" debug: true
Once the notification configuration is in place, the home assistant core should be restarted to make it take effect. After restarting, also make sure to check the logs as that will tell you if the notification agent is ready to be used, or if there was a problem with authentication.
This worked really well for my use cases. I make use of SMTP notification services in multiple services and adding this use case works well for me to operate things. An alternative would be to make use of the home assistant app and its notification service, which requires the app to be installed on any device needing the notifications, or to use another 3rd party service. This is a good alternative, but I wanted to try and make use of fewer 3rd party services, and email is a pretty ubiquitous service to utilize for this.