Home Assistant Notification Showdown

Notifications are an important part of a Home Automation platform. Users typically want to get alerted when things happen and there are various degrees of importance for notifications. Right now in Home Assistant 0.76.2 there are 60 different notification platforms! In this post I’m going to review several different notification platforms supported in Home Assistant. You probably don’t want an email when your garage door doesn’t close but an email might make sense for a weekly electricity usage report, I’ll go over some use cases for each type of notification.

We’re an Android household so this review is coming from that perspective, if you’re using iOS there is a Home Assistant iOS App that supports notifications that I’ve heard good things about. You may also find some of the other notification platforms discussed in this post to be useful to supplement.

Email (SMTP)

First off on the list is SMTP or “Simple Mail Transfer Protocol”. This is the protocol for sending emails. Emails can be an important part of a notification scheme for your Home Automation platform. You probably don’t want to get an email when you’re window opens, but it might make sense to get an Email once a week with any devices that have a low battery that need replacing. Email is great for routine reports of your setup.

To get started you need an SMTP server, there are a few options. You could use a third party service like Mailgun, they provide SMTP using an API making it easy to integrate with Home Assistant. Another popular option would be just to use the Gmail SMTP servers. For this article I’m just going to show how to use Gmail. I have a separate Gmail account for Home Assistant that can send emails to my own gmail. To use the gmail servers you can use the configuration below.

In this config I’m emailing my personal Gmail account from a Gmail I setup for home assistant. Note that you can have multiple recipients here too if you want to email your whole family. To try it out go to the dev services page and do a test service call, you should get an email shortly.

 

Email can be a great option for routine reports on your Home Automation. Check out the full SMTP docs for how to send fully formed HTML email and pictures.

SMS

Everyone knows about SMS, i.e. text messaging. Text messaging can be a great tool for getting fast alerts out to your phone. Home Assistant has support for a few different SMS platforms but today I’m going to setup using Twilio. One important thing to remember about SMS, unlike email you will have to pay per text messages. Luckily, Twilio gives you a trial account to let you send some text messages for free to evaluate the platform.

To get started, go ahead and make an account on Twilio. After creating an account create a project called “Home Assistant”, you should be able to get your own Twilio phone number. Once that is ready we can add the Twilio notify platform to Home Assistant. First off, you need to add the Twilio component to your top level configuration.yaml file. You need two pieces of information from Twilio, your Account SID and Auth Token. Go to your Project Settings page to get the information. Your Account SID should start with “AC” and your Auth Token should be displayed right underneath. I’m storing mine in my secrets.yaml file and referring to them in the configuration.yaml file.

Next you need to add Twilio SMS to the notification platform. This should be in your notify section of your configuration file. Use the number you got from Twilio as the from_number. Note how the phone number is formatted for Home Assistant, you need it written in E.164 format for it to work.

Finally, reboot your Home Assistant instance and we can test it out via the services menu. Put your own phone number as the target.

Using SMS does cost money, so it might not be your go-to notification platform for all your alerts, but I think it could be useful for emergency situations or alarms. Or for people who don’t want to install another App on their phone just for notifications.

Web Services

There are lots of other third party notification platforms that require you to setup an app on your phone to receive notifications.

Telegram

Telegram is a web service that is popular among Home Assistant users. It’s cross-platform allowing you to send and receive messages from a desktop application on Linux/Windows/macOS as well as through their app on Android/iOS or even through a web browser. Telegram has excellent security features including heavily encrypted messages that can self-destruct. A killer feature of the Telegram platform is creating bots, I’ll touch on that a bit here, but will be doing a future post on more advanced techniques using a bot.

Getting Your Credentials

To get started go to http://telegram.org and create an account and open the app. First, we’ll need to create a bot, luckily there is a bot for that! Start a new conversation with the user BotFather and send it a message containing /start.

Answer the questions and set up a username for the bot, eventually, you’ll get an API token. This will be your bot’s API token. Now, we need to get our chat_id. This is a unique value for your account so that we can tell the bot who to message from Home Assistant. Once again, there’s a bot for that! Start a new conversation with the user IDBot and send it a /start message. Now you should have two tokens, one is the bot’s API key and one is your chat ID.

To get started with home assistant we need to add the Telegram Bot platform. There are two different ways to setup the Telegram bot, polling and webhooks. Polling can be used when your Home Assistant instance is not exposed to the outside web, webhooks requires external access. Right now I’m using polling because my instance is not exposed, but the setup procedure is similar. Add the following to your top-level configuration.yaml file.

I kept my ID values within my secrets.yaml file so that they are not exposed. The allowed_chat_ids is a list of values, so you can add all the users of your Home Assistant instance to the list.

Using the Services

After restarting Home Assistant you can send notifications through the telegram_bot.send_message service. See below for a screenshot showing a test notification through Home Assistant.

The telegram bot adds lots of services to Home Assistant including sending a location, documents, photos and video!

If you want to use the standard notify services to send notifications you can add the telegram platform to your notify section of configuration.yaml.

After restarting Home Assistant again there will be a new service created on the notify platform.

Telegram has no restrictions on the number of messages you send and has great cross-platform support, so if you’re willing to do the little extra legwork of creating an account for a bot (which is easy!) you get an awesome notification service which is easy to use and has tons of message types available. Like I mentioned before, you can create some awesome Telegram bots for Home Assistant that allow you to interact with your configuration, stay tuned to the blog for a future article!

Pushover

Pushover gives a dead simple app for receiving notifications onto your phone from Home Assistant. There is a one time $5 cost for buying the Android app and you can install the app for a free 7 day trial to try it out.

First things first, go to the Pushover website and create an account. After completing that go and download the App for your platform and login with the account you just made.

Next, we need to create an Application on the Pushover website.

After creating the application you should get the API key. You will also need your user key found on the Pushover Dashboard. Once you have both of those keys you can add a new notification platform.

After restarting Home Assistant you can test it via the services menu to make sure everything is working fine.

After executing the service you should get a push notification on your phone you can open.

Pushover is great if you’re looking for a really simple way to push notifications to your phone or even your desktop. For just a one time $5 purchase you can send 7,500 messages a month! You can also add your browser as a device to get messages on your laptop/desktop machine as well.

Pushbullet

Want a web service this is a bit more robust? Pushbullet is another service that consists of an App on your phone and a third party service to push notifications. It works very similarity to Pushover but has some nice features including an easy way to embed pictures, transferring files between your phone to computer and mirroring notifications to your personal computer if you have the Pushbullet Chrome app installed.

To get started head over to Pushbullet and create an account. You can just login with your Google account. Next, you’ll want to get Pushbullet on Android or iOS installed on your smartphone.

Next, you’ll need your Access token, head to your Account Settings to create a new access token and copy it down. You can then add a new notify platform in your Home Assistant configuration:

After restarting Home Assistant we can test this out again by using the services tab.

This service call is a bit different making use of the fact we can embedded hosted images with Pushbullet easily. This uses the optional “data” attribute with a URL to a file location. After calling the service you should get a notification on your phone that looks similar to the one below.

I really like Pushbullet because of all the extra features the App gives you and how easy it is to embed pictures in your notifications. If you are looking to put images from your security cameras when motion is triggered or a door is opened you should be able to embed them in Pushbullet notifications pretty easily. Pushbullet lets you stay on the free tier as long as you want but offer a “Pro” line for $40 a year. You can find out more on their Pushbullet Pro page.

Summary

There are lots of options for getting notifications to your devices when events are happening on your smartphone. I think the best solution is a combination of them to communicate data to you in the most effective way. Personally, I think I will mostly be using Email for reporting type notifications that I don’t need to act on immediately.  SMS messages will be for emergency type notifications and I’ll be using Telegram for all my other notifications. I’m also planning on building a bot so I can send it commands when I’m not at home, subscribe or follow me on twitter to make sure you don’t miss it!

What notification platforms are you using? Leave a comment below.