Skip to main content

Notifications of climate control system malfunctions

This article considers a situation where the current temperature does not reach the setpoint for a long time. In this case, the user must be notified that the equipment is not operating correctly.

For example, the user must be notified if the difference between the current temperature and the setpoint exceeds 4 degrees for 4 hours.

Use these instructions to implement this example.

  1. Create a new project or open an existing one
  2. Add and configure the driver you will use
  3. Create feedbacks to display the temperature setpoint and the current temperature

TempDeviation_1.png

  1. Create a new script and add the following:
IR.AddListener(IR.EVENT_START,0,function() {

var l_nIntervalMilsec = 1000*60*60*4; // conversion 4 hours to a miliseconds
var MinTempDeviation = 4; // Minimum temperature outflow
var l_sDriverName = "KNX IP BAOS 770"; // The name of the driver used in the project.
var l_sSetTemp = "SetTemp"; // Name of the feedback temperature setpoint
var l_sTemp = "TempSensor"; // Name of the temperature sensor feedback

var l_nTimer = 0; // Number of seconds for the interval
var l_nInterval = 0; // Interval

// When the temperature arrives, we check if the temperature is higher than the set one, then we set the interval for counting 4 hours
// Remove interval if everything is ok
IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice(l_sDriverName), function(m_sName, m_sValue){
if(m_sName == l_sTemp) {
var m_nSetTemp = IR.GetVariable("Drivers."+l_sDriverName+"."+l_sSetTemp);
if(Math.abs(m_nSetTemp - m_sValue) > MinTempDeviation){
if(l_nInterval == 0){
SetInterval();
}
} else {
if(l_nInterval != 0){
IR.ClearInterval(l_nInterval);
l_nInterval = 0;
}
}
}
});

// The function sets the interval in which the temperature will be compared.
function SetInterval(){
l_nInterval = IR.SetInterval(1000, function(){
var m_nSetTemp = IR.GetVariable("Drivers."+l_sDriverName+"."+l_sSetTemp);
var m_nTemp = IR.GetVariable("Drivers."+l_sDriverName+"."+l_sTemp);
if(Math.abs(m_nSetTemp-m_nTemp) > MinTempDeviation){
l_nTimer++;
if(l_nTimer >= l_nIntervalMilsec){
Alarm();
l_nTimer = 0;
}
}
});
}

// The function that calls the necessary notification - inside this function you can use the necessary notification method
function Alarm(){
IR.Log("Attention temperature difference of 4 degrees is kept for 4 hours");
}
});
  1. Enter your values in the variables:
  • l_nIntervalMilsec - time interval in milliseconds;
  • MinTempDeviation - temperature difference;
  • l_sDriverName - name of the driver used in the project;
  • l_sSetTemp - name of the feedback displaying the temperature setpoint;
  • l_sTemp - name of the feedback displaying the current temperature;
  1. In the Alarm function, enter the required method for notifying the user. For example, you can use Push notifications.
Tip

download: example