debugging hooks and events
This commit is contained in:
parent
e4703dafc8
commit
10f2a1087a
@ -3,7 +3,7 @@ logger(DEBUG,"Including db.php");
|
|||||||
|
|
||||||
class db extends mysqli
|
class db extends mysqli
|
||||||
{
|
{
|
||||||
public $mysqlServer = "192.168.1.253"; // "127.0.0.1";
|
public $mysqlServer = "localhost"; // "127.0.0.1";
|
||||||
public $username = "moha";
|
public $username = "moha";
|
||||||
public $passwd = "MysqlMoha";
|
public $passwd = "MysqlMoha";
|
||||||
public $database = "moha";
|
public $database = "moha";
|
||||||
|
@ -189,10 +189,7 @@ function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $pro
|
|||||||
{
|
{
|
||||||
if (is_array($device->$key))
|
if (is_array($device->$key))
|
||||||
{
|
{
|
||||||
if (!empty($device->$key["value"]))
|
$oldValue = $device->$key["value"];
|
||||||
{
|
|
||||||
$oldValue = $device->$key["value"];
|
|
||||||
}
|
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
$oldValue = $device->$key;
|
$oldValue = $device->$key;
|
||||||
@ -202,6 +199,7 @@ function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $pro
|
|||||||
$device->{$key} = array("value" => null);
|
$device->{$key} = array("value" => null);
|
||||||
$device->$key["functions"] = array();
|
$device->$key["functions"] = array();
|
||||||
}
|
}
|
||||||
|
echo $key . 'oldvalue = ' . $oldValue . " value = " . $value . EOL;
|
||||||
if ($oldValue !== $value)
|
if ($oldValue !== $value)
|
||||||
{
|
{
|
||||||
$device->$key["value"] = $value;
|
$device->$key["value"] = $value;
|
||||||
@ -209,13 +207,14 @@ function iterateDevice($topic, $fn, $parentDevice, &$device, $payloadArray, $pro
|
|||||||
//$changed[$fn]["value"] = $value;
|
//$changed[$fn]["value"] = $value;
|
||||||
logger(INFO, sprintf(_("Device %s property %s, %s"), $fn, $propertyTree . $key, bool2string($value)));
|
logger(INFO, sprintf(_("Device %s property %s, %s"), $fn, $propertyTree . $key, bool2string($value)));
|
||||||
$mohaDB->logProperty($parentDevice, $propertyTree . $key, $value, $oldValue);
|
$mohaDB->logProperty($parentDevice, $propertyTree . $key, $value, $oldValue);
|
||||||
}
|
print_r($device->$key);
|
||||||
if (!empty($device->$key["functions"]))
|
if (!empty($device->$key["functions"]))
|
||||||
{
|
|
||||||
logger(DEBUG,_("executing notifications functions"));
|
|
||||||
foreach($device->$key["functions"] as $function)
|
|
||||||
{
|
{
|
||||||
$function($device, $key, $value);
|
logger(DEBUG,_("executing notifications functions"));
|
||||||
|
foreach($device->$key["functions"] as $function)
|
||||||
|
{
|
||||||
|
$function($device, $key, $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
|
47
events.php
47
events.php
@ -10,19 +10,22 @@ function checkEvents()
|
|||||||
$exception = false;
|
$exception = false;
|
||||||
foreach ($events as $key => $event)
|
foreach ($events as $key => $event)
|
||||||
{
|
{
|
||||||
|
$now = now();
|
||||||
if (!empty($event->startDatetime))
|
if (!empty($event->startDatetime))
|
||||||
{
|
{
|
||||||
if($event->dateTimeEvent <= now())
|
logger(DEBUG, _("StarDatetime is set"));
|
||||||
|
if($event->dateTimeEvent < $now)
|
||||||
{
|
{
|
||||||
|
logger(DEBUG, _("Event must be executed"));
|
||||||
if (!empty($event->exceptionInterval))
|
if (!empty($event->exceptionInterval))
|
||||||
{
|
{
|
||||||
|
logger(DEBUG, _("Testing exceptions"));
|
||||||
foreach($event->exceptionInterval as $key => $value)
|
foreach($event->exceptionInterval as $key => $value)
|
||||||
{
|
{
|
||||||
if($datetime("now") >= $value->start and $datetime("now") <= $value->end)
|
if($now > $value->start and $now < $value->end)
|
||||||
{
|
{
|
||||||
$exception = true;
|
$exception = true;
|
||||||
}elseif($datetime("now") >= $value->stop)
|
}elseif($now > $value->stop)
|
||||||
{
|
{
|
||||||
unset($event->exceptionInterval[$key]);
|
unset($event->exceptionInterval[$key]);
|
||||||
}
|
}
|
||||||
@ -30,19 +33,19 @@ function checkEvents()
|
|||||||
}
|
}
|
||||||
if ($exception === false)
|
if ($exception === false)
|
||||||
{
|
{
|
||||||
echo "---->sending command set " . $event->param . "=>" . $event->value . " to " . $event->device->friendlyName . EOL;
|
logger(DEBUG, sprintf(_("sending command set %s => %s for %s"), $event->param ,bool2string($event->value), $event->device->friendlyName));
|
||||||
publish(mktopic($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)
|
if (($event->dateTimeEvent->add($event->recurrenceInterval)) === false)
|
||||||
{
|
{
|
||||||
logger(ERROR, _("Error in event recurrence. event: ") . $key);
|
logger(ERROR, _("Error in adding interval to event recurrence. event: ") . $key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}elseif (!empty($event->dateTimeEvent) and $event->dateTimeEvent <= now())
|
}elseif (!empty($event->dateTimeEvent) and $event->dateTimeEvent < now())
|
||||||
{
|
{
|
||||||
logger(DEBUG, sprintf(_("---->sending command set %s => %s to %s"),$event->param, $event->value, $event->device->friendlyName));
|
logger(DEBUG, sprintf(_("Sending command set %s => %s to %s"),$event->param, bool2string($event->value), $event->device->friendlyName));
|
||||||
$mid = publish(mktopic($event->device), array($event->param => $event->value), "set"); //, $key);
|
$mid = publish(mktopic($event->device), array($event->param => $event->value), "set"); //, $key);
|
||||||
$event->published = now();
|
$event->published = $now;
|
||||||
//echo "#################################\nUnsetting event $key \n###########################" . EOL;
|
//echo "#################################\nUnsetting event $key \n###########################" . EOL;
|
||||||
unset($events[$key]);
|
unset($events[$key]);
|
||||||
}
|
}
|
||||||
@ -50,7 +53,7 @@ function checkEvents()
|
|||||||
//print_r($events);
|
//print_r($events);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setOneshotEvent(&$device, $datetime, $param, $value, $replace=false)
|
function setOneshotEvent(&$device, $datetime, $property, $value, $replace=false)
|
||||||
{
|
{
|
||||||
global $events;
|
global $events;
|
||||||
$events[] = new event;
|
$events[] = new event;
|
||||||
@ -58,12 +61,12 @@ function setOneshotEvent(&$device, $datetime, $param, $value, $replace=false)
|
|||||||
$events[$key]->dateTimeEvent = new dateTime($datetime);
|
$events[$key]->dateTimeEvent = new dateTime($datetime);
|
||||||
$events[$key]->ieeeAddress = $device->ieeeAddress;
|
$events[$key]->ieeeAddress = $device->ieeeAddress;
|
||||||
$events[$key]->topic = $device->topic;
|
$events[$key]->topic = $device->topic;
|
||||||
$events[$key]->param = $param;
|
$events[$key]->param = $property;
|
||||||
$events[$key]->value = $value;
|
$events[$key]->value = $value;
|
||||||
$events[$key]->device = & $device;
|
$events[$key]->device = & $device;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setRecurrentEvent(&$device, $param, $value, $startDatetime, $stopDatetime, $hours, $minutes, $seconds, $days, $weeks, $months, $years)
|
function setRecurrentEvent(&$device, $property, $value, $startDatetime, $stopDatetime, $hours, $minutes, $seconds, $days, $weeks, $months, $years)
|
||||||
{
|
{
|
||||||
global $events;
|
global $events;
|
||||||
$string = "P";
|
$string = "P";
|
||||||
@ -84,7 +87,7 @@ function setRecurrentEvent(&$device, $param, $value, $startDatetime, $stopDateti
|
|||||||
$event->ieee_address = $device->ieeeAddress;
|
$event->ieee_address = $device->ieeeAddress;
|
||||||
$event->topic = $device->topic;
|
$event->topic = $device->topic;
|
||||||
$event->device = & $device;
|
$event->device = & $device;
|
||||||
$event->param = $param;
|
$event->param = $property;
|
||||||
$event->value = $value;
|
$event->value = $value;
|
||||||
$event->dateTimeEvent = $event->startDatetime;
|
$event->dateTimeEvent = $event->startDatetime;
|
||||||
if (($event->dateTimeEvent->add($event->recurrenceInterval)) === false)
|
if (($event->dateTimeEvent->add($event->recurrenceInterval)) === false)
|
||||||
@ -94,7 +97,7 @@ function setRecurrentEvent(&$device, $param, $value, $startDatetime, $stopDateti
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setDelay(&$device, $delay, $unit="second", $param, $value, $replace=false)
|
function setDelay(&$device, $delay, $unit="second", $property, $value, $replace=false)
|
||||||
{
|
{
|
||||||
global $events;
|
global $events;
|
||||||
$datetime = new dateTime();
|
$datetime = new dateTime();
|
||||||
@ -134,30 +137,30 @@ function setDelay(&$device, $delay, $unit="second", $param, $value, $replace=fal
|
|||||||
//print_r($datetime);
|
//print_r($datetime);
|
||||||
if ($replace)
|
if ($replace)
|
||||||
{
|
{
|
||||||
$eventKey = searchEvent($device, $param, $value);
|
$eventKey = searchEvent($device, $property, $value);
|
||||||
if ($eventKey !== false) deleteEvent($eventKey);
|
if ($eventKey !== false) deleteEvent($eventKey);
|
||||||
}
|
}
|
||||||
//$dt = $datetime->format("Y-m-d\TH:i:s\Z");
|
//$dt = $datetime->format("Y-m-d\TH:i:s\Z");
|
||||||
$events[] = new event;
|
$events[] = new event;
|
||||||
$key = key($events);
|
$key = array_key_last($events);
|
||||||
$events[$key]->dateTimeEvent = $datetime;
|
$events[$key]->dateTimeEvent = $datetime;
|
||||||
$events[$key]->ieeeAddress = $device->ieeeAddress;
|
$events[$key]->ieeeAddress = $device->ieeeAddress;
|
||||||
$events[$key]->topic = $device->topic;
|
$events[$key]->topic = $device->topic;
|
||||||
$events[$key]->param = $param;
|
$events[$key]->param = $property;
|
||||||
$events[$key]->value = $value;
|
$events[$key]->value = $value;
|
||||||
$events[$key]->device = & $device;
|
$events[$key]->device = & $device;
|
||||||
echo "new event";
|
logger (DEBUG, _('Setting new delay in $events[]'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchEvent($device, $param , $value)
|
function searchEvent($device, $property , $value)
|
||||||
{
|
{
|
||||||
global $events;
|
global $events;
|
||||||
echo "searching event" . EOL;
|
logger(DEBUG, _("searching event for device %s, property %s and value %s"), $device->friendlyName, $property, bool2string($value));
|
||||||
foreach($events as $key => $event)
|
foreach($events as $key => $event)
|
||||||
{
|
{
|
||||||
//echo "Event : $event => $value" . EOL;
|
//echo "Event : $event => $value" . EOL;
|
||||||
//echo "===>";print_r($event); echo EOL;
|
//echo "===>";print_r($event); echo EOL;
|
||||||
if($event->topic == $device->topic and $event->param == $param and $event->value == $value and $event->ieeeAddress == $device->ieeeAddress)
|
if($event->topic == $device->topic and $event->param == $property and $event->value == $value and $event->ieeeAddress == $device->ieeeAddress)
|
||||||
{
|
{
|
||||||
//echo "==============================\nfound " . $key . "\n=================================" . EOL;
|
//echo "==============================\nfound " . $key . "\n=================================" . EOL;
|
||||||
return $key;
|
return $key;
|
||||||
@ -169,7 +172,7 @@ function searchEvent($device, $param , $value)
|
|||||||
function deleteEvent($eventKey)
|
function deleteEvent($eventKey)
|
||||||
{
|
{
|
||||||
global $events;
|
global $events;
|
||||||
if ($eventKey !==false)
|
if ($eventKey !== false)
|
||||||
{
|
{
|
||||||
unset ($events[$eventKey]);
|
unset ($events[$eventKey]);
|
||||||
logger(INFO, _("delete event key =") . $eventKey);
|
logger(INFO, _("delete event key =") . $eventKey);
|
||||||
|
@ -33,14 +33,14 @@ class availability
|
|||||||
if ($device->availability != $value)
|
if ($device->availability != $value)
|
||||||
{
|
{
|
||||||
//echo "==========>>>>>> Availability $value" . EOL;
|
//echo "==========>>>>>> Availability $value" . EOL;
|
||||||
if (!empty($device->availability))
|
//if (!empty($device->availability))
|
||||||
{
|
//{
|
||||||
$log = WARNING;
|
$log = ALERT;
|
||||||
}else
|
//}else
|
||||||
{
|
//{
|
||||||
$log = INFO;
|
// $log = INFO;
|
||||||
}
|
//}
|
||||||
$device->availability = $value;
|
//$device->availability = $value;
|
||||||
logger($log, sprintf(_("Device: %s/%s is %s"), $device->topic, $device->friendlyName, $value));
|
logger($log, sprintf(_("Device: %s/%s is %s"), $device->topic, $device->friendlyName, $value));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -11,7 +11,7 @@ class rdc_salon_eclairage extends hook
|
|||||||
RDC_SALON_LUMINOSITE => array("illuminance_lux", false)
|
RDC_SALON_LUMINOSITE => array("illuminance_lux", false)
|
||||||
);
|
);
|
||||||
|
|
||||||
public $delay = 3; // amount of time in $timeunit
|
public $delay = 5; // amount of time in $timeunit
|
||||||
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
|
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
|
||||||
public $luminance_min = 60;
|
public $luminance_min = 60;
|
||||||
public $luminance_max = 3000;
|
public $luminance_max = 3000;
|
||||||
@ -26,15 +26,15 @@ class rdc_salon_eclairage extends hook
|
|||||||
{
|
{
|
||||||
case "occupancy":
|
case "occupancy":
|
||||||
//print_r($indexDevices[RDC_SALON_LUMINOSITE]);
|
//print_r($indexDevices[RDC_SALON_LUMINOSITE]);
|
||||||
if ($value == 1 and $indexDevices[RDC_SALON_LUMINOSITE]->illuminance_lux["value"] <= $this->luminance_min)
|
if ($value == ON and $indexDevices[RDC_SALON_LUMINOSITE]->illuminance_lux["value"] <= $this->luminance_min)
|
||||||
{
|
{
|
||||||
$this->send("ON");
|
$this->send("ON", "OFF", AUTO);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "contact":
|
case "contact":
|
||||||
if ($value == false and $indexDevices[RDC_SALON_LUMINOSITE]->illuminance_lux["value"] <= $this->luminance_min)
|
if ($value == false and $indexDevices[RDC_SALON_LUMINOSITE]->illuminance_lux["value"] <= $this->luminance_min)
|
||||||
{
|
{
|
||||||
$this->send("ON");
|
$this->send("ON", "OFF", AUTO);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "illuminance_lux":
|
case "illuminance_lux":
|
||||||
@ -47,7 +47,7 @@ class rdc_salon_eclairage extends hook
|
|||||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $param, bool2string($value)));
|
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $param, bool2string($value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function send($state)
|
private function send($state, $delayState = false, $method = MANUAL)
|
||||||
{
|
{
|
||||||
global $devices, $indexDevices;
|
global $devices, $indexDevices;
|
||||||
$device = & $indexDevices[RDC_SALON_ECLAIRAGE_PANNEAU];
|
$device = & $indexDevices[RDC_SALON_ECLAIRAGE_PANNEAU];
|
||||||
@ -57,12 +57,14 @@ class rdc_salon_eclairage extends hook
|
|||||||
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $device->friendlyName));
|
logger(INFO, sprintf(_("publishing message: %s to %s"), json_encode($msg), $device->friendlyName));
|
||||||
$device->payload = $msg;
|
$device->payload = $msg;
|
||||||
$device->set();
|
$device->set();
|
||||||
setDelay($device, $this->delay, $this->timeUnit, "state", "OFF", true);
|
$device->method = $method;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
logger(INFO, sprintf(_("not publishing message: %s to %s, already set"), json_encode($msg), $device->friendlyName));
|
logger(INFO, sprintf(_("not publishing message: %s to %s, already set"), json_encode($msg), $device->friendlyName));
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
//echo 'delaystate = ' . var_dump($delayState);
|
||||||
|
if ($delayState !== false) setDelay($device, $this->delay, $this->timeUnit, "state", $delayState, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class rdc_sdb_eclairage extends hook
|
|||||||
//public $initlialized = false;
|
//public $initlialized = false;
|
||||||
|
|
||||||
public $delay = 3; // amount of time in $timeunit
|
public $delay = 3; // amount of time in $timeunit
|
||||||
public $delayManual = 10; // amount of time in $timeunit for manual mode
|
public $delayManual = 15; // amount of time in $timeunit for manual mode
|
||||||
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
|
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
|
||||||
// list of devices we are listening to
|
// list of devices we are listening to
|
||||||
|
|
||||||
@ -26,6 +26,7 @@ class rdc_sdb_eclairage extends hook
|
|||||||
public function callBack(&$device, $property, $value)
|
public function callBack(&$device, $property, $value)
|
||||||
{
|
{
|
||||||
global $devices, $indexDevices;
|
global $devices, $indexDevices;
|
||||||
|
var_dump($value);
|
||||||
switch($property)
|
switch($property)
|
||||||
{
|
{
|
||||||
case "occupancy":
|
case "occupancy":
|
||||||
@ -47,14 +48,14 @@ class rdc_sdb_eclairage extends hook
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, bool2string($value)));
|
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, ($value == 0 ? "OFF" : "ON")));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function send($state)
|
private function send($state)
|
||||||
{
|
{
|
||||||
global $devices, $indexDevices;
|
global $devices, $indexDevices;
|
||||||
$msg = array("state_l1" => $state);
|
$msg = array("state_l1" => $state);
|
||||||
$device = & $indexDevices["0x00158d0005c1a998"];
|
$device = & $indexDevices[RDC_SDB_WC_ECLAIRAGE];
|
||||||
logger(INFO, sprintf(_("publishing message: %s to %s"), $msg, $device->friendlyName));
|
logger(INFO, sprintf(_("publishing message: %s to %s"), $msg, $device->friendlyName));
|
||||||
$device->payload = $msg;
|
$device->payload = $msg;
|
||||||
$device->set(null);
|
$device->set(null);
|
||||||
|
@ -7,27 +7,28 @@ class rdc_wc_eclairage extends hook
|
|||||||
protected $devicelist = array(RDC_SDB_WC_ECLAIRAGE => array("state_l2", false));
|
protected $devicelist = array(RDC_SDB_WC_ECLAIRAGE => array("state_l2", false));
|
||||||
|
|
||||||
public $delay = 3; // amount of time in $timeunit
|
public $delay = 3; // amount of time in $timeunit
|
||||||
public $delayManual = 10; // amount of time in $timeunit for manual mode
|
public $delayManual = 8; // amount of time in $timeunit for manual mode
|
||||||
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
|
public $timeUnit = "minute"; // unit of time for delay, second, minute, day, week, month, year
|
||||||
|
|
||||||
// callback fonction. Is called with these 4 parameters
|
// callback fonction. Is called with these 4 parameters
|
||||||
public function callBack(&$device, $property, $value)
|
public function callBack(&$device, $property, $value)
|
||||||
{
|
{
|
||||||
global $devices, $indexDevices;
|
global $devices, $indexDevices;
|
||||||
|
var_dump($value);
|
||||||
switch($property)
|
switch($property)
|
||||||
{
|
{
|
||||||
case "state_l2":
|
case "state_l2":
|
||||||
if ($value == ON)
|
if ($value == "ON")
|
||||||
{
|
{
|
||||||
setDelay($device, $this->delayManual, $this->timeUnit, "state_l2", "OFF", true);
|
setDelay($device, $this->delayManual, $this->timeUnit, "state_l2", "OFF", true);
|
||||||
$device->method = MANUAL;
|
$device->method = MANUAL;
|
||||||
}elseif ($value = OFF)
|
}elseif ($value = "OFF")
|
||||||
{
|
{
|
||||||
deleteEvent(searchEvent($device, "state_l2", "OFF"));
|
deleteEvent(searchEvent($device, "state_l2", "OFF"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, bool2string($value)));
|
logger (INFO, sprintf(_("%s: notification received from MQTT from %s => parameter: %s value: %s"), $this->hookName, $device->friendlyName, $property, $value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,16 +8,17 @@ $topics["pws2mqtt"]->callback = function($topic, $message)
|
|||||||
logger(INFO, sprintf(_("Incoming notification of device %s => friendly name : %s"), $topic[0], $topic[1]));
|
logger(INFO, sprintf(_("Incoming notification of device %s => friendly name : %s"), $topic[0], $topic[1]));
|
||||||
$device = & $devices[$topic[0]];
|
$device = & $devices[$topic[0]];
|
||||||
$payloadArray = json_decode($message->payload);
|
$payloadArray = json_decode($message->payload);
|
||||||
if (!isset($device[$fn])) //must not exists, but ...
|
if (!isset($device[$fn]))
|
||||||
{
|
{
|
||||||
logger(LOG_WARNING, $logFh, "init of " . $fn .EOL);
|
logger(LOG_WARNING, $logFh, "init of " . $fn .EOL);
|
||||||
$device[$fn] = array();
|
$device[$fn] = array();
|
||||||
$device[$fn]["device"] = new device;
|
$device[$fn]["device"] = new device;
|
||||||
$device[$fn]["device"]->type = $payloadArray->type;
|
$device[$fn]["device"]->type = $payloadArray->type;
|
||||||
$device[$fn]["device"]->ieeeAddress = $payloadArray->ieeeAddress;
|
$device[$fn]["device"]->ieeeAddress = $payloadArray->ieeeAddress;
|
||||||
|
$device[$fn]["device"]->friendlyname = $fn;
|
||||||
$indexDevices[$device[$fn]["device"]->ieeeAddress] = & $device[$fn]["device"];
|
$indexDevices[$device[$fn]["device"]->ieeeAddress] = & $device[$fn]["device"];
|
||||||
}
|
}
|
||||||
$device = & $device[$fn];
|
$device = & $device[$fn];
|
||||||
changeDevice($topic[0], $topic[1], $device["device"], $payloadArray);
|
changeDevice($topic[0], $fn, $device["device"], $payloadArray);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
Reference in New Issue
Block a user