matterbridge-example-dynamic-platform 2.0.6 → 2.0.7

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
@@ -23,6 +23,14 @@ If you like this project and find it useful, please consider giving it a star on
23
23
 
24
24
  <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="120"></a>
25
25
 
26
+ ## [2.0.7] - 2026-01-31
27
+
28
+ ### Added
29
+
30
+ - [SmartOutlet]: Added a smart outlet with an energy meter and four individually controllable sockets (with tagList 1, 2, 3 and 4).
31
+
32
+ <a href="https://www.buymeacoffee.com/luligugithub"><img src="https://matterbridge.io/assets/bmc-button.svg" alt="Buy me a coffee" width="80"></a>
33
+
26
34
  ## [2.0.6] - 2026-01-31
27
35
 
28
36
  ### Added
package/README.md CHANGED
@@ -19,7 +19,7 @@
19
19
 
20
20
  Matterbridge dynamic platform example plugin is a template to develop your own plugin using the dynamic platform.
21
21
 
22
- It exposes 62 virtual devices:
22
+ It exposes 63 virtual devices:
23
23
 
24
24
  - a door contact sensor
25
25
  - a motion sensor
@@ -40,6 +40,7 @@ It exposes 62 virtual devices:
40
40
  - an outlet (plug) with onOff cluster
41
41
  - an outlet (plug) with onOff cluster, energy measurements and power measurements
42
42
  - an outlet (plug) with onOff cluster, apparent energy measurements and power measurements
43
+ - a smart outlet with an energy meter and four individually controllable sockets (with tagList 1, 2, 3 and 4)
43
44
  - a cover with windowCovering cluster and lift feature
44
45
  - a cover with windowCovering cluster and both lift and tilt features
45
46
  - a lock with doorLock cluster
package/dist/module.d.ts CHANGED
@@ -31,6 +31,7 @@ export declare class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDyna
31
31
  outlet: MatterbridgeEndpoint | undefined;
32
32
  outletEnergy: MatterbridgeEndpoint | undefined;
33
33
  outletEnergyApparent: MatterbridgeEndpoint | undefined;
34
+ smartOutlet: MatterbridgeEndpoint | undefined;
34
35
  coverLift: MatterbridgeEndpoint | undefined;
35
36
  coverLiftTilt: MatterbridgeEndpoint | undefined;
36
37
  lock: MatterbridgeEndpoint | undefined;
