Major Changes for Alarmhandling
This commit is contained in:
@@ -11,6 +11,18 @@
|
|||||||
{ "type": "NumberSpinner", "name": "ISP", "caption": "ISP-Number" },
|
{ "type": "NumberSpinner", "name": "ISP", "caption": "ISP-Number" },
|
||||||
{ "type": "SelectInstance", "name": "VisuId", "caption": "Web Visu" },
|
{ "type": "SelectInstance", "name": "VisuId", "caption": "Web Visu" },
|
||||||
{ "type": "CheckBox", "name": "SendNotification", "caption": "Send Notification" },
|
{ "type": "CheckBox", "name": "SendNotification", "caption": "Send Notification" },
|
||||||
|
|
||||||
|
{ "type": "CheckBox", "name": "SendWhatsapp", "caption": "Send Whatsapp" },
|
||||||
|
{ "type": "SelectInstance", "name": "WhatappInst", "caption": "Whatsapp Insance" },
|
||||||
|
{ "type": "ValidationTextBox", "name": "WhatsappNumbers", "caption": "Whatsapp-Numbers" },
|
||||||
|
|
||||||
|
{ "type": "CheckBox", "name": "SendMail", "caption": "Send Mail" },
|
||||||
|
{ "type": "SelectInstance", "name": "MailInst", "caption": "Mail Insance"},
|
||||||
|
{ "type": "ValidationTextBox", "name": "MailAdresses", "caption": "Mail-Adresses" },
|
||||||
|
|
||||||
|
{ "type": "CheckBox", "name": "SendDiscord", "caption": "Send Discord" },
|
||||||
|
{ "type": "SelectInstance", "name": "DiscordInst", "caption": "Discord Insance"},
|
||||||
|
|
||||||
{ "type": "CheckBox", "name": "LogValues", "caption": "Log Values" },
|
{ "type": "CheckBox", "name": "LogValues", "caption": "Log Values" },
|
||||||
|
|
||||||
{ "type": "Select", "name": "SslHttp", "caption": "SSL ?",
|
{ "type": "Select", "name": "SslHttp", "caption": "SSL ?",
|
||||||
|
|||||||
@@ -20,6 +20,17 @@ class MonitoringServer extends IPSModule {
|
|||||||
|
|
||||||
$this->RegisterPropertyBoolean("SendNotification","false");
|
$this->RegisterPropertyBoolean("SendNotification","false");
|
||||||
|
|
||||||
|
$this->RegisterPropertyBoolean("SendWhatsapp",false);
|
||||||
|
$this->RegisterPropertyInteger("WhatappInst", 0);
|
||||||
|
$this->RegisterPropertyString("WhatsappNumbers", "0159123456789,0157987456123");
|
||||||
|
|
||||||
|
$this->RegisterPropertyBoolean("SendMail",false);
|
||||||
|
$this->RegisterPropertyInteger("MailInst", 0);
|
||||||
|
$this->RegisterPropertyString("MailAdresses", "hallo@mail.com,info@stoerung.de");
|
||||||
|
|
||||||
|
$this->RegisterPropertyBoolean("SendDiscord",false);
|
||||||
|
$this->RegisterPropertyInteger("DiscordInst", 0);
|
||||||
|
|
||||||
$this->RegisterPropertyBoolean("LogValues","true");
|
$this->RegisterPropertyBoolean("LogValues","true");
|
||||||
|
|
||||||
$this->RegisterPropertyString("SslHttp","http://");
|
$this->RegisterPropertyString("SslHttp","http://");
|
||||||
@@ -150,7 +161,7 @@ class MonitoringServer extends IPSModule {
|
|||||||
$projectname = $this->ReadPropertyString("Projectname");
|
$projectname = $this->ReadPropertyString("Projectname");
|
||||||
$ispnumber = $this->ReadPropertyInteger("ISP");
|
$ispnumber = $this->ReadPropertyInteger("ISP");
|
||||||
|
|
||||||
$sendit = $this->ReadPropertyBoolean("SendNotification");
|
|
||||||
$inalarmcount = 0;
|
$inalarmcount = 0;
|
||||||
$alarmvalues = 0;
|
$alarmvalues = 0;
|
||||||
$catChilds = IPS_GetChildrenIDs($catAlarmId);
|
$catChilds = IPS_GetChildrenIDs($catAlarmId);
|
||||||
@@ -170,10 +181,10 @@ class MonitoringServer extends IPSModule {
|
|||||||
$time = time();
|
$time = time();
|
||||||
$payload = GetValue($childid);
|
$payload = GetValue($childid);
|
||||||
$alarmvalues++;
|
$alarmvalues++;
|
||||||
if ($sendit == true){
|
|
||||||
if ($this->notify($childid, $visuId, $catAlarmId, $projectnumber, $projectname, $ispnumber) == true){
|
|
||||||
|
if ($this->notify($childid, $visuId, $catAlarmId, $projectnumber, $projectname, $ispnumber) == true){
|
||||||
$inalarmcount ++;
|
$inalarmcount ++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -360,6 +371,20 @@ class MonitoringServer extends IPSModule {
|
|||||||
|
|
||||||
private function notify($trigid, $webfrontid, $targetid, $projectnumber, $projectname, $ispnr){
|
private function notify($trigid, $webfrontid, $targetid, $projectnumber, $projectname, $ispnr){
|
||||||
|
|
||||||
|
|
||||||
|
$sendit = $this->ReadPropertyBoolean("SendNotification");
|
||||||
|
$sendwhatsapp = $this->ReadPropertyBoolean("SendWhatsapp");
|
||||||
|
$sendmail = $this->ReadPropertyBoolean("SendMail");
|
||||||
|
$senddc = $this->ReadPropertyBoolean("SendDiscord");
|
||||||
|
|
||||||
|
$idWhatsapp = $this->ReadPropertyInteger("WhatappInst");
|
||||||
|
$numbersWhatsapp = $this->ReadPropertyString("WhatsappNumbers");
|
||||||
|
|
||||||
|
$idMail = $this->ReadPropertyInteger("MailInst");
|
||||||
|
$mailAdresses = $this->ReadPropertyString("MailAdresses");
|
||||||
|
|
||||||
|
$idDc = $this->ReadPropertyInteger("DiscordInst");
|
||||||
|
|
||||||
$tdOld = $this->ReadAttributeString("AtAlarmtable");
|
$tdOld = $this->ReadAttributeString("AtAlarmtable");
|
||||||
$td = $tdOld;
|
$td = $tdOld;
|
||||||
|
|
||||||
@@ -374,7 +399,40 @@ class MonitoringServer extends IPSModule {
|
|||||||
|
|
||||||
$this->SetBuffer($smname, "false");
|
$this->SetBuffer($smname, "false");
|
||||||
|
|
||||||
VISU_PostNotification($webfrontid, $art, $smname, $ico, $targetid);
|
if ($sendit == true){
|
||||||
|
VISU_PostNotification($webfrontid, $art, $smname, $ico, $targetid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($sendwhatsapp == true){
|
||||||
|
|
||||||
|
if ( $idWhatsapp > 0 && $idWhatsapp != 123456){
|
||||||
|
|
||||||
|
$paramvals = [
|
||||||
|
"pn" => $art,
|
||||||
|
"stoertext" => $smname
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($numbersWhatsapp as $number){
|
||||||
|
WBM_SendMessage($idWhatsapp,$number,$paramvals);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sendmail == true){
|
||||||
|
if ($idMail > 0 && $idMail != 123456){
|
||||||
|
|
||||||
|
foreach ($mailAdresses as $adress){
|
||||||
|
SMTP_SendMailEx($idMail, $adress, $art, $smname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($senddc == true){
|
||||||
|
if ($idDc > 0 && $idDc != 123456){
|
||||||
|
DWM_SendMessage($idDc, $art, $smname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$td = '<tr><td>'.$smname.'</td><td>'.$time.'</td></tr>'.$tdOld;
|
$td = '<tr><td>'.$smname.'</td><td>'.$time.'</td></tr>'.$tdOld;
|
||||||
$this->WriteAttributeString("AtAlarmtable", $td);
|
$this->WriteAttributeString("AtAlarmtable", $td);
|
||||||
|
|||||||
Reference in New Issue
Block a user