matterbridge 3.3.9-dev-20251118-930cfdb → 3.3.9-dev-20251119-ea13a99

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.
@@ -9,6 +9,8 @@ import { checkNotLatinCharacters } from './matterbridgeEndpointHelpers.js';
9
9
  import { bridgedNode } from './matterbridgeDeviceTypes.js';
10
10
  import { isValidArray, isValidObject, isValidString } from './utils/isvalid.js';
11
11
  import { addVirtualDevice } from './helpers.js';
12
+ import { hasParameter } from './utils/commandLine.js';
13
+ import { BroadcastServer } from './broadcastServer.js';
12
14
  export class MatterbridgePlatform {
13
15
  matterbridge;
14
16
  log;
@@ -26,10 +28,18 @@ export class MatterbridgePlatform {
26
28
  ready;
27
29
  registeredEndpointsByUniqueId = new Map();
28
30
  registeredEndpointsByName = new Map();
31
+ #server;
32
+ #debug = hasParameter('debug') || hasParameter('verbose');
33
+ #verbose = hasParameter('verbose');
29
34
  constructor(matterbridge, log, config) {
30
35
  this.matterbridge = matterbridge;
31
36
  this.log = log;
32
37
  this.config = config;
38
+ this.#server = new BroadcastServer('platform', this.log);
39
+ if (this.#debug && !this.#verbose)
40
+ this.log.debug(`Creating MatterbridgePlatform for plugin ${this.config.name}`);
41
+ if (this.#verbose)
42
+ this.log.debug(`Creating MatterbridgePlatform for plugin ${this.config.name} with config:\n${JSON.stringify(this.config, null, 2)}\n`);
33
43
  if (!isValidString(this.config.name, 1))
34
44
  throw new Error('Platform: the plugin name is missing or invalid.');
35
45
  this.log.debug(`Creating storage for plugin ${this.config.name} in ${path.join(this.matterbridge.matterbridgeDirectory, this.config.name)}`);
@@ -87,6 +97,7 @@ export class MatterbridgePlatform {
87
97
  await this.context?.close();
88
98
  this.context = undefined;
89
99
  await this.storage?.close();
100
+ this.#server.close();
90
101
  }
91
102
  async onChangeLoggerLevel(logLevel) {
92
103
  this.log.debug(`The plugin doesn't override onChangeLoggerLevel. Logger level set to: ${logLevel}`);
@@ -119,7 +130,10 @@ export class MatterbridgePlatform {
119
130
  plugin.schemaJson = schema;
120
131
  }
121
132
  wssSendRestartRequired(snackbar = true, fixed = false) {
122
- this.matterbridge.frontend.wssSendRestartRequired(snackbar, fixed);
133
+ this.#server.request({ type: 'frontend_restartrequired', src: 'platform', dst: 'frontend', params: { snackbar, fixed } });
134
+ }
135
+ wssSendSnackbarMessage(message, timeout, severity) {
136
+ this.#server.request({ type: 'frontend_snackbarmessage', src: 'platform', dst: 'frontend', params: { message, timeout, severity } });
123
137
  }
124
138
  getDevices() {
125
139
  return Array.from(this.registeredEndpointsByUniqueId.values());
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.3.9-dev-20251118-930cfdb",
3
+ "version": "3.3.9-dev-20251119-ea13a99",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge",
9
- "version": "3.3.9-dev-20251118-930cfdb",
9
+ "version": "3.3.9-dev-20251119-ea13a99",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@matter/main": "0.15.6",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.3.9-dev-20251118-930cfdb",
3
+ "version": "3.3.9-dev-20251119-ea13a99",
4
4
  "description": "Matterbridge plugin manager for Matter",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",