Files
haos-blueprints/Common/Telegram Commands/README.md
alexei.dolgolyov 67a31b320d Add allowed chat IDs filter to Telegram Commands
New input `allowed_chat_ids` restricts which Telegram chats can trigger
the automation. Leave empty to allow all chats (no filtering).
Useful for security-sensitive commands.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 02:12:22 +03:00

1.3 KiB

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)