matterbridge 3.3.4-dev-20251020-4d2dd49 → 3.3.4-dev-20251020-df40d12
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/CHANGELOG.md +1 -0
- package/dist/cli.js +7 -6
- package/dist/devices/airConditioner.js +2 -2
- package/dist/devices/batteryStorage.js +3 -3
- package/dist/devices/dishwasher.js +4 -4
- package/dist/devices/evse.js +6 -5
- package/dist/devices/extractorHood.js +1 -1
- package/dist/devices/heatPump.js +2 -2
- package/dist/devices/laundryDryer.js +3 -3
- package/dist/devices/laundryWasher.js +5 -5
- package/dist/devices/microwaveOven.js +5 -5
- package/dist/devices/oven.js +5 -5
- package/dist/devices/refrigerator.js +4 -4
- package/dist/devices/roboticVacuumCleaner.js +11 -11
- package/dist/devices/solarPower.js +2 -2
- package/dist/devices/speaker.js +2 -1
- package/dist/devices/temperatureControl.js +2 -2
- package/dist/devices/waterHeater.js +6 -6
- package/dist/frontend.js +27 -26
- package/dist/helpers.js +1 -1
- package/dist/matterbridge.js +17 -13
- package/dist/matterbridgeAccessoryPlatform.js +2 -0
- package/dist/matterbridgeBehaviors.js +20 -20
- package/dist/matterbridgeDeviceTypes.js +85 -85
- package/dist/matterbridgeDynamicPlatform.js +2 -0
- package/dist/matterbridgeEndpoint.js +64 -61
- package/dist/matterbridgeEndpointHelpers.js +78 -75
- package/dist/matterbridgePlatform.js +2 -2
- package/dist/update.js +1 -1
- package/dist/utils/format.js +29 -0
- package/dist/utils/jestHelpers.js +7 -3
- package/dist/utils/network.js +0 -26
- package/dist/utils/tracker.js +17 -45
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -2,10 +2,14 @@ import { rmSync } from 'node:fs';
|
|
|
2
2
|
import { inspect } from 'node:util';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { jest } from '@jest/globals';
|
|
5
|
-
import { DeviceTypeId, Endpoint, Environment, ServerNode, ServerNodeStore, VendorId, LogFormat as MatterLogFormat, LogLevel as MatterLogLevel, Lifecycle } from '@matter/main';
|
|
6
|
-
import { AggregatorEndpoint, RootEndpoint } from '@matter/main/endpoints';
|
|
7
|
-
import { MdnsService } from '@matter/main/protocol';
|
|
8
5
|
import { AnsiLogger } from 'node-ansi-logger';
|
|
6
|
+
import '@matter/nodejs';
|
|
7
|
+
import { LogFormat as MatterLogFormat, LogLevel as MatterLogLevel, Environment, Lifecycle } from '@matter/general';
|
|
8
|
+
import { DeviceTypeId, VendorId } from '@matter/types';
|
|
9
|
+
import { MdnsService } from '@matter/protocol';
|
|
10
|
+
import { ServerNode, Endpoint, ServerNodeStore } from '@matter/node';
|
|
11
|
+
import { AggregatorEndpoint } from '@matter/node/endpoints/aggregator';
|
|
12
|
+
import { RootEndpoint } from '@matter/node/endpoints/root';
|
|
9
13
|
export let loggerLogSpy;
|
|
10
14
|
export let consoleLogSpy;
|
|
11
15
|
export let consoleDebugSpy;
|
package/dist/utils/network.js
CHANGED
|
@@ -180,29 +180,3 @@ export async function getGlobalNodeModules() {
|
|
|
180
180
|
});
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
|
-
export function formatMemoryUsage(bytes) {
|
|
184
|
-
if (bytes >= 1024 ** 3) {
|
|
185
|
-
return `${(bytes / 1024 ** 3).toFixed(2)} GB`;
|
|
186
|
-
}
|
|
187
|
-
else if (bytes >= 1024 ** 2) {
|
|
188
|
-
return `${(bytes / 1024 ** 2).toFixed(2)} MB`;
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
return `${(bytes / 1024).toFixed(2)} KB`;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
export function formatOsUpTime(seconds) {
|
|
195
|
-
if (seconds >= 86400) {
|
|
196
|
-
const days = Math.floor(seconds / 86400);
|
|
197
|
-
return `${days} day${days !== 1 ? 's' : ''}`;
|
|
198
|
-
}
|
|
199
|
-
if (seconds >= 3600) {
|
|
200
|
-
const hours = Math.floor(seconds / 3600);
|
|
201
|
-
return `${hours} hour${hours !== 1 ? 's' : ''}`;
|
|
202
|
-
}
|
|
203
|
-
if (seconds >= 60) {
|
|
204
|
-
const minutes = Math.floor(seconds / 60);
|
|
205
|
-
return `${minutes} minute${minutes !== 1 ? 's' : ''}`;
|
|
206
|
-
}
|
|
207
|
-
return `${seconds} second${seconds !== 1 ? 's' : ''}`;
|
|
208
|
-
}
|
package/dist/utils/tracker.js
CHANGED
|
@@ -3,6 +3,7 @@ if (process.argv.includes('--loader') || process.argv.includes('-loader'))
|
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import EventEmitter from 'node:events';
|
|
5
5
|
import { AnsiLogger, BRIGHT, CYAN, RESET, YELLOW, db, RED } from 'node-ansi-logger';
|
|
6
|
+
import { formatPercent, formatBytes, formatTimeStamp } from './format.js';
|
|
6
7
|
export class Tracker extends EventEmitter {
|
|
7
8
|
name;
|
|
8
9
|
debug;
|
|
@@ -65,35 +66,6 @@ export class Tracker extends EventEmitter {
|
|
|
65
66
|
this.runGarbageCollector();
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
|
-
formatTimeStamp(timestamp) {
|
|
69
|
-
return `${new Date(timestamp).toLocaleString()}`;
|
|
70
|
-
}
|
|
71
|
-
formatOsUpTime(seconds) {
|
|
72
|
-
if (seconds >= 86400) {
|
|
73
|
-
const days = Math.floor(seconds / 86400);
|
|
74
|
-
return `${days} day${days !== 1 ? 's' : ''}`;
|
|
75
|
-
}
|
|
76
|
-
if (seconds >= 3600) {
|
|
77
|
-
const hours = Math.floor(seconds / 3600);
|
|
78
|
-
return `${hours} hour${hours !== 1 ? 's' : ''}`;
|
|
79
|
-
}
|
|
80
|
-
if (seconds >= 60) {
|
|
81
|
-
const minutes = Math.floor(seconds / 60);
|
|
82
|
-
return `${minutes} minute${minutes !== 1 ? 's' : ''}`;
|
|
83
|
-
}
|
|
84
|
-
return `${seconds} second${seconds !== 1 ? 's' : ''}`;
|
|
85
|
-
}
|
|
86
|
-
formatPercent(percent) {
|
|
87
|
-
return `${percent.toFixed(2)} %`;
|
|
88
|
-
}
|
|
89
|
-
formatBytes(bytes) {
|
|
90
|
-
if (bytes === 0)
|
|
91
|
-
return '0 B';
|
|
92
|
-
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
93
|
-
const idx = Math.min(Math.floor(Math.log(bytes) / Math.log(1024)), units.length - 1);
|
|
94
|
-
const value = bytes / Math.pow(1024, idx);
|
|
95
|
-
return `${value.toFixed(2)} ${units[idx]}`;
|
|
96
|
-
}
|
|
97
69
|
start(sampleIntervalMs = 10000) {
|
|
98
70
|
if (this.trackerInterval)
|
|
99
71
|
return;
|
|
@@ -154,14 +126,14 @@ export class Tracker extends EventEmitter {
|
|
|
154
126
|
this.emit('memory', entry.freeMemory, entry.totalMemory, entry.rss, entry.heapUsed, entry.heapTotal, entry.external, entry.arrayBuffers);
|
|
155
127
|
this.emit('snapshot', entry);
|
|
156
128
|
if (this.debug) {
|
|
157
|
-
this.log.debug(`Time: ${
|
|
158
|
-
`os ${CYAN}${BRIGHT}${
|
|
159
|
-
`process ${CYAN}${BRIGHT}${
|
|
160
|
-
`rss: ${CYAN}${BRIGHT}${
|
|
161
|
-
`heapUsed: ${CYAN}${BRIGHT}${
|
|
162
|
-
`heapTotal: ${CYAN}${BRIGHT}${
|
|
163
|
-
`external: ${CYAN}${BRIGHT}${
|
|
164
|
-
`arrayBuffers: ${CYAN}${BRIGHT}${
|
|
129
|
+
this.log.debug(`Time: ${formatTimeStamp(entry.timestamp)} ` +
|
|
130
|
+
`os ${CYAN}${BRIGHT}${formatPercent(entry.osCpu)}${RESET}${db} (${entry.peakOsCpu > prevEntry.peakOsCpu ? RED : ''}${formatPercent(entry.peakOsCpu)}${db}) ` +
|
|
131
|
+
`process ${CYAN}${BRIGHT}${formatPercent(entry.processCpu)}${RESET}${db} (${entry.peakProcessCpu > prevEntry.peakProcessCpu ? RED : ''}${formatPercent(entry.peakProcessCpu)}${db}) ` +
|
|
132
|
+
`rss: ${CYAN}${BRIGHT}${formatBytes(entry.rss)}${RESET}${db} (${entry.peakRss > prevEntry.peakRss ? RED : ''}${formatBytes(entry.peakRss)}${db}) ` +
|
|
133
|
+
`heapUsed: ${CYAN}${BRIGHT}${formatBytes(entry.heapUsed)}${RESET}${db} (${entry.peakHeapUsed > prevEntry.peakHeapUsed ? RED : ''}${formatBytes(entry.peakHeapUsed)}${db}) ` +
|
|
134
|
+
`heapTotal: ${CYAN}${BRIGHT}${formatBytes(entry.heapTotal)}${RESET}${db} (${entry.peakHeapTotal > prevEntry.peakHeapTotal ? RED : ''}${formatBytes(entry.peakHeapTotal)}${db}) ` +
|
|
135
|
+
`external: ${CYAN}${BRIGHT}${formatBytes(entry.external)}${RESET}${db} (${entry.peakExternal > prevEntry.peakExternal ? RED : ''}${formatBytes(entry.peakExternal)}${db}) ` +
|
|
136
|
+
`arrayBuffers: ${CYAN}${BRIGHT}${formatBytes(entry.arrayBuffers)}${RESET}${db} (${entry.peakArrayBuffers > prevEntry.peakArrayBuffers ? RED : ''}${formatBytes(entry.peakArrayBuffers)}${db})`);
|
|
165
137
|
}
|
|
166
138
|
Tracker.historyIndex = (Tracker.historyIndex + 1) % Tracker.historySize;
|
|
167
139
|
}, sampleIntervalMs);
|
|
@@ -214,14 +186,14 @@ export class Tracker extends EventEmitter {
|
|
|
214
186
|
const entry = Tracker.history[index];
|
|
215
187
|
if (entry.timestamp === 0)
|
|
216
188
|
continue;
|
|
217
|
-
this.log.debug(`${
|
|
218
|
-
`${CYAN}${BRIGHT}${
|
|
219
|
-
`${CYAN}${BRIGHT}${
|
|
220
|
-
`${CYAN}${BRIGHT}${
|
|
221
|
-
`${CYAN}${BRIGHT}${
|
|
222
|
-
`${CYAN}${BRIGHT}${
|
|
223
|
-
`${CYAN}${BRIGHT}${
|
|
224
|
-
`${CYAN}${BRIGHT}${
|
|
189
|
+
this.log.debug(`${formatTimeStamp(entry.timestamp)} ` +
|
|
190
|
+
`${CYAN}${BRIGHT}${formatPercent(entry.osCpu).padStart(8)}${RESET} (${formatPercent(entry.peakOsCpu).padStart(8)}) ` +
|
|
191
|
+
`${CYAN}${BRIGHT}${formatPercent(entry.processCpu).padStart(8)}${RESET} (${formatPercent(entry.peakProcessCpu).padStart(8)}) ` +
|
|
192
|
+
`${CYAN}${BRIGHT}${formatBytes(entry.rss).padStart(9)}${RESET} (${formatBytes(entry.peakRss).padStart(9)}) ` +
|
|
193
|
+
`${CYAN}${BRIGHT}${formatBytes(entry.heapUsed).padStart(9)}${RESET} (${formatBytes(entry.peakHeapUsed).padStart(9)}) ` +
|
|
194
|
+
`${CYAN}${BRIGHT}${formatBytes(entry.heapTotal).padStart(9)}${RESET} (${formatBytes(entry.peakHeapTotal).padStart(9)}) ` +
|
|
195
|
+
`${CYAN}${BRIGHT}${formatBytes(entry.external).padStart(9)}${RESET} (${formatBytes(entry.peakExternal).padStart(9)}) ` +
|
|
196
|
+
`${CYAN}${BRIGHT}${formatBytes(entry.arrayBuffers).padStart(9)}${RESET} (${formatBytes(entry.peakArrayBuffers).padStart(9)})`);
|
|
225
197
|
}
|
|
226
198
|
}
|
|
227
199
|
this.log.debug(`Tracker stopped`);
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge",
|
|
3
|
-
"version": "3.3.4-dev-20251020-
|
|
3
|
+
"version": "3.3.4-dev-20251020-df40d12",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge",
|
|
9
|
-
"version": "3.3.4-dev-20251020-
|
|
9
|
+
"version": "3.3.4-dev-20251020-df40d12",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@matter/main": "0.15.6",
|
package/package.json
CHANGED