Logo Logo en
  • iRidi Pro
    Основные компоненты
    • Приложение i3 Pro
    • iRidi Pro Server
    • iRidi Studio
    • iRidium studio v. 1.3.8 (устаревшая версия)
    Java Script в iRidi
    • Руководство
    • Справочник
    • Примеры
    • JS драйвера
    другие
    • Личный Кабинет
    • iRidium Cloud
    • iRidium Transfer
    • Push-уведомления
    • Лучшая практика
    Лицензирование
    • Лицензирование и передача проекта
    • Оффлайн-лицензирование
    • Активация iRidi Pro Server
  • Продукты
    i3 lite
    • Приложение i3 lite
    • Регистрация и лицензирование
    • Сервер
    • Модули
    KNX Home Server
    • Приложение i3 KNX
    • KNX Home Server
    BUS77 HOME SERVER
    • Приложения Bus77 Home и Bus77 Lite
    • Bus77 Home Server
    Решения
    • BYOD - решение для гостиниц
    • Портал жителя - решение для МКД
    iRidi SCADA
    • iRidi SCADA
  • Bus77
    НАСТРОЙКА BUS77
    • Основы Bus77
    • Приложения Bus77 Home и Bus77 Lite
    • Работа с драйвером Bus77 в iRidi Studio
    • Настройка шины Bus77 в iRidi Studio
    ПРОТОКОЛ BUS77
    • Характеристики CAN (Bus77)
    • Описание протокола
    • Исходники на GitHub
    ОБОРУДОВАНИЕ BUS77
    • Каталог Bus77 Pro
    • Каталог Bus77 Lite
  • Поддерживаемое оборудование
    Драйверы
    • Список драйверов
    • ProAV драйвера
    • AV & Custom Systems
    • JS драйвера
    • Сторонние драйвера и фриланс
    Протоколы и интерфейсы
    • Голосовое управление
    • 1-Wire
    • BACnet IP
    • Bus77
    • KNX
    • KNX IP BAOS
    • Weinzierl kBerry
    • Microsoft Exchange
    • Modbus
    • MQTT
    • NFC
    • ODBC
    • Onvif
    • SIP
    • SNMP
    • Wake On Lan
    • Z-Wave
    • ZigBee
    Производители
    • AMX
    • AVCiT
    • Beckhoff ADS
    • Biamp Tesira
    • Bluesound
    • Casambi
    • BSS Harman
    • Clipsal
    • ControlArt 7Port
    • Crestron
    • DigiBird
    • Domintell
    • Duotecno
    • EIDE
    • EPSNET
    • Global Cache
    • HDL Buspro
    • Helvar
    • IEAST
    • INELS BUS
    • INELS Wireless
    • Intesis
    • Kleger
    • Kramer VIA
    • Kramer 3000
    • Larnitech
    • Legrand Netatmo
    • LG TV
    • Lutron
    • Lutron Homeworks QS
    • MyHome
    • Nest
    • Novastar
    • Panasоnic PTZ
    • Philips Dynalite
    • PJLink
    • Satel
    • SamsungTV
    • Sonos
    • Somfy
    • SpinetiX
    • Televic Conference
    • TIS
    • Tion
    • URRI
    • Velbus
    • Velocio
    • Vinteo
    • WyreStorm
    • WiiM
    • Xicato
    • Yamaha
    • ZONT
    • Z-Wave.me
    Протестированное оборудование
    • Панель HDL S57
    • Панель HDL S10
    • SIP-домофон
    • Akuvox
    • Arlight
    • Divus
    • QBic TD-1050 PRO
    • QBic TD-1060 Slim
    • QBic TD-1070
    • Sigur
    • Uni-Ubi
    • Velocio
  • Оборудование iRidi

    Серверы
    • HS Сервер
    • ProAV Control Processor Basic
    • ProAV Control Processor Advanced
    • Спецификация контроллеров UMC
    • Настройка контроллера UMC C2
    • Настройка контроллера UMC C3
    • Настройка контроллера HDL IntelliCenter 2 (UMC C4)
    Модули расширения
    • I-PX-RS1
    • I-PX-RS4
    • I-PX-IR3
    KNX
    • KNX Home Server
    • KNX IP Interface
    Панели управления
    • iRidium Panel 7
    • Touch Panel P3
    • Touch Panel P6
    • Touch Panel P8
    • Touch Panel P10
    • Tabletop Touch Panel 10
    • AV Remote Control
    ОБОРУДОВАНИЕ BUS77
    • Каталог Bus77 Pro
    • Каталог Bus77 Lite
    • Differences
