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

@ -7,27 +7,28 @@ class rdc_wc_eclairage extends hook
protected $devicelist = array(RDC_SDB_WC_ECLAIRAGE => array("state_l2", false));
public $delay = 3; // amount of time in $timeunit
public $delayManual = 10; // amount of time in $timeunit for manual mode
public $delayManual = 8; // amount of time in $timeunit for manual mode
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
// callback fonction. Is called with these 4 parameters
public function callBack(&$device, $property, $value)
{
global $devices, $indexDevices;
var_dump($value);
switch($property)
{
case "state_l2":
if ($value == ON)
if ($value == "ON")
{
setDelay($device, $this->delayManual, $this->timeUnit, "state_l2", "OFF", true);
$device->method = MANUAL;
}elseif ($value = OFF)
}elseif ($value = "OFF")
{
deleteEvent(searchEvent($device, "state_l2", "OFF"));
}
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));
}
}