home-assistant.github.io/source/components/notify.telegram.markdown
2015-10-09 23:21:25 +02:00

1.7 KiB

layout title description date sidebar comments sharing footer
page Telegram notification support Instructions how to add Telegram notifications to Home Assistant. 2015-10-09 18:00 false false true true
The telegram platform uses [Telegram](https://web.telegram.org) to delivery notifications from Home Assistant to your Android device, your Windows phone, or your iOS device.

The requirement are:

  • You need a Telegram bot. Please follow those instructions to create one and get the token. Keep in mind that bots are not allowed to contact users. You need to make the first contactwith your user.
  • The chat ID of an user

An easy way to get your chat ID is described below:

import telegram
bot = telegram.Bot(token='YOUR_API_TOKEN')
chat_id = bot.getUpdates()[-1].message.chat_id
print(chat_id)

To enable Telegram notifications in your installation, add the following to your configuration.yaml file:

# Example configuration.yaml entry
notify:
  name: NOTIFIER_NAME
  platform: telegram
  # Get those by creating a new bot on https://core.telegram.org/bots
  api_key: ABCDEFGHJKLMNOPQRSTUVXYZ
  chat_id: YOUR_CHAT_ID

Configuration variables:

  • name (Optional): Setting the optional parameter name allows multiple notifiers to be created. The default value is notify. The notifier will bind to the service notify.NOTIFIER_NAME.
  • api_key (Required): The API token of your bot.
  • chat_id (Required: The chat ID of your user.

To use notifications, please see the getting started with automation page.