Skip to main content

Telegram PTZ & Notifications

Telegram PTZ & Notifications

The telegram component can do two things. First, it can send detection videos (and thumbnails) to a chat when a detection occurs. Second, it can be used to control the ptz component from the chat, with commands like '/left', '/right', etc.

Configuration

Configuration example
telegram:
telegram_bot_token: <ask_the_bot_father>
telegram_chat_ids: [<run_a_script>]
detection_label: person
send_detection_thumbnail: true
send_detection_video: true
send_detection_message: false
cameras:
camera_1:
camera_2:

Script to get chat id:

import asyncio
from telegram import Bot

# Replace 'YOUR_BOT_TOKEN' with the token you got from BotFather
bot_token = 'your_bot_token'


async def get_chat_id():
# Create an instance of the Bot
bot = Bot(token=bot_token)

# Get updates
updates = await bot.get_updates()

for update in updates:
print(update.message.chat.id, update.message.chat.username)

if __name__ == '__main__':
asyncio.run(get_chat_id())
telegrammap required
Telegram bot to control pan-tilt-zoom cameras.

Troubleshooting

To enable debug logging for telegram, add the following to your config.yaml
/config/config.yaml
logger:
logs:
viseron.components.telegram: debug