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
    Перейти к: навигация, поиск
    Эта страница является переводом страницы IFTTT. Перевод выполнен на 100%.

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

    Содержание

    • 1 Work of iRidium with IFTTT service
      • 1.1 Activation of IFTTT trigger when a smart home device is on
        • 1.1.1 Setting Webhook
        • 1.1.2 Setting iRidium pro project
      • 1.2 A device is activated when a letter comes to Gmail.
        • 1.2.1 Setting Gmail
        • 1.2.2 Setting a project in iRidium pro
        • 1.2.3 Testing
      • 1.3 Work with IFTTT in iRidium lite
        • 1.3.1 Setting Gmail module
        • 1.3.2 Sending a notification to an e-mail, when a smart home device is activated.
        • 1.3.3 A device is activated when a letter comes to the e-mail.

    Work of iRidium with IFTTT service

    General manual on setting iRidium work with IFTTT service

    IFTTT platform allows to connect two cloud services. There can be many examples how this platform can be used in remote control of Smart home.
    Let's have e look at 2 most popular ways to work with IFTTT:
    1 Activation of IFTTT trigger when a smart home device is on
    An example When the front door lock is opened, a notification is sent to an e-mail.
    2 A device is turned on, when IFTTT trigger is activated
    An example When a new message comes to the e-mail, a lamp is to be turned on.
    Description below shows how to set the given examples.

    iRidium server and constant internent access are required to work with IFTTT service.

    Activation of IFTTT trigger when a smart home device is on

    Setting Webhook

    1 Go to IFTTT web-site and authorize
    2 After authorization, click on your account and select New Applet from the list that appears.

    IFTTT 1.png


    3 A standard form appears, click +this

    IFTTT 2.png


    4 Find and select Webhooks in the list that appears

    IFTTT 3.png


    5 To create a trigger create a new request (Receive a web request)

    IFTTT 4.png


    6 Create an event, for example, door_opened and click create trigger
    7 Click +that and in the list that appears select what to do when the door_opened event happens.

    IFTTT 5.png


    In our example when door_opened event happens, a letter is sent to an e-mail notifying about it.
    8 We'll select Gmail

    IFTTT 6.png


    9 Select an action - to send a letter to yourself (Send yourself an email). A review of the trigger appears, we must have a close look at it to check that everything is correct and to complete creation by clicking the Finish button.

    IFTTT 7.png


    To test the trigger work go to Webhooks tab.

    IFTTT 8.png


    Go to the documenatation page

    IFTTT 9.png


    Create a request on this page. Enter the name of the event in the event field (in our example, it's door_opened) and click Test it.

    IFTTT 10.png


    On the same page you'll see your unique key. It will be used when you pass on to setting iRidium project.

    Setting iRidium pro project

    1 Create a server project.
    2 Add to it AV&Custom Systems (HTTP) driver

    IFTTT 11.png


    3 Set as shown below.

    IFTTT 12.png


    4 Add "Event" virtual channel

    IFTTT 13.png


    5 Create a new script in the project and add the following to it

    IR.AddListener(IR.EVENT_START,0,function(){
     
       var IFTTT_Token = "your key"; //enter Webhook secret key here (take it from the documentation section of Webhook)
       var IFTTT = IR.GetDevice("IFTTT (Custom HTTP (TCP))"); //driver name
     
       IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(in_sName, in_nValue){
          IFTTT.Send(["GET,/trigger/"+in_nValue+"/with/key/"+IFTTT_Token+"/"]);
       });
       IR.SubscribeTagChange("Server.Channels.Event");  //name of a virtual channel
     
       IR.AddListener(IR.EVENT_RECEIVE_TEXT, IFTTT, function(text) {  
          IR.Log(text);
       });
     
    });

    6 Enter your key (from the Webhook documenation) in the IFTTT_Token variable
    7 Add drivers that you will work with (we'll use Modbus TCP as a example) and set them

    IFTTT 14.png


    8 Set feedback channels to devices

    IFTTT 14 1.png


    9 Create a routine for Webhook event to be activated
    When=> a driver tag gets data that the door is opened

    IFTTT 15.png


    Then=> send text with the event name to virtual channel

    IFTTT 16.png


    Write the same event name as in the Webhook trigger

    IFTTT 17.png


    When the door is opened and a value comes to the tag, a routine is activated that sends Webhook information that door-opened event happened and a notification about it comes to the e-mail.

    A device is activated when a letter comes to Gmail.

    This way, like the first one, can work via Webhook

    For the device to be activated, IFTTT trigger can be activated that sends a letter to Gmail with the event name in the topic
    For example, you want the light to turn on when a letter with Light_on topic comes and to turn off when a letter with Light_off topic comes.

    Setting Gmail

    1 Go to Google Apps Script web-site.
    2 Click Start scripting

    IFTTT 18.png


    3 Click Create script

    IFTTT 19.png


    4 Enter the following script

    function doGet(in_sResponse) 
    {
      var l_sToken = ""; //enter here the key that only you will know.
      var l_aEvents = in_sResponse.parameter.name.split(' ');
      var l_nMailCount = 0;
      var l_Object={};
      var l_Response = Gmail.Users.Messages.list('me');
     
      // Go through all the messages
      for(var iMsg in l_Response.messages)
      {
        l_nMailCount++;
        var l_nMessageID = l_Response.messages[iMsg].id;
     
    var l_Message = Gmail.Users.Messages.get('me',l_nMessageID);
     
    if(l_Message)
    {
    // Go through all the message headers
    for(var iHeaders in l_Message.payload.headers)
    {
    if(l_Message.payload.headers[iHeaders].name == "Subject")
    {
    // Check for the presence of headers in events
    for(var i = 0;i < l_aEvents.length;i++)
    {
    if(l_aEvents[i] == l_Message.payload.headers[iHeaders].value)
    {
    if(!l_Object[l_aEvents[i]])
       l_Object[l_aEvents[i]] = l_nMessageID;
     
    Gmail.Users.Messages.trash('me',l_nMessageID)
    }   
    }
    }
    }
     
    // Work with a maximum of 5 letters
    if(l_nMailCount==5){break}
    } else
    break;
      }
      return ContentService.createTextOutput(JSON.stringify(l_Object));
    }

    Write your unique key in the var l_sToken variable for nobody but you to use this funtion. Later on this key must be written in the body of a letter.

    5 Save it by clicking IFTTT 20.png icon or use Ctrl+S, and give a random name to it
    6 To work with Gmail, Gmail API has to be enabled. To do it, go to Resources/Advanced Google services

    IFTTT 21.png


    7 Find Gmail API in the list that appears and enable it.
    8 A notification appears below the list that this service has to be enabled in the Google Cloud Platform API Dashboard. Follow the link.

    IFTTT 22.png


    9 Fill in the form and click Accept.

    IFTTT 23.png


    10 Click Enable API and services button on the page that appears.

    IFTTT 24.png


    11 Find and select Gmail API in the list

    IFTTT 25.png


    12 Turn it on.

    IFTTT 26.png


    13 Click Create Credentials for API in the window that appears.

    IFTTT 27.png


    14 Fill in the form as shown below.

    IFTTT 28.png


    15 The system will ask your permission to access data.

    IFTTT 29.png


    16 Click Review Permissions and a window appears. Select your account, click Advanced, then click Go to.

    IFTTT 30.png
    IFTTT 31.png


    17 Click Allow
    18 Now that you have allowed the script to get access to Gmail data, it must be made public. Go to Publish tab and select Deploy as web app

    IFTTT 32.png


    19 Fill in the form as shown below.

    IFTTT 33.png


    A window appears next where you can see URL. It will be used in further work with iRidium pro. Copy it startting with /macros

    IFTTT 34.png


    Setting a project in iRidium pro

    1 Create a server project.
    2 Add to it AV&Custom Systems (HTTP) driver

    IFTTT 11.png


    3 Set it as shown below.

    IFTTT 12.png


    4 Add one more AV&Custom Systems (HTTP) driver and set it as shown below.

    IFTTT 35.png


    5 Add Event virtual channels and Event_ Out virtual tag.

    IFTTT 36.png


    6 Create a new script in the project and add the following to it

    IR.AddListener(IR.EVENT_START,0,function(){
     
       var IFTTT_Token = "your key"; // enter Webhook secret key here (take it from the documentation section of Webhook)
       var Script_google_URL = "/macros/____________"; // URL from the last step of Gmail setting
       var Event = "light_on+light_off"; // name of event (written in the topic of a letter) 
       var Interval = 10000; // an interval between requests to Gmail
     
    //-------------------------------------------------------------------------
       var IFTTT = IR.GetDevice("IFTTT (Custom HTTP (TCP))");
       var Script_google = IR.GetDevice("script_google");
     
       IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(in_sName, in_nValue){
          IFTTT.Send(["GET,/trigger/"+in_nValue+"/with/key/"+IFTTT_Token+"/"]);
       });
       IR.SubscribeTagChange("Server.Channels.Event"); 
     
       IR.SetInterval(Interval, function (){
       if(Script_google_URL!=""){
          Script_google.Send(["GET,"+Script_google_URL+"?name="+Event]);
          }
       })
     
       IR.AddListener(IR.EVENT_RECEIVE_TEXT, IFTTT, function(text) {  
          IR.Log("IFTTT "+text);
       });
       IR.AddListener(IR.EVENT_RECEIVE_TEXT, Script_google, function(text) {
             if(text.substr(0,1)=="{"){
             var oText = JSON.Parse(text);
             for(key in oText){
                IR.SetVariable("Server.Tags.Event_Out", key); 
                IR.Log('Successful: '+key);
             }   
          }
       });
    });

    7 Enter your key, that you got on the documentation page Webhook in the IFTTT_Token variable;
    8 Enter URL, that you got in the last step of setting Gmail in the Script_google_URL variable
    9 Write the name of event that activates a device in the Event Variable.
    Names of events must be written in the topic of a letter, that comes to Gmail.
    10 Add drivers that you will work with (we'll use Modbus TCP as a example) and set them

    IFTTT 14.png


    9 Create a routine:
    When=> a name of event comes from Gmail to Event_out virtual tag

    IFTTT 37.png


    Write the name of event that is to be written in the topic of a letter

    Then=> send a command to a device

    IFTTT 38.png


    IFTTT 39.png


    download:
    • An example

    Testing

    1 Upload a project to the server
    2 Send a letter to the Gmail address where the script is set.

    IFTTT 40 1 1.png


    Write the name of an event, for example, light-on in the topic of a letter
    Write your uniques key that you entered in the var l_sToken vriable of the Google script in the body of the letter.

    3 В зависимости от заданного в скрипте вашего проекта интервала, дождитесь, когда событие сработает. В окне сервера появится уведомление о том, что событие сработало и устройство выполнит команду.

    IFTTT 40.png


    Work with IFTTT in iRidium lite

    Work with IFTTT in iRidium lite can be set via Gmail module. Gmail module can be used to set e-mail notification about different events and to create a routine to control equipment via e-mail. Then connect Gmail to any cloud service available in IFTTT.

    Internet connection and Google account are required to work with IFTTT.
    It is recommended to use iRidium server.

    Let's have a look at 2 examples of work with this service:
    1 Sending a notification to an e-mail, when a smart home device is activated.
    An example When a leakage sensor is activated, send a notification to an e-mail.

    2 A device is activated when a letter comes to the e-mail.
    An example When a new letter comes to the e-mail, heating/cooling system must be turned on.
    Below we'll describe how to set iRidium lite projects to realize the tasks in the examples.

    Setting Gmail module

    1 Add Gmail for Server module to the project.

    IFTTT 41.png


    2 Set the interval at which the module requests Gmail service if there is a new e-mail. Press Add.

    IFTTT 42.png


    3 Go to the module and authorize in it.

    IFTTT 43.png


    IFTTT 44.png


    Press "Advanced" in the browser window that appears and follow Go to iridiummobile.net link.

    IFTTT 45.png


    Press Allow in the window that appears.
    The module is set, you can pass on to setting routines.

    Sending a notification to an e-mail, when a smart home device is activated.

    Here is the setting for the first example: when a leakage sensor is activated, send a letter to the e-mail.
    Go to the Routines section and create a server routine. (Работа с правилами)
    Select activation of a leakage sensor in the When' event:

    IFTTT 46.png


    Set sending a letter via Gmail module in Actions.
    Write the e-mail, where letters are to be sent, the topic and the text of the message.

    IFTTT 47.png


    IFTTT 48.png


    A ready routine looks this way:

    IFTTT 49.png


    The setting is complete and the routine can be tested. When sensor contacts are closed, a notification is sent to the e-mail.

    A device is activated when a letter comes to the e-mail.

    Here is the setting for the second example: when a new message with a definite topic comes to the e-mail, the heating system must be turned on.
    Go to the Routines section and create a server routine. (Work with routines)
    Set Gmail module to keep track of new letters with a definite topic in the When event.

    IFTTT 50.png


    In the topic write the name of the event and a secret key that only a user knows (if required):

    IFTTT 51.png


    IFTTT 52.png


    Select the temperature or the heating mode in Actions.

    IFTTT 53.png


    A ready routine looks this way:

    IFTTT 54.png


    The setting is complete and the routine can be tested. When a letter with a definite topic is sent to the e-mail, assigned to the Gmail module, a routine is activated and a device is turned on.

    Источник — «https://dev.iridi.com/index.php?title=IFTTT/en&oldid=74664»
    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