ich nutze aktuell folgendes Script, um mir die offenen Fenster bei Verlassen des Hauses anzuzeigen:
Code: Alles auswählen
string message; string now; string present; string status; string msg1; string msg2;
var var_fensterkontakte = dom.GetObject(ID_SYSTEM_VARIABLES).Get("var_Fensterkontakte").Value();
! +++++++++++ Setup Script ++++++++++++++++
string ONLYOPEN= "yes"; ! if yes pushed only the opened sensors
string FUNCTIONS = "Fensterkontakte"; ! which function / room / favorites
boolean DEBUG = true; ! true/false zusaetzliche Ausgabe des Scriptes auf dem Monitor
! +++++ Setzen der Priorität für die Push-Nachricht +++++
(dom.GetObject(ID_SYSTEM_VARIABLES).Get(svPushPrio)).State("0");
!++++++ DONT TOUCH BEHIND THIS LINE +++++++++
string i;
string slist;
integer count = 0;
var sec=dom.GetObject(FUNCTIONS);
if ( (DEBUG == true) && (!sec) ){ WriteLine(" Gewerk nicht vorhanden");quit;}
foreach(i,sec.EnumUsedIDs()) {
string status_new = "unbekannt";
boolean choice = false;
boolean status = false;
var ch = dom.GetObject(i);
if ( ch.IsTypeOf(OT_CHANNEL) ) {
var dev = dom.GetObject(ch.Device());
var chType = ch.HssType();
var devType = dev.HssType();
string room; string id; foreach(id, ch.ChnRoom()) { var roomi = dom.GetObject(id); room = room # " "# roomi.Name() ; }
if ( ( chType == "SHUTTER_CONTACT") || ( chType == "ROTARY_HANDLE_SENSOR") || ( chType == "ROTARY_HANDLE_TRANSCEIVER") ) { choice = true; var status = ch.DPByHssDP("STATE").Value();}
if ( ( devType == "HMW-Sen-SC-12-DR") && ( chType == "SENSOR") ) { choice = true; var status = ch.DPByHssDP("SENSOR").Value();}
if (choice){
if (status) { count = count +1; }
if (status == 0 ) { status_new = " zu "; }
if (status == 1 ) { status_new = " gekippt "; }
if (status == 2 ) { status_new = " offen "; }
if (ONLYOPEN == "yes") {
if (status) { slist=slist # dev.Name() #" - Status: " # status_new #" - im Raum: "#room #"\n"; }
} else { slist=slist # dev.Name() #" - Status: " # status_new #" - im Raum: "#room #"\n"; }
}
}
if(count > 0) { msg1 = (count #" offen \n" #slist).ToUTF8(); }
else { msg1 = "Es ist sind alle Fenster geschlossen"; }
}
!Überprüfen ob alle Fenster zu sind, dann erst Alarmanlage scharf stellen
if( (count == 0) ) {
var sirene_scharf = (dom.GetObject(ID_DATAPOINTS)).Get("BidCos-RF.OEQ0491823:4.ARMSTATE").State(2); !Sirene scharf
dom.GetObject(ID_SYSTEM_VARIABLES).Get("Alarmanlage_aktivieren_zeitverzoegert").State(1); !Alarmanlage zeitverzögert scharf stellen
}
Wie würdet ihr das lösen, sich das zuletzt geöffnete Fenster schicken zu lassen?
Viele Grüße