1
0

modified rdc_sdb_eclairage

This commit is contained in:
Daniel Tartavel 2022-07-31 22:31:51 +02:00
parent be7db07714
commit d13529251b
2 changed files with 14 additions and 12 deletions

View File

@ -80,7 +80,7 @@ function checkEvents()
// datetime format : "yyyy-mm-dd hh:mm:ss" // datetime format : "yyyy-mm-dd hh:mm:ss"
function setOneshotEvent(device &$deviceObject, string $datetime, $property, $value, $replace=false, $method=null) function setOneshotEvent(device &$deviceObject, string $datetime, $property, $value, $function=null, $replace=false, $method=null)
{ {
global $events; global $events;
$events[] = new event; $events[] = new event;
@ -91,6 +91,7 @@ function setOneshotEvent(device &$deviceObject, string $datetime, $property, $va
$events[$key]->param = $property; $events[$key]->param = $property;
$events[$key]->value = $value; $events[$key]->value = $value;
$events[$key]->device = & $deviceObject; $events[$key]->device = & $deviceObject;
$events[$key]->function = $function;
if ($method !==null) $events[$key]->method =$method; if ($method !==null) $events[$key]->method =$method;
} }
@ -157,7 +158,7 @@ function setRecurrentEvent($function, $ieeeAddress, string $property, $value, bo
return 0; return 0;
} }
function setDelay(device &$deviceObject, float $delay, string $unit, string $property, $value, bool $replace=false, int $method = null) function setDelay(device &$deviceObject, float $delay, string $unit, string $property, $value, $function, bool $replace=false, int $method = null)
{ {
global $events, $logLevel; global $events, $logLevel;
$oldLevel = $logLevel; $oldLevel = $logLevel;
@ -211,6 +212,7 @@ function setDelay(device &$deviceObject, float $delay, string $unit, string $pro
$events[$key]->param = $property; $events[$key]->param = $property;
$events[$key]->value = $value; $events[$key]->value = $value;
$events[$key]->device = & $deviceObject; $events[$key]->device = & $deviceObject;
$events[$key]->function = $function;
if ($method !== null) $events[$key]->method = $method; if ($method !== null) $events[$key]->method = $method;
logger (DEBUG, _('Setting new delay in $events[]'), __FILE__ . ":" . __LINE__); logger (DEBUG, _('Setting new delay in $events[]'), __FILE__ . ":" . __LINE__);
//print_r($events[$key]); //print_r($events[$key]);
@ -228,7 +230,7 @@ function removeEvent(device $deviceObject, string $property , $value, int $metho
} }
} }
function searchEvent(device $deviceObject, string $property , $value) function searchEvent(device $deviceObject, string $property, $function, $value)
{ {
global $events; global $events;
logger(DEBUG, sprintf(_("searching event for device %s, property %s and value %s"), $deviceObject->friendlyName, $property, bool2string($value)), __FILE__ . ":" . __LINE__); logger(DEBUG, sprintf(_("searching event for device %s, property %s and value %s"), $deviceObject->friendlyName, $property, bool2string($value)), __FILE__ . ":" . __LINE__);

View File

@ -52,7 +52,7 @@ class rdc_sdb_eclairage extends hook
}elseif (testActionneurs($this->actionneurs)) }elseif (testActionneurs($this->actionneurs))
{ {
logger(DEBUG, _("Actionneurs are all false"), __FILE__ . ":" . __LINE__); logger(DEBUG, _("Actionneurs are all false"), __FILE__ . ":" . __LINE__);
setDelay($deviceTarget, $this->delay, $this->timeUnit, "state_l1", "OFF", true, IDLE); //setDelay($deviceTarget, $this->delay, $this->timeUnit, "state_l1", "OFF", true, IDLE);
} }
break; break;
case "state_l1": case "state_l1":