viewtopic.php?f=19&t=48398#p485390
alchy hat geschrieben: ↑16.01.2019, 14:30The script reads when executed the battery state for RF & IP sensors and saves them in a list in a system variable when available.
Code: Alles auswählen
Read all battery stats of all devices and save them in system variable ! v0.2 (c) by Alchy var svout = "Name of your system variable"; ! Name of the System Variable Typ string where list should be saved ! ++++++ Don't change ++++++++++ string svId;string oSV;string slist = "";integer count = 0; foreach(svId, dom.GetObject(ID_DATAPOINTS).EnumUsedIDs()) { object oSV = dom.GetObject(svId); if(oSV.TypeName() == "HSSDP") { object oCH = dom.GetObject(oSV.Channel()); object oDev = dom.GetObject(oCH.Device()); if ( (oSV.HssType() == "BATTERY_STATE") || (oSV.HssType() == "OPERATING_VOLTAGE") && (!oSV.Value() == 0.0 ) ) { count = count + 1 ; slist = slist #count #". "#oDev.Name() #" Batteriespannung : "#oSV.Value().ToString(1)#" V\n"; }}} if ( (dom.GetObject(ID_SYSTEM_VARIABLES)).Get(svout) ) { dom.GetObject(ID_SYSTEM_VARIABLES).Get(svout).State(slist); WriteLine(slist #" \r\t in Variable: " #svout #" eingetragen");}else{WriteLine("\tAchtung: Variable: " #svout #" : für den Wert:\n"#slist #"\n\t nicht vorhanden");}