debugging
This commit is contained in:
@ -41,7 +41,7 @@ class availability
|
||||
// $log = INFO;
|
||||
//}
|
||||
//$device->availability = $value;
|
||||
logger($log, sprintf(_("Device: %s/%s is %s"), $device->topic, $device->friendlyName, $value));
|
||||
logger($log, sprintf(_("Device: %s/%s is %s"), $device->topic, $device->friendlyName, $value), __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class rdc_chambre_eclairage extends hook
|
||||
{
|
||||
$this->send(RDC_CHAMBRE_LUMINOSITE, "ON", "OFF", AUTO);
|
||||
}
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, $value));
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, $value), __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
|
||||
private function send($device, $state, $delayState = false, $method = MANUAL)
|
||||
@ -37,13 +37,13 @@ class rdc_chambre_eclairage extends hook
|
||||
$msg = array("state" => $state);
|
||||
if ($device->state["value"] != $state)
|
||||
{
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $device->friendlyName));
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $device->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
$device->payload = $msg;
|
||||
$device->set();
|
||||
$device->method = $method;
|
||||
}else
|
||||
{
|
||||
logger(INFO, sprintf(_("not publishing message: %s to %s, already set"), json_encode($msg), $device->friendlyName));
|
||||
logger(INFO, sprintf(_("not publishing message: %s to %s, already set"), json_encode($msg), $device->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
|
||||
}
|
||||
//echo 'delaystate = ' . var_dump($delayState);
|
||||
|
@ -23,7 +23,7 @@ class alerte_intrusion extends hook
|
||||
case "contact":
|
||||
if ($value == false)
|
||||
{
|
||||
logger(ALERT, sprintf(_("%s est ouverte alors que personne n'est présent"), $device->friendlyName));
|
||||
logger(ALERT, sprintf(_("%s est ouverte alors que personne n'est présent"), $device->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -21,40 +21,54 @@ class rdc_salon_eclairage extends hook
|
||||
public function callBack(&$device, $param, $value)
|
||||
{
|
||||
global $devices, $indexDevices;
|
||||
logger(INFO, _("hook : rdc_salon_eclairage"));
|
||||
logger(INFO, _("hook : rdc_salon_eclairage"), __FILE__ . ":" . __LINE__);
|
||||
switch($param)
|
||||
{
|
||||
case "occupancy":
|
||||
logger(DEBUG, _("CASE: Occupancy => ") . bool2string($value), __FILE__ . ":" . __LINE__);
|
||||
//print_r($indexDevices[RDC_SALON_LUMINOSITE]);
|
||||
if ($value == ON and $indexDevices[RDC_SALON_LUMINOSITE]->illuminance_lux["value"] <= $this->luminance_min)
|
||||
if ($value == ON and getValue(RDC_SALON_LUMINOSITE, "illuminance_lux") <= $this->luminance_min)
|
||||
{
|
||||
logger(DEBUG, _("setting to ON"), __FILE__ . ":" . __LINE__);
|
||||
$this->send("ON", null, AUTO);
|
||||
removeEvent($indexDevices[RDC_SALON_ECLAIRAGE_PANNEAU], "state", "OFF");
|
||||
}
|
||||
if ($value == OFF)
|
||||
}elseif ($value == OFF)
|
||||
{
|
||||
if ($indexDevices(RDC_SALON_MVMT)->occupancy == OFF and $indexDevices(RDC_SALON_MVMT2)->occupancy == OFF)
|
||||
logger(DEBUG, _("Value is OFF"), __FILE__ . ":" . __LINE__);
|
||||
if (getValue(RDC_SALON_MVMT, "occupancy") == OFF)
|
||||
{
|
||||
setDelay($indexDevices[RDC_SALON_ECLAIRAGE_PANNEAU], $this->delay, $this->timeUnit, "state", "OFF", true);
|
||||
//$this->send("ON", "OFF", AUTO);
|
||||
if (getValue(RDC_SALON_MVMT2, "occupancy") == OFF)
|
||||
{
|
||||
logger(DEBUG, _("Setting to OFF"), __FILE__ . ":" . __LINE__);
|
||||
setDelay($indexDevices[RDC_SALON_ECLAIRAGE_PANNEAU], $this->delay, $this->timeUnit, "state", "OFF", true);
|
||||
//$this->send("ON", "OFF", AUTO);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "contact":
|
||||
if ($value == false and $indexDevices[RDC_SALON_LUMINOSITE]->illuminance_lux["value"] <= $this->luminance_min)
|
||||
logger(DEBUG, _("CASE: Contact Door"), __FILE__ . ":" . __LINE__);
|
||||
if ($value == false and getValue(RDC_SALON_LUMINOSITE, "illuminance_lux") <= $this->luminance_min)
|
||||
{
|
||||
//$this->send("ON", "OFF", AUTO);
|
||||
logger(DEBUG, _("Door is open and illumance < min"), __FILE__ . ":" . __LINE__);
|
||||
$this->send("ON", "OFF", AUTO);
|
||||
}
|
||||
break;
|
||||
case "illuminance_lux":
|
||||
logger(DEBUG, _("CASE : Illuminance"), __FILE__ . ":" . __LINE__);
|
||||
if ($value >= $this->luminance_max)
|
||||
{
|
||||
logger(DEBUG, _("illuminace is > to max"), __FILE__ . ":" . __LINE__);
|
||||
//$this->send("OFF", null, AUTO);
|
||||
removeEvent($indexDevices[RDC_SALON_ECLAIRAGE_PANNEAU], "state", "OFF");
|
||||
}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__);
|
||||
$this->send("ON", null, AUTO);
|
||||
}
|
||||
break;
|
||||
}
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $param, bool2string($value)));
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $param, bool2string($value)), __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
|
||||
private function send($state, $delayState = false, $method = MANUAL)
|
||||
@ -64,13 +78,13 @@ class rdc_salon_eclairage extends hook
|
||||
$msg = array("state" => $state);
|
||||
if ($device->state["value"] != $state)
|
||||
{
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $device->friendlyName));
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $device->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
$device->payload = $msg;
|
||||
$device->set();
|
||||
$device->method = $method;
|
||||
}else
|
||||
{
|
||||
logger(INFO, sprintf(_("not publishing message: %s to %s, already set"), json_encode($msg), $device->friendlyName));
|
||||
logger(INFO, sprintf(_("not publishing message: %s to %s, already set"), json_encode($msg), $device->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
|
||||
}
|
||||
//echo 'delaystate = ' . var_dump($delayState);
|
||||
|
@ -49,7 +49,7 @@ class rdc_sdb_eclairage extends hook
|
||||
}
|
||||
break;
|
||||
}
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, ($value == 0 ? "OFF" : "ON")));
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, ($value == 0 ? "OFF" : "ON")), __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
|
||||
private function send($state)
|
||||
@ -57,7 +57,7 @@ class rdc_sdb_eclairage extends hook
|
||||
global $devices, $indexDevices;
|
||||
$msg = array("state_l1" => $state);
|
||||
$device = & $indexDevices[RDC_SDB_WC_ECLAIRAGE];
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), $state, $device->friendlyName));
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), $state, $device->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
$device->payload = $msg;
|
||||
$device->set(null);
|
||||
|
||||
|
@ -28,7 +28,7 @@ class rdc_wc_eclairage extends hook
|
||||
}
|
||||
break;
|
||||
}
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, $value));
|
||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, $value), __FILE__ . ":" . __LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user