Telegram Plugin
Download:
plugin-telegram.zip (1 MB)
License: MIT
Plugin Telegram is designed to send messages from the intraHouse system to the Telegram messenger using a bot.
Plugin installation
The plugin installation procedure is shown here
For the plug-in to work, you need to create a telegram-bot. This procedure is performed in the Telegram application.
Creating a Telegram bot
Telegram bot is created with the help of another bot called BotFather
Press the START button to start communicating with the BotFather
Send the command / newbot
The bot will offer to enter a name that will be displayed in the contact list:
The bot will offer to enter the name of the bot, in the end it should end in “bot”:
If the name is not taken, BotFather will reply with a message with a token – a “key” to access the bot created:
Plugin setup
Double click on the plugin line to open the plugin properties window.
On the Parameters tab, complete the following fields:
- Token – the key to the created bot
- Proxy – select the desired mode (Auto / Manual Setup / Off)
If the Auto mode is set in the Proxy settings, the plugin automatically selects the address of the Proxy server.
Click the Save button.
Getting user ID
Information setting
To add an address for information, follow these steps
Go to the Access section, then Accounts. Select the required account and click the button to display the information addresses.
Click the add button.
Fill in the fields:
- Information channel – select the necessary information plug-in.
- Group – assign the necessary information group.
- Address (number) – enter the previously received user ID
Click the Save button.
Note. After adding a user, you need to restart the plugin.
Using
Telegram plugin can be used in scripts to send messages.
For example, this script will send a message to Telegram when water leaks
/** * @name Water leak * @desc Shut off the water valve and report the water leakage. */ const actor = Device("ActorD", "Water valve"); const sensor = Device("SensorD", "Leakage sensor"); const script = { check() { return sensor.dval; }, start() { this.startTimer("T1", 3, "close"); }, close() { this.do(actor,"off"); this.info('telegram', 'OWNER', 'Water leak! The water valve is shut off!'); } };