some debbuging :-(
This commit is contained in:
@ -9,7 +9,7 @@ class rdc_wc_eclairage extends hook
|
||||
RDC_WC_MVMT => "occupancy"
|
||||
);
|
||||
|
||||
public $delay = 5; // amount of time in $timeunit
|
||||
public $delay = 3; // amount of time in $timeunit
|
||||
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
|
||||
|
||||
@ -26,27 +26,29 @@ class rdc_wc_eclairage extends hook
|
||||
logger(DEBUG, "CASE: state_l2", __FILE__ . ":" . __LINE__);
|
||||
if ($value == "ON")
|
||||
{
|
||||
if ($targetDevice->properties["state_l1"]["method"] !== AUTO)
|
||||
if ($targetDevice->properties["state_l2"]["method"] !== AUTO)
|
||||
{
|
||||
$targetDevice->properties["state_l1"]["method"] = MANUAL;
|
||||
//setDelay($device, $this->delayManual, $this->timeUnit, "state_l2", "OFF", true);
|
||||
$targetDevice->properties["state_l2"]["method"] = MANUAL;
|
||||
setDelay($device, $this->delayManual, $this->timeUnit, "state_l2", "OFF", true);
|
||||
}
|
||||
}elseif ($value == "OFF")
|
||||
{
|
||||
removeEvent($device, "state_l2", "OFF", IDLE);
|
||||
$targetDevice->properties["state_l2"]["method"] = IDLE;
|
||||
removeEvent($device, "state_l2", "OFF");
|
||||
}
|
||||
break;
|
||||
case "occupancy":
|
||||
logger(DEBUG, "CASE: occupancy", __FILE__ . ":" . __LINE__);
|
||||
if ($value == true)
|
||||
if ($value == true and $targetDevice->properties["state_l2"]["method"] == IDLE)
|
||||
{
|
||||
$targetDevice->properties["state_l2"]["method"] = AUTO;
|
||||
//setDelay($device, $this->delay, $this->timeUnit, "state_l2", "OFF", true,IDLE);
|
||||
$this->send($targetDevice, "ON");
|
||||
}elseif ($targetDevice->properties["state_l2"]["method"] != MANUAL)
|
||||
}elseif ($value == false and $targetDevice->properties["state_l2"]["method"] != MANUAL)
|
||||
{
|
||||
$targetDevice->properties["state_l2"]["method"] = IDLE;
|
||||
$this->send($targetDevice, "OFF");
|
||||
//$targetDevice->properties["state_l2"]["method"] = IDLE;
|
||||
//$this->send($targetDevice, "OFF");
|
||||
setDelay($device, $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