Maybe someone can help me. I have looked on the forum for a good sample script of a general alarm handler.
This is the case: I have multiple things that can raise an alarm connected to IPS, for instance: tempertuur reading of the solar installation thet trigger an alarm when hotter then > 95, temperture reading of multiple vessels that trigger when > 80, flow reading in case the pump is not working, multiple door and window contacts from HM, smoke detectors, a wind messure device that will give an alarm when wind >55 knots, etc. etc. Also setting the alarm when I am away could be controlled with this!
Of course I can put them all in seprate variable but that would be hard to follow and display in one view. I can also put them in an array and add or delete something when an alarm raises or trips.
Does any of you have a good idea how to set this up? Or do you have some sample code/ sample project?
Thanks for the reply… It looks simple the code and very usefull.
I don’t have any problem with reading in German, only writing in German is difficult. I don’t know if de moderators will let me start an English topic the German topics else I would have placed it there. Maybe I just have to try it an see what will happen :).
I have some questions… hopefully you can help me with it:
Do you also use it to read back if an alarm has been raised. This to prevent that you keep writing messages in the log. Example: on a variable change of a temperature I have some code that checks if the temperature is not above 95 C. When it’s too high it will trip an alarm. But in the meantime the temperature keeps rising which can give it an alarm again. I have an extra alarm set on 105 C that will send a sms to different mobile numbers. How would you do this? Put an global variable in say ‘Alarm95Solar’ which you set when the temperature is too high and reset it when it drops below the 95?
Do you put this function in every php script where an alarm can be raised? Or is there a way to call a function from a different file? I tried to do this, call a function from another file but couldn’t get it to work. It would be nice to have a function base so that I can reuse the code.
Do you put this function in every php script where an alarm can be raised? Or is there a way to call a function from a different file? I tried to do this, call a function from another file but couldn’t get it to work. It would be nice to have a function base so that I can reuse the code.
You can put this function in to another script (for instance the Name of the script is 12345.ips.php), then you can use this function, if you use the include() statment
To Your example.
You have a temperature variable. If the Value is changing, then it will starts an Script like this
include'12345.ips.php';//you have to use the filename
if ($IPS_OLDVALUE < 95 and $IPS_VALUE >= 95){ //Value exceeds 95°
SetMessageList(51809 /*[MessageBox]*/,"Solar","Temperatur $IPS_VALUE ");
}
if ($IPS_OLDVALUE < 105 and $IPS_VALUE >= 105){
// send SMS
// pray for clouds
}
I couldn’t find $IPS_OLDVALUE in the documentation either but after a search on the forum I found a peace of samplecode from Attain… the thing is that you have to trigger the script through the varable change (Attain will explain this when you follow the link