1
0

- changed webserver to apiserver

- added webserver
- a lot of debugging
- install shell script
This commit is contained in:
2022-04-07 01:44:17 +02:00
parent 0d35b1ff3f
commit f8fc3f63ec
28 changed files with 463 additions and 223 deletions

View File

@ -28,40 +28,47 @@ class rdc_sdb_eclairage extends hook
{
global $indexDevices;
//var_dump($value);
$deviceTarget = $indexDevices[RDC_SDB_WC_ECLAIRAGE];
logger(DEBUG, "Callback : " . $this->hookName, __FILE__ . ":" . __LINE__);
switch($property)
$deviceTarget = &$indexDevices[RDC_SDB_WC_ECLAIRAGE];
if ($deviceTarget !== null)
{
case "occupancy":
logger(DEBUG, _("CASE: occupancy"), __FILE__ . ":" . __LINE__);
if ($value == ON )
{
$this->send("ON");
$device->method = AUTO;
}
break;
case "state_l1":
logger(DEBUG, _("CASE: state_l1"), __FILE__ . ":" . __LINE__);
if ($value == "ON")
{
if ($device->method != MANUAL)
logger(DEBUG, "Callback : " . $this->hookName, __FILE__ . ":" . __LINE__);
switch($property)
{
case "occupancy":
logger(DEBUG, _("CASE: occupancy"), __FILE__ . ":" . __LINE__);
if ($value == ON )
{
$delay = $this->delay;
$device->method = AUTO;
}else
{
$delay = $this->delayManual;
$device->method = MANUAL;
$this->send("ON");
$deviceTarget->properties["state_l1"]["method"] = AUTO;
}
setDelay($deviceTarget, $delay, $this->timeUnit, "state_l1", "OFF", true);
}elseif ($value == "OFF")
{
removeEvent($deviceTarget, "state_l1", "OFF");
$device->method = null;
}
break;
break;
case "state_l1":
logger(DEBUG, _("CASE: state_l1"), __FILE__ . ":" . __LINE__);
if ($value == "ON")
{
if ($deviceTarget->properties["state_l1"]["method"] != MANUAL)
{
$delay = $this->delay;
$deviceTarget->properties["state_l1"]["method"] = AUTO;
}else
{
$delay = $this->delayManual;
$deviceTarget->properties["state_l1"]["method"] = MANUAL;
}
setDelay($deviceTarget, $delay, $this->timeUnit, "state_l1", "OFF", true, IDLE);
}elseif ($value == "OFF")
{
removeEvent($deviceTarget, "state_l1", "OFF");
$deviceTarget->properties["state_l1"]["method"] = IDLE;
}
break;
}
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__);
}else
{
logger (ERROR, RDC_SDB_WC_ECLAIRAGE . _(" does not exists"), __FILE__ . ":" . __LINE__);
}
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)