1
0

debug rdc_store et rdc_wc_eclairage\nmise en page constant.php

This commit is contained in:
Daniel Tartavel
2022-06-13 20:57:53 +02:00
parent 71c8ce246f
commit da3f4ab51f
5 changed files with 340 additions and 16 deletions

View File

@ -3,14 +3,15 @@
class rdc_wc_eclairage extends hook
{
public $hookName = "rdc_wc_eclairage";
public $active = true; //enable/disable hook (true => enabled)
protected $devicelist = array(
RDC_SDB_WC_ECLAIRAGE => "state_l2",
RDC_WC_MVMT => "occupancy"
);
public $delay = 3; // amount of time in $timeunit
public $delayManual = 15; // amount of time in $timeunit for manual mode
public $delay = 1; // amount of time in $timeunit
public $delayManual = 10; // 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
@ -26,7 +27,7 @@ class rdc_wc_eclairage extends hook
logger(DEBUG, "CASE: state_l2", __FILE__ . ":" . __LINE__);
if ($value == "ON")
{
if ($targetDevice->properties["state_l2"]["method"] !== AUTO)
if ($targetDevice->properties["state_l2"]["method"] == IDLE)
{
$targetDevice->properties["state_l2"]["method"] = MANUAL;
setDelay($device, $this->delayManual, $this->timeUnit, "state_l2", "OFF", true);
@ -39,12 +40,11 @@ class rdc_wc_eclairage extends hook
break;
case "occupancy":
logger(DEBUG, "CASE: occupancy", __FILE__ . ":" . __LINE__);
if ($value == true and $targetDevice->properties["state_l2"]["method"] == IDLE)
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 ($value == false and $targetDevice->properties["state_l2"]["method"] != MANUAL)
}elseif ($value === false and $targetDevice->properties["state_l2"]["method"] == AUTO)
{
//$targetDevice->properties["state_l2"]["method"] = IDLE;
//$this->send($targetDevice, "OFF");