1
0

- changed webserver to apiserver

- added webserver
- a lot of debugging
- install shell script
This commit is contained in:
2022-04-07 01:44:17 +02:00
parent 0d35b1ff3f
commit f8fc3f63ec
28 changed files with 463 additions and 223 deletions

View File

@ -31,25 +31,33 @@ class hook
{
foreach ($this->devicelist as $ieeeAddress => $property)
{
logger(DEBUG, _("Device: ") . $ieeeAddress, __FILE__ . ":" . __LINE__);
if ($this->propertyInitialized[$ieeeAddress][$property] === false)
if (array_key_exists($ieeeAddress, $devices))
{
logger(DEBUG, _("Trying to store callback"), __FILE__ . ":" . __LINE__);
if (isset($indexDevices[$ieeeAddress]->properties[$property]["functions"]))
logger(DEBUG, _("Device: ") . $ieeeAddress, __FILE__ . ":" . __LINE__);
if ($this->propertyInitialized[$ieeeAddress][$property] === false)
{
$indexDevices[$ieeeAddress]->properties[$property]["functions"][$this->hookName] = array($this,"callback");
$this->propertyInitialized[$ieeeAddress][$property] = true;
logger(DEBUG, sprintf(_("Property '%s' of %s is initialized with callback"), $property, $indexDevices[$ieeeAddress]->friendlyName), __FILE__ . ":" . __LINE__);
logger(DEBUG, _("Trying to store callback"), __FILE__ . ":" . __LINE__);
if (array_key_exists("functions", $indexDevices[$ieeeAddress]->properties[$property]))
{
$indexDevices[$ieeeAddress]->properties[$property]["functions"][$this->hookName] = array($this,"callback");
$this->propertyInitialized[$ieeeAddress][$property] = true;
logger(DEBUG, sprintf(_("Property '%s' of %s is initialized with callback"), $property, $indexDevices[$ieeeAddress]->friendlyName), __FILE__ . ":" . __LINE__);
}else
{
logger(WARNING, sprintf(_("Hook %s can not initialize Property '%s' of device %s"), $this->hookName, $property, $ieeeAddress), __FILE__ . ":" . __LINE__);
$result = false;
}
}else
{
logger(WARNING, sprintf(_("Hook %s can not initialize Property '%s' of device %s"), $this->hookName, $property, $ieeeAddress), __FILE__ . ":" . __LINE__);
$result = false;
logger(DEBUG, _("Callback already installed"), __FILE__ . ":" . __LINE__);
}
}else
{
logger(DEBUG, _("Callback already installed"), __FILE__ . ":" . __LINE__);
logger(ERROR, $ieeeAddress . (" does not exists"), __FILE__ . ":" . __LINE__);
mkIndexes();
}
}
//echo "result => "; var_dump($result);
if ($result === true)