"contact", GARAGE_PORTE => "contact", RDC_CHAMBRE_BAIE => "contact", RDC_SALON_BAIE => "contact", GARAGE_PORTAIL => "contact", ETAGE_SALON_FENETRE => "contact", ETAGE_CUISINE_FENETRE => "contact", ETAGE_PORTE_FENETRE => "contact" ); function installHooks(&$indexDevices) { return $this->installHooksFunction($indexDevices); } // callback fonction. Is called with these 4 parameters public function callBack($device, $property, $value) { logger(DEBUG, sprintf(_("property=%s, value=%s"), $property, $value), __FILE__ . ":" . __LINE__); switch($property) { case "contact": if (isPresent() === false) { if ($value == false and isPresent() === false) { logger(ALERT, sprintf(_("%s vient de s'ouvrir alors que personne n'est présent"), $device->friendlyName), __FILE__ . ":" . __LINE__, $device); }else { logger(ALERT, sprintf(_("%s vient de se fermer alors que personne n'est présent"), $device->friendlyName), __FILE__ . ":" . __LINE__, $device); } } break; } } /* 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 ($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["alerte_intrusion"] = new alerte_intrusion(); logger(DEBUG, _("Initializing event"), __FILE__ . ":" . __LINE__); //$function = array($hooks["testPortes"], "testPortes"); //setRecurrentEvent("alerte_intrusion", $function, "", "", 0, -1, "", "", false, 21); ?>