matterbridge-zigbee2mqtt 3.0.3-dev-20251211-1802e6b → 3.0.3-dev-20251213-a1054ac

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,17 +12,19 @@ If you like this project and find it useful, please consider giving it a star on
12
12
 
13
13
  - [mqtt]: Added a guide to setup Unix socket on the host.
14
14
  - [mqtt]: Added a guide to setup Unix socket with docker.
15
+ - [mqtt]: Added support for web socket connection: use ws://mqtthost.
16
+ - [mqtt]: Added support for secure web socket connection: use wss://mqtthost.
15
17
 
16
18
  ### Changed
17
19
 
18
20
  - [package]: Updated dependencies.
19
21
  - [mqtt]: Clarified in the schema that the mqtt port is not used with Unix socket.
20
22
  - [mqtt]: Use mqtt+unix:///path for Unix socket.
21
- - [mqtt]: Removed options.protocol.
23
+ - [mqtt]: Removed options.protocol. Thanks Rob van Oostenrijk (https://github.com/Luligu/matterbridge-zigbee2mqtt/issues/133).
22
24
 
23
25
  ### Fixed
24
26
 
25
- - [mqtt]: Fixed wrong log messages with Unix socket.
27
+ - [mqtt]: Fixed wrong log messages with Unix socket. Thanks Rob van Oostenrijk (https://github.com/Luligu/matterbridge-zigbee2mqtt/issues/133).
26
28
 
27
29
  <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
28
30
 
package/README.md CHANGED
@@ -21,6 +21,8 @@ No hub or dedicated hardware needed.
21
21
 
22
22
  No cloud: all is local and fast.
23
23
 
24
+ The connection to the MQTT broker is possible with **mqtt** (tcp), **mqtts** (tls), **mqtt+unix** (Unix socket), **ws** (web socket) and **wss** (secure web socket). Self signed certificates and mutual tls are supported too.
25
+
24
26
  Interested in super fast and autonomous **[automations for zigbee2mqtt](https://github.com/Luligu/zigbee2mqtt-automations)**? Try this: https://github.com/Luligu/zigbee2mqtt-automations.
25
27
 
26
28
  If you like this project and find it useful, please consider giving it a star on [GitHub](https://github.com/Luligu/matterbridge-zigbee2mqtt) and sponsoring it.
@@ -75,19 +77,7 @@ matterbridge
75
77
 
76
78
  ## If you want to contribute to the plugin
77
79
 
78
- On windows:
79
-
80
- ```
81
- cd $HOME\Matterbridge
82
- git clone https://github.com/Luligu/matterbridge-zigbee2mqtt
83
- cd matterbridge-zigbee2mqtt
84
- npm ci
85
- npm run dev:link
86
- npm run build
87
- matterbridge -add .
88
- ```
89
-
90
- On linux and macOS:
80
+ Clone the plugin
91
81
 
92
82
  ```
93
83
  cd ~/Matterbridge
@@ -284,6 +274,8 @@ If one of your devices is not supported out of the box, open an issue and we wil
284
274
 
285
275
  ## Unix socket (Linux only)
286
276
 
277
+ **Note**: Unix domain sockets (mqtt+unix://) are always local and do not support TLS. Security is enforced through filesystem permissions on the socket file.
278
+
287
279
  ### Create the directory for the Unix socket on the host
288
280
 
289
281
  ```bash
@@ -296,11 +288,11 @@ sudo chown mosquitto:mosquitto /var/run/mosquitto
296
288
  # Allow group users (e.g. matterbridge) to access the socket
297
289
  sudo chmod 750 /var/run/mosquitto
298
290
 
299
- # Optional: Add your user to the mosquitto group to access the socket without sudo
300
- # sudo usermod -aG mosquitto $USER
291
+ # Add your user to the mosquitto group to access the socket without sudo
292
+ sudo usermod -aG mosquitto $USER
301
293
 
302
294
  # If matterbridge runs like user matterbridge, add the matterbridge user to the mosquitto group to access the socket without sudo
303
- # sudo usermod -aG mosquitto matterbridge
295
+ sudo usermod -aG mosquitto matterbridge
304
296
  ```
305
297
 
306
298
  Log out and back in after running usermod -aG for the group changes to take effect.
package/dist/module.js CHANGED
@@ -49,7 +49,13 @@ export class ZigbeePlatform extends MatterbridgeDynamicPlatform {
49
49
  if (config.host && typeof config.host === 'string') {
50
50
  this.mqttHost = config.host;
51
51
  this.mqttHost =
52
- !this.mqttHost.startsWith('mqtt://') && !this.mqttHost.startsWith('mqtts://') && !this.mqttHost.startsWith('mqtt+unix://') ? 'mqtt://' + this.mqttHost : this.mqttHost;
52
+ !this.mqttHost.startsWith('mqtt://') &&
53
+ !this.mqttHost.startsWith('mqtts://') &&
54
+ !this.mqttHost.startsWith('ws://') &&
55
+ !this.mqttHost.startsWith('wss://') &&
56
+ !this.mqttHost.startsWith('mqtt+unix://')
57
+ ? 'mqtt://' + this.mqttHost
58
+ : this.mqttHost;
53
59
  }
54
60
  if (config.port)
55
61
  this.mqttPort = config.port;
@@ -53,7 +53,7 @@ export class Zigbee2MQTT extends EventEmitter {
53
53
  if (mqttClientId)
54
54
  this.options.clientId = mqttClientId;
55
55
  this.options.protocolVersion = protocolVersion;
56
- if (mqttHost.startsWith('mqtts://')) {
56
+ if (mqttHost.startsWith('mqtts://') || mqttHost.startsWith('wss://')) {
57
57
  this.log.debug('Using mqtts:// protocol for secure MQTT connection');
58
58
  if (!ca) {
59
59
  this.log.info('When using mqtts:// protocol, you must provide the ca certificate for SSL/TLS connections with self-signed certificates.');
@@ -62,17 +62,19 @@ export class Zigbee2MQTT extends EventEmitter {
62
62
  try {
63
63
  fs.accessSync(ca, fs.constants.R_OK);
64
64
  this.options.ca = fs.readFileSync(ca);
65
+ this.log.info(`Successfully read the CA certificate from ${ca}`);
65
66
  }
66
67
  catch (error) {
67
68
  this.log.error(`Error reading the CA certificate from ${ca}:`, error);
68
69
  }
69
70
  }
70
71
  this.options.rejectUnauthorized = rejectUnauthorized !== undefined ? rejectUnauthorized : true;
71
- this.options.protocol = 'mqtts';
72
+ this.log.info(`TLS rejectUnauthorized is set to ${this.options.rejectUnauthorized}`);
72
73
  if (cert && key) {
73
74
  try {
74
75
  fs.accessSync(cert, fs.constants.R_OK);
75
76
  this.options.cert = fs.readFileSync(cert);
77
+ this.log.info(`Successfully read the client certificate from ${cert}`);
76
78
  }
77
79
  catch (error) {
78
80
  this.log.error(`Error reading the client certificate from ${cert}:`, error);
@@ -80,13 +82,14 @@ export class Zigbee2MQTT extends EventEmitter {
80
82
  try {
81
83
  fs.accessSync(key, fs.constants.R_OK);
82
84
  this.options.key = fs.readFileSync(key);
85
+ this.log.info(`Successfully read the client key from ${key}`);
83
86
  }
84
87
  catch (error) {
85
88
  this.log.error(`Error reading the client key from ${key}:`, error);
86
89
  }
87
90
  }
88
91
  }
89
- else if (mqttHost.startsWith('mqtt://')) {
92
+ else if (mqttHost.startsWith('mqtt://') || mqttHost.startsWith('ws://')) {
90
93
  this.log.debug('Using mqtt:// protocol for non-secure MQTT connection');
91
94
  if (ca) {
92
95
  this.log.warn('You are using mqtt:// protocol, but you provided a CA certificate. It will be ignored.');
@@ -111,7 +114,7 @@ export class Zigbee2MQTT extends EventEmitter {
111
114
  }
112
115
  }
113
116
  else {
114
- this.log.warn('You are using an unsupported MQTT protocol. Please use mqtt:// or mqtts:// or mqtt+unix://.');
117
+ this.log.warn('You are using an unsupported MQTT protocol. Please use mqtt:// or mqtts:// or ws:// or wss:// or mqtt+unix://.');
115
118
  }
116
119
  this.z2mIsAvailabilityEnabled = false;
117
120
  this.z2mIsOnline = false;
@@ -17,12 +17,12 @@
17
17
  "ui:widget": "hidden"
18
18
  },
19
19
  "host": {
20
- "description": "MQTT server host (IP address or hostname with mqtt:// or mqtts:// prefix) or mqtt+unix://<SOCKET_PATH> for Unix socket on Linux (e.g. mqtt+unix:///var/run/mosquitto/mqtt.sock). For secure connections, use the mqtts:// prefix and ensure your certificates are configured. If you use a hostname, make sure that the hostname is resolvable by the system running matterbridge.",
20
+ "description": "MQTT server host (IP address or hostname with mqtt:// or mqtts:// or ws:// or wss:// prefix) or mqtt+unix://<SOCKET_PATH> for Unix socket on Linux (e.g. mqtt+unix:///var/run/mosquitto/mqtt.sock). For secure connections, use the mqtts:// or wss:// prefix and ensure your certificates are configured. If you use a hostname, make sure that the hostname is resolvable by the system running matterbridge.",
21
21
  "type": "string",
22
22
  "default": "mqtt://localhost"
23
23
  },
24
24
  "port": {
25
- "description": "MQTT server port (i.e. 1883 for mqtt:// and 8883 for mqtts://). For Unix socket, this value is ignored.",
25
+ "description": "MQTT server port (i.e. 1883 for mqtt://, 8883 for mqtts://, 9001 for ws:// or 9443 for wss://). For Unix socket, this value is ignored.",
26
26
  "type": "number",
27
27
  "default": 1883
28
28
  },
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-zigbee2mqtt",
3
- "version": "3.0.3-dev-20251211-1802e6b",
3
+ "version": "3.0.3-dev-20251213-a1054ac",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge-zigbee2mqtt",
9
- "version": "3.0.3-dev-20251211-1802e6b",
9
+ "version": "3.0.3-dev-20251213-a1054ac",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "moment": "2.30.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge-zigbee2mqtt",
3
- "version": "3.0.3-dev-20251211-1802e6b",
3
+ "version": "3.0.3-dev-20251213-a1054ac",
4
4
  "description": "Matterbridge zigbee2mqtt plugin",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",