matterbridge-zigbee2mqtt 3.0.3-dev-20251211-b4188c4 → 3.0.3-dev-20251211-1802e6b

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
@@ -8,9 +8,21 @@ If you like this project and find it useful, please consider giving it a star on
8
8
 
9
9
  ## [3.0.3] - 2025-12-12
10
10
 
11
+ ### Added
12
+
13
+ - [mqtt]: Added a guide to setup Unix socket on the host.
14
+ - [mqtt]: Added a guide to setup Unix socket with docker.
15
+
11
16
  ### Changed
12
17
 
13
18
  - [package]: Updated dependencies.
19
+ - [mqtt]: Clarified in the schema that the mqtt port is not used with Unix socket.
20
+ - [mqtt]: Use mqtt+unix:///path for Unix socket.
21
+ - [mqtt]: Removed options.protocol.
22
+
23
+ ### Fixed
24
+
25
+ - [mqtt]: Fixed wrong log messages with Unix socket.
14
26
 
15
27
  <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
16
28
 
package/README.md CHANGED
@@ -284,7 +284,7 @@ If one of your devices is not supported out of the box, open an issue and we wil
284
284
 
285
285
  ## Unix socket (Linux only)
286
286
 
287
- ### Create the directory for the socket
287
+ ### Create the directory for the Unix socket on the host
288
288
 
289
289
  ```bash
290
290
  # Create the directory for the Unix socket if it doesn't exist
@@ -311,7 +311,7 @@ sudo -u mosquitto ls -ld /var/run/mosquitto
311
311
  sudo -u mosquitto ls -l /var/run/mosquitto/mqtt.sock
312
312
  ```
313
313
 
314
- ### Configure mosquitto to use Unix socket
314
+ ### Configure mosquitto to use Unix socket on the host
315
315
 
316
316
  Add this to your mosquitto.conf
317
317
 
@@ -330,19 +330,20 @@ sudo systemctl restart mosquitto
330
330
 
331
331
  ### Configure docker to use Unix socket
332
332
 
333
- Add the unix socket volume for each service using it (i.e. mosquitto, zigbee2mqtt and matterbridge).
333
+ Create the directory on the host
334
334
 
335
+ ```bash
336
+ mkdir -p "$HOME/mosquitto/run"
337
+ sudo chown 1883:1883 "$HOME/mosquitto/run"
338
+ sudo chmod 770 "$HOME/mosquitto/run"
335
339
  ```
