debuggage
This commit is contained in:
@@ -27,20 +27,23 @@ class rdc_chambre_eclairage extends hook
|
||||
$lux = $indexDevices[RDC_CHAMBRE_LUMINOSITE]->properties["illuminance_lux"];
|
||||
$targetAmbiance = $indexDevices[RDC_CHAMBRE_AMBIANCE];
|
||||
$targetEclairage = $indexDevices[RDC_CHAMBRE_ECLAIRAGE];
|
||||
if ($property == "occupancy" and $value == ON)
|
||||
if ($property == "occupancy")
|
||||
{
|
||||
logger(DEBUG, _("CASE: occupancy"), __FILE__ . ":" . __LINE__);
|
||||
if ($targetAmbiance->properties["state"]["method"] == MANUAL)
|
||||
if ($value == ON and $lux < 150)
|
||||
{
|
||||
$method = false;
|
||||
$delayState = false;
|
||||
}else
|
||||
{
|
||||
$method = AUTO;
|
||||
$delayState = "OFF";
|
||||
}
|
||||
logger(DEBUG, _("CASE: occupancy"), __FILE__ . ":" . __LINE__);
|
||||
if ($targetAmbiance->properties["state"]["method"] == MANUAL)
|
||||
{
|
||||
$method = false;
|
||||
$delayState = false;
|
||||
}else
|
||||
{
|
||||
$method = AUTO;
|
||||
$delayState = "OFF";
|
||||
}
|
||||
|
||||
$this->send($targetAmbiance, "state", "ON", $delayState, $method);
|
||||
$this->send($targetAmbiance, "state", "ON", $delayState, $method);
|
||||
}
|
||||
}elseif ($property == "contact")
|
||||
{
|
||||
logger(DEBUG, _("CASE: contact"), __FILE__ . ":" . __LINE__);
|
||||
@@ -51,14 +54,22 @@ class rdc_chambre_eclairage extends hook
|
||||
{
|
||||
$this->send($targetEclairage, "state_l1", "OFF", false, IDLE);
|
||||
}
|
||||
}elseif ($property == "state" and $value == "OFF")
|
||||
}elseif ($property == "state")
|
||||
{
|
||||
logger(DEBUG, _("CASE: state => value = 'OFF'"), __FILE__ . ":" . __LINE__);
|
||||
$targetAmbiance->properties[$property]["method"] = IDLE;
|
||||
}elseif ($property == "state_l1" and $value == "OFF")
|
||||
if ($value == "OFF")
|
||||
{
|
||||
logger(DEBUG, _("CASE: state => value = 'OFF'"), __FILE__ . ":" . __LINE__);
|
||||
$targetAmbiance->properties[$property]["method"] = IDLE;
|
||||
removeEvent($targetAmbiance, $property, "OFF", IDLE);
|
||||
}
|
||||
}elseif ($property == "state_l1")
|
||||
{
|
||||
logger(DEBUG, _("CASE: state_l1 => value = 'OFF'"), __FILE__ . ":" . __LINE__);
|
||||
$targetEclairage->properties[$property]["method"] = IDLE;
|
||||
if ($value == "OFF")
|
||||
{
|
||||
logger(DEBUG, _("CASE: state_l1 => value = 'OFF'"), __FILE__ . ":" . __LINE__);
|
||||
//$targetEclairage->properties[$property]["method"] = IDLE;
|
||||
removeEvent($targetAmbiance, $property, "OFF", IDLE);
|
||||
}
|
||||
}elseif ($property == "action")
|
||||
{
|
||||
logger(DEBUG, _("CASE: action"), __FILE__ . ":" . __LINE__);
|
||||
@@ -70,7 +81,7 @@ class rdc_chambre_eclairage extends hook
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, bool2string($value)), __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
|
||||
private function send(&$deviceObject, $property, $state, $delayState = false, $method = MANUAL)
|
||||
private function send(&$deviceObject, $property, $state, $delayState = false, $method = AUTO)
|
||||
{
|
||||
global $indexDevices;
|
||||
$msg = array($property => $state);
|
||||
@@ -78,15 +89,14 @@ class rdc_chambre_eclairage extends hook
|
||||
//{
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $deviceObject->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
$deviceObject->payload = $msg;
|
||||
$deviceObject->set();
|
||||
$deviceObject->properties[$property]["method"] = $method;
|
||||
$deviceObject->set($property, $method);
|
||||
///}else
|
||||
/*{
|
||||
logger(INFO, sprintf(_("not publishing message: %s to %s, already set"), json_encode($msg), $deviceObject->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
|
||||
}*/
|
||||
//echo 'delaystate = ' . var_dump($delayState);
|
||||
if ($delayState !== false) setDelay($deviceObject, $this->delay, $this->timeUnit, "state", $delayState, true);
|
||||
if ($delayState !== false) setDelay($deviceObject, $this->delay, $this->timeUnit, "state", $delayState, true, IDLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user