added custom script plus some debugging
This commit is contained in:
16
events.php
16
events.php
@@ -30,7 +30,7 @@ function checkEvents()
|
||||
if ($exception === false)
|
||||
{
|
||||
echo "---->sending command set " . $event->param . "=>" . $event->value . " to " . $event->device->friendlyName . EOL;
|
||||
publish($event->device, array($event->param => $event->value), "set", $key);
|
||||
publish(mktopic($event->device), array($event->param => $event->value), "set", $key);
|
||||
if (($event->dateTimeEvent->add($event->recurrenceInterval)) === false)
|
||||
{
|
||||
logger(ERROR, _("Error in event recurrence. event: ") . $key);
|
||||
@@ -40,7 +40,7 @@ function checkEvents()
|
||||
}elseif (!empty($event->dateTimeEvent) and $event->dateTimeEvent <= now())
|
||||
{
|
||||
echo "---->sending command set " . $event->param . "=>" . $event->value . " to " . $event->device->friendlyName . EOL;
|
||||
$mid = publish($event->device, array($event->param => $event->value), "set", $key);
|
||||
$mid = publish(mktopic($event->device), array($event->param => $event->value), "set", $key);
|
||||
$event->published = now();
|
||||
//echo "#################################\nUnsetting event $key \n###########################" . EOL;
|
||||
unset($events[$key]);
|
||||
@@ -168,8 +168,16 @@ function searchEvent($device, $param , $value)
|
||||
function deleteEvent($eventKey)
|
||||
{
|
||||
global $events;
|
||||
unset ($events[$eventKey]);
|
||||
logger(INFO, _("delete event ") . $eventKey);
|
||||
if ($eventKey !==false)
|
||||
{
|
||||
unset ($events[$eventKey]);
|
||||
logger(INFO, _("delete event key =") . $eventKey);
|
||||
}else
|
||||
{
|
||||
//try to delete an flase event
|
||||
logger(WARNING, _("Try to delete event with key = ") . var_dump($eventKey));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user