smart-home-engine 1.9.0 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/web/assets/{index-Dk0u9C_4.css → index-D_NqSYjh.css} +1 -1
- package/dist/web/assets/{index-4vE-ZHvJ.js → index-DqPNasAj.js} +60 -60
- package/dist/web/assets/{tsMode-CKR1khFZ.js → tsMode-1NAzjOi5.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/src/web/log-ws.js +12 -1
- package/src/web/mqtt-api.js +8 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-
|
|
1
|
+
import{m as O}from"./monaco-langs-BW2J83t5.js";import{t as I}from"./index-DqPNasAj.js";/*!-----------------------------------------------------------------------------
|
|
2
2
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
3
|
* Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
|
|
4
4
|
* Released under the MIT license
|
package/dist/web/index.html
CHANGED
|
@@ -172,10 +172,10 @@
|
|
|
172
172
|
}
|
|
173
173
|
})();
|
|
174
174
|
</script>
|
|
175
|
-
<script type="module" crossorigin src="/assets/index-
|
|
175
|
+
<script type="module" crossorigin src="/assets/index-DqPNasAj.js"></script>
|
|
176
176
|
<link rel="modulepreload" crossorigin href="/assets/monaco-langs-BW2J83t5.js">
|
|
177
177
|
<link rel="stylesheet" crossorigin href="/assets/monaco-langs-DyX1CsEw.css">
|
|
178
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
178
|
+
<link rel="stylesheet" crossorigin href="/assets/index-D_NqSYjh.css">
|
|
179
179
|
</head>
|
|
180
180
|
<body>
|
|
181
181
|
<div id="app"></div>
|
package/package.json
CHANGED
package/src/web/log-ws.js
CHANGED
|
@@ -94,6 +94,17 @@ function getLogBuffer() {
|
|
|
94
94
|
return _logBuffer.slice();
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Broadcast a structured broker (mosquitto) log entry to all connected
|
|
99
|
+
* WebSocket clients as { type: 'brokerLog', level, msg, ts }.
|
|
100
|
+
* @param {string} level Single-letter mosquitto level: D|I|N|W|E
|
|
101
|
+
* @param {string} msg
|
|
102
|
+
* @param {number} ts Unix ms timestamp
|
|
103
|
+
*/
|
|
104
|
+
function broadcastBrokerLog(level, msg, ts) {
|
|
105
|
+
broadcast({ type: 'brokerLog', level, msg, ts });
|
|
106
|
+
}
|
|
107
|
+
|
|
97
108
|
/**
|
|
98
109
|
* Close the WebSocket server.
|
|
99
110
|
* @returns {Promise<void>}
|
|
@@ -109,4 +120,4 @@ function closeWss() {
|
|
|
109
120
|
});
|
|
110
121
|
}
|
|
111
122
|
|
|
112
|
-
module.exports = { attachWss, broadcast, broadcastLog, closeWss, getLogBuffer, setWelcomeProvider };
|
|
123
|
+
module.exports = { attachWss, broadcast, broadcastBrokerLog, broadcastLog, closeWss, getLogBuffer, setWelcomeProvider };
|
package/src/web/mqtt-api.js
CHANGED
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
const express = require('express');
|
|
19
|
-
const { broadcast } = require('./log-ws');
|
|
19
|
+
const { broadcast, broadcastBrokerLog } = require('./log-ws');
|
|
20
|
+
|
|
21
|
+
const BROKER_LOG_TOPICS = new Set(['D', 'I', 'N', 'W', 'E'].map(l => `$SYS/broker/log/${l}`));
|
|
20
22
|
|
|
21
23
|
const router = express.Router();
|
|
22
24
|
|
|
@@ -35,7 +37,11 @@ function init(store, getMqttClient) {
|
|
|
35
37
|
// Forward every mqtt:: state change to connected WebSocket clients
|
|
36
38
|
store.on('change', (key, val, obj) => {
|
|
37
39
|
if (!key.startsWith('mqtt::')) return;
|
|
38
|
-
|
|
40
|
+
const topic = key.slice(6);
|
|
41
|
+
broadcast({ type: 'mqtt', topic, val: obj.val, ts: obj.ts });
|
|
42
|
+
if (BROKER_LOG_TOPICS.has(topic)) {
|
|
43
|
+
broadcastBrokerLog(topic.slice('$SYS/broker/log/'.length), String(obj.val), obj.ts);
|
|
44
|
+
}
|
|
39
45
|
});
|
|
40
46
|
}
|
|
41
47
|
|