1
0

debug\ncode optimization

This commit is contained in:
2022-01-19 00:22:34 +01:00
parent 11a2253804
commit e4703dafc8
15 changed files with 135 additions and 82 deletions

View File

@@ -2,7 +2,7 @@
class rdc_salon_eclairage extends hook
{
public $hookName = "rdc_salon_eclairage";
public $active = true;
// list of devices we are listening to
protected $devicelist = array(
RDC_SALON_MVMT => array("occupancy", false),
@@ -44,19 +44,19 @@ class rdc_salon_eclairage extends hook
}
break;
}
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $param, $value));
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $param, bool2string($value)));
}
private function send($state)
{
global $devices, $indexDevices;
$device = & $indexDevices[RDC_SALON_ECLAIRAGE_PANNEAU];
$msg = array("state" => $state);
if ($device->state["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);
$device->set();
setDelay($device, $this->delay, $this->timeUnit, "state", "OFF", true);
}else
{

View File

@@ -12,17 +12,13 @@ class rdc_sdb_eclairage extends hook
public $delayManual = 10; // amount of time in $timeunit for manual mode
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
// list of devices we are listening to
// 0x00158d0003f0f3b4 douche mvmnt
// 0x842e14fffe1c0cd1 plafond mvmnt
// 0x00124b0022ec05dc mvmnt
// 0x00158d0005c1a998 module commutateur => state_l1
// devicelist[$ieeAddress][0] => property to watch
// devicelist[$ieeAddress][1] => initialized = true
protected $devicelist = array(
"0x00158d0003f0f3b4" => array("occupancy", false),
"0x842e14fffe1c0cd1" => array("occupancy", false),
"0x00124b0022ec05dc" => array("occupancy", false),
RDC_SDB_DOUCHE_MVMT => array("occupancy", false),
RDC_SDB_PLAFOND_MVMT => array("occupancy", false),
RDC_SDB_MVMT => array("occupancy", false),
RDC_SDB_WC_ECLAIRAGE => array("state_l1", false)
);
@@ -51,7 +47,7 @@ class rdc_sdb_eclairage extends hook
}
break;
}
logger (INFO, _("%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, bool2string($value)));
}
private function send($state)

View File

@@ -27,7 +27,7 @@ class rdc_wc_eclairage extends hook
}
break;
}
logger (INFO, _("%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, bool2string($value)));
}
}