a lot of bugs corrected\nrdc_wc_eclairage
This commit is contained in:
@@ -6,10 +6,10 @@ class rdc_salon_eclairage extends hook
|
||||
public $active = true;
|
||||
// list of devices we are listening to
|
||||
protected $devicelist = array(
|
||||
RDC_SALON_MVMT => array("occupancy", false),
|
||||
RDC_SALON_MVMT2 => array("occupancy", false),
|
||||
RDC_ENTREE_PORTE => array("contact", false),
|
||||
RDC_SALON_LUMINOSITE => array("illuminance_lux", false)
|
||||
RDC_SALON_MVMT => "occupancy",
|
||||
RDC_SALON_MVMT2 => "occupancy",
|
||||
RDC_ENTREE_PORTE => "contact",
|
||||
RDC_SALON_LUMINOSITE => "illuminance_lux"
|
||||
);
|
||||
|
||||
public $delay = 3; // amount of time in $timeunit
|
||||
@@ -18,7 +18,7 @@ class rdc_salon_eclairage extends hook
|
||||
public $luminance_max = 100;
|
||||
|
||||
// callback fonction. Is called with these 4 parameters
|
||||
public function callBack(&$device, $param, $value)
|
||||
public function callBack($device, $param, $value)
|
||||
{
|
||||
global $indexDevices;
|
||||
logger(INFO, _("hook : rdc_salon_eclairage"), __FILE__ . ":" . __LINE__);
|
||||
@@ -33,12 +33,17 @@ class rdc_salon_eclairage extends hook
|
||||
case "occupancy":
|
||||
logger(INFO, _("CASE: Occupancy => ") . bool2string($value), __FILE__ . ":" . __LINE__);
|
||||
//print_r(getValue(RDC_SALON_LUMINOSITE, "illuminance_lux"));
|
||||
if ($value == ON and getValue(RDC_SALON_LUMINOSITE, "illuminance_lux") <= $this->luminance_min)
|
||||
if ($value == ON)
|
||||
{
|
||||
logger(INFO, _("setting to ON"), __FILE__ . ":" . __LINE__);
|
||||
$this->send($deviceTarget, "ON", null, AUTO);
|
||||
removeEvent($deviceTarget, "state", "OFF");
|
||||
}elseif ($value == OFF)
|
||||
$illuminance = getValue(RDC_SALON_LUMINOSITE, "illuminance_lux");
|
||||
logger(INFO, _("illuminance value : ") . $illuminance, __FILE__ . ":" . __LINE__);
|
||||
if ($illuminance <= $this->luminance_min)
|
||||
{
|
||||
logger(INFO, _("setting to ON"), __FILE__ . ":" . __LINE__);
|
||||
$this->send($deviceTarget, "ON", null, AUTO);
|
||||
removeEvent($deviceTarget, "state", "OFF");
|
||||
}
|
||||
}else
|
||||
{
|
||||
logger(INFO, _("Value is OFF"), __FILE__ . ":" . __LINE__);
|
||||
if (getValue(RDC_SALON_MVMT, "occupancy") == OFF and (getValue(RDC_SALON_MVMT2, "occupancy") == OFF))
|
||||
@@ -74,7 +79,7 @@ class rdc_salon_eclairage extends hook
|
||||
{
|
||||
setDelay($deviceTarget, $this->delay, $this->timeUnit, "state", "OFF", true);
|
||||
}
|
||||
}elseif ($value <= $this->luminance_min and (getValue(RDC_SALON_MVMT, "occupancy") == ON OR getValue(RDC_SALON_MVMT2,"occupancy") == ON))
|
||||
}elseif ($value <= $this->luminance_min and (getValue(RDC_SALON_MVMT, "occupancy") == ON || getValue(RDC_SALON_MVMT2,"occupancy") == ON))
|
||||
{
|
||||
logger(INFO, _("illuminance < min and movement detected"), __FILE__ . ":" . __LINE__);
|
||||
$this->send($deviceTarget, "ON", null, AUTO);
|
||||
|
Reference in New Issue
Block a user