1
0

debugging hooks and events

This commit is contained in:
2022-01-20 00:26:57 +01:00
parent e4703dafc8
commit 10f2a1087a
9 changed files with 66 additions and 58 deletions

View File

@ -9,7 +9,7 @@ class rdc_sdb_eclairage extends hook
//public $initlialized = false;
public $delay = 3; // amount of time in $timeunit
public $delayManual = 10; // amount of time in $timeunit for manual mode
public $delayManual = 15; // 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
@ -26,6 +26,7 @@ class rdc_sdb_eclairage extends hook
public function callBack(&$device, $property, $value)
{
global $devices, $indexDevices;
var_dump($value);
switch($property)
{
case "occupancy":
@ -47,14 +48,14 @@ class rdc_sdb_eclairage extends hook
}
break;
}
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, bool2string($value)));
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, ($value == 0 ? "OFF" : "ON")));
}
private function send($state)
{
global $devices, $indexDevices;
$msg = array("state_l1" => $state);
$device = & $indexDevices["0x00158d0005c1a998"];
$device = & $indexDevices[RDC_SDB_WC_ECLAIRAGE];
logger(INFO, sprintf(_("publishing message: %s to %s"), $msg, $device->friendlyName));
$device->payload = $msg;
$device->set(null);