package/dist/module.js CHANGED
@@ -3,7 +3,7 @@ import { RoboticVacuumCleaner, LaundryWasher, WaterHeater, Evse, SolarPower, Bat
3
3
  import { isValidBoolean, isValidNumber, isValidObject, isValidString } from 'matterbridge/utils';
4
4
  import { debugStringify } from 'matterbridge/logger';
5
5
  import { AreaNamespaceTag, LocationTag, NumberTag, PositionTag, RefrigeratorTag, SwitchesTag, UINT16_MAX, UINT32_MAX } from 'matterbridge/matter';
6
- import { PowerSource, BooleanState, OnOff, LevelControl, AirQuality, CarbonDioxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurement, FlowMeasurement, ColorControl, DoorLock, FanControl, FormaldehydeConcentrationMeasurement, NitrogenDioxideConcentrationMeasurement, OzoneConcentrationMeasurement, Pm10ConcentrationMeasurement, Pm1ConcentrationMeasurement, Pm25ConcentrationMeasurement, RadonConcentrationMeasurement, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, SmokeCoAlarm, TemperatureMeasurement, Thermostat, ThermostatCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, WindowCovering, EnergyEvseMode, EnergyEvse, RvcRunMode, RvcCleanMode, Descriptor, BridgedDeviceBasicInformation, OvenMode, OperationalState, OccupancySensing, IlluminanceMeasurement, PressureMeasurement, RefrigeratorAndTemperatureControlledCabinetMode, RvcOperationalState, DeviceEnergyManagement, ElectricalEnergyMeasurement, ElectricalPowerMeasurement, } from 'matterbridge/matter/clusters';
6
+ import { PowerSource, BooleanState, OnOff, LevelControl, AirQuality, CarbonDioxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurement, FlowMeasurement, ColorControl, DoorLock, FanControl, FormaldehydeConcentrationMeasurement, NitrogenDioxideConcentrationMeasurement, OzoneConcentrationMeasurement, Pm10ConcentrationMeasurement, Pm1ConcentrationMeasurement, Pm25ConcentrationMeasurement, RadonConcentrationMeasurement, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, SmokeCoAlarm, TemperatureMeasurement, Thermostat, ThermostatCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, WindowCovering, EnergyEvseMode, EnergyEvse, RvcRunMode, RvcCleanMode, Descriptor, BridgedDeviceBasicInformation, OvenMode, OperationalState, OccupancySensing, IlluminanceMeasurement, PressureMeasurement, RefrigeratorAndTemperatureControlledCabinetMode, RvcOperationalState, DeviceEnergyManagement, ElectricalEnergyMeasurement, ElectricalPowerMeasurement, OnOffCluster, } from 'matterbridge/matter/clusters';
7
7
  function luxToMatter(lux) {
8
8
  if (!Number.isFinite(lux) || lux <= 0)
9
9
  return 0;
@@ -45,6 +45,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
45
45
  outlet;
46
46
  outletEnergy;
47
47
  outletEnergyApparent;
48
+ smartOutlet;
48
49
  coverLift;
49
50
  coverLiftTilt;
50
51
  lock;
@@ -472,6 +473,37 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
472
473
  this.outletEnergyApparent?.addCommandHandler('off', async () => {
473
474
  this.outletEnergyApparent?.log.info('Command off called');
474
475
  });
476
+ this.smartOutlet = new MatterbridgeEndpoint([bridgedNode, powerSource, electricalSensor], { id: 'SmartOutlet' }, this.config.debug)
477
+ .createDefaultBridgedDeviceBasicInformationClusterServer('Smart outlet', 'SOU00063', 0xfff1, 'Matterbridge', 'Matterbridge Smart Outlet')
478
+ .createDefaultPowerSourceWiredClusterServer()
479
+ .createDefaultElectricalEnergyMeasurementClusterServer(0, 0)
480
+ .createDefaultElectricalPowerMeasurementClusterServer(220_000, 0, 0, 50_000)
481
+ .addRequiredClusterServers();
482
+ this.smartOutlet
483
+ .addChildDeviceTypeWithClusterServer('Socket 1', onOffOutlet, [OnOffCluster.id], {
484
+ id: 'Socket1',
485
+ tagList: [{ mfgCode: null, namespaceId: NumberTag.One.namespaceId, tag: NumberTag.One.tag, label: null }],
486
+ })
487
+ .addRequiredClusterServers();
488
+ this.smartOutlet
489
+ .addChildDeviceTypeWithClusterServer('Socket 2', onOffOutlet, [OnOffCluster.id], {
490
+ id: 'Socket2',
491
+ tagList: [{ mfgCode: null, namespaceId: NumberTag.Two.namespaceId, tag: NumberTag.Two.tag, label: null }],
492
+ })
493
+ .addRequiredClusterServers();
494
+ this.smartOutlet
495
+ .addChildDeviceTypeWithClusterServer('Socket 3', onOffOutlet, [OnOffCluster.id], {
496
+ id: 'Socket3',
497
+ tagList: [{ mfgCode: null, namespaceId: NumberTag.Three.namespaceId, tag: NumberTag.Three.tag, label: null }],
498
+ })
499
+ .addRequiredClusterServers();
500
+ this.smartOutlet
501
+ .addChildDeviceTypeWithClusterServer('Socket 4', onOffOutlet, [OnOffCluster.id], {
502
+ id: 'Socket4',
503
+ tagList: [{ mfgCode: null, namespaceId: NumberTag.Four.namespaceId, tag: NumberTag.Four.tag, label: null }],
504
+ })
505
+ .addRequiredClusterServers();
506
+ this.smartOutlet = await this.addDevice(this.smartOutlet);
475
507
  this.coverLift = new MatterbridgeEndpoint([coverDevice, bridgedNode, powerSource], { id: 'CoverLift' }, this.config.debug)
476
508
  .createDefaultIdentifyClusterServer()
477
509
  .createDefaultGroupsClusterServer()
@@ -1835,6 +1867,14 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
1835
1867
  await this.outletEnergyApparent?.setAttribute(ElectricalPowerMeasurement.Cluster.id, 'apparentPower', 0, this.outletEnergyApparent.log);
1836
1868
  }
1837
1869
  }
1870
+ state = this.smartOutlet?.getChildEndpointById('Socket1')?.getAttribute(OnOff.Cluster.id, 'onOff', this.smartOutlet.log);
1871
+ if (isValidBoolean(state)) {
1872
+ this.smartOutlet?.log.info(`Set smart outlets onOff`);
1873
+ await this.smartOutlet?.getChildEndpointById('Socket1')?.setAttribute(OnOff.Cluster.id, 'onOff', !state, this.smartOutlet.log);
1874
+ await this.smartOutlet?.getChildEndpointById('Socket2')?.setAttribute(OnOff.Cluster.id, 'onOff', state, this.smartOutlet.log);
1875
+ await this.smartOutlet?.getChildEndpointById('Socket3')?.setAttribute(OnOff.Cluster.id, 'onOff', !state, this.smartOutlet.log);
1876
+ await this.smartOutlet?.getChildEndpointById('Socket4')?.setAttribute(OnOff.Cluster.id, 'onOff', state, this.smartOutlet.log);
1877
+ }
1838
1878
  }, 60 * 1000 + 300);
1839
1879
  }
1840
1880
  await this.coverLift?.setWindowCoveringTargetAsCurrentAndStopped();
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-example-dynamic-platform",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge-example-dynamic-platform",
9
- "version": "2.0.6",
9
+ "version": "2.0.7",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "node-ansi-logger": "3.1.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge-example-dynamic-platform",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Matterbridge dynamic plugin",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",