1
0

debugging

This commit is contained in:
2022-01-28 23:05:58 +01:00
parent 1361cb9395
commit 425107cec7
22 changed files with 167 additions and 136 deletions

View File

@ -7,12 +7,12 @@ $topics["linky2mqtt"]->callback = function($topic, $message)
global $topics, $logFh, $devices, $included;
$topicName = $topic[0];
$friendlyName = $topic[1]; // get friendlyName
logger(INFO, sprintf(_("Incoming notification of device %s"), $topic[0], $topic[1]));
logger(INFO, sprintf(_("Incoming notification of device %s"), $topic[0], $topic[1]), __FILE__ . ":" . __LINE__);
$device = & $devices[$topic[0]];
$payloadArray = json_decode($message->payload);
if (!isset($device[$fn])) //must not exists, but ...
{
logger(LOG_WARNING, $logFh, "init of " . $fn .EOL);
logger(LOG_WARNING, $logFh, _("init of ") . $fn, __FILE__ . ":" . __LINE__);
$device[$fn] = array();
$device[$fn]["device"] = new device;
$device[$fn]["device"]->type = "mesure";

View File

@ -5,13 +5,13 @@ $topics["pws2mqtt"]->callback = function($topic, $message)
{
global $topics, $logFh, $devices, $included;
$fn = $topic[1]; // get friendlyname
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]), __FILE__ . ":" . __LINE__);
$device = & $devices[$topic[0]];
$payloadArray = json_decode($message->payload);
if (!isset($device[$fn]))
{
logger(WARNING, $logFh, "init of " . $fn .EOL);
logger(WARNING, $logFh, _("init of ") . $fn, __FILE__ . ":" . __LINE__);
$device[$fn] = array();
$device[$fn]["device"] = new device;
$device[$fn]["device"]->type = $payloadArray->type;

View File

@ -11,13 +11,13 @@ $callback = function($topic, $message)
$topics[$topic[0]]->info = json_decode($message->payload);
break;
case "devices":
logger(DEBUG,_("Inserting zigbee devices in DB"));
logger(DEBUG,_("Inserting zigbee devices in DB"), __FILE__ . ":" . __LINE__);
$topics[$topic[0]]->devices = json_decode($message->payload);
fwrite($logFh, print_r($topics[$topic[0]]->devices, true));
mkDevicesDB($topic[0], $topics[$topic[0]]->devices);
break;
case "groups":
logger(DEBUG,_("Inserting zigbee groups in DB"));
logger(DEBUG,_("Inserting zigbee groups in DB"), __FILE__ . ":" . __LINE__);
$topics[$topic[0]]->groups = json_decode($message->payload);
mkDevicesDB($topic[0], $topics[$topic[0]]->groups, true);
break;
@ -57,7 +57,7 @@ $callback = function($topic, $message)
//print_r($device) ;
if (!isset($device[$fn])) //must not exists, but ...
{
logger(LOG_WARNING, $logFh, "init of " . $fn .EOL);
logger(LOG_WARNING, $logFh, _("init of ") . $fn, __FILE__ . ":" . __LINE__);
$device[$fn] = array();
$device[$fn]["device"] = new device;
addDevice($device[$fn], $fn, $payloadArray);