write debug to log and mqtt
parent
55989ff7f6
commit
ea74c28060
|
@ -64,6 +64,7 @@ $mqtt->onMessage(function ($message) use (
|
||||||
&$news,
|
&$news,
|
||||||
&$globalCounter,
|
&$globalCounter,
|
||||||
&$isRunning,
|
&$isRunning,
|
||||||
|
&$mqtt,
|
||||||
$mqttTopic
|
$mqttTopic
|
||||||
) {
|
) {
|
||||||
if ($mqttTopic . "/restart" === $message->topic) {
|
if ($mqttTopic . "/restart" === $message->topic) {
|
||||||
|
@ -71,7 +72,7 @@ $mqtt->onMessage(function ($message) use (
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($mqttTopic . "/debug" === $message->topic) {
|
if ($mqttTopic . "/debug" === $message->topic) {
|
||||||
logit(
|
$debug = strval(
|
||||||
json_encode(
|
json_encode(
|
||||||
$data,
|
$data,
|
||||||
JSON_UNESCAPED_SLASHES +
|
JSON_UNESCAPED_SLASHES +
|
||||||
|
@ -79,6 +80,9 @@ $mqtt->onMessage(function ($message) use (
|
||||||
JSON_PRETTY_PRINT
|
JSON_PRETTY_PRINT
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
logit($debug);
|
||||||
|
|
||||||
|
$mqtt->publish($mqttTopic . "/debugmsg", $debug, 2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$globalCounter++;
|
$globalCounter++;
|
||||||
|
@ -104,6 +108,7 @@ $mqtt->onMessage(function ($message) use (
|
||||||
logit("Subscribing to $mqttTopic with QoS $qos ");
|
logit("Subscribing to $mqttTopic with QoS $qos ");
|
||||||
$mqtt->subscribe($mqttTopic, $qos);
|
$mqtt->subscribe($mqttTopic, $qos);
|
||||||
$mqtt->subscribe($mqttTopic . "/restart", $qos);
|
$mqtt->subscribe($mqttTopic . "/restart", $qos);
|
||||||
|
$mqtt->subscribe($mqttTopic . "/debug", $qos);
|
||||||
logit("Subscribed");
|
logit("Subscribed");
|
||||||
|
|
||||||
$timer = 0;
|
$timer = 0;
|
||||||
|
|
Loading…
Reference in New Issue