debug
This commit is contained in:
@ -43,7 +43,7 @@ class alerte_intrusion extends hook
|
||||
}
|
||||
}
|
||||
|
||||
public function testPortes($deviceList=false, $send=true, $opened=true) :array
|
||||
/* public function testPortes($deviceList=false, $send=true, $opened=true) :array
|
||||
{
|
||||
global $indexDevices;
|
||||
$portes = array();
|
||||
@ -81,12 +81,12 @@ class alerte_intrusion extends hook
|
||||
logger(ALERT, _("doors opened :") . $msg, null ,$device);
|
||||
}
|
||||
return $portes;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
$hooks["alerte_intrusion"] = new alerte_intrusion();
|
||||
logger(DEBUG, _("Initializing event"), __FILE__ . ":" . __LINE__);
|
||||
$function = array($hooks["alerte_intrusion"], "testPortes");
|
||||
//$function = array($hooks["testPortes"], "testPortes");
|
||||
//setRecurrentEvent("alerte_intrusion", $function, "", "", 0, -1, "", "", false, 21);
|
||||
|
||||
?>
|
||||
|
@ -16,7 +16,7 @@ class rdc_salon_eclairage extends hook
|
||||
protected $actionneurs = array(
|
||||
array(RDC_SALON_MVMT, "occupancy", 1),
|
||||
array(RDC_SALON_MVMT2, "occupancy", 1),
|
||||
array(RDC_SALON_PRESENCE => "presence", 1)
|
||||
array(RDC_SALON_PRESENCE, "presence", 1)
|
||||
);
|
||||
public $delay = 3; // amount of time in $timeunit
|
||||
public $timeUnit = "minute"; // unit of time for delay, second, minute, hour, day, week, month, year
|
||||
@ -61,7 +61,7 @@ class rdc_salon_eclairage extends hook
|
||||
}else
|
||||
{
|
||||
logger(INFO, _("Value is OFF"), __FILE__ . ":" . __LINE__);
|
||||
if (testActionneurs($this->actionneurs) and $method = AUTO)
|
||||
if (testActionneurs($this->actionneurs) === false and $method == AUTO)
|
||||
//if ((getValue(RDC_SALON_MVMT, "occupancy") == OFF) and (getValue(RDC_SALON_MVMT2, "occupancy") == OFF) and $method == AUTO)
|
||||
{
|
||||
logger(INFO, _("Setting to OFF"), __FILE__ . ":" . __LINE__);
|
||||
|
@ -68,18 +68,22 @@ class rdc_temperature_int_ext extends hook
|
||||
}
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, bool2string($value)), __FILE__ . ":" . __LINE__, $device);
|
||||
}
|
||||
$portes = $hooks["alerte_intrusion"]->testPortes($this->portesList, false, true);
|
||||
print_r($portes);
|
||||
if ($status == 1)
|
||||
{
|
||||
$portes = $hooks["test_portes"]->testPortes($this->portesList, false, false);
|
||||
if (empty($portes))
|
||||
{
|
||||
logger(ALERT, _("Open doors to climate"), null, $device);
|
||||
$time = now();
|
||||
foreach($portes as $porte)
|
||||
{
|
||||
$msg .= $porte . "\n";
|
||||
}
|
||||
logger(ALERT, _("Open doors to climate") . $msg, null, $device);
|
||||
}
|
||||
}else
|
||||
{
|
||||
//$portes = $hooks["alerte_intrusion"]->testPortes(false, true);
|
||||
$portes = $hooks["test_portes"]->testPortes($this->portesList, false, true);
|
||||
if (!empty($portes))
|
||||
{
|
||||
$time = now();
|
||||
|
62
hooks/scripts/test_portes.php
Normal file
62
hooks/scripts/test_portes.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
require_once "events.php";
|
||||
|
||||
|
||||
class test_portes extends hook
|
||||
{
|
||||
public $hookName = "test_portes";
|
||||
public $active = true;
|
||||
|
||||
protected $devicelist = array(
|
||||
);
|
||||
|
||||
function installHooks(&$indexDevices)
|
||||
{
|
||||
return $this->installHooksFunction($indexDevices);
|
||||
}
|
||||
|
||||
public function testPortes($deviceList=false, $send=true, $opened=true) :array
|
||||
{
|
||||
global $indexDevices;
|
||||
$portes = array();
|
||||
|
||||
logger(DEBUG, _("Function testPorte"), __FILE__ . ":" . __LINE__);
|
||||
|
||||
if ($deviceList === false) $deviceList = $hooks["rdc_portes_ouvertes"]->devicelist;
|
||||
$msg = "";
|
||||
foreach ($deviceList as $device => $property)
|
||||
{
|
||||
//echo "device: " . $device . "\n";
|
||||
//echo "opened = " . bool2string($opened);
|
||||
//echo " value = " . var_dump($indexDevices[$device]->properties[$property]);
|
||||
|
||||
if ($opened)
|
||||
{
|
||||
if($indexDevices[$device]->properties[$property]["value"] === false)
|
||||
{
|
||||
//echo "porte opened";
|
||||
$portes[] = $indexDevices[$device]->friendlyName;
|
||||
$msg .= $indexDevices[$device]->friendlyName . "\n";
|
||||
}
|
||||
}else
|
||||
{
|
||||
if($indexDevices[$device]->properties[$property]["value"] === true)
|
||||
{
|
||||
//echo "porte closed";
|
||||
$portes[] = $indexDevices[$device]->friendlyName;
|
||||
$msg .= $indexDevices[$device]->friendlyName . "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($send)
|
||||
{
|
||||
logger(ALERT, _("doors opened :") . $msg, null ,$device);
|
||||
}
|
||||
return $portes;
|
||||
}
|
||||
}
|
||||
$hooks["test_portes"] = new test_portes();
|
||||
logger(DEBUG, _("Initializing event"), __FILE__ . ":" . __LINE__);
|
||||
$function = array($hooks["test_portes"], "testPortes");
|
||||
//setRecurrentEvent("test_portes", $function, "", "", 0, -1, "", "", false, 21);
|
||||
?>
|
Reference in New Issue
Block a user