1
0

debugging

This commit is contained in:
2022-01-17 00:18:50 +01:00
parent cd20e973cd
commit 4fb5504cdc
18 changed files with 379 additions and 269 deletions

View File

@@ -1,15 +1,14 @@
<?php
class rdc_salon_eclairage
class rdc_salon_eclairage extends hook
{
public $hookName = "rdc_salon_eclairage";
public $active = true;
// list of devices we are listening to
private $devicelist = array(
RDC_SALON_MVMT => "occupancy",
RDC_SALON_MVMT2 => "occupancy",
RDC_ENTREE_PORTE => "contact",
RDC_SALON_LUMINOSITE => "illuminance_lux"
protected $devicelist = array(
RDC_SALON_MVMT => array("occupancy", false),
RDC_SALON_MVMT2 => array("occupancy", false),
RDC_ENTREE_PORTE => array("contact", false),
RDC_SALON_LUMINOSITE => array("illuminance_lux", false)
);
public $delay = 3; // amount of time in $timeunit
@@ -18,20 +17,6 @@ class rdc_salon_eclairage
public $luminance_max = 3000;
function __construct()
{
global $indexDevices;
// assigne the function to the sensors devices
if ($this->active === true)
{
foreach ($this->devicelist as $ieeeAddress => $param)
{
$indexDevices[$ieeeAddress]->$param["functions"][] = array($this,"callback");
}
}
}
// callback fonction. Is called with these 4 parameters
public function callBack(&$device, $param, $value)
{
@@ -61,7 +46,7 @@ class rdc_salon_eclairage
{
global $devices, $indexDevices;
$device = & $indexDevices[RDC_SALON_ECLAIRAGE_PANNEAU];
if ($device->state_l1["value"] != $state)
if ($device->state["value"] != $state)
{
$msg = array("state" => $state);
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $device->friendlyName));