version 1.9.1
This commit is contained in:
@@ -32,13 +32,19 @@ class MonitoringServer extends IPSModule {
|
|||||||
|
|
||||||
|
|
||||||
$this->RegisterTimer("UpdateAlarms", 0, 'SEMS_checkAlarms('.$this->InstanceID.');');
|
$this->RegisterTimer("UpdateAlarms", 0, 'SEMS_checkAlarms('.$this->InstanceID.');');
|
||||||
$this->RegisterTimer("UpdateValues", 0, 'SEMS_checkValues('.$this->InstanceID.');');
|
$this->RegisterTimer("UpdateValues", 0, 'SEMS_checkValues('.$this->InstanceID.',false);');
|
||||||
|
$this->RegisterTimer("ForceUpdateValues", 0, 'SEMS_checkValues('.$this->InstanceID.',true);');
|
||||||
|
|
||||||
$this->RegisterVariableInteger("AlarmVarCount", "Number of Alarmvalues", "", 0);
|
$this->RegisterVariableInteger("AlarmVarCount", "Number of Alarmvalues", "", 0);
|
||||||
$this->RegisterVariableInteger("AlarmActiveCount", "Number of Values in Alarmstate", "", 1);
|
$this->RegisterVariableInteger("AlarmActiveCount", "Number of Values in Alarmstate", "", 1);
|
||||||
$this->RegisterVariableInteger("AnalogVarCount", "Number of Analogvalues", "", 2);
|
$this->RegisterVariableInteger("AnalogVarCount", "Number of Analogvalues", "", 2);
|
||||||
$this->RegisterVariableInteger("DigitalVarCount", "Number of DigitalValues", "", 3);
|
$this->RegisterVariableInteger("DigitalVarCount", "Number of DigitalValues", "", 3);
|
||||||
|
|
||||||
|
$this->RegisterVariableString("Alarmtable", "Alarmhistorie", "~HTMLBox", 30);
|
||||||
|
$this->RegisterAttributeString("AtAlarmtable", "");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -49,6 +55,8 @@ class MonitoringServer extends IPSModule {
|
|||||||
|
|
||||||
$this->SetTimerInterval("UpdateAlarms", $this->ReadPropertyInteger("UpdateintervallAlarms") * 1000);
|
$this->SetTimerInterval("UpdateAlarms", $this->ReadPropertyInteger("UpdateintervallAlarms") * 1000);
|
||||||
$this->SetTimerInterval("UpdateValues", $this->ReadPropertyInteger("UpdateintervallValues") * 1000);
|
$this->SetTimerInterval("UpdateValues", $this->ReadPropertyInteger("UpdateintervallValues") * 1000);
|
||||||
|
$this->SetTimerInterval("ForceUpdateValues", $this->ReadPropertyInteger("UpdateintervallForceValues") * 1000 * 60);
|
||||||
|
|
||||||
$this->clearNames();
|
$this->clearNames();
|
||||||
|
|
||||||
// Diese Zeile nicht löschen
|
// Diese Zeile nicht löschen
|
||||||
@@ -169,7 +177,7 @@ class MonitoringServer extends IPSModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function checkValues() {
|
public function checkValues($force) {
|
||||||
|
|
||||||
$catNotifyId = $this->ReadPropertyInteger("ParseNotifyCategoryID");
|
$catNotifyId = $this->ReadPropertyInteger("ParseNotifyCategoryID");
|
||||||
$catAnalogId = $this->ReadPropertyInteger("ParseAnalogCategoryID");
|
$catAnalogId = $this->ReadPropertyInteger("ParseAnalogCategoryID");
|
||||||
@@ -180,7 +188,6 @@ class MonitoringServer extends IPSModule {
|
|||||||
$ispnumber = $this->ReadPropertyInteger("ISP");
|
$ispnumber = $this->ReadPropertyInteger("ISP");
|
||||||
|
|
||||||
$logit = $this->ReadPropertyBoolean("LogValues");
|
$logit = $this->ReadPropertyBoolean("LogValues");
|
||||||
$logit = $this->ReadPropertyBoolean("LogValues");
|
|
||||||
|
|
||||||
|
|
||||||
$numberofvalues = 0;
|
$numberofvalues = 0;
|
||||||
@@ -215,7 +222,7 @@ class MonitoringServer extends IPSModule {
|
|||||||
|
|
||||||
|
|
||||||
$numberofvalues++;
|
$numberofvalues++;
|
||||||
if($changedtime > $time - $updatetime){
|
if(($changedtime > $time - $updatetime) | $force){
|
||||||
|
|
||||||
$parname = str_replace(" ","", $parname);
|
$parname = str_replace(" ","", $parname);
|
||||||
$varname = str_replace(" ","", $varname);
|
$varname = str_replace(" ","", $varname);
|
||||||
@@ -241,13 +248,15 @@ class MonitoringServer extends IPSModule {
|
|||||||
$valuename = $parname."".$varname;
|
$valuename = $parname."".$varname;
|
||||||
|
|
||||||
//IPS_LogMessage ("Analog Var-Logger", "Ready: ".$system."/".$category."/".$valuename." with Value: ".$payload);
|
//IPS_LogMessage ("Analog Var-Logger", "Ready: ".$system."/".$category."/".$valuename." with Value: ".$payload);
|
||||||
|
if ($logit == true){
|
||||||
if($this->checkInfluxState() > -1){
|
if($this->checkInfluxState() > -1){
|
||||||
$this->Write2Influx($payload, $ssl, $server, $port, $db, $system, $category, $valuename);
|
$this->Write2Influx($payload, $ssl, $server, $port, $db, $system, $category, $valuename);
|
||||||
IPS_LogMessage ("Analog Var-Logger", "LOGGED: ".$system."/".$category."/".$valuename." with Value: ".$payload);
|
IPS_LogMessage ("Analog Var-Logger", "LOGGED: ".$system."/".$category."/".$valuename." with Value: ".$payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -287,10 +296,11 @@ class MonitoringServer extends IPSModule {
|
|||||||
$category = $system."_Digital";
|
$category = $system."_Digital";
|
||||||
$valuename = $parname."_".$varname;
|
$valuename = $parname."_".$varname;
|
||||||
|
|
||||||
|
if ($logit == true){
|
||||||
if($this->checkInfluxState() > -1){
|
if($this->checkInfluxState() > -1){
|
||||||
$this->Write2Influx($payload, $ssl, $server, $port, $db, $system, $category, $valuename);
|
$this->Write2Influx($payload, $ssl, $server, $port, $db, $system, $category, $valuename);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,16 +311,15 @@ class MonitoringServer extends IPSModule {
|
|||||||
}
|
}
|
||||||
SetValueInteger($this->GetIDForIdent("DigitalVarCount"),$numberofvalues);
|
SetValueInteger($this->GetIDForIdent("DigitalVarCount"),$numberofvalues);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private function notify($trigid, $webfrontid, $targetid, $projectnumber, $projectname, $ispnr){
|
private function notify($trigid, $webfrontid, $targetid, $projectnumber, $projectname, $ispnr){
|
||||||
|
|
||||||
|
$tdOld = $this->ReadAttributeString("AtAlarmtable");
|
||||||
|
$td = $tdOld;
|
||||||
|
|
||||||
|
$time = date("Y-m-d H:i:s");
|
||||||
|
|
||||||
$art = $projectnumber." | ".$projectname. " | ISP ".$ispnr;
|
$art = $projectnumber." | ".$projectname. " | ISP ".$ispnr;
|
||||||
$ico = "Flame";
|
$ico = "Flame";
|
||||||
@@ -322,19 +331,49 @@ class MonitoringServer extends IPSModule {
|
|||||||
$this->SetBuffer($smname, "false");
|
$this->SetBuffer($smname, "false");
|
||||||
|
|
||||||
VISU_PostNotification($webfrontid, $art, $smname, $ico, $targetid);
|
VISU_PostNotification($webfrontid, $art, $smname, $ico, $targetid);
|
||||||
WFC_PushNotification($webfrontid, $art, $smname, "", $targetid);
|
|
||||||
|
$td = '<tr><td>'.$smname.'</td><td>'.$time.'</td></tr>'.$tdOld;
|
||||||
|
$this->WriteAttributeString("AtAlarmtable", $td);
|
||||||
|
IPS_LogMessage ("Notify", "Alarmhistory updated");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
elseif (GetValue($trigid) == false) {
|
elseif (GetValue($trigid) == false) {
|
||||||
$this->SetBuffer($smname, "true");
|
$this->SetBuffer($smname, "true");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$style = '<style>
|
||||||
|
|
||||||
|
th {
|
||||||
|
background-color: lightblue;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
border-top: 1px solid grey;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr:hover {background-color: grey;}
|
||||||
|
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
';
|
||||||
|
$table = $style.'<table width=100%><tr><th>Name</th><th>Zeit / Datum</th></tr>'.$td.'</table>';
|
||||||
|
SetValueString($this->GetIDForIdent("Alarmtable"), $table);
|
||||||
|
IPS_LogMessage ("Notify", "Alarmhistory writen");
|
||||||
|
|
||||||
if (GetValue($trigid) == true){
|
if (GetValue($trigid) == true){
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getTextAfterLastSlash($inputString) {
|
private function getTextAfterLastSlash($inputString) {
|
||||||
|
|||||||
+1
-1
@@ -8,6 +8,6 @@
|
|||||||
"date": 1491343200
|
"date": 1491343200
|
||||||
},
|
},
|
||||||
"version": "1.9",
|
"version": "1.9",
|
||||||
"build": 0,
|
"build": 1,
|
||||||
"date": 0
|
"date": 0
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user