0
Completed
Ekaterina (head of support) 2 years ago in Products / HDL-BUS Pro • updated by Xopyc (expert) 6 days ago 6
This simple script make you able to see if the communication with HDL bus stopped.
In case of UDP broadcast connections it is not possible to see the online status of HDL IP module, so you have to look at the traffic from HDL, and if it is stopped for awhile you can show "Offline message".
See the example attached.
You can choose a time without traffic indicates the offline. It is 10 sec by default.

!HDL Online indicator.irpz
Since I program the scene setting in Switch Panel. I want to control the scene via switch panel. Can I do this?
DLP panels supports only "Panel Control" and "Universal Switch" commands. You can lounch the Sceen with executing device supports "Sceen Control" operation code.

I'm using this script in real project with Raspberry Pi server. But in the latest version of the Iridium server many errors have appeared (one after another):

[15-04-2017 20:25:36.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:36.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:36.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:36.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:36.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:36.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:36.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:36.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       WARNING SCRIPT  Script exception: RangeError: /var/lib/iRidium Server/Documents/RaspberryPi_Server/scripts/HDL_service.js:46: error
[15-04-2017 20:25:37.000]       DEBUG   SCRIPT  Script garbage memory collected. 

After performing the garbage collection, it disappears for a while, but then appears again.


function initHDLWatchdog(){
   IR.AddListener(IR.EVENT_TAG_CHANGE, HDLdevice, function(name, value){
      IR.SetVariable("Server.Tags.HDLWatchdog", 1);   
      IR.ClearInterval(idHDLWatchdogTimer); 
      idHDLWatchdogTimer = IR.SetTimeout(10000, function(){  //This line is followed by the error text                               
         debug("===There is no Data from the HDL bus for a 10 sec, offline indicated");
         IR.SetVariable("Server.Tags.HDLWatchdog", 0); 
      });    
   }); 
}


This is JS for i2 control only, not for server ;)

ok, but how check HDL is online on server?

Hello

Here is a server script


var id//global variable for timer

function offline()//function that start if hdl bus does not answer

{

IR.Log("hdl is ofline")

}

IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("HDL-BUS Pro Network (UDP)"), function(name,value)

{

IR.ClearInterval(id);//clear interval if hdl bus answer

id = IR.SetTimeout(10000, offline);//set new timer

});