debug\ncode optimization
This commit is contained in:
@ -42,7 +42,7 @@ $callback = function($topic, $message)
|
||||
$fnTree = explode ("/" , $topic[1]); // get friendlyname
|
||||
echo $topic[0] . " => " . $topic[1] . EOL;
|
||||
//$devices[$topic[0]][$fnTree[0]]->json = json_decode($message->payload);
|
||||
if ($fnTree[array_key_last($fnTree)] == "availability")
|
||||
if ($fnTree[array_key_last($fnTree)] == "availability" and is_string($message->payload))
|
||||
{
|
||||
unset ($fnTree[array_key_last($fnTree)]);
|
||||
$payloadArray = array("availability" => $message->payload);
|
||||
@ -60,7 +60,7 @@ $callback = function($topic, $message)
|
||||
logger(LOG_WARNING, $logFh, "init of " . $fn .EOL);
|
||||
$device[$fn] = array();
|
||||
$device[$fn]["device"] = new device;
|
||||
//addDevice($device[$fn], $fn, );
|
||||
addDevice($device[$fn], $fn, $payloadArray);
|
||||
}
|
||||
$device = & $device[$fn];
|
||||
}
|
||||
|
Reference in New Issue
Block a user