Files
haos-blueprints/Common/Telegram Commands
alexei.dolgolyov 24f89e57b8 Replace deprecated target with chat_id in Telegram bot service calls
Fixes deprecation warning for HA 2026.9.0 where telegram_bot.send_message
`target` parameter is being removed in favor of `chat_id`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 00:46:17 +03:00
..

Telegram Commands Blueprint

This blueprint responds to Telegram bot commands (e.g., /start, /help, /status). Each command can trigger a different callback action and send an optional reply.

How It Works

  1. User sends a command to the Telegram bot (e.g., /lights_on)
  2. Home Assistant receives telegram_command event
  3. Blueprint matches command to the configured list
  4. Executes the corresponding callback action
  5. Optionally sends a reply message

Command Format

Commands should start with "/" (e.g., /status, /lights_on, /arm_alarm). The bot must be configured to receive these commands.

Example Configuration

Commands Answers
/status "Status checked"
/lights_on "Lights turned on"
/lights_off "Lights turned off"
/arm "Alarm armed"

Each command has its own callback action that executes when received.

Access Control

You can restrict which Telegram chats are allowed to trigger the automation by specifying Allowed Chat IDs:

  • Leave empty to allow commands from any chat (no filtering)
  • Add specific chat IDs to restrict access to those chats only
  • Supports user IDs (positive numbers) and group IDs (negative numbers)

This is useful for security-sensitive commands like arming alarms or controlling locks.

Author

Alexei Dolgolyov (dolgolyov.alexei@gmail.com)