iRidium mobile web-site
Содержание
    Инструменты‌
    • Сведения о странице
    • Постоянная ссылка
    • Версия для печати
    • Спецстраницы
    • Связанные правки
    • Ссылки сюда
    Login / Create Account
    Материал из for iRidium developers
    Перейти к: навигация, поиск
    Эта страница является переводом страницы Telegram. Перевод выполнен на 100%.

    Other languages:
    English • ‎русский

    Содержание

    • 1 Telegram
    • 2 Creating a Telegram Bot
    • 3 Integration of Module to Project
    • 4 Start of Bot by End-user

    Telegram

    Telegram is a module to sent messages from i3 pro toTelegram. Telegram bot will send you messages set in iRidium Studio, when an event is activated (for example, messages can be received from leakage sensors, smoke detectors and other equipment).

    documentation was last updated on 20.4.2021


    Download the example
    • Telegram+HDL_SecurityModule.irpz

    Download an example of a project:

    • Telegram.irpz


    Creating a Telegram Bot

    1 Open Telegram, enter BotFather in the search line;

    2 Choose a found bot and activtae a dialogue with it by pressing the Start button;

    3 Send the /newbot command to create your own bot;

    4 BotFather will suggest that you choose a name for your bot, enter the name;

    5 Enter a unique username for the bot with _bot at the end;

    6 After a successful registration BotFather will send you a message with a toke that must be saved for further work.

    Integration of Module to Project

    We have a project that demonstrates the work of Telegram module. To integrate the module to your project, do the following:

    1 Download a project with a module for Telegram;

    2 Open the module in iRidium Studio;

    3 Merge your project with a module for Telegram:

    Telegram2.png

    4 Open the Main file in the SCRIPT section, the file contains an example;

    5 Change parameters in the example:

    Telegram1.png
    • device Name - the name of the driver for Telegram;
    • chat ID - ID of a user of a group;
    • token of the bot - the token of a bot;
    • timeout between messages - a delay to send messages in miliseconds;
    • print Log - a varianle that determines whether to display a log or not (true, false).


    Getting chat ID:

    1. Open Telegram and enter userinfobot in the search line;
    2. Choose a found bot, activate a dialogue with it and press the Start button;
    3. You'll get information about your Telegram account in a message: login, id, name, surname.


    Gettiing the chat ID of a group:

    1. Add the bot to the group (the bot is added via a regular addition of members and search of a bot by name);
    2. Start the bot with the help of the /start command;
    3. You can get a list of updates for your bot via the following link, where <YourBOTToken> is replaced with the token of your bot: https://api.telegram.org/bot<YourBOTToken>/getUpdates;
    4. You'll get an answer like this:
    Telegram4.png

    The id field of the chat object is the id of your group.

    6 Write a data handler in the Main script following the example. Set an event that will trigger sending a message and the text of a message.


    6.1. An example of sending a message when a button is pressed


    1 Replace values in the chat ID and token of the bot fields with those that are used by the Telegram bot;

    2 Create send_mail()function and write the text of a message that will be sent by Telegram bot;

    3 Assign the send_mail() function to a button with the help of Script call macro.

    var l_pTelegram;
     
    IR.AddListener(IR.EVENT_START, 0, function(){
            l_pTelegram = new Telegram(
            /* device Name */ "Telegram",
            /* chat ID */ "0000", 
            /* token of the bot */ "botToken", 
            /* timeout between messages */ 200, 
            /* print Log */ true);
     
    });
     
    function send_mail() 
    {
        l_pTelegram.SendMessage("text message");
    }

    6.2. An example of sending a message when a value changed in a driver tag


    1 Replace values in the chat ID and token of the bot fields with those that are used by the Telegram bot;

    2 Replace the value of "Name Device" with the name of a driver, which value will be tracked and sent to Telegram.

    3 Add to the IR.EVENT_TAG_CHANGE listener channels which values will be tracked and the text of a message that will be sent to Telegram.

    var l_pTelegram;
     
    IR.AddListener(IR.EVENT_START, 0, function(){
            l_pTelegram = new Telegram(
            /* device Name */ "Telegram",
            /* chat ID */ "0000", 
            /* token of the bot */ "botToken", 
            /* timeout between messages */ 200, 
            /* print Log */ true);
     
        var driver = IR.GetDevice("Name Device"); // driver name
    });
     
     
    IR.AddListener(IR.EVENT_TAG_CHANGE, driver, function(name,value)
    {
       if (name == "Address 1" && value == 1) // if the driver feedback "Address 1" changed to 1
       {
          l_pTelegram.SendMessage("Back door opened!"); // text of notification
       }            
    });

    6.3. An example of sending a message when a certain date comes


    1 Replace values in the chat ID and token of the bot fields with those that are used by the Telegram bot;

    2 Write in the IR.EVENT_GLOBAL_TAG_CHANGE listener the date and time to send a message and the text of a message.

    var l_pTelegram;
     
    IR.AddListener(IR.EVENT_START, 0, function(){
            l_pTelegram = new Telegram(
            /* device Name */ "Telegram",
            /* chat ID */ "0000", 
            /* token of the bot */ "botToken", 
            /* timeout between messages */ 200, 
            /* print Log */ true);
     
    });
     
     
    IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function (name, value)
    {
       // conditions:
       if (IR.GetVariable("System.Date.MM_DD") == "03/14" && IR.GetVariable("System.Time.Hour") == 10 && IR.GetVariable("System.Time.Minutes") == 0) 
       { 
          l_pTelegram.SendMessage("Happy Birthday Mike!"); // text of notification
       }
    });
     
    IR.SubscribeTagChange("System.Time.Minutes"); // subscribe on minutes to check condition each minute


    Start of Bot by End-user

    To start working with a Telegram bot, an end-user must do the following.

    1 Give the chat ID of his account or chat to the integrator.

    2 Find the bot by its username;

    3 Activate a dialogue and start the bot by sending the /start command.

    Источник — «https://dev.iridi.com/index.php?title=Telegram/en&oldid=110436»
    About us
    Company
    Team
    History
    Philosophy
    Rewards
    Partnership
    Our partner
    Partnership Programs
    Apply for partnership
    products
    iRidium pro
    iRidium lite
    iRidium gate
    iRidium server
    Loads
    iRidium pro
    iRidium lite
    Other version
    Marketing materials
    Support
    On-line courses/Video
    Recommended equipment
    Other version
    iRidium pro
    Documentation
    FAQ
    Forum
    iRidium lite
    Documentation
    Forum
    Projects
    Standart projects
    Smart buildings
    Smart house
    Special solution
    Find a dealer
    News
    Youtube
    Twitter
    VK
    Logo
    contact@iridi.com
    +7 (499) 322-73-29

    Privacy policy