matterbridge 2.1.6-dev.1 → 2.1.6-dev.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/CHANGELOG.md +1 -1
- package/dist/matterbridgePlatform.js +27 -20
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -38,7 +38,7 @@ matterbridge-hass v. 0.0.8
|
|
|
38
38
|
### Added
|
|
39
39
|
|
|
40
40
|
- [docker]: Added health check directly inside the docker image. No need to change configuration.
|
|
41
|
-
- [platform]:
|
|
41
|
+
- [platform]: Saving in the storage the selects for faster loading of plugins.
|
|
42
42
|
- [icon]: Added matterbridge svg icon (thanks: https://github.com/robvanoostenrijk https://github.com/stuntguy3000).
|
|
43
43
|
- [frontend]: Frontend v.2.4.2.
|
|
44
44
|
|
|
@@ -14,6 +14,10 @@ export class MatterbridgePlatform {
|
|
|
14
14
|
context;
|
|
15
15
|
selectDevice = new Map();
|
|
16
16
|
selectEntity = new Map();
|
|
17
|
+
contextReady;
|
|
18
|
+
selectDeviceContextReady;
|
|
19
|
+
selectEntityContextReady;
|
|
20
|
+
ready;
|
|
17
21
|
registeredEndpoints = new Map();
|
|
18
22
|
registeredEndpointsByName = new Map();
|
|
19
23
|
constructor(matterbridge, log, config) {
|
|
@@ -31,26 +35,28 @@ export class MatterbridgePlatform {
|
|
|
31
35
|
forgiveParseErrors: true,
|
|
32
36
|
});
|
|
33
37
|
this.log.debug(`Creating context for plugin ${this.config.name}`);
|
|
34
|
-
this.storage.createStorage('context').then((context) => {
|
|
38
|
+
this.contextReady = this.storage.createStorage('context').then((context) => {
|
|
35
39
|
this.context = context;
|
|
36
40
|
this.log.debug(`Created context for plugin ${this.config.name}`);
|
|
41
|
+
return context;
|
|
37
42
|
});
|
|
38
43
|
this.log.debug(`Loading selectDevice for plugin ${this.config.name}`);
|
|
39
|
-
this.storage.createStorage('selectDevice').then((context) => {
|
|
40
|
-
context.get('selectDevice', [])
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
44
|
+
this.selectDeviceContextReady = this.storage.createStorage('selectDevice').then(async (context) => {
|
|
45
|
+
const selectDevice = await context.get('selectDevice', []);
|
|
46
|
+
for (const device of selectDevice)
|
|
47
|
+
this.selectDevice.set(device.serial, device);
|
|
44
48
|
this.log.debug(`Loaded ${this.selectDevice.size} selectDevice for plugin ${this.config.name}`);
|
|
45
49
|
});
|
|
46
50
|
this.log.debug(`Loading selectEntity for plugin ${this.config.name}`);
|
|
47
|
-
this.storage.createStorage('selectEntity').then((context) => {
|
|
48
|
-
context.get('selectEntity', [])
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
51
|
+
this.selectEntityContextReady = this.storage.createStorage('selectEntity').then(async (context) => {
|
|
52
|
+
const selectEntity = await context.get('selectEntity', []);
|
|
53
|
+
for (const entity of selectEntity)
|
|
54
|
+
this.selectEntity.set(entity.name, entity);
|
|
52
55
|
this.log.debug(`Loaded ${this.selectEntity.size} selectEntity for plugin ${this.config.name}`);
|
|
53
56
|
});
|
|
57
|
+
this.ready = Promise.all([this.contextReady, this.selectDeviceContextReady, this.selectEntityContextReady]).then(() => {
|
|
58
|
+
this.log.debug(`MatterbridgePlatform for plugin ${this.config.name} is fully initialized`);
|
|
59
|
+
});
|
|
54
60
|
}
|
|
55
61
|
async onStart(reason) {
|
|
56
62
|
this.log.error('Plugins must override onStart.', reason);
|
|
@@ -77,7 +83,9 @@ export class MatterbridgePlatform {
|
|
|
77
83
|
this.selectEntity.clear();
|
|
78
84
|
this.registeredEndpoints.clear();
|
|
79
85
|
this.registeredEndpointsByName.clear();
|
|
80
|
-
this.
|
|
86
|
+
this.contextReady = undefined;
|
|
87
|
+
this.selectDeviceContextReady = undefined;
|
|
88
|
+
this.selectEntityContextReady = undefined;
|
|
81
89
|
await this.context?.close();
|
|
82
90
|
this.context = undefined;
|
|
83
91
|
await this.storage?.close();
|
|
@@ -214,16 +222,15 @@ export class MatterbridgePlatform {
|
|
|
214
222
|
endpointMap.set(device.uniqueId, device.maybeNumber);
|
|
215
223
|
}
|
|
216
224
|
for (const child of device.getChildEndpoints()) {
|
|
217
|
-
|
|
218
|
-
if (!childId || !child.maybeNumber)
|
|
225
|
+
if (!child.maybeId || !child.maybeNumber)
|
|
219
226
|
continue;
|
|
220
|
-
if (endpointMap.has(device.uniqueId + separator +
|
|
221
|
-
this.log.warn(`Child endpoint number for device ${CYAN}${device.deviceName}${wr}.${CYAN}${
|
|
222
|
-
endpointMap.set(device.uniqueId + separator +
|
|
227
|
+
if (endpointMap.has(device.uniqueId + separator + child.id) && endpointMap.get(device.uniqueId + separator + child.id) !== child.maybeNumber) {
|
|
228
|
+
this.log.warn(`Child endpoint number for device ${CYAN}${device.deviceName}${wr}.${CYAN}${child.id}${wr} changed from ${CYAN}${endpointMap.get(device.uniqueId + separator + child.id)}${wr} to ${CYAN}${child.maybeNumber}${wr}`);
|
|
229
|
+
endpointMap.set(device.uniqueId + separator + child.id, child.maybeNumber);
|
|
223
230
|
}
|
|
224
|
-
if (!endpointMap.has(device.uniqueId + separator +
|
|
225
|
-
this.log.debug(`Setting child endpoint number for device ${CYAN}${device.uniqueId}${db}.${CYAN}${
|
|
226
|
-
endpointMap.set(device.uniqueId + separator +
|
|
231
|
+
if (!endpointMap.has(device.uniqueId + separator + child.id)) {
|
|
232
|
+
this.log.debug(`Setting child endpoint number for device ${CYAN}${device.uniqueId}${db}.${CYAN}${child.id}${db} to ${CYAN}${child.maybeNumber}${db}`);
|
|
233
|
+
endpointMap.set(device.uniqueId + separator + child.id, child.maybeNumber);
|
|
227
234
|
}
|
|
228
235
|
}
|
|
229
236
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "matterbridge",
|
|
3
|
-
"version": "2.1.6-dev.
|
|
3
|
+
"version": "2.1.6-dev.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "matterbridge",
|
|
9
|
-
"version": "2.1.6-dev.
|
|
9
|
+
"version": "2.1.6-dev.2",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@matter/main": "^0.12.4-alpha.0-20250212-b2729c9eb",
|
|
@@ -474,9 +474,9 @@
|
|
|
474
474
|
}
|
|
475
475
|
},
|
|
476
476
|
"node_modules/call-bind-apply-helpers": {
|
|
477
|
-
"version": "1.0.
|
|
478
|
-
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.
|
|
479
|
-
"integrity": "sha512-
|
|
477
|
+
"version": "1.0.2",
|
|
478
|
+
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
|
479
|
+
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
|
480
480
|
"license": "MIT",
|
|
481
481
|
"dependencies": {
|
|
482
482
|
"es-errors": "^1.3.0",
|