Creating your own driver
This example demonstrates how to create a driver in iRidi Studio based on the AV & Custom Systems (HTTP) driver.
Documentation updated 01.01.2024
To process received data and/or control equipment, you can use the AV & Custom Systems (HTTP) driver. This requires iRidi Studio installed on a PC and any local network traffic analyzer (for example, WireShark). In this example, we retrieve data from https://openweathermap.org, parse it, and display the values in a Panel Project. The traffic analyzer (Wireshark) is used only to demonstrate how to parse data when the format of requests sent to the resource (equipment) and its responses is unknown.
Retrieving data from a resource
- Start a browser and open the developer's website (in this example, a website providing weather information for your city and other cities: https://openweathermap.org). Select the API request you will use to retrieve data. This example uses a request for the current weather in "London".

The format of a data request to the resource is as follows:
http://api.openweathermap.org/data/2.5/weather?q=**{city name}** &units=metric&appid=**{API key}** ,
{city name}- city,{API key}- API key for authentication.
- For more information, see the official website: openweathermap.
- Start Wireshark. In Wireshark, select your capture device (network adapter):

- Set the filter to "http":

- Send the request in the browser ( https://clck.ru/WBLfX ), then switch to Wireshark, which should capture your traffic. Find the required request and its response among the captured packets. The response is returned in JSON format; we will parse it and display the data in the project.

Working in iRidi Studio
- Start iRidi Studio and create 4 Label items: two for value captions and two to display air temperature and humidity data.

- Create an AV & Custom Systems (HTTP) project driver. In the driver properties, set Host to the domain name / IP address of the resource that will receive requests (api.openweathermap.org/).

- For more information, see the description of the AV & Custom Systems.
- To send a request to the resource, use JS methods in the Script Editor built into iRidi Studio. Create a new script in Studio and paste this code to retrieve 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);
});
- To keep the data current, you can poll the resource automatically at a time interval. To do this, use IR.SetInterval:
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);
});
- The AV & Custom Systems (HTTP) driver does not keep the connection open. Its Online and Status tokens indicate the connection status only while sending a request and receiving a response.