- lots of debugging
- beginning to add graphical stats - beginning to add device by type - added a dashboard "etage" - begining to add notification to multiple recipients in freemobile hook
This commit is contained in:
@ -10,7 +10,7 @@ class rdc_wc_eclairage extends hook
|
||||
);
|
||||
|
||||
public $delay = 3; // amount of time in $timeunit
|
||||
public $delayManual = 8; // amount of time in $timeunit for manual mode
|
||||
public $delayManual = 15; // amount of time in $timeunit for manual mode
|
||||
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
|
||||
|
||||
// callback fonction. Is called with these 4 parameters
|
||||
@ -18,23 +18,32 @@ class rdc_wc_eclairage extends hook
|
||||
{
|
||||
global $indexDevices;
|
||||
//var_dump($value);
|
||||
logger(DEBUG, "Callback : " . $this->hookName, __FILE__ . ":" . __LINE__);
|
||||
switch($property)
|
||||
{
|
||||
case "state_l2":
|
||||
logger(DEBUG, _("CASE: state_l2"), __FILE__ . ":" . __LINE__);
|
||||
logger(DEBUG, "CASE: state_l2", __FILE__ . ":" . __LINE__);
|
||||
if ($value == "ON")
|
||||
{
|
||||
setDelay($device, $this->delayManual, $this->timeUnit, "state_l2", "OFF", true);
|
||||
$device->method = MANUAL;
|
||||
if ($device->method == AUTO)
|
||||
{
|
||||
setDelay($device, $this->delay, $this->timeUnit, "state_l2", "OFF", true);
|
||||
}else
|
||||
{
|
||||
$device->method = MANUAL;
|
||||
setDelay($device, $this->delayManual, $this->timeUnit, "state_l2", "OFF", true);
|
||||
}
|
||||
}elseif ($value == "OFF")
|
||||
{
|
||||
deleteEvent(searchEvent($device, "state_l2", "OFF"));
|
||||
removeEvent($device, "state_l2", "OFF");
|
||||
$device->method = null;
|
||||
}
|
||||
break;
|
||||
case "occupancy":
|
||||
logger(DEBUG, _("CASE: occupancy"), __FILE__ . ":" . __LINE__);
|
||||
logger(DEBUG, "CASE: occupancy", __FILE__ . ":" . __LINE__);
|
||||
if ($value == true)
|
||||
{
|
||||
$device->method = AUTO;
|
||||
$this->send("ON");
|
||||
}
|
||||
}
|
||||
@ -48,11 +57,6 @@ class rdc_wc_eclairage extends hook
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $deviceObject->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
$deviceObject->payload = $msg;
|
||||
$deviceObject->set(null);
|
||||
if ($deviceObject->method != MANUAL)
|
||||
{
|
||||
$deviceObject->method = AUTO;
|
||||
}
|
||||
setDelay($deviceObject, $this->delay, $this->timeUnit, "state_l2", "OFF", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user