- changed webserver to apiserver
- added webserver - a lot of debugging - install shell script
This commit is contained in:
@ -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)
|
||||
|
@ -22,7 +22,6 @@ class topic {
|
||||
|
||||
class device
|
||||
{
|
||||
public $method; //0 = auto or 1 = manual
|
||||
public $topic;
|
||||
public $ieeeAddress;
|
||||
public $groupID;
|
||||
@ -40,9 +39,8 @@ class device
|
||||
$this->availability = array("value" => null, "functions" => array());
|
||||
}
|
||||
|
||||
public function set($method=0) //, $event = null)
|
||||
public function set() //, $event = null)
|
||||
{
|
||||
$this->method = $method;
|
||||
publish($this->topic . "/" . $this->friendlyName, $this->payload, "set"); //, $event);
|
||||
}
|
||||
|
||||
@ -72,6 +70,7 @@ class event
|
||||
public $stopDatetime;
|
||||
public $recurrenceInterval; // interval : for recurrent event
|
||||
public $exceptionInterval; // array of object ranges
|
||||
public $method; // cf: constants.php (IDLE, AUTO, MANUAL)
|
||||
}
|
||||
|
||||
class watch
|
||||
|
Reference in New Issue
Block a user