matterbridge-mqtt 0.0.5-dev-20260609-e4b3a62 → 0.0.5

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
@@ -12,6 +12,7 @@ If you like this project and find it useful, please consider giving it a star on
12
12
 
13
13
  ### Added
14
14
 
15
+ - Require Matterbridge 3.8.1.
15
16
  - Add handler to create all device types.
16
17
  - Add MQTT packet metadata forwarding to message handlers.
17
18
  - Add retained MQTT message logging.
package/dist/module.js CHANGED
@@ -12,8 +12,8 @@ export class MqttPlatform extends MatterbridgeDynamicPlatform {
12
12
  constructor(matterbridge, log, config) {
13
13
  super(matterbridge, log, config);
14
14
  this.config = config;
15
- if (typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.8.0')) {
16
- throw new Error(`This plugin requires Matterbridge version >= "3.8.0". Please update Matterbridge to the latest version in the frontend.`);
15
+ if (typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.8.1')) {
16
+ throw new Error(`This plugin requires Matterbridge version >= "3.8.1". Please update Matterbridge to the latest version in the frontend.`);
17
17
  }
18
18
  this.log.info(`Initializing platform: ${this.config.name}`);
19
19
  this.mqtt = new MqttService(this.config);
@@ -92,11 +92,15 @@ export class MqttPlatform extends MatterbridgeDynamicPlatform {
92
92
  this.log.debug(`MQTT ${packet.retain ? 'retained ' : ''}message on '${topic}': ${debugStringify(message)}`);
93
93
  if (subTopic === 'config') {
94
94
  this.log.info(`Received ${info.bgMagenta.black.bold ` config `} message for device ${info.bgCyan.black.bold ` ${deviceId} `} endpoint ${info.bgGreen.black.bold ` ${endpointName} `}`);
95
- if (typeof message.deviceTypes !== 'object' && !Array.isArray(message.deviceTypes)) {
95
+ if (typeof message !== 'object' || message === null || Array.isArray(message)) {
96
+ this.log.warn(`Received MQTT message on topic '${topic}' with invalid format: config is missing or not an object. Ignoring.`);
97
+ return;
98
+ }
99
+ if (!Array.isArray(message.deviceTypes)) {
96
100
  this.log.warn(`Received MQTT message on topic '${topic}' with invalid format: 'deviceTypes' field is missing or not an array. Ignoring.`);
97
101
  return;
98
102
  }
99
- if (typeof message.clusters !== 'object' || Array.isArray(message.clusters)) {
103
+ if (typeof message.clusters !== 'object' || message.clusters === null || Array.isArray(message.clusters)) {
100
104
  this.log.warn(`Received MQTT message on topic '${topic}' with invalid format: 'clusters' field is missing or not an object. Ignoring.`);
101
105
  return;
102
106
  }
@@ -104,11 +108,11 @@ export class MqttPlatform extends MatterbridgeDynamicPlatform {
104
108
  }
105
109
  else if (subTopic === 'state') {
106
110
  this.log.info(`Received ${info.bgMagenta.black.bold ` state `} message for device ${info.bgCyan.black.bold ` ${deviceId} `} endpoint ${info.bgGreen.black.bold ` ${endpointName} `}`);
107
- this.state.set(topic, payload);
108
- if (typeof message !== 'object' || Array.isArray(message)) {
111
+ if (typeof message !== 'object' || message === null || Array.isArray(message)) {
109
112
  this.log.warn(`Received MQTT message on topic '${topic}' with invalid format: state is missing or not an object. Ignoring.`);
110
113
  return;
111
114
  }
115
+ this.state.set(topic, payload);
112
116
  if (this.isConfigured)
113
117
  fireAndForget(this.updateHandler(topic, payload), this.log, `Failed to handle state update for device ${deviceId} on endpoint ${endpointName}`);
114
118
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-mqtt",
3
- "version": "0.0.5-dev-20260609-e4b3a62",
3
+ "version": "0.0.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge-mqtt",
9
- "version": "0.0.5-dev-20260609-e4b3a62",
9
+ "version": "0.0.5",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "mqtt": "5.15.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge-mqtt",
3
- "version": "0.0.5-dev-20260609-e4b3a62",
3
+ "version": "0.0.5",
4
4
  "description": "Matterbridge mqtt plugin",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",