matterbridge 3.0.1-dev-20250505-cbd2c6e → 3.0.1-dev-20250505-1dd1d7e

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
@@ -13,7 +13,7 @@ If you like this project and find it useful, please consider giving it a star on
13
13
  If you want to run Matterbridge in Home Assistant please use the official add-on https://github.com/Luligu/matterbridge-home-assistant-addon that also has Ingress and side panel.
14
14
  It is also available the official Matterbridge Home Assistant plugin https://github.com/Luligu/matterbridge-hass.
15
15
 
16
- ## [3.0.1] - 2025-05-??
16
+ ## [3.0.1] - 2025-05-05
17
17
 
18
18
  ### Added
19
19
 
@@ -24,6 +24,7 @@ It is also available the official Matterbridge Home Assistant plugin https://git
24
24
  - [frontend]: Moved all plugin actions from express to web socket.
25
25
  - [frontend]: Moved all config from express to web socket.
26
26
  - [endpoint]: Added OperationalState cluster helper and behavior.
27
+ - [behaviors]: Added Jest test on MatterbridgeBehaviors.
27
28
 
28
29
  ### Changed
29
30
 
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Docker Version](https://img.shields.io/docker/v/luligu/matterbridge?label=docker%20version&sort=semver)](https://hub.docker.com/r/luligu/matterbridge)
6
6
  [![Docker Pulls](https://img.shields.io/docker/pulls/luligu/matterbridge.svg)](https://hub.docker.com/r/luligu/matterbridge)
7
7
  ![Node.js CI](https://github.com/Luligu/matterbridge/actions/workflows/build.yml/badge.svg)
8
- ![Coverage](https://img.shields.io/badge/Jest%20coverage-80%25-brightgreen)
8
+ ![Coverage](https://img.shields.io/badge/Jest%20coverage-84%25-brightgreen)
9
9
 
10
10
  [![power by](https://img.shields.io/badge/powered%20by-matter--history-blue)](https://www.npmjs.com/package/matter-history)
11
11
  [![power by](https://img.shields.io/badge/powered%20by-node--ansi--logger-blue)](https://www.npmjs.com/package/node-ansi-logger)
@@ -15,12 +15,12 @@ import { ColorControlServer } from '@matter/main/behaviors/color-control';
15
15
  import { WindowCoveringServer } from '@matter/main/behaviors/window-covering';
16
16
  import { DoorLockServer } from '@matter/main/behaviors/door-lock';
17
17
  import { FanControlServer } from '@matter/main/behaviors/fan-control';
18
- import { ThermostatBehavior } from '@matter/main/behaviors/thermostat';
19
- import { ValveConfigurationAndControlBehavior } from '@matter/main/behaviors/valve-configuration-and-control';
18
+ import { ThermostatServer } from '@matter/main/behaviors/thermostat';
19
+ import { ValveConfigurationAndControlServer } from '@matter/main/behaviors/valve-configuration-and-control';
20
20
  import { ModeSelectServer } from '@matter/main/behaviors/mode-select';
21
21
  import { SmokeCoAlarmServer } from '@matter/main/behaviors/smoke-co-alarm';
22
22
  import { SwitchServer } from '@matter/main/behaviors/switch';
23
- import { OperationalStateBehavior } from '@matter/main/behaviors/operational-state';
23
+ import { OperationalStateServer } from '@matter/main/behaviors/operational-state';
24
24
  export class MatterbridgeServerDevice {
25
25
  log;
26
26
  commandHandler;
@@ -161,6 +161,12 @@ export class MatterbridgeServerDevice {
161
161
  }
162
162
  export class MatterbridgeServer extends Behavior {
163
163
  static id = 'matterbridge';
164
+ initialize() {
165
+ const device = this.state.deviceCommand;
166
+ device?.setEndpointId(this.endpoint.maybeId);
167
+ device?.setEndpointNumber(this.endpoint.maybeNumber);
168
+ super.initialize();
169
+ }
164
170
  }
165
171
  (function (MatterbridgeServer) {
166
172
  class State {
@@ -169,128 +175,141 @@ export class MatterbridgeServer extends Behavior {
169
175
  MatterbridgeServer.State = State;
170
176
  })(MatterbridgeServer || (MatterbridgeServer = {}));
171
177
  export class MatterbridgeIdentifyServer extends IdentifyServer {
172
- initialize() {
173
- const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
174
- device.setEndpointId(this.endpoint.maybeId);
175
- device.setEndpointNumber(this.endpoint.maybeNumber);
176
- super.initialize();
177
- }
178
178
  identify({ identifyTime }) {
179
179
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
180
180
  device.identify({ identifyTime });
181
+ device.log.debug(`MatterbridgeIdentifyServer: identify called`);
181
182
  super.identify({ identifyTime });
182
183
  }
183
184
  triggerEffect({ effectIdentifier, effectVariant }) {
184
185
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
185
186
  device.triggerEffect({ effectIdentifier, effectVariant });
187
+ device.log.debug(`MatterbridgeIdentifyServer: triggerEffect called`);
186
188
  super.triggerEffect({ effectIdentifier, effectVariant });
187
189
  }
188
190
  }
189
191
  export class MatterbridgeOnOffServer extends OnOffServer {
190
- async on() {
192
+ on() {
191
193
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
192
194
  device.on();
195
+ device.log.debug(`MatterbridgeOnOffServer: on called`);
193
196
  super.on();
194
197
  }
195
- async off() {
198
+ off() {
196
199
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
197
200
  device.off();
201
+ device.log.debug(`MatterbridgeOnOffServer: off called`);
198
202
  super.off();
199
203
  }
200
- async toggle() {
204
+ toggle() {
201
205
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
202
206
  device.toggle();
207
+ device.log.debug(`MatterbridgeOnOffServer: toggle called`);
203
208
  super.toggle();
204
209
  }
205
210
  }
206
211
  export class MatterbridgeLevelControlServer extends LevelControlServer {
207
- async moveToLevel({ level, transitionTime, optionsMask, optionsOverride }) {
212
+ moveToLevel({ level, transitionTime, optionsMask, optionsOverride }) {
208
213
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
209
214
  device.moveToLevel({ level, transitionTime, optionsMask, optionsOverride });
215
+ device.log.debug(`MatterbridgeLevelControlServer: moveToLevel called`);
210
216
  super.moveToLevel({ level, transitionTime, optionsMask, optionsOverride });
211
217
  }
212
- async moveToLevelWithOnOff({ level, transitionTime, optionsMask, optionsOverride }) {
218
+ moveToLevelWithOnOff({ level, transitionTime, optionsMask, optionsOverride }) {
213
219
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
214
220
  device.moveToLevelWithOnOff({ level, transitionTime, optionsMask, optionsOverride });
221
+ device.log.debug(`MatterbridgeLevelControlServer: moveToLevelWithOnOff called`);
215
222
  super.moveToLevelWithOnOff({ level, transitionTime, optionsMask, optionsOverride });
216
223
  }
217
224
  }
218
225
  export class MatterbridgeColorControlServer extends ColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature) {
219
- async moveToHue({ optionsMask, optionsOverride, hue, direction, transitionTime }) {
226
+ moveToHue({ optionsMask, optionsOverride, hue, direction, transitionTime }) {
220
227
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
221
228
  device.moveToHue({ optionsMask, optionsOverride, hue, direction, transitionTime });
229
+ device.log.debug(`MatterbridgeColorControlServer: moveToHue called`);
222
230
  super.moveToHue({ optionsMask, optionsOverride, hue, direction, transitionTime });
223
231
  }
224
- async moveToSaturation({ optionsMask, optionsOverride, saturation, transitionTime }) {
232
+ moveToSaturation({ optionsMask, optionsOverride, saturation, transitionTime }) {
225
233
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
226
234
  device.moveToSaturation({ optionsMask, optionsOverride, saturation, transitionTime });
235
+ device.log.debug(`MatterbridgeColorControlServer: moveToSaturation called`);
227
236
  super.moveToSaturation({ optionsMask, optionsOverride, saturation, transitionTime });
228
237
  }
229
- async moveToHueAndSaturation({ optionsOverride, optionsMask, saturation, hue, transitionTime }) {
238
+ moveToHueAndSaturation({ optionsOverride, optionsMask, saturation, hue, transitionTime }) {
230
239
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
231
240
  device.moveToHueAndSaturation({ optionsOverride, optionsMask, saturation, hue, transitionTime });
241
+ device.log.debug(`MatterbridgeColorControlServer: moveToHueAndSaturation called`);
232
242
  super.moveToHueAndSaturation({ optionsOverride, optionsMask, saturation, hue, transitionTime });
233
243
  }
234
- async moveToColor({ optionsMask, optionsOverride, colorX, colorY, transitionTime }) {
244
+ moveToColor({ optionsMask, optionsOverride, colorX, colorY, transitionTime }) {
235
245
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
236
246
  device.moveToColor({ optionsMask, optionsOverride, colorX, colorY, transitionTime });
247
+ device.log.debug(`MatterbridgeColorControlServer: moveToColor called`);
237
248
  super.moveToColor({ optionsMask, optionsOverride, colorX, colorY, transitionTime });
238
249
  }
239
- async moveToColorTemperature({ optionsOverride, optionsMask, colorTemperatureMireds, transitionTime }) {
250
+ moveToColorTemperature({ optionsOverride, optionsMask, colorTemperatureMireds, transitionTime }) {
240
251
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
241
252
  device.moveToColorTemperature({ optionsOverride, optionsMask, colorTemperatureMireds, transitionTime });
253
+ device.log.debug(`MatterbridgeColorControlServer: moveToColorTemperature called`);
242
254
  super.moveToColorTemperature({ optionsOverride, optionsMask, colorTemperatureMireds, transitionTime });
243
255
  }
244
256
  }
245
257
  export class MatterbridgeWindowCoveringServer extends WindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift) {
246
- async upOrOpen() {
258
+ upOrOpen() {
247
259
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
248
260
  device.upOrOpen();
261
+ device.log.debug(`MatterbridgeWindowCoveringServer: upOrOpen called`);
249
262
  super.upOrOpen();
250
263
  }
251
- async downOrClose() {
264
+ downOrClose() {
252
265
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
253
266
  device.downOrClose();
267
+ device.log.debug(`MatterbridgeWindowCoveringServer: downOrClose called`);
254
268
  super.downOrClose();
255
269
  }
256
270
  stopMotion() {
257
271
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
258
272
  device.stopMotion();
273
+ device.log.debug(`MatterbridgeWindowCoveringServer: stopMotion called`);
259
274
  super.stopMotion();
260
275
  }
261
276
  goToLiftPercentage({ liftPercent100thsValue }) {
262
277
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
263
278
  device.goToLiftPercentage({ liftPercent100thsValue });
279
+ device.log.debug(`MatterbridgeWindowCoveringServer: goToLiftPercentage with ${liftPercent100thsValue}`);
264
280
  super.goToLiftPercentage({ liftPercent100thsValue });
265
281
  }
266
282
  async handleMovement(type, reversed, direction, targetPercent100ths) {
267
283
  }
268
284
  }
269
285
  export class MatterbridgeDoorLockServer extends DoorLockServer {
270
- async lockDoor() {
286
+ lockDoor() {
271
287
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
272
288
  device.lockDoor();
289
+ device.log.debug(`MatterbridgeDoorLockServer: lockDoor called`);
273
290
  super.lockDoor();
274
291
  }
275
- async unlockDoor() {
292
+ unlockDoor() {
276
293
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
277
294
  device.unlockDoor();
295
+ device.log.debug(`MatterbridgeDoorLockServer: unlockDoor called`);
278
296
  super.unlockDoor();
279
297
  }
280
298
  }
281
299
  export class MatterbridgeModeSelectServer extends ModeSelectServer {
282
- async changeToMode({ newMode }) {
300
+ changeToMode({ newMode }) {
283
301
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
284
302
  device.changeToMode({ newMode });
303
+ device.log.debug(`MatterbridgeModeSelectServer: changeToMode called with mode: ${newMode}`);
285
304
  super.changeToMode({ newMode });
286
305
  }
287
306
  }
288
307
  export class MatterbridgeFanControlServer extends FanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step) {
289
- async step({ direction, wrap, lowestOff }) {
308
+ step({ direction, wrap, lowestOff }) {
290
309
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
291
310
  device.step({ direction, wrap, lowestOff });
292
311
  const lookupStepDirection = ['Increase', 'Decrease'];
293
- device.log.debug(`Command step called with direction: ${lookupStepDirection[direction]} wrap: ${wrap} lowestOff: ${lowestOff}`);
312
+ device.log.debug(`MatterbridgeFanControlServer: step called with direction: ${lookupStepDirection[direction]} wrap: ${wrap} lowestOff: ${lowestOff}`);
294
313
  device.log.debug(`- current percentCurrent: ${this.state.percentCurrent}`);
295
314
  if (direction === FanControl.StepDirection.Increase) {
296
315
  if (wrap && this.state.percentCurrent === 100) {
@@ -307,15 +326,14 @@ export class MatterbridgeFanControlServer extends FanControlServer.with(FanContr
307
326
  this.state.percentCurrent = Math.max(this.state.percentCurrent - 10, lowestOff ? 0 : 10);
308
327
  }
309
328
  device.log.debug('Set percentCurrent to:', this.state.percentCurrent);
310
- super.step({ direction, wrap, lowestOff });
311
329
  }
312
330
  }
313
- export class MatterbridgeThermostatServer extends ThermostatBehavior.with(Thermostat.Feature.Cooling, Thermostat.Feature.Heating, Thermostat.Feature.AutoMode) {
314
- async setpointRaiseLower({ mode, amount }) {
331
+ export class MatterbridgeThermostatServer extends ThermostatServer.with(Thermostat.Feature.Cooling, Thermostat.Feature.Heating, Thermostat.Feature.AutoMode) {
332
+ setpointRaiseLower({ mode, amount }) {
315
333
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
316
334
  device.setpointRaiseLower({ mode, amount });
317
335
  const lookupSetpointAdjustMode = ['Heat', 'Cool', 'Both'];
318
- device.log.debug(`Command setpointRaiseLower called with mode: ${lookupSetpointAdjustMode[mode]} amount: ${amount / 10}`);
336
+ device.log.debug(`MatterbridgeThermostatServer: setpointRaiseLower called with mode: ${lookupSetpointAdjustMode[mode]} amount: ${amount / 10}`);
319
337
  device.log.debug(`- current occupiedHeatingSetpoint: ${this.state.occupiedHeatingSetpoint / 100}`);
320
338
  device.log.debug(`- current occupiedCoolingSetpoint: ${this.state.occupiedCoolingSetpoint / 100}`);
321
339
  if ((mode === Thermostat.SetpointRaiseLowerMode.Heat || mode === Thermostat.SetpointRaiseLowerMode.Both) && this.state.occupiedHeatingSetpoint !== undefined) {
@@ -330,43 +348,41 @@ export class MatterbridgeThermostatServer extends ThermostatBehavior.with(Thermo
330
348
  }
331
349
  }
332
350
  }
333
- export class MatterbridgeValveConfigurationAndControlServer extends ValveConfigurationAndControlBehavior.with(ValveConfigurationAndControl.Feature.Level) {
334
- initialize() {
335
- }
351
+ export class MatterbridgeValveConfigurationAndControlServer extends ValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level) {
336
352
  open({ openDuration, targetLevel }) {
337
353
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
338
- device.log.debug(`Command open called with openDuration: ${openDuration} targetLevel: ${targetLevel}`);
354
+ device.log.debug(`MatterbridgeValveConfigurationAndControlServer: open called with openDuration: ${openDuration} targetLevel: ${targetLevel}`);
339
355
  device.open({ openDuration, targetLevel });
340
356
  this.state.targetLevel = targetLevel ?? 100;
341
357
  this.state.currentLevel = targetLevel ?? 100;
342
358
  }
343
359
  close() {
344
360
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
345
- device.log.debug(`Command close called`);
361
+ device.log.debug(`MatterbridgeValveConfigurationAndControlServer: close called`);
346
362
  device.close();
347
363
  this.state.targetLevel = 0;
348
364
  this.state.currentLevel = 0;
349
365
  }
350
366
  }
351
367
  export class MatterbridgeSmokeCoAlarmServer extends SmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm) {
352
- async selfTestRequest() {
368
+ selfTestRequest() {
353
369
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
370
+ device.log.debug(`MatterbridgeSmokeCoAlarmServer: selfTestRequest called`);
354
371
  device.selfTestRequest();
355
- super.selfTestRequest();
356
372
  }
357
373
  }
358
374
  export class MatterbridgeBooleanStateConfigurationServer extends BooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel) {
359
- async enableDisableAlarm({ alarmsToEnableDisable }) {
375
+ enableDisableAlarm({ alarmsToEnableDisable }) {
360
376
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
377
+ device.log.debug(`MatterbridgeBooleanStateConfigurationServer: enableDisableAlarm called`);
361
378
  device.enableDisableAlarm({ alarmsToEnableDisable });
362
- super.enableDisableAlarm({ alarmsToEnableDisable });
363
379
  }
364
380
  }
365
381
  export class MatterbridgeSwitchServer extends SwitchServer {
366
382
  initialize() {
367
383
  }
368
384
  }
369
- export class MatterbridgeOperationalStateServer extends OperationalStateBehavior {
385
+ export class MatterbridgeOperationalStateServer extends OperationalStateServer {
370
386
  initialize() {
371
387
  const device = this.endpoint.stateOf(MatterbridgeServer).deviceCommand;
372
388
  device.log.debug('MatterbridgeOperationalStateServer initialized: setting operational state to Stopped');
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.0.1-dev-20250505-cbd2c6e",
3
+ "version": "3.0.1-dev-20250505-1dd1d7e",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge",
9
- "version": "3.0.1-dev-20250505-cbd2c6e",
9
+ "version": "3.0.1-dev-20250505-1dd1d7e",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "@matter/main": "0.13.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge",
3
- "version": "3.0.1-dev-20250505-cbd2c6e",
3
+ "version": "3.0.1-dev-20250505-1dd1d7e",
4
4
  "description": "Matterbridge plugin manager for Matter",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",