Merge branch 'master' of git.labolyon.fr:DTux/moha
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
require_once "events.php";
|
||||
|
||||
class alerte_intrusion extends hook
|
||||
{
|
||||
public $hookName = "alerte_intrusion";
|
||||
@ -27,24 +29,30 @@ class alerte_intrusion extends hook
|
||||
}
|
||||
}
|
||||
|
||||
public function test()
|
||||
public function testPortes()
|
||||
{
|
||||
global $indexDevices;
|
||||
logger(DEBUG, _("Function alerte_intrusion->testPorte"), __FILE__ . ":" . __LINE__);
|
||||
|
||||
$msg = "";
|
||||
foreach ($this->devicelist as $device => $property)
|
||||
{
|
||||
if($indexDevices[$device]->properties[$property] != false)
|
||||
{
|
||||
$msg .= $indexDevices->friendlyName . " is open" . EOL;
|
||||
$msg .= $indexDevices[$device]->friendlyName . " is open" . EOL;
|
||||
}
|
||||
}
|
||||
if ($msg != "")
|
||||
if (!empty($msg))
|
||||
{
|
||||
logger(ALERT, $msg, __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
return nl2br($msg);
|
||||
}
|
||||
}
|
||||
|
||||
$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);
|
||||
|
||||
?>
|
||||
|
@ -237,7 +237,7 @@ class rdc_store extends hook
|
||||
}
|
||||
}
|
||||
|
||||
private function send($level)
|
||||
private function send($level, $method)
|
||||
{
|
||||
global $indexDevices;
|
||||
$deviceObject = $indexDevices[RDC_STORE];
|
||||
|
@ -31,16 +31,16 @@ class rdc_wc_eclairage extends hook
|
||||
if ($targetDevice->properties["state_l2"]["method"] == IDLE)
|
||||
{
|
||||
$targetDevice->properties["state_l2"]["method"] = MANUAL;
|
||||
setDelay($device, $this->delayManual, $this->timeUnit, "state_l2", "OFF", true);
|
||||
setDelay($targetDevice, $this->delayManual, $this->timeUnit, "state_l2", "OFF", true);
|
||||
}
|
||||
}elseif ($value == "OFF")
|
||||
{
|
||||
$targetDevice->properties["state_l2"]["method"] = IDLE;
|
||||
removeEvent($device, "state_l2", "OFF");
|
||||
removeEvent($targetDevice, "state_l2", "OFF");
|
||||
}
|
||||
break;
|
||||
case "occupancy":
|
||||
logger(DEBUG, "CASE: occupancy", __FILE__ . ":" . __LINE__);
|
||||
logger(DEBUG, "CASE: WC occupancy", __FILE__ . ":" . __LINE__);
|
||||
logger(DEBUG, "method =" . $targetDevice->properties["state_l2"]["method"], __FILE__ . ":" . __LINE__);
|
||||
if ($value === true and $targetDevice->properties["state_l2"]["method"] == IDLE)
|
||||
{
|
||||
@ -50,7 +50,7 @@ class rdc_wc_eclairage extends hook
|
||||
{
|
||||
//$targetDevice->properties["state_l2"]["method"] = IDLE;
|
||||
//$this->send($targetDevice, "OFF");
|
||||
setDelay($device, $this->delay, $this->timeUnit, "state_l2", "OFF", true, IDLE);
|
||||
setDelay($targetDevice, $this->delay, $this->timeUnit, "state_l2", "OFF", true, IDLE);
|
||||
}
|
||||
}
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, bool2string($value)), __FILE__ . ":" . __LINE__);
|
||||
|
Reference in New Issue
Block a user