1
0

debugging

This commit is contained in:
2022-01-17 00:18:50 +01:00
parent cd20e973cd
commit 4fb5504cdc
18 changed files with 379 additions and 269 deletions

View File

@@ -0,0 +1,33 @@
<?php
//TODO to test and debug
$topics["linky2mqtt"] = new topic;
/*$devices["linky2mqtt"]["linky"]["device"] = new device;
$device = &$devices["linky2mqtt"]["linky"]["device"];
*/
$topics["linky2mqtt"]->callback = function($topic, $message)
{
global $topics, $logFh, $devices, $included;
$topicName = $topic[0];
$friendlyName = $topic[1]; // get friendlyName
logger(INFO, sprintf(_("Icoming notification of device %s"), $topic[0], $topic[1]));
$device = & $devices[$topic[0]];
$payloadArray = json_decode($message->payload);
//print_r($payloadArray);
//print_r($device) ;
if (!isset($device[$fn])) //must not exists, but ...
{
logger(LOG_WARNING, $logFh, "init of " . $fn .EOL);
$device[$fn] = array();
$device[$fn]["device"] = new device;
$device[$fn]["device"]->type = "mesure";
$device[$fn]["device"]->ieeeAddress = $payloadArray["ADSC"];
//addDevice($device[$fn], $fn, );
}
$device = & $device[$fn];
//print_r($device);
changeDevice($topicName, $friendlyName, $device["device"], $payloadArray);
print_r($device["device"]);
}
?>