1
0

new script presence.php\ndebug

This commit is contained in:
2022-08-28 23:44:21 +02:00
parent b5c30b1ae4
commit 2b4fc54071
4 changed files with 38 additions and 6 deletions

View File

@ -43,26 +43,34 @@ class alerte_intrusion extends hook
}
}
public function testPortes($send=true, $opened=true) :array
public function testPortes($deviceList=false, $send=true, $opened=true) :array
{
global $indexDevices;
$portes = array();
logger(DEBUG, _("Function alerte_intrusion->testPorte"), __FILE__ . ":" . __LINE__);
if ($deviceList === false) $deviceList = $this->deviceList;
$msg = "";
foreach ($this->devicelist as $device => $property)
foreach ($deviceList as $device => $property)
{
if (!$opened)
//echo "device: " . $device . "\n";
//echo "opened = " . bool2string($opened);
//echo " value = " . var_dump($indexDevices[$device]->properties[$property]);
if ($opened)
{
if($indexDevices[$device]->properties[$property] == false)
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] == true)
if($indexDevices[$device]->properties[$property]["value"] === true)
{
//echo "porte closed";
$portes[] = $indexDevices[$device]->friendlyName;
$msg .= $indexDevices[$device]->friendlyName . "\n";
}