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

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

    Creating your own driver

    The example shows a process of creating a driver in iRidium Studio on the basis of AV & Custom Systems (HTTP) driver.

    The documentation was updated on 20.8.2021

    Download:
    • an example of a project with API OpenWeather


    You can use AV & Custom Systems (HTTP) driver to process received informaton and/or to control equipment. To do it, you require Iridium Studio installed on a PC and any network analyzer (for example, WireShark). In the example we'll get data from https://openweathermap.org, parse them and display values in a panel project. Wireshark network analyzer is used to show that it is possible to parse data in cases when you do not know the format of sending requests to a resource (equipment) and the format of getting answers from it.

    Getting Data from a Resource

    1 Start a browser and go to the developer's website (in our example, it is https://openweathermap.org - a website providing information about weather in different locations). Choose an API request that will be executed to get data. Let's have a look at a request to get data about the current weather in London as an example.

    CreateDriver1.png

    A request of data to a resource will have the following format:

    http://api.openweathermap.org/data/2.5/weather?q={city name}&units=metric&appid={API key}, 
    
    • {city name} - the name of a city,
    • {API key} - API authentication key.

    You can read more detailed information on openweathermap official website.

    2 Start Wireshark. Choose a device to capture (a network card) in Wireshark:

    CreateDriver3.png

    3 Choose a filter - by "http":

    CreateDriver2.png

    4 Make a request in a browser ( https://clck.ru/WBLfX ), then go to Wireshark, it must capture your traffic. Find a required request among captured packets and answer it. An answer to a request returns to the JSON format, it will be parsed and displayed in the project.

    CreateDriver4.png


    Working in iRidium studio

    1 Start iRidium Studio and create four Labels, two will be used to show names of values and the other two will be used to display data about the air temperature and humidity.

    CreateDriver5.png

    2 Create AV & Custom Systems (HTTP) project driver. Open the driver parameters, find Host and enter the domain name / IP-address of a resource where a request will be sent (api.openweathermap.org/).

    CreateDriver6.jpg

    Read more detailed information in the description of AV & Custom Systems driver.

    3 To send a request to a resource, use JS methods with the help of Script Editor in iRidium Studio. Create a new script in the Studio and paste the given code to get data from the website:

    var DEVICE = IR.GetDevice("AV & Custom Systems (HTTP)");
     
    function send()
    {
        DEVICE.Send(['GET,/data/2.5/weather?q=London&appid=81fb48bd46071175ab394e5f0e54092d']);
    }
     
    IR.AddListener(IR.EVENT_START, 0, send);
     
    IR.AddListener(IR.EVENT_RECEIVE_TEXT, DEVICE, function(dataweather)
    {
        var result = JSON.Parse(dataweather);
        IR.GetPage("Page 1").GetItem("Item 1").Text = result.main.temp ;
        IR.GetPage("Page 1").GetItem("Item 2").Text = result.main.humidity;
        IR.Log(dataweather);
    });

    4 To display current data about the weather all the time, you can create a request that will be sent automatically at a set interval. It can be done with the IR.SetInterval method:

    IR.AddListener(IR.EVENT_ITEM_SHOW, IR.GetItem("Page 1"), function()
    {
        var ID = IR.SetInterval(5000, send); //5sec
    });
     
    IR.AddListener(IR.EVENT_ITEM_HIDE,IR.GetItem("Page 1"),function()
    {
        IR.ClearInterval(ID);
    });

    AV & Custom Systems (HTTP) does not keep an open connection, Online and Status tokens of the driver display the connection status the moment a request is sent, and an answer is received.

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