debuggage
This commit is contained in:
@ -27,6 +27,7 @@ class rdc_wc_eclairage extends hook
|
||||
logger(DEBUG, "CASE: state_l2", __FILE__ . ":" . __LINE__);
|
||||
if ($value == "ON")
|
||||
{
|
||||
logger(DEBUG, "method =" . $targetDevice->properties["state_l2"]["method"], __FILE__ . ":" . __LINE__);
|
||||
if ($targetDevice->properties["state_l2"]["method"] == IDLE)
|
||||
{
|
||||
$targetDevice->properties["state_l2"]["method"] = MANUAL;
|
||||
@ -42,8 +43,8 @@ class rdc_wc_eclairage extends hook
|
||||
logger(DEBUG, "CASE: occupancy", __FILE__ . ":" . __LINE__);
|
||||
if ($value === true and $targetDevice->properties["state_l2"]["method"] == IDLE)
|
||||
{
|
||||
$targetDevice->properties["state_l2"]["method"] = AUTO;
|
||||
$this->send($targetDevice, "ON");
|
||||
//$targetDevice->properties["state_l2"]["method"] = AUTO;
|
||||
$this->send($targetDevice, "ON", AUTO);
|
||||
}elseif ($value === false and $targetDevice->properties["state_l2"]["method"] == AUTO)
|
||||
{
|
||||
//$targetDevice->properties["state_l2"]["method"] = IDLE;
|
||||
@ -53,14 +54,14 @@ class rdc_wc_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($targetDevice, $state)
|
||||
private function send($targetDevice, $state, $method = IDLE)
|
||||
{
|
||||
global $indexDevices;
|
||||
|
||||
$msg = array("state_l2" => $state);
|
||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $targetDevice->friendlyName), __FILE__ . ":" . __LINE__);
|
||||
$targetDevice->payload = $msg;
|
||||
$targetDevice->set(null);
|
||||
$targetDevice->set("state_l2", $method);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user