1
0

finished rdc_temperature_int_ext.php\ncontinued events.php (recurrence)

This commit is contained in:
2022-08-28 00:06:24 +02:00
parent f42df97c5c
commit b5c30b1ae4
6 changed files with 209 additions and 90 deletions

View File

@@ -11,7 +11,10 @@ class alerte_intrusion extends hook
GARAGE_PORTE => "contact",
RDC_CHAMBRE_BAIE => "contact",
RDC_SALON_BAIE => "contact",
GARAGE_PORTAIL => "contact"
GARAGE_PORTAIL => "contact",
ETAGE_SALON_FENETRE => "contact",
ETAGE_CUISINE_FENETRE => "contact",
ETAGE_PORTE_FENETRE => "contact"
);
function installHooks(&$indexDevices)
@@ -40,7 +43,7 @@ class alerte_intrusion extends hook
}
}
public function testPortes($send=true) :array
public function testPortes($send=true, $opened=true) :array
{
global $indexDevices;
$portes = array();
@@ -49,10 +52,20 @@ class alerte_intrusion extends hook
$msg = "";
foreach ($this->devicelist as $device => $property)
{
if($indexDevices[$device]->properties[$property] == false)
if (!$opened)
{
$portes[] = $indexDevices[$device]->friendlyName;
$msg .= $indexDevices[$device]->friendlyName . "\n";
if($indexDevices[$device]->properties[$property] == false)
{
$portes[] = $indexDevices[$device]->friendlyName;
$msg .= $indexDevices[$device]->friendlyName . "\n";
}
}else
{
if($indexDevices[$device]->properties[$property] == true)
{
$portes[] = $indexDevices[$device]->friendlyName;
$msg .= $indexDevices[$device]->friendlyName . "\n";
}
}
}
if ($send)
@@ -66,6 +79,6 @@ class alerte_intrusion extends hook
$hooks["alerte_intrusion"] = new alerte_intrusion();
logger(DEBUG, _("Initializing event"), __FILE__ . ":" . __LINE__);
$function = array($hooks["alerte_intrusion"], "testPortes");
setRecurrentEvent($function, 0, 0, 0, 0, 0, 0, 21, 0, 0, 1, 0, 0, 0);
setRecurrentEvent($function, 0, 0, 0, false, 0, 0, 21, 0, 0, 0, 0, 0, 0);
?>