mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-23 01:06:52 +00:00
parent
864f839981
commit
b871b2b999
@ -48,7 +48,7 @@ To enable Telegram notifications in your installation, add the following to your
|
|||||||
```yaml
|
```yaml
|
||||||
# Example configuration.yaml entry for the Telegram Bot
|
# Example configuration.yaml entry for the Telegram Bot
|
||||||
telegram_bot:
|
telegram_bot:
|
||||||
platform: webhooks
|
platform: polling
|
||||||
api_key: ABCDEFGHJKLMNOPQRSTUVXYZ
|
api_key: ABCDEFGHJKLMNOPQRSTUVXYZ
|
||||||
allowed_chat_ids:
|
allowed_chat_ids:
|
||||||
- CHAT_ID_1
|
- CHAT_ID_1
|
||||||
|
@ -13,7 +13,7 @@ ha_release: 0.42
|
|||||||
|
|
||||||
Use Telegram on your mobile or desktop device to send and receive messages or commands to/from your Home Assistant.
|
Use Telegram on your mobile or desktop device to send and receive messages or commands to/from your Home Assistant.
|
||||||
|
|
||||||
This component creates notification services to send, or edit previously sent, messages from a [Telegram Bot account](https://core.telegram.org/bots) configured either with the [polling](/_components/telegram_bot.polling.markdown) method or with the [webhooks](/_components/telegram_bot.webhooks.markdown) one, and trigger events when receiving messages.
|
This component creates notification services to send, or edit previously sent, messages from a [Telegram Bot account](https://core.telegram.org/bots) configured either with the [polling](/components/telegram_bot.polling/) method or with the [webhooks](/components/telegram_bot.webhooks/) one, and trigger events when receiving messages.
|
||||||
|
|
||||||
|
|
||||||
### {% linkable_title Notification services %}
|
### {% linkable_title Notification services %}
|
||||||
@ -121,7 +121,7 @@ Respond to a callback query originated by clicking on an online keyboard button.
|
|||||||
### {% linkable_title `Telegram` notification platform %}
|
### {% linkable_title `Telegram` notification platform %}
|
||||||
|
|
||||||
|
|
||||||
The [Telegram notification platform](/_components/notify.telegram.markdown) requires the `telegram_bot` component to work with, and it's designed to generate a customised shortcut (`notify.USERNAME`) to send notifications (messages, photos, documents and locations) to a particular `chat_id` with the old syntax, allowing backward compatibility.
|
The [Telegram notification platform](/components/notify.telegram/) requires the `telegram_bot` component to work with, and it's designed to generate a customised shortcut (`notify.USERNAME`) to send notifications (messages, photos, documents and locations) to a particular `chat_id` with the old syntax, allowing backward compatibility.
|
||||||
|
|
||||||
The required yaml configuration now reduces to:
|
The required yaml configuration now reduces to:
|
||||||
```yaml
|
```yaml
|
||||||
@ -144,6 +144,7 @@ args: "<any other text following the command>"
|
|||||||
from_first: "<first name of the sender>"
|
from_first: "<first name of the sender>"
|
||||||
from_last: "<last name of the sender>"
|
from_last: "<last name of the sender>"
|
||||||
user_id: "<id of the sender>"
|
user_id: "<id of the sender>"
|
||||||
|
chat_id: "<origin chat id>"
|
||||||
```
|
```
|
||||||
|
|
||||||
Any other message not starting with `/` will be processed as simple text, firing a `telegram_text` event on the event bus with the following `event_data`:
|
Any other message not starting with `/` will be processed as simple text, firing a `telegram_text` event on the event bus with the following `event_data`:
|
||||||
@ -153,6 +154,7 @@ text: "some text received"
|
|||||||
from_first: "<first name of the sender>"
|
from_first: "<first name of the sender>"
|
||||||
from_last: "<last name of the sender>"
|
from_last: "<last name of the sender>"
|
||||||
user_id: "<id of the sender>"
|
user_id: "<id of the sender>"
|
||||||
|
chat_id: "<origin chat id>"
|
||||||
```
|
```
|
||||||
|
|
||||||
if the message is sent from a [press from an inline button](https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating), for example, a callback query is received, and Home Assistant will fire a `telegram_callback` event with:
|
if the message is sent from a [press from an inline button](https://core.telegram.org/bots#inline-keyboards-and-on-the-fly-updating), for example, a callback query is received, and Home Assistant will fire a `telegram_callback` event with:
|
||||||
@ -165,6 +167,7 @@ from_last: "<last name of the sender>"
|
|||||||
user_id: "<id of the sender>"
|
user_id: "<id of the sender>"
|
||||||
id: "<unique id of the callback>"
|
id: "<unique id of the callback>"
|
||||||
chat_instance: "<chat instance>"
|
chat_instance: "<chat instance>"
|
||||||
|
chat_id: "<origin chat id>"
|
||||||
```
|
```
|
||||||
|
|
||||||
### {% linkable_title Configuration samples %}
|
### {% linkable_title Configuration samples %}
|
||||||
@ -215,7 +218,7 @@ trigger:
|
|||||||
action:
|
action:
|
||||||
- service: homeassistant.turn_on
|
- service: homeassistant.turn_on
|
||||||
entity_id: switch.vision_zm1601eu5_battery_operated_siren_switch_9_0
|
entity_id: switch.vision_zm1601eu5_battery_operated_siren_switch_9_0
|
||||||
- delay:
|
- delay:
|
||||||
seconds: 10
|
seconds: 10
|
||||||
- service: homeassistant.turn_off
|
- service: homeassistant.turn_off
|
||||||
entity_id: switch.vision_zm1601eu5_battery_operated_siren_switch_9_0
|
entity_id: switch.vision_zm1601eu5_battery_operated_siren_switch_9_0
|
||||||
@ -330,7 +333,7 @@ Only acknowledges the 'NO' answer:
|
|||||||
message: 'OK, you said no!'
|
message: 'OK, you said no!'
|
||||||
```
|
```
|
||||||
|
|
||||||
For a more complex usage of the `telegram_bot` capabilities, using [AppDaemon](https://home-assistant.io/docs/ecosystem/appdaemon/tutorial/) is advised.
|
For a more complex usage of the `telegram_bot` capabilities, using [AppDaemon](/docs/ecosystem/appdaemon/tutorial/) is advised.
|
||||||
|
|
||||||
This is how the previous 4 automations would be through a simple AppDaemon app:
|
This is how the previous 4 automations would be through a simple AppDaemon app:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user