Google announced they were going to discontinue Hangouts what seems like forever ago (I mentioned it in my 2020 predictions). They still haven’t completely retired it, but I expect they will soon. The expectation is that most users will migrate to Google Chat. I rely on the Google Hangouts Home Assistant Integration for most of my smart home notifications. Not wanting to chance how things will work when are forced to migrate, I switched to a Telegram Bot for my notifications. Here’s why, and how I did it.
How I use notifications in my smart home
Notifications are very important in my smart home. I like to know when key events have taken place, when security events have happened, and I like confirmation of certain activities. Some of the notifications I have set up in Home Assistant are sent to me when:
The alarm isn’t armed at night
When the alarm is disarmed
A panic button is pressed
When the robot vacuum is scheduled to run
When a garage door has been left open too long
A new Home Assistant release is available
The generator is running
A code is used to open the front door lock (and who’s code it was)
These notifications and many others are important for knowing what’s going on in my home.
Why I chose Telegram
The main reason I’ve been using Google Hangout notifications is that they are quick and I can access them on multiple platforms, including Linux. I want to see notifications on the desktop, on mobile, and on Chromebooks too. I also like having a log of all of the notifications. It sometimes helps when troubleshooting automations.
Telegram fits all of these scenarios. It’s timely, it has Chrome, Linux, and Android clients. It also keeps a timestamped log of notifications. It ticks all the boxes.
One feature it has that I currently don’t use is the ability to send commands back to Home Assistant. But it is good to know I can do this if I want to in the future.
Setting Telegram notifications in Home Assistant
In short, this takes 3 steps: Getting a Telegram account and setting up a bot, configuring Home Assistant, and sending notifications.
Step 1: Set up Telegram account and create and configure your bot.
Telegram uses “bots” for communication. You’ll need to create a bot for your notifications and then get its access token and chat ID for integration into Home Assistant.
Install the Telegram client on your mobile device. Sign up for an account.
Search for the BotFather-bot in your Telegram Messenger app .
Ask BotFather-bot to create new bot for your notifications by sending the /newbot command. You’ll be asked to fill in some information to create the bot.
After you create your bot you’ll be shown an access token. Copy/Write this down. You’ll need it later. If you forget to write it down or need to find it again for some reason you send the /token command to see it.
Go to the bot you just created and send a message (with any content).
Time to get the chat id. Open a web browser and go to the URL: https://api.telegram.org/bot<token>/getUpdates (without the brackets around token). <token> is the token you wrote dearn in step 4. Check the output and look for the value after "id": This is your chat ID.
Now you have everything you need to set up your Home Assistant Telegram integration. But you may want to make a few other customizations to your bot. I recommend adding a picture. Go back to BotFather-bot and issue the command /setuserpic. This will allow you to add a picture. If you don’t like the name you selected for your bot you can also ask BotFather-bot to set a new name with the /setname command.
Step 3: Configure Telegram Home Assistant integration
After setting up the bot you are now ready to integrate with Home Assistant. There are three ways to integrate with Home Assistant with Telegram:
Polling platform – If you don’t want to expose your Home Assistant instance to the Internet you can use the polling platform to send and receive messages with your Telegram bot.
Webhooks platform – If you have your Home Assistant securely exposed to the Internet or are okay with doing so you can use the webhooks platform to send and receive messages.
Broadcast platform – If you are only interested in sending messages (notifications) to your Telegram Bot and not having your bot send messages to Home Assistant then this is probably the best option, and it is the one I chose.
In your configuration.yaml add the following:
telegram_bot:
- platform: broadcast
api_key: YOUR_API_KEY
allowed_chat_ids:
- 123456789 # example chat id
You may want to store your API Key and chat id(s) in your secrets.yaml file. Then set up the telegram notification platform to make it easier to send messages (notifications) to Telegram via scripts and automations.
Make note of the NOTIFIER_NAME that you choose. You’ll use this when sending Telegram notifications. I use “telegram_main” for my notifications. You’ll need to restart Home Assistant for this to become effective.
Step 4: Send notifications using Telegram
Sending notifications using Telegram is straight forward. Just place something like below in whatever automation or script that you want to send a notification:
- service: notify.telegram_main
data:
message: "URGENT: This is a telegram notification"
Final thoughts
For years I’ve been using Google Hangouts for reliable Home Assistant notifications. Unfortunately, Google is discontinuing the platform. Notifications are too important to leave to chance, so I migrated to Telegram. I’ve been pretty happy with it, and hopefully I won’t need to change notification engines for a while.
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.AcceptRejectRead More
Privacy & Cookies Policy
Privacy Overview
This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.