1
0

added callable function in event object

This commit is contained in:
2022-03-15 22:49:13 +01:00
parent c8772aeda0
commit 80234fc505
4 changed files with 14 additions and 6 deletions

View File

@@ -15,7 +15,7 @@ function checkEvents()
$now = now();
if (!empty($event->startDatetime))
{
logger(DEBUG, _("StarDatetime is set"), __FILE__ . ":" . __LINE__);
logger(DEBUG, _("StartDatetime is set"), __FILE__ . ":" . __LINE__);
if($event->dateTimeEvent < $now)
{
logger(DEBUG, _("Event must be executed"), __FILE__ . ":" . __LINE__);
@@ -35,11 +35,17 @@ function checkEvents()
}
if ($exception === false)
{
logger(DEBUG, sprintf(_("sending command set %s => %s for %s"), $event->param ,bool2string($event->value), $event->device->friendlyName), __FILE__ . ":" . __LINE__);
publish(mktopic($event->device), array($event->param => $event->value), "set");
if (($event->dateTimeEvent->add($event->recurrenceInterval)) === false)
if (is_callable($this->function))
{
logger(ERROR, _("Error in adding interval to event recurrence. event: ") . $key, __FILE__ . ":" . __LINE__);
$this->function(&$event);
}else
{
logger(DEBUG, sprintf(_("sending command set %s => %s for %s"), $event->param ,bool2string($event->value), $event->device->friendlyName), __FILE__ . ":" . __LINE__);
publish(mktopic($event->device), array($event->param => $event->value), "set");
if (($event->dateTimeEvent->add($event->recurrenceInterval)) === false)
{
logger(ERROR, _("Error in adding interval to event recurrence. event: ") . $key, __FILE__ . ":" . __LINE__);
}
}
}
}