Remote Control of Domoticz by Telegram Bot

From Domoticz
Jump to navigation Jump to search

Introduction

This page assumes you have set up your Telegram Bot as described on this page - Telegram Bot

In June 2015 Telegram introduced Telegram Bots, these are effectively just a different type of Telegram account, rather than having any bot functionality of their own. So the Telegram Bot page has explained how to use a Telegram Bot to send notifications. This page goes one stage further by adding automation functionality to your Telegram Bot.

Like any Telegram account a Telegram Bot is able to both send and receive messages. Messages are sent using https requests as previously described. Messages received by your Telegram Bot remain on the server for at least 24 hours (if not read) and need to be collected from the server by a program which provides the automation part of the Telegram Bot.

dtgbot (lua)

dtgbot is a lua program which continuously requests from the Telegram servers any new messages sent to your Telegram Bot. So it sends a long poll request to the server, which the server will not respond to for 60 seconds unless a new message arrive in which case it is returned to dtgbot instantly, this means that dtgbot puts a very low load on your Raspberry Pi as it only sends and recieves 1 http request every minute unless it is asked to do something.

When a message is recieved then dtgbot analyses whether it is a command, if so then it asks Domoticz either for information or instructs Domoticz to carry out an action. dtgbot is extensible either by writing new Lua functions (based on the same template) or by creating bash scripts which dtgbot can execute.

To see what dtgbot and your Telegram Bot can do together have a look at - Telegram Bot - dtgbot Functionality.

To install dtgbot see page dtgbot installing

DTGBOTMENU Telegram Bot for Domoticz on Docker.

This is an further development of the lua implementation but now on docker to ease installation and usage. See for more info https://github.com/jvanderzande/dtgbotmenu4docker

DynamicTelegramBot (python)

Dynamic telegram bot for Domoticz written in Python 3 for ease of install.

With this bot you can monitor and control your Domoticz devices outside your internal home network without the need of setting up certificates, portforwarding etc.

When typing /start a menu will appear instead of the normal keyboard where you can choose to show all favourite devices on the dashboard or switch to show all your Rooms or show the default device tabs (switches, group/scene, utility, weather, cameras). Then you can show all devices of the selected room or device tab. And off course you can switch switches, set setpoints, view camera snapshots etc.

To see what dynamicTelegramBot can do and how to install it go to https://github.com/waltervl/dynamicTelegramBot