some adjustments
This commit is contained in:
@@ -45,37 +45,40 @@ class rdc_sdb_eclairage extends hook
|
||||
switch($property)
|
||||
{
|
||||
case "occupancy":
|
||||
$method = $deviceTarget->properties["state_l1"]["method"];
|
||||
logger(DEBUG, _("CASE: occupancy"), __FILE__ . ":" . __LINE__);
|
||||
if ($value == ON)
|
||||
{
|
||||
if($deviceTarget->properties["state_l1"]["method"] == IDLE)
|
||||
if($method == IDLE)
|
||||
{
|
||||
logger(DEBUG, _("lighting with method auto"), __FILE__ . ":" . __LINE__);
|
||||
//$deviceTarget->properties["state_l1"]["method"] = AUTO;
|
||||
$this->send("ON", AUTO);
|
||||
removeEvent($deviceTarget, "state", "OFF");
|
||||
}
|
||||
}elseif (testActionneurs($this->actionneurs))
|
||||
}elseif (!testActionneurs($this->actionneurs))
|
||||
{
|
||||
logger(DEBUG, _("Actionneurs are all false"), __FILE__ . ":" . __LINE__);
|
||||
//setDelay($deviceTarget, $this->delay, $this->timeUnit, "state_l1", "OFF", true, IDLE);
|
||||
$this->send("OFF", IDLE);
|
||||
}
|
||||
break;
|
||||
case "state_l1":
|
||||
$method = $deviceTarget->properties["state_l1"]["method"];
|
||||
|
||||
logger(DEBUG, _("CASE: state_l1"), __FILE__ . ":" . __LINE__);
|
||||
if ($value == "ON")
|
||||
{
|
||||
if ($deviceTarget->properties["state_l1"]["method"] == IDLE)
|
||||
if ($method == IDLE)
|
||||
{
|
||||
logger(DEBUG, _("State_l1 is IDLE"), __FILE__ . ":" . __LINE__);
|
||||
$deviceTarget->properties["state_l1"]["method"] = MANUAL;
|
||||
setDelay($deviceTarget, $this->delayManual, $this->timeUnit, "state_l1", "OFF", true, IDLE);
|
||||
removeEvent($deviceTarget, "state_l1", "OFF", MANUAL);
|
||||
//setDelay($deviceTarget, $this->delayManual, $this->timeUnit, "state_l1", "OFF", true, IDLE);
|
||||
}
|
||||
}elseif ($value == "OFF")
|
||||
{
|
||||
removeEvent($deviceTarget, "state_l1", "OFF", IDLE);
|
||||
$deviceTarget->properties["state_l1"]["method"] = IDLE;
|
||||
logger(DEBUG, _("State_l1 is false light is off and method is ") . $deviceTarget->properties["state_l1"]["method"], __FILE__ . ":" . __LINE__);
|
||||
//$deviceTarget->properties["state_l1"]["method"] = IDLE;
|
||||
logger(DEBUG, _("State_l1 is false light is off and method is ") . $method, __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user