1
0

modified init and some debugging

This commit is contained in:
2022-01-06 13:03:26 +01:00
parent 85a7fd7ed9
commit 004c6aa572
10 changed files with 178 additions and 34 deletions

View File

@@ -14,7 +14,7 @@ class rdc_salon_eclairage
public $delay = 3; // amount of time in $timeunit
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
public $luminance_min = 80;
public $luminance_min = 60;
public $luminance_max = 3000;
@@ -60,12 +60,19 @@ class rdc_salon_eclairage
private function send($state)
{
global $devices, $indexDevices;
$msg = array("state" => $state);
$device = & $indexDevices[RDC_SALON_ECLAIRAGE_PANNEAU];
logger(INFO, sprintf(_("publishing message: %s to %s"), $msg, $device->friendlyName));
$device->payload = $msg;
$device->set(null);
setDelay($device, $this->delay, $this->timeUnit, "state", "OFF", true);
if ($device->state_l1["value"] != $state)
{
$msg = array("state" => $state);
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $device->friendlyName));
$device->payload = $msg;
$device->set(null);
setDelay($device, $this->delay, $this->timeUnit, "state", "OFF", true);
}else
{
logger(INFO, sprintf(_("not publishing message: %s to %s, already set"), json_encode($msg), $device->friendlyName));
}
}
}