matterbridge-example-dynamic-platform 2.0.13-dev-20260302-e8d75fe → 2.0.13-dev-20260302-2a66e51

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
@@ -35,7 +35,9 @@ If you like this project and find it useful, please consider giving it a star on
35
35
 
36
36
  ### Added
37
37
 
38
- - [BridgedOutlet]: Add a bridged outlet with four individually controllable plugs.
38
+ - [BridgedOutlet]: Add a bridged outlet with four individually controllable plugs that expose their names.
39
+ - [onOffMountedLegacy]: Add an onOff Mounted Switch legacy device.
40
+ - [dimmerMountedLegacy]: Add a dimmer Mounted Switch legacy device.
39
41
 
40
42
  ### Changed
41
43
 
package/README.md CHANGED
@@ -24,13 +24,13 @@
24
24
 
25
25
  Matterbridge dynamic platform example plugin is a template to develop your own plugin using the dynamic platform.
26
26
 
27
- It exposes 64 virtual devices:
27
+ It exposes 66 virtual devices:
28
28
 
29
29
  - a door contact sensor
30
30
  - a motion sensor
31
31
  - an illuminance sensor
32
32
  - a temperature sensor
33
- - an humidity sensor
33
+ - a humidity sensor
34
34
  - a pressure sensor
35
35
  - a flow sensor
36
36
  - a climate sensor with temperature, humidity and pressure
@@ -46,7 +46,7 @@ It exposes 64 virtual devices:
46
46
  - an outlet (plug) with onOff cluster, energy measurements and power measurements
47
47
  - an outlet (plug) with onOff cluster, apparent energy measurements and power measurements
48
48
  - a smart outlet with an energy meter and four individually controllable sockets (with tagList 1, 2, 3 and 4)
49
- - a bridged outlet with four individually controllable plugs
49
+ - a bridged outlet with four individually controllable plugs that expose their names
50
50
  - a cover with windowCovering cluster and lift feature
51
51
  - a cover with windowCovering cluster and both lift and tilt features
52
52
  - a lock with doorLock cluster
@@ -60,22 +60,24 @@ It exposes 64 virtual devices:
60
60
  - a fan with Off Low Med High presets
61
61
  - a fan with Off Low Med High Auto presets and step
62
62
  - a fan with all the features MultiSpeed, Auto, Step, Rock, Wind and AirflowDirection and mode Off Low Med High Auto.
63
- - a rainSensor device
64
- - a waterFreezeDetector device
65
- - a waterLeakDetector device
63
+ - a rain sensor device
64
+ - a water freeze detector device
65
+ - a water leak detector device
66
66
  - a smokeCoAlarm (with smoke and co features) sensor (supported by Apple Home)
67
67
  - a smokeCoAlarm (with smoke only feature) sensor (supported by Apple Home)
68
68
  - a smokeCoAlarm (with co only feature) sensor (supported by Apple Home)
69
69
  - an airConditioner device
70
70
  - an airPurifier device with temperature and humidity sensor (supported by Apple Home)
71
- - a pumpDevice device
71
+ - a pump device
72
72
  - a waterValve device
73
73
  - an airQuality device with all concentration measurements clusters (supported by Apple Home with the concentration measurements from version 18.5)
74
74
  - a momentary switch composed by three switches with Single Double Long (tagged with One Two Three and Top Middle Bottom) and three switches with Single only.
75
75
  - a latching switch
76
76
  - a Robot Vacuum Cleaner device (supported by SmartThings, Alexa, Home Assistant and partially by Apple Home). Read also <https://github.com/Luligu/matterbridge/discussions/264>.
77
- - a onOff Mounted Switch device (supported by SmartThings, Alexa, Home Assistant)
77
+ - an onOff Mounted Switch device (supported by SmartThings, Alexa, Home Assistant)
78
+ - a onOff Mounted Switch legacy device (supported by all controllers)
78
79
  - a dimmer Mounted Switch device (supported by SmartThings, Alexa, Home Assistant)
80
+ - a dimmer Mounted Switch legacy device (supported by all controllers)
79
81
  - a laundry Washer device (supported by SmartThings, Alexa and Home Assistant)
80
82
  - a laundry Dryer device (supported by SmartThings, Alexa and Home Assistant)
81
83
  - a dishwasher device (supported by SmartThings, Alexa and Home Assistant)
@@ -92,9 +94,9 @@ It exposes 64 virtual devices:
92
94
  - a basic video player (supported by SmartThings)
93
95
  - a speaker device (supported by SmartThings)
94
96
 
95
- All these devices continuously change state and position. The plugin also shows how to use all the command handlers (you can control all the devices), how to subscribe to attributes and how to trigger events.
97
+ All these devices continuously change their state and position. The plugin also shows how to use all the command handlers (so you can control all the devices), how to subscribe to attributes, and how to trigger events.
96
98
 
97
- If you want to write your plugin, the easiest way to start create a new plugin is to clone the [Matterbridge Plugin Template](https://github.com/Luligu/matterbridge-plugin-template) which has **Dev Container support for instant development environment** and all tools and extensions (like Node.js, npm, TypeScript, ESLint, Prettier, Jest and Vitest) already loaded and configured.
99
+ If you want to write your own plugin, the easiest way to get started is to clone the [Matterbridge Plugin Template](https://github.com/Luligu/matterbridge-plugin-template). It has **Dev Container support for an instant development environment**, with all tools and extensions (like Node.js, npm, TypeScript, ESLint, Prettier, Jest, and Vitest) already loaded and configured.
98
100
 
99
101
  If you like this project and find it useful, please consider giving it a star on [GitHub](https://github.com/Luligu/matterbridge-example-dynamic-platform) and sponsoring it.
100
102
 
@@ -108,4 +110,4 @@ See the guidelines on [Matterbridge](https://github.com/Luligu/matterbridge/blob
108
110
 
109
111
  ## Style guide
110
112
 
111
- See also the [Style Guide](./STYLE_GUIDE.md) for JSDoc, naming and logging conventions used in this repository.
113
+ See also the [Style Guide](./STYLEGUIDE.md) for JSDoc, naming, and logging conventions used in this repository.
package/dist/module.js CHANGED
@@ -36,6 +36,8 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
36
36
  switch;
37
37
  mountedOnOffSwitch;
38
38
  mountedDimmerSwitch;
39
+ mountedOnOffSwitchLegacy;
40
+ mountedDimmerSwitchLegacy;
39
41
  lightOnOff;
40
42
  dimmer;
41
43
  light;
@@ -194,7 +196,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
194
196
  this.switch?.addCommandHandler('off', async () => {
195
197
  this.switch?.log.info('Command off called');
196
198
  });
197
- this.mountedOnOffSwitch = new MatterbridgeEndpoint([onOffMountedSwitch, onOffOutlet, bridgedNode, powerSource], { id: 'OnOffMountedSwitch' }, this.config.debug)
199
+ this.mountedOnOffSwitch = new MatterbridgeEndpoint([onOffMountedSwitch, bridgedNode, powerSource], { id: 'OnOffMountedSwitch' }, this.config.debug)
198
200
  .createDefaultIdentifyClusterServer()
199
201
  .createDefaultBridgedDeviceBasicInformationClusterServer('OnOff Mounted Switch', 'OMS00011', 0xfff1, 'Matterbridge', 'Matterbridge OnOff Mounted Switch')
200
202
  .createDefaultOnOffClusterServer()
@@ -210,7 +212,23 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
210
212
  this.mountedOnOffSwitch?.addCommandHandler('off', async () => {
211
213
  this.mountedOnOffSwitch?.log.info('Command off called');
212
214
  });
213
- this.mountedDimmerSwitch = new MatterbridgeEndpoint([dimmableMountedSwitch, dimmableOutlet, bridgedNode, powerSource], { id: 'DimmerMountedSwitch' }, this.config.debug)
215
+ this.mountedOnOffSwitchLegacy = new MatterbridgeEndpoint([onOffMountedSwitch, onOffOutlet, bridgedNode, powerSource], { id: 'OnOffMountedSwitchLegacy' }, this.config.debug)
216
+ .createDefaultIdentifyClusterServer()
217
+ .createDefaultBridgedDeviceBasicInformationClusterServer('OnOff Mounted Switch Legacy', 'OMSL00011', 0xfff1, 'Matterbridge', 'Matterbridge OnOff Mounted Switch Legacy')
218
+ .createDefaultOnOffClusterServer()
219
+ .createDefaultPowerSourceWiredClusterServer()
220
+ .addRequiredClusterServers();
221
+ this.mountedOnOffSwitchLegacy = await this.addDevice(this.mountedOnOffSwitchLegacy);
222
+ this.mountedOnOffSwitchLegacy?.addCommandHandler('identify', async ({ request: { identifyTime } }) => {
223
+ this.mountedOnOffSwitchLegacy?.log.info(`Command identify called identifyTime:${identifyTime}`);
224
+ });
225
+ this.mountedOnOffSwitchLegacy?.addCommandHandler('on', async () => {
226
+ this.mountedOnOffSwitchLegacy?.log.info('Command on called');
227
+ });
228
+ this.mountedOnOffSwitchLegacy?.addCommandHandler('off', async () => {
229
+ this.mountedOnOffSwitchLegacy?.log.info('Command off called');
230
+ });
231
+ this.mountedDimmerSwitch = new MatterbridgeEndpoint([dimmableMountedSwitch, bridgedNode, powerSource], { id: 'DimmerMountedSwitch' }, this.config.debug)
214
232
  .createDefaultIdentifyClusterServer()
215
233
  .createDefaultBridgedDeviceBasicInformationClusterServer('Dimmer Mounted Switch', 'DMS00012', 0xfff1, 'Matterbridge', 'Matterbridge Dimmer Mounted Switch')
216
234
  .createDefaultOnOffClusterServer()
@@ -233,6 +251,29 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
233
251
  this.mountedDimmerSwitch?.addCommandHandler('moveToLevelWithOnOff', async ({ request: { level } }) => {
234
252
  this.mountedDimmerSwitch?.log.debug(`Command moveToLevelWithOnOff called request: ${level}`);
235
253
  });
254
+ this.mountedDimmerSwitchLegacy = new MatterbridgeEndpoint([dimmableMountedSwitch, dimmableOutlet, bridgedNode, powerSource], { id: 'DimmerMountedSwitchLegacy' }, this.config.debug)
255
+ .createDefaultIdentifyClusterServer()
256
+ .createDefaultBridgedDeviceBasicInformationClusterServer('Dimmer Mounted Switch Legacy', 'DMSL00012', 0xfff1, 'Matterbridge', 'Matterbridge Dimmer Mounted Switch Legacy')
257
+ .createDefaultOnOffClusterServer()
258
+ .createDefaultLevelControlClusterServer()
259
+ .createDefaultPowerSourceWiredClusterServer()
260
+ .addRequiredClusterServers();
261
+ this.mountedDimmerSwitchLegacy = await this.addDevice(this.mountedDimmerSwitchLegacy);
262
+ this.mountedDimmerSwitchLegacy?.addCommandHandler('identify', async ({ request: { identifyTime } }) => {
263
+ this.mountedDimmerSwitchLegacy?.log.info(`Command identify called identifyTime:${identifyTime}`);
264
+ });
265
+ this.mountedDimmerSwitchLegacy?.addCommandHandler('on', async () => {
266
+ this.mountedDimmerSwitchLegacy?.log.info('Command on called');
267
+ });
268
+ this.mountedDimmerSwitchLegacy?.addCommandHandler('off', async () => {
269
+ this.mountedDimmerSwitchLegacy?.log.info('Command off called');
270
+ });
271
+ this.mountedDimmerSwitchLegacy?.addCommandHandler('moveToLevel', async ({ request: { level } }) => {
272
+ this.mountedDimmerSwitchLegacy?.log.debug(`Command moveToLevel called request: ${level}`);
273
+ });
274
+ this.mountedDimmerSwitchLegacy?.addCommandHandler('moveToLevelWithOnOff', async ({ request: { level } }) => {
275
+ this.mountedDimmerSwitchLegacy?.log.debug(`Command moveToLevelWithOnOff called request: ${level}`);
276
+ });
236
277
  this.lightOnOff = new MatterbridgeEndpoint([onOffLight, bridgedNode, powerSource], { id: 'Light (on/off)' }, this.config.debug)
237
278
  .createDefaultIdentifyClusterServer()
238
279
  .createDefaultBridgedDeviceBasicInformationClusterServer('Light (on/off)', 'LON00013', 0xfff1, 'Matterbridge', 'Matterbridge Light on/off')
@@ -462,6 +503,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
462
503
  .createDefaultElectricalEnergyMeasurementClusterServer(0, 0)
463
504
  .createDefaultElectricalPowerMeasurementClusterServer(220_000, 0, 0, 50_000)
464
505
  .addRequiredClusterServers();
506
+ this.smartOutlet.addFixedLabel('composed', 'Compound device');
465
507
  this.smartOutlet
466
508
  .addChildDeviceTypeWithClusterServer('Socket 1', onOffOutlet, [OnOffCluster.id], {
467
509
  id: 'Socket1',
@@ -1179,6 +1221,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
1179
1221
  this.momentarySwitch = new MatterbridgeEndpoint([bridgedNode, powerSource], { id: 'Momentary switch composed' }, this.config.debug)
1180
1222
  .createDefaultBridgedDeviceBasicInformationClusterServer('Momentary switch', 'MOS00041', 0xfff1, 'Matterbridge', 'Matterbridge Momentary Switch')
1181
1223
  .createDefaultPowerSourceReplaceableBatteryClusterServer(50, PowerSource.BatChargeLevel.Ok, 2900, 'CR2450', 1);
1224
+ this.momentarySwitch.addFixedLabel('composed', 'Compound device');
1182
1225
  this.momentarySwitch
1183
1226
  .addChildDeviceType('Momentary switch 1', [genericSwitch], {
1184
1227
  tagList: [
@@ -1770,11 +1813,13 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
1770
1813
  }
1771
1814
  await this.switch?.setAttribute(OnOff.Cluster.id, 'onOff', this.intervalOnOff, this.switch.log);
1772
1815
  await this.mountedOnOffSwitch?.setAttribute(OnOff.Cluster.id, 'onOff', this.intervalOnOff, this.mountedOnOffSwitch.log);
1816
+ await this.mountedOnOffSwitchLegacy?.setAttribute(OnOff.Cluster.id, 'onOff', this.intervalOnOff, this.mountedOnOffSwitchLegacy.log);
1773
1817
  this.switch?.log.info(`Set switch initial onOff to ${this.intervalOnOff}`);
1774
1818
  if (this.config.useInterval) {
1775
1819
  this.addInterval(async () => {
1776
1820
  await this.switch?.setAttribute(OnOff.Cluster.id, 'onOff', this.intervalOnOff, this.switch.log);
1777
1821
  await this.mountedOnOffSwitch?.setAttribute(OnOff.Cluster.id, 'onOff', this.intervalOnOff, this.mountedOnOffSwitch.log);
1822
+ await this.mountedOnOffSwitchLegacy?.setAttribute(OnOff.Cluster.id, 'onOff', this.intervalOnOff, this.mountedOnOffSwitchLegacy.log);
1778
1823
  this.log.info(`Set switches onOff to ${this.intervalOnOff}`);
1779
1824
  this.intervalOnOff = !this.intervalOnOff;
1780
1825
  }, 60 * 1000 + 100);
@@ -1785,6 +1830,8 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
1785
1830
  await this.dimmer?.setAttribute(LevelControl.Cluster.id, 'currentLevel', 1, this.dimmer.log);
1786
1831
  await this.mountedDimmerSwitch?.setAttribute(OnOff.Cluster.id, 'onOff', false, this.mountedDimmerSwitch.log);
1787
1832
  await this.mountedDimmerSwitch?.setAttribute(LevelControl.Cluster.id, 'currentLevel', 1, this.mountedDimmerSwitch.log);
1833
+ await this.mountedDimmerSwitchLegacy?.setAttribute(OnOff.Cluster.id, 'onOff', false, this.mountedDimmerSwitchLegacy.log);
1834
+ await this.mountedDimmerSwitchLegacy?.setAttribute(LevelControl.Cluster.id, 'currentLevel', 1, this.mountedDimmerSwitchLegacy.log);
1788
1835
  this.dimmer?.log.info(`Set dimmer initial onOff to false, currentLevel to 1.`);
1789
1836
  await this.light?.setAttribute(OnOff.Cluster.id, 'onOff', false, this.light.log);
1790
1837
  await this.light?.setAttribute(LevelControl.Cluster.id, 'currentLevel', 200, this.light.log);
@@ -1817,6 +1864,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
1817
1864
  await this.lightOnOff?.setAttribute(OnOff.Cluster.id, 'onOff', false, this.lightOnOff.log);
1818
1865
  await this.dimmer?.setAttribute(OnOff.Cluster.id, 'onOff', false, this.dimmer.log);
1819
1866
  await this.mountedDimmerSwitch?.setAttribute(OnOff.Cluster.id, 'onOff', false, this.mountedDimmerSwitch.log);
1867
+ await this.mountedDimmerSwitchLegacy?.setAttribute(OnOff.Cluster.id, 'onOff', false, this.mountedDimmerSwitchLegacy.log);
1820
1868
  await this.light?.setAttribute(OnOff.Cluster.id, 'onOff', false, this.light.log);
1821
1869
  await this.lightXY?.setAttribute(OnOff.Cluster.id, 'onOff', false, this.lightXY.log);
1822
1870
  await this.lightHS?.setAttribute(OnOff.Cluster.id, 'onOff', false, this.lightHS.log);
@@ -1827,6 +1875,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
1827
1875
  await this.lightOnOff?.setAttribute(OnOff.Cluster.id, 'onOff', true, this.lightOnOff?.log);
1828
1876
  await this.dimmer?.setAttribute(OnOff.Cluster.id, 'onOff', true, this.dimmer.log);
1829
1877
  await this.mountedDimmerSwitch?.setAttribute(OnOff.Cluster.id, 'onOff', true, this.mountedDimmerSwitch.log);
1878
+ await this.mountedDimmerSwitchLegacy?.setAttribute(OnOff.Cluster.id, 'onOff', true, this.mountedDimmerSwitchLegacy.log);
1830
1879
  await this.light?.setAttribute(OnOff.Cluster.id, 'onOff', true, this.light.log);
1831
1880
  await this.lightXY?.setAttribute(OnOff.Cluster.id, 'onOff', true, this.lightXY.log);
1832
1881
  await this.lightHS?.setAttribute(OnOff.Cluster.id, 'onOff', true, this.lightHS.log);
@@ -1834,6 +1883,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
1834
1883
  this.log.info('Set lights onOff to true');
1835
1884
  await this.dimmer?.setAttribute(LevelControl.Cluster.id, 'currentLevel', this.intervalLevel, this.dimmer.log);
1836
1885
  await this.mountedDimmerSwitch?.setAttribute(LevelControl.Cluster.id, 'currentLevel', this.intervalLevel, this.mountedDimmerSwitch.log);
1886
+ await this.mountedDimmerSwitchLegacy?.setAttribute(LevelControl.Cluster.id, 'currentLevel', this.intervalLevel, this.mountedDimmerSwitchLegacy.log);
1837
1887
  await this.light?.setAttribute(LevelControl.Cluster.id, 'currentLevel', this.intervalLevel, this.light.log);
1838
1888
  await this.lightXY?.setAttribute(LevelControl.Cluster.id, 'currentLevel', this.intervalLevel, this.lightXY.log);
1839
1889
  await this.lightHS?.setAttribute(LevelControl.Cluster.id, 'currentLevel', this.intervalLevel, this.lightHS.log);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-example-dynamic-platform",
3
- "version": "2.0.13-dev-20260302-e8d75fe",
3
+ "version": "2.0.13-dev-20260302-2a66e51",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge-example-dynamic-platform",
9
- "version": "2.0.13-dev-20260302-e8d75fe",
9
+ "version": "2.0.13-dev-20260302-2a66e51",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "node-ansi-logger": "3.2.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge-example-dynamic-platform",
3
- "version": "2.0.13-dev-20260302-e8d75fe",
3
+ "version": "2.0.13-dev-20260302-2a66e51",
4
4
  "description": "Matterbridge dynamic plugin",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",