336
- volumes:
337
- # Share the same run directory (anonymous volume)
338
- - /var/run/mosquitto
339
- ```
340
-
341
- Docker does NOT bind the host directory /var/run/mosquitto.
342
340
 
343
- That internal volume lives inside Docker’s own storage, not on your host filesystem.
341
+ Add the unix socket volume for each service using it (i.e. mosquitto, zigbee2mqtt and matterbridge).
344
342
 
345
- Because of this, there is no need to create /var/run/mosquitto on the host.
343
+ ```
344
+ volumes:
345
+ - "${HOME}/mosquitto/run:/var/run/mosquitto"
346
+ ```
346
347
 
347
348
  # Known issues
348
349
 
package/dist/module.js CHANGED
@@ -12,7 +12,7 @@ export class ZigbeePlatform extends MatterbridgeDynamicPlatform {
12
12
  config;
13
13
  bridgedDevices = [];
14
14
  zigbeeEntities = [];
15
- connectTimeout = 30000;
15
+ connectTimeout = 90000;
16
16
  availabilityTimeout = 10000;
17
17
  injectTimer;
18
18
  mqttHost = 'mqtt://localhost';
@@ -49,7 +49,7 @@ 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('unix://') ? 'mqtt://' + this.mqttHost : this.mqttHost;
52
+ !this.mqttHost.startsWith('mqtt://') && !this.mqttHost.startsWith('mqtts://') && !this.mqttHost.startsWith('mqtt+unix://') ? 'mqtt://' + this.mqttHost : this.mqttHost;
53
53
  }
54
54
  if (config.port)
55
55
  this.mqttPort = config.port;
@@ -104,20 +104,20 @@ export class ZigbeePlatform extends MatterbridgeDynamicPlatform {
104
104
  this.log.error(`Invalid MQTT broker host: ${this.mqttHost} or port: ${this.mqttPort}`);
105
105
  }
106
106
  this.z2m.on('mqtt_connect', () => {
107
- this.log.info(`MQTT broker at ${this.z2m.mqttHost}:${this.z2m.mqttPort} connected`);
107
+ this.log.info(`MQTT broker at ${this.z2m.getUrl()} connected`);
108
108
  this.z2m.subscribe(this.z2m.mqttTopic + '/#');
109
109
  });
110
110
  this.z2m.on('mqtt_subscribed', () => {
111
- this.log.info(`MQTT broker at ${this.z2m.mqttHost}:${this.z2m.mqttPort} subscribed to: ${this.z2m.mqttTopic + '/#'}`);
111
+ this.log.info(`MQTT broker at ${this.z2m.getUrl()} subscribed to: ${this.z2m.mqttTopic + '/#'}`);
112
112
  });
113
113
  this.z2m.on('close', () => {
114
- this.log.warn(`MQTT broker at ${this.z2m.mqttHost}:${this.z2m.mqttPort} closed the connection`);
114
+ this.log.warn(`MQTT broker at ${this.z2m.getUrl()} closed the connection`);
115
115
  });
116
116
  this.z2m.on('end', () => {
117
- this.log.warn(`MQTT broker at ${this.z2m.mqttHost}:${this.z2m.mqttPort} ended the connection`);
117
+ this.log.warn(`MQTT broker at ${this.z2m.getUrl()} ended the connection`);
118
118
  });
119
119
  this.z2m.on('mqtt_error', (error) => {
120
- this.log.error(`MQTT broker at ${this.z2m.mqttHost}:${this.z2m.mqttPort} error:`, error);
120
+ this.log.error(`MQTT broker at ${this.z2m.getUrl()} error:`, error);
121
121
  });
122
122
  this.z2m.on('online', () => {
123
123
  this.log.info('zigbee2MQTT is online');
@@ -33,7 +33,6 @@ export class Zigbee2MQTT extends EventEmitter {
33
33
  options = {
34
34
  clientId: 'matterbridge_' + crypto.randomBytes(8).toString('hex'),
35
35
  keepalive: 60,
36
- protocol: 'mqtt',
37
36
  protocolVersion: 5,
38
37
  reconnectPeriod: 5000,
39
38
  connectTimeout: 60 * 1000,
@@ -99,20 +98,20 @@ export class Zigbee2MQTT extends EventEmitter {
99
98
  this.log.warn('You are using mqtt:// protocol, but you provided a key. It will be ignored.');
100
99
  }
101
100
  }
102
- else if (mqttHost.startsWith('unix://')) {
103
- this.log.debug('Using unix:// protocol for MQTT connection over Unix socket');
101
+ else if (mqttHost.startsWith('mqtt+unix://')) {
102
+ this.log.debug('Using mqtt+unix:// protocol for MQTT connection over Unix socket');
104
103
  if (ca) {
105
- this.log.warn('You are using unix:// protocol, but you provided a CA certificate. It will be ignored.');
104
+ this.log.warn('You are using mqtt+unix:// protocol, but you provided a CA certificate. It will be ignored.');
106
105
  }
107
106
  if (cert) {
108
- this.log.warn('You are using unix:// protocol, but you provided a certificate. It will be ignored.');
107
+ this.log.warn('You are using mqtt+unix:// protocol, but you provided a certificate. It will be ignored.');
109
108
  }
110
109
  if (key) {
111
- this.log.warn('You are using unix:// protocol, but you provided a key. It will be ignored.');
110
+ this.log.warn('You are using mqtt+unix:// protocol, but you provided a key. It will be ignored.');
112
111
  }
113
112
  }
114
113
  else {
115
- this.log.warn('You are using an unsupported MQTT protocol. Please use mqtt:// or mqtts://.');
114
+ this.log.warn('You are using an unsupported MQTT protocol. Please use mqtt:// or mqtts:// or mqtt+unix://.');
116
115
  }
117
116
  this.z2mIsAvailabilityEnabled = false;
118
117
  this.z2mIsOnline = false;
@@ -168,7 +167,7 @@ export class Zigbee2MQTT extends EventEmitter {
168
167
  }
169
168
  }
170
169
  getUrl() {
171
- return this.mqttHost.startsWith('unix://') ? this.mqttHost : this.mqttHost + ':' + this.mqttPort.toString();
170
+ return this.mqttHost.includes('unix://') ? this.mqttHost : this.mqttHost + ':' + this.mqttPort.toString();
172
171
  }
173
172
  async start() {
174
173
  this.log.debug(`Starting connection to ${this.getUrl()}...`);
@@ -17,7 +17,7 @@
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 unix://<SOCKET_PATH> for Unix socket on Linux (e.g. 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:// 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.",
21
21
  "type": "string",
22
22
  "default": "mqtt://localhost"
23
23
  },
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-zigbee2mqtt",
3
- "version": "3.0.3-dev-20251211-b4188c4",
3
+ "version": "3.0.3-dev-20251211-1802e6b",
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-b4188c4",
9
+ "version": "3.0.3-dev-20251211-1802e6b",
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-b4188c4",
3
+ "version": "3.0.3-dev-20251211-1802e6b",
4
4
  "description": "Matterbridge zigbee2mqtt plugin",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",