Internal and External connection switching
You can see an examples for your equipment here:
- Domintell
- EPSNET
- HDL-BUS Pro
- Helvar
- KNX (any KNX IP gateways and routers)
- KNX IP BAOS by Weinzierl
- Modbus
- Global Cache
- AV & Custom Systems
- AMX
- Clipsal
- Crestron
Channel properties, driver properties
- properties of command, created via the GUI Editor in the project Tree. You can only call this command by the name.
- connection settings of driver, created in the Project tree or via the script.
HTTP standard driver wait response
IR.GetDevice('DEVICE').Send(['GET,/remoteAction=11,']);
The driver is not waiting for 5 seconds becauseit is getting something back from the device.
Example of HTTP request
GET /wiki/HTTP HTTP/1.0\r\n Host: ru.wikipedia.org\r\n \r\n
IR.GetDevice("DEVICE").Send(['GET /wiki/HTTP HTTP/1.0\r\nHost: ru.wikipedia.org\r\n\r\n']);
Adding multiple copies of the same custom device driver in a project
By default you have one item:
var mydevice = new Marantz_sr7007_main("Marantz SR7007_first_device");If you need to make 1 or 2 more items:
var mydevice1 = new Marantz_sr7007_main("Marantz SR7007_first_device"); var mydevice2 = new Marantz_sr7007_main("Marantz SR7007_second_device"); var mydevice3 = new Marantz_sr7007_main("Marantz SR7007_third_device");
What is the difference between "Built-in iRidium drivers" and "JS Modules"?
Script drivers are always created on the base of the native AV & Custom Systems driver with the help of iRidium scripts (the programming language based on Java Script). They are used for controlling any systems which are not included int he standard iRidium base.
Usually the script drivers are distributed with the visualization project (for example, XBMC, Sonos, iTunes, ... ).
Javascript syntax checking
Logging Affects Performance of your projects
This is relevant for low power devices ( IOS \ Android ) given their limited CPU power.
"IF" and "ELSE IF" conditions for Tag Change Event. Show Popup when the Driver Feedback = 1
The Modbus structure is not an "event based". It sends the value from each Feedback to iRidium each second, so the TAG_CHANGE_EVENT fires every time for the same value. It is not good when you use TAG_CHANGE_EVENT to make some action like Show Popup when the channel goes to 1 (popup showed every second in this case).
You can use an additional condition which triggering channel only ones, when it changes value from X to Y.
Example: "Show Popup when the Modbus Feedback = 1"
var reject = 0; // it locks the condition when the value not really changes IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("Modbus (TCP)"), function(name,value) { if (name == "Feedback 1" && value == 0) // feedback changes from 1 to 0 { reject = 0; } else if (name == "Command 2" && value == 1 && reject == 0) // feedback changes from 0 to 1 or it stays 1 for some time { IR.ShowPopup('Popup 1'); reject = 1; } });
OpenPopupOnChange.irpz
"OR" condition. Turn on the Item if one of feedbacks is not a zero
You can use it, for example, when you need to activate item or make an action only if one of the feedbacks from the list > 0:
var deviceName = "KNX"; // Driver Name var ChannelBuff = ['Dimmer', 'f32', 'u32', 's32', 'u16', 's16']; // List of Feedbacks var projectToken = "MyProjectToken"; // Project Token name function CheckChannels(DeviceID, _ChannelBuff, _Token) { DeviceID = IR.GetDevice(DeviceID); // Get the device ID for (var i = 0; i <= _ChannelBuff.length - 1; i++) // Check the Feedbacks if(DeviceID.GetFeedback(_ChannelBuff[i]) > 0) // If the Feedback > 0, then write 1 to Project Token IR.SetVariable("Global." + projectToken, 1) } IR.AddListener(IR.EVENT_TAG_CHANGE , IR.GetDevice(deviceName), function(name,value) { IR.SetVariable("Global." + projectToken, 0); CheckChannels(deviceName, ChannelBuff, projectToken); })
ONifOneTokenNotAzero.irpz
ONifOneChannelNotAzero.irpz
"IF" and "ELSE IF" for the data received. Change Item by receiving some Value
if (condition1 && condition2) { <action> };
Conditions in iRidium must be performed inside of EVENTS, which allows you to use some data, generated by events:
IR.AddListener(IR.EVENT_TAG_CHANGE , IR.GetDevice("MyDriver"), function(name,value) { <action> });
EVENT_TAG_CHANGE sends you a name and value of the Driver's Feedback in your project, which changes now. So, you can use a name of the feedback and value of this feedback in your conditions.
IR.AddListener(IR.EVENT_TAG_CHANGE , IR.GetDevice("MyDriver"), function(name,value) { if (name == "Feedback 1" && value == 100) { IR.Log("got 100 from Feedback 1"); IR.GetItem("Page 1").GetItem("Item 1").Value = 1; //got 100 but set 1 in Item } else if () { IR.Log("got something else"); } });
Pass an HTTP request variable in JSON format
Description:
http://wiki2.iridiummobile.ru/Drivers_API#JSON.Stringify
Example:
device.Send(['PUT,/api\r\n\HTTP/1.1,' + JSON.Stringify(request) + ',\r\n\r\n']);
error body contains invalid json - this answer from server. Maybe missed char end of line ',\r\n\r\n'.
Send command in HEX
IR.AddListener(IR.EVENT_CHANNEL_SET,that.device,function(name) { that.Msg = IR.GetVariable("Drivers."+that.DriverName+".Telegram"); //Msg string will be "7F F2 FA 00 01 00 BD 67 FA FF FE 06 87 0D" IR.Log("Driver: Msg = "+ that.Msg); that.device.Send([that.Msg]); });
var value = parseInt("FF", 16);
for(var cnt=0;cnt { partMSG=telegram.substring(cnt,cnt+2); partTel = parseInt(partMSG, 16); that.device.Send([partTel]); }
HTTP Send Command
IR.GetDevice("DEVICE").Send(['GET,getverion\r\n HTTP 1.1', '\r\n\r\n']); IR.GetDevice("DEVICE").Send(['PUT,getverion\r\n HTTP 1.1', '\r\n\r\n']); IR.GetDevice("DEVICE").Send(['POST,getverion\r\n HTTP 1.1', '\r\n\r\n']);
Device.Send(['GET,/data/path/data.xml,']);use "," for end of string
Send several ir codes from a slider
LevelIR__1_.irpz
Notifications for iOS
At the moment notifications for the background mode (minimized or closed application) are not supported.
1. Notify about disconnecting from equipment (Offline)
/***** online notification ****/ IR.AddListener(IR.EVENT_OFFLINE, IR.GetDevice("My Driver"), function() { IR.GetItem("Page 1").GetItem("Item 1").Text = IR.GetVariable("System.Time.24") + " System Offline"; // notification IR.GetItem("Page 1").GetItem("Item 1").GetState(0).TextColor = 0xFF0000FF; // text color });3. Automatic opening of the popup when activating a channel
/***** event notification (Tag Change) ****/ var old_value1 = -1; // do not show notification if the previous state is the same var old_value2 = -1; IR.AddListener(IR.EVENT_START, 0, function() { IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("My Driver"), function(name, value) { if (name == 'Channel 10' && value == 1 && value != old_value1){ // Check the Value = 1 in Feedback "Channel 10" IR.ShowPopup("Notify_danger"); IR.GetItem("Popup 1").GetItem("Item_Display").Text = IR.GetVariable("System.Time.24") + " Lamp in Garden broken"; old_value1 = value; } else if (name == 'Channel 10' && value == 2 && value != old_value2){ // Check the feedback "Channel 10'" IR.ShowPopup("Notify_important"); IR.GetItem("Popup 1").GetItem("Item_Display").Text = IR.GetVariable("System.Time.24") + " Lamp in Garden Response Failed. Please Check"; old_value2 = value; } });4. Play a sound at channel activation
/***** event notification (Tag Change) ****/ IR.AddListener(IR.EVENT_START, 0, function() { IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("My Driver"), function(name, value) { if (name == 'Channel 11' && value == 1){ // Check the Value = 1 in Feedback "Channel 11" IR.PlaySound('BEEP1.WAV',1,70); // Play Sound ('name',slot,volume) IR.GetItem("Page 1").GetItem("Item 5").Text = IR.GetVariable("System.Time.24") + " Incoming Call"; } });
Parallax Effect (3D background in the project)
Use the script from example to make a Parallax Effect for your projects background.
Background Image should be bigger than the base page
Parallax_Effect.irpz
Custom Password in GUI for secured Page
you can use this script (see attachment, script is in the "JS" tab in GUI Editor)
Lists and Single/Double Tap on list item distinguishing
Hi everybody,
I decided to write this post as I haven't found any clear solutions for the tasks I met. Writing a driver for Autonomic Mirage Media Server (MMS) I faced the necessity to provide a good way for the user to manage content of the media server so that the user could find and select the media to include into 'now playing' list. Imagine the following situation. A user wants to find a content to play by genre. I want to show on the popup both the list of genres as well as the list of albums related to the selected genre. Once the user choose a specific album, I want to show both the list of albums, related to the selected genre, as well as the list of songs within the selected album. Of course there are a number of ways how to organize that but I didn't want to have a mess of popups and I wanted the user to clearly understand the 'chain'.
Thus I decided to do the following. A created a popup with a static list of 'list' popups. At once only two 'list' popups are visible. Once the user chooses the item in the left list within the 'list' popup, I scroll the static list so that the right 'list' popup becomes the left one and the third 'list' popup becomes visible... I didn't use the practice to populate a single list with different data as in a real life so called 'list popups' will have completely different layout.
One more thing to be mentioned: I wanted to distinguish a single tap on the list item from a double tap and do different things. For instance I wanted to show special popup on the double tap on the item so that the user could choose whether to play the album/song immediately or just add it to the playlist.
In the attached project there are both technics are shown. Probably there is an easier way to do the same or I reinvented the wheel...
Vladimir Makarov
NestedLists.irpz
Сервис поддержки клиентов работает на платформе UserEcho