- debugage\n- version avec plugins fonctionnels
This commit is contained in:
@ -39,8 +39,8 @@ class rdc_chambre_eclairage extends hook
|
||||
private function send($deviceObject, $state, $delayState = false, $method = MANUAL)
|
||||
{
|
||||
global $devices, $indexDevices;
|
||||
$msg = array("state" => $state);
|
||||
if ($deviceObject->properties["state"]["value"] != $state)
|
||||
$msg = array("state_l1" => $state);
|
||||
if ($deviceObject->properties["state_l1"]["value"] != $state)
|
||||
{
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $deviceObject->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
$deviceObject->payload = $msg;
|
||||
|
@ -26,32 +26,34 @@ class rdc_salon_eclairage extends hook
|
||||
$lux = $indexDevices[RDC_SALON_LUMINOSITE];
|
||||
$mvmt = $indexDevices[RDC_SALON_MVMT];
|
||||
$mvmt2 = $indexDevices[RDC_SALON_MVMT2];
|
||||
logger (INFO, _("property => ") . $param . _("value =>") . bool2string($value), __FILE__ . ":" . __LINE__);
|
||||
|
||||
switch($param)
|
||||
{
|
||||
case "occupancy":
|
||||
logger(DEBUG, _("CASE: Occupancy => ") . bool2string($value), __FILE__ . ":" . __LINE__);
|
||||
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)
|
||||
{
|
||||
logger(DEBUG, _("setting to ON"), __FILE__ . ":" . __LINE__);
|
||||
logger(INFO, _("setting to ON"), __FILE__ . ":" . __LINE__);
|
||||
$this->send($deviceTarget, "ON", null, AUTO);
|
||||
removeEvent($deviceTarget, "state", "OFF");
|
||||
}elseif ($value == OFF)
|
||||
{
|
||||
logger(DEBUG, _("Value is OFF"), __FILE__ . ":" . __LINE__);
|
||||
logger(INFO, _("Value is OFF"), __FILE__ . ":" . __LINE__);
|
||||
if (getValue(RDC_SALON_MVMT, "occupancy") == OFF and (getValue(RDC_SALON_MVMT2, "occupancy") == OFF))
|
||||
{
|
||||
logger(DEBUG, _("Setting to OFF"), __FILE__ . ":" . __LINE__);
|
||||
logger(INFO, _("Setting to OFF"), __FILE__ . ":" . __LINE__);
|
||||
setDelay($deviceTarget, $this->delay, $this->timeUnit, "state", "OFF", true);
|
||||
//$this->send($deviceTarget, "ON", "OFF", AUTO);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "contact":
|
||||
logger(DEBUG, _("CASE: Contact Door"), __FILE__ . ":" . __LINE__);
|
||||
logger(INFO, _("CASE: Contact Door"), __FILE__ . ":" . __LINE__);
|
||||
if ($value == false and getValue(RDC_SALON_LUMINOSITE, "illuminance_lux") <= $this->luminance_min and getValue($deviceTarget->ieeeAddress, "state") == "OFF")
|
||||
{
|
||||
logger(DEBUG, _("Door is open and illumance < min"), __FILE__ . ":" . __LINE__);
|
||||
logger(INFO, _("Door is open and illumance < min"), __FILE__ . ":" . __LINE__);
|
||||
if (getValue(RDC_SALON_MVMT, "occupancy") == ON or getValue(RDC_SALON_MVMT2, "occupancy") == ON)
|
||||
{
|
||||
$this->send($deviceTarget, "ON", null, AUTO);
|
||||
@ -62,10 +64,10 @@ class rdc_salon_eclairage extends hook
|
||||
}
|
||||
break;
|
||||
case "illuminance_lux":
|
||||
logger(DEBUG, _("CASE : Illuminance"), __FILE__ . ":" . __LINE__);
|
||||
logger(INFO, _("CASE : Illuminance"), __FILE__ . ":" . __LINE__);
|
||||
if ($value >= $this->luminance_max)
|
||||
{
|
||||
logger(DEBUG, _("illuminace is > to max"), __FILE__ . ":" . __LINE__);
|
||||
logger(INFO, _("illuminace is > to max"), __FILE__ . ":" . __LINE__);
|
||||
//$this->send($deviceTarget, "OFF", null, AUTO);
|
||||
//removeEvent($indexDevices[RDC_SALON_ECLAIRAGE_PANNEAU], "state", "OFF");
|
||||
if (searchEvent($deviceTarget, "state", "OFF") === false)
|
||||
@ -74,7 +76,7 @@ class rdc_salon_eclairage extends hook
|
||||
}
|
||||
}elseif ($value <= $this->luminance_min and (getValue(RDC_SALON_MVMT, "occupancy") == ON OR getValue(RDC_SALON_MVMT2,"occupancy") == ON))
|
||||
{
|
||||
logger(DEBUG, _("illuminance < min and movement detected"), __FILE__ . ":" . __LINE__);
|
||||
logger(INFO, _("illuminance < min and movement detected"), __FILE__ . ":" . __LINE__);
|
||||
$this->send($deviceTarget, "ON", null, AUTO);
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user