";
}
fwrite($spawn, $response);
break;
case "set":
logger(DEBUG, "set reached");
$response = "";
fwrite($spawn, $response);
break;
case "print":
logger(DEBUG, "print reached");
$var = $GLOBALS[$argList["object"]];
if (isset($argList["topic"]))
{
$topic = $argList["topic"];
}
if (isset($argList["address"]))
{
$var = $var[$argList["address"]];
}elseif (isset($argList["fn"]))
{
if(!empty($topic))
{
$var = $var[$topic];
$path = explode("/", $argList["fn"]);
foreach($path as $tmp)
{
$var = $var[$tmp];
}
}else
{
logger(ERROR, _("topic is not defining: add &topic=zigbee2mqtt to the resquest"));
}
}
$error = error_get_last();
if($error !== null)
{
$response = "" . $error["message"] . " file: " . $error["file"] . " line: " . $error["line"] . "";
}
$response = "" . print_r($var, true) . "";
fwrite($spawn, $response);
break;
default:
logger(DEBUG, "not understanding command");
fwrite($spawn, "not understanding command");
}
}
}
}
}
}
?>