matterbridge 2.2.0-dev.4 → 2.2.0-dev.6

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 CHANGED
@@ -58,6 +58,7 @@ matterbridge-hass v. 0.0.8
58
58
  - [package]: Update matter.js to 0.12.4-alpha.0-20250223-1e0341a1a
59
59
  - [package]: Update matter.js to 0.12.4-alpha.0-20250224-46934b522
60
60
  - [package]: Update matter.js to 0.12.4-alpha.0-20250225-52ac4166b
61
+ - [package]: Update matter.js to 0.12.4-alpha.0-20250226-e4ba47db7
61
62
  - [matterbridge]: The check for available updates now runs at restart and each 24 hours after.
62
63
 
63
64
  ### Fixed
@@ -14,12 +14,13 @@ export class MatterbridgePlatform {
14
14
  context;
15
15
  selectDevice = new Map();
16
16
  selectEntity = new Map();
17
- contextReady;
18
- selectDeviceContextReady;
19
- selectEntityContextReady;
17
+ _contextReady;
18
+ _selectDeviceContextReady;
19
+ _selectEntityContextReady;
20
20
  ready;
21
- registeredEndpoints = new Map();
22
- registeredEndpointsByName = new Map();
21
+ _registeredEndpoints = new Map();
22
+ _registeredEndpointsByName = new Map();
23
+ _storedDevices = new Map();
23
24
  constructor(matterbridge, log, config) {
24
25
  this.matterbridge = matterbridge;
25
26
  this.log = log;
@@ -35,26 +36,26 @@ export class MatterbridgePlatform {
35
36
  forgiveParseErrors: true,
36
37
  });
37
38
  this.log.debug(`Creating context for plugin ${this.config.name}`);
38
- this.contextReady = this.storage.createStorage('context').then((context) => {
39
+ this._contextReady = this.storage.createStorage('context').then((context) => {
39
40
  this.context = context;
40
41
  this.context.remove('endpointMap');
41
42
  this.log.debug(`Created context for plugin ${this.config.name}`);
42
43
  });
43
44
  this.log.debug(`Loading selectDevice for plugin ${this.config.name}`);
44
- this.selectDeviceContextReady = this.storage.createStorage('selectDevice').then(async (context) => {
45
+ this._selectDeviceContextReady = this.storage.createStorage('selectDevice').then(async (context) => {
45
46
  const selectDevice = await context.get('selectDevice', []);
46
47
  for (const device of selectDevice)
47
48
  this.selectDevice.set(device.serial, device);
48
49
  this.log.debug(`Loaded ${this.selectDevice.size} selectDevice for plugin ${this.config.name}`);
49
50
  });
50
51
  this.log.debug(`Loading selectEntity for plugin ${this.config.name}`);
51
- this.selectEntityContextReady = this.storage.createStorage('selectEntity').then(async (context) => {
52
+ this._selectEntityContextReady = this.storage.createStorage('selectEntity').then(async (context) => {
52
53
  const selectEntity = await context.get('selectEntity', []);
53
54
  for (const entity of selectEntity)
54
55
  this.selectEntity.set(entity.name, entity);
55
56
  this.log.debug(`Loaded ${this.selectEntity.size} selectEntity for plugin ${this.config.name}`);
56
57
  });
57
- this.ready = Promise.all([this.contextReady, this.selectDeviceContextReady, this.selectEntityContextReady]).then(() => {
58
+ this.ready = Promise.all([this._contextReady, this._selectDeviceContextReady, this._selectEntityContextReady]).then(() => {
58
59
  this.log.debug(`MatterbridgePlatform for plugin ${this.config.name} is fully initialized`);
59
60
  });
60
61
  }
@@ -81,8 +82,9 @@ export class MatterbridgePlatform {
81
82
  await this.checkEndpointNumbers();
82
83
  this.selectDevice.clear();
83
84
  this.selectEntity.clear();
84
- this.registeredEndpoints.clear();
85
- this.registeredEndpointsByName.clear();
85
+ this._registeredEndpoints.clear();
86
+ this._registeredEndpointsByName.clear();
87
+ this._storedDevices.clear();
86
88
  await this.context?.close();
87
89
  this.context = undefined;
88
90
  await this.storage?.close();
@@ -91,11 +93,11 @@ export class MatterbridgePlatform {
91
93
  this.log.debug(`The plugin doesn't override onChangeLoggerLevel. Logger level set to: ${logLevel}`);
92
94
  }
93
95
  hasDeviceName(deviceName) {
94
- return this.registeredEndpointsByName.has(deviceName);
96
+ return this._registeredEndpointsByName.has(deviceName);
95
97
  }
96
98
  async registerDevice(device) {
97
99
  device.plugin = this.name;
98
- if (device.deviceName && this.registeredEndpointsByName.has(device.deviceName)) {
100
+ if (device.deviceName && this._registeredEndpointsByName.has(device.deviceName)) {
99
101
  this.log.error(`Device with name ${CYAN}${device.deviceName}${er} is already registered. The device will not be added. Please change the device name.`);
100
102
  return;
101
103
  }
@@ -104,21 +106,25 @@ export class MatterbridgePlatform {
104
106
  }
105
107
  await this.matterbridge.addBridgedEndpoint(this.name, device);
106
108
  if (device.uniqueId)
107
- this.registeredEndpoints.set(device.uniqueId, device);
109
+ this._registeredEndpoints.set(device.uniqueId, device);
108
110
  if (device.deviceName)
109
- this.registeredEndpointsByName.set(device.deviceName, device);
111
+ this._registeredEndpointsByName.set(device.deviceName, device);
110
112
  }
111
113
  async unregisterDevice(device) {
112
114
  await this.matterbridge.removeBridgedEndpoint(this.name, device);
113
115
  if (device.uniqueId)
114
- this.registeredEndpoints.delete(device.uniqueId);
116
+ this._registeredEndpoints.delete(device.uniqueId);
115
117
  if (device.deviceName)
116
- this.registeredEndpointsByName.delete(device.deviceName);
118
+ this._registeredEndpointsByName.delete(device.deviceName);
117
119
  }
118
120
  async unregisterAllDevices() {
119
121
  await this.matterbridge.removeAllBridgedEndpoints(this.name);
120
- this.registeredEndpoints.clear();
121
- this.registeredEndpointsByName.clear();
122
+ this._registeredEndpoints.clear();
123
+ this._registeredEndpointsByName.clear();
124
+ }
125
+ async storeDevice(serial, name, configUrl) {
126
+ this.log.debug(`Stored device with serial ${CYAN}${serial}${db} name ${CYAN}${name}${db}`);
127
+ this._storedDevices.set(serial, { serial, name, configUrl });
122
128
  }
123
129
  verifyMatterbridgeVersion(requiredVersion) {
124
130
  const compareVersions = (matterbridgeVersion, requiredVersion) => {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "files": {
3
3
  "main.css": "./static/css/main.cf25d33e.css",
4
- "main.js": "./static/js/main.f87f07b6.js",
4
+ "main.js": "./static/js/main.f60aae10.js",
5
5
  "static/js/453.abd36b29.chunk.js": "./static/js/453.abd36b29.chunk.js",
6
6
  "static/media/roboto-latin-700-normal.woff2": "./static/media/roboto-latin-700-normal.4535474e1cf8598695ad.woff2",
7
7
  "static/media/roboto-latin-500-normal.woff2": "./static/media/roboto-latin-500-normal.7077203b1982951ecf76.woff2",
@@ -61,11 +61,11 @@
61
61
  "static/media/roboto-greek-ext-400-normal.woff": "./static/media/roboto-greek-ext-400-normal.16eb83b4a3b1ea994243.woff",
62
62
  "index.html": "./index.html",
63
63
  "main.cf25d33e.css.map": "./static/css/main.cf25d33e.css.map",
64
- "main.f87f07b6.js.map": "./static/js/main.f87f07b6.js.map",
64
+ "main.f60aae10.js.map": "./static/js/main.f60aae10.js.map",
65
65
  "453.abd36b29.chunk.js.map": "./static/js/453.abd36b29.chunk.js.map"
66
66
  },
67
67
  "entrypoints": [
68
68
  "static/css/main.cf25d33e.css",
69
- "static/js/main.f87f07b6.js"
69
+ "static/js/main.f60aae10.js"
70
70
  ]
71
71
  }
@@ -1 +1 @@
1
- <!doctype html><html lang="en"><head><meta charset="utf-8"/><base href="./"><link rel="icon" href="./matterbridge 32x32.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Matterbridge</title><link rel="manifest" href="./manifest.json"/><script defer="defer" src="./static/js/main.f87f07b6.js"></script><link href="./static/css/main.cf25d33e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1
+ <!doctype html><html lang="en"><head><meta charset="utf-8"/><base href="./"><link rel="icon" href="./matterbridge 32x32.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Matterbridge</title><link rel="manifest" href="./manifest.json"/><script defer="defer" src="./static/js/main.f60aae10.js"></script><link href="./static/css/main.cf25d33e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>