Telegram 广播

Telegram 实现支持 仅发送消息。您的 Home Assistant 实例无需暴露在互联网上,并且不需要轮询以接收发送到机器人的消息或命令。

有关如何通过 telegram_bot.send_message 操作发送消息的信息,请查看 这里

配置

要将其集成到 Home Assistant 中,请将以下部分添加到您的 configuration.yamlconfiguration.yaml 文件是 Home Assistant 的主要配置文件。它列出了要加载的集成及其特定配置。在某些情况下,需要直接在 configuration.yaml 文件中手动编辑配置。大多数集成可以在 UI 中配置。 [Learn more] 文件中:

# 示例 configuration.yaml 条目
telegram_bot:
  - platform: broadcast
    api_key: YOUR_API_KEY
    allowed_chat_ids:
      - 123456789 # 用户的示例ID
      - -987654321  # 组的示例ID,以 - 开头

Configuration Variables

allowed_chat_ids list Required

一个代表可以发送消息的用户和群聊的 ID 列表。默认情况下,消息将发送到第一个允许的 chat_id。通过使用 target 操作数据属性,消息可以发送到列表中的其他 chat_ids。

api_key string Required

您机器人的 API 令牌。

parse_mode string (Optional, default: markdown)

如果消息数据中未明确指定,默认的消息解析器,可以是 htmlmarkdown

proxy_url string (Optional)

如果在代理后工作,代理 URL,可选地包括用户名和密码。(socks5://username:password@proxy_ip:proxy_port)。

要获取您的 chat_idapi_key,请按照 这里 的说明进行操作。