Writing and Reading Server Variables from JS
Server variables are Driver Tokens, Channels, Tags, as well as Virtual Channels and Virtual Tags. They can be changed and requested from control panels (send command, display feedback) and from script, located on the Server.
Server Variables are available for writing and reading with the help of the following systems IR.GetVariable(name)
and IR.SetVariable(name, value)
in Server script.
Server Variables for control panels look like commands and channels on any other driver. That's why API iRidium. Drivers methods can be used for them.
Writing value to the variable
1. Copy the full name of a variable from IRIDIUM SERVER
tab.
2. Use IR.SetVariable method to write a value to the variable:
Constructor
IR.SetVariable(<span style="color: rgb(79, 129, 189);">"Server.Path.Name"</span>, value) OR IR.SetVariable(<span style="color: rgb(79, 129, 189);">"Server.Path.DriverName.Name"</span>, value)
At the input | Value | Description |
Server.Path.Name | Server.Channels.Virtual 1 | type: string. Full name of server variable |
Server.Path.DriverName.Name | Server.Channels.KNX.Dimmer | type: string Full name driver variable |
Value | 100 | type: string, number, boolean Value to write to the server variable |
At the ouput | ||
success | true | тип: boolean successful writing |
For example
IR.AddListener(IR.EVENT_START, 0, function(){ IR.SetVariable("Server.Channels.Virtual 1", 100); });
IR.AddListener(IR.EVENT_START, 0, function() { IR.SetVariable("Server.Channels.KNX.Dimmer", 100); });
Read variable value
1. Copy the full name of a variable from IRIDIUM SERVER
tab.
2. Use IR.SetVariable method to read a value to the variable: :
Constructor
IR.GetVariable(<span style="color: rgb(79, 129, 189);">"Server.Path.Name"</span>) or IR.GetVariable(<span style="color: rgb(79, 129, 189);">"Server.Path.DriverName.Name"</span>)
At the input | Value | Description |
Server.Path.Name | Server.Channels.Virtual 1 | Type: string Full name of server variable |
Server.Path.DriverName.Name | Server.Channels.KNX.Dimmer | Type: string Full name of driver variable |
At the ouput | ||
value | 100 | Type: string, number, boolean value of server variable |
For example
IR.AddListener(IR.EVENT_START, 0, function(){ IR.GetVariable("Server.Channels.Virtual 1"); }); Method can be applied to server channels and server tag <img src="/s/attachments/15553/6/6264/7378ae4d008d7f713a563b990d29a74e.png"> IR.AddListener(IR.EVENT_START, 0, function(){ IR.GetVariable("Server.Channels.KNX.Dimmer"); });
Customer support service by UserEcho