matterbridge-example-dynamic-platform 1.2.4 → 1.2.5-dev-20250624-3a67316
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 +1 -1
- package/README.md +3 -2
- package/dist/platform.js +41 -9
- package/npm-shrinkwrap.json +17 -16
- package/package.json +5 -5
- package/yellow-button.png +0 -0
- package/tsconfig.jest.json +0 -8
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
@@ -5,7 +5,8 @@
|
|
5
5
|
[](https://hub.docker.com/r/luligu/matterbridge)
|
6
6
|
[](https://hub.docker.com/r/luligu/matterbridge)
|
7
7
|

|
8
|
-

|
9
|
+
[](https://codecov.io/gh/Luligu/matterbridge-example-dynamic-platformr)
|
9
10
|
|
10
11
|
[](https://www.npmjs.com/package/matterbridge)
|
11
12
|
[](https://www.npmjs.com/package/matter-history)
|
@@ -45,7 +46,7 @@ It exposes 41 virtual devices:
|
|
45
46
|
- a pumpDevice device
|
46
47
|
- a waterValve device
|
47
48
|
- an airQuality device with all concentration measurements clusters (supported by Apple Home with the concentration measurements from version 18.5)
|
48
|
-
- a momentary switch
|
49
|
+
- a momentary switch composed by three switches (tagged with One Two Three and Top Middle Bottom)
|
49
50
|
- a latching switch
|
50
51
|
- 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.
|
51
52
|
- a onOff Mounted Switch device (supported by SmartThings, Alexa, Home Assistant)
|
package/dist/platform.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { MatterbridgeEndpoint, MatterbridgeDynamicPlatform, airQualitySensor, bridgedNode, colorTemperatureLight, coverDevice, dimmableLight, doorLockDevice, fanDevice, flowSensor, humiditySensor, onOffLight, onOffOutlet, onOffSwitch, powerSource, rainSensor, smokeCoAlarm, temperatureSensor, thermostatDevice, waterFreezeDetector, waterLeakDetector, airPurifier, pumpDevice, waterValve, genericSwitch, airConditioner, laundryWasher, cooktop, extractorHood, microwaveOven, oven, refrigerator, dishwasher, laundryDryer, onOffMountedSwitch, dimmableMountedSwitch, extendedColorLight, RoboticVacuumCleaner, WaterHeater, Evse, } from 'matterbridge';
|
2
2
|
import { isValidBoolean, isValidNumber } from 'matterbridge/utils';
|
3
|
-
import { LocationTag } from 'matterbridge/matter';
|
4
|
-
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, } from 'matterbridge/matter/clusters';
|
3
|
+
import { LocationTag, NumberTag, PositionTag } from 'matterbridge/matter';
|
4
|
+
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, } from 'matterbridge/matter/clusters';
|
5
5
|
import { Appliances } from './appliances.js';
|
6
6
|
export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatform {
|
7
7
|
switch;
|
@@ -939,11 +939,37 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
939
939
|
else {
|
940
940
|
this.airQuality = undefined;
|
941
941
|
}
|
942
|
-
this.momentarySwitch = new MatterbridgeEndpoint([
|
943
|
-
.createDefaultBridgedDeviceBasicInformationClusterServer('Momentary switch', 'serial_947942331225', 0xfff1, 'Matterbridge', 'Matterbridge MomentarySwitch', parseInt(this.version.replace(/\D/g, '')), this.version === '' ? 'Unknown' : this.version, parseInt(this.matterbridge.matterbridgeVersion.replace(/\D/g, '')), this.matterbridge.matterbridgeVersion)
|
942
|
+
this.momentarySwitch = new MatterbridgeEndpoint([bridgedNode, powerSource], { uniqueStorageKey: 'Momentary switch composed' }, this.config.debug)
|
943
|
+
.createDefaultBridgedDeviceBasicInformationClusterServer('Momentary switch (Top-1 Middle-2 Bottom-3)', 'serial_947942331225', 0xfff1, 'Matterbridge', 'Matterbridge MomentarySwitch', parseInt(this.version.replace(/\D/g, '')), this.version === '' ? 'Unknown' : this.version, parseInt(this.matterbridge.matterbridgeVersion.replace(/\D/g, '')), this.matterbridge.matterbridgeVersion)
|
944
944
|
.createDefaultIdentifyClusterServer()
|
945
|
-
.createDefaultSwitchClusterServer()
|
946
945
|
.createDefaultPowerSourceReplaceableBatteryClusterServer(50, PowerSource.BatChargeLevel.Ok, 2900, 'CR2450', 1);
|
946
|
+
this.momentarySwitch
|
947
|
+
.addChildDeviceType('Momentary switch 1', [genericSwitch], {
|
948
|
+
tagList: [
|
949
|
+
{ mfgCode: null, namespaceId: NumberTag.One.namespaceId, tag: NumberTag.One.tag, label: null },
|
950
|
+
{ mfgCode: null, namespaceId: PositionTag.Top.namespaceId, tag: PositionTag.Top.tag, label: null },
|
951
|
+
],
|
952
|
+
})
|
953
|
+
.createDefaultIdentifyClusterServer()
|
954
|
+
.createDefaultSwitchClusterServer();
|
955
|
+
this.momentarySwitch
|
956
|
+
.addChildDeviceType('Momentary switch 2', [genericSwitch], {
|
957
|
+
tagList: [
|
958
|
+
{ mfgCode: null, namespaceId: NumberTag.Two.namespaceId, tag: NumberTag.Two.tag, label: null },
|
959
|
+
{ mfgCode: null, namespaceId: PositionTag.Middle.namespaceId, tag: PositionTag.Middle.tag, label: null },
|
960
|
+
],
|
961
|
+
})
|
962
|
+
.createDefaultIdentifyClusterServer()
|
963
|
+
.createDefaultSwitchClusterServer();
|
964
|
+
this.momentarySwitch
|
965
|
+
.addChildDeviceType('Momentary switch 3', [genericSwitch], {
|
966
|
+
tagList: [
|
967
|
+
{ mfgCode: null, namespaceId: NumberTag.Three.namespaceId, tag: NumberTag.Three.tag, label: null },
|
968
|
+
{ mfgCode: null, namespaceId: PositionTag.Bottom.namespaceId, tag: PositionTag.Bottom.tag, label: null },
|
969
|
+
],
|
970
|
+
})
|
971
|
+
.createDefaultIdentifyClusterServer()
|
972
|
+
.createDefaultSwitchClusterServer();
|
947
973
|
this.setSelectDevice(this.momentarySwitch.serialNumber ?? '', this.momentarySwitch.deviceName ?? '', undefined, 'hub');
|
948
974
|
if (this.validateDevice(this.momentarySwitch.deviceName ?? '')) {
|
949
975
|
await this.registerDevice(this.momentarySwitch);
|
@@ -984,7 +1010,7 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
984
1010
|
{ label: 'Scheduled', mode: 2, modeTags: [{ value: EnergyEvseMode.ModeTag.TimeOfUse }] },
|
985
1011
|
{ label: 'Solar Charging', mode: 3, modeTags: [{ value: EnergyEvseMode.ModeTag.SolarCharging }] },
|
986
1012
|
{ label: 'Solar Charging Scheduled', mode: 4, modeTags: [{ value: EnergyEvseMode.ModeTag.SolarCharging }, { value: EnergyEvseMode.ModeTag.TimeOfUse }] },
|
987
|
-
]);
|
1013
|
+
], EnergyEvse.State.PluggedInDemand, EnergyEvse.SupplyState.ChargingEnabled, EnergyEvse.FaultState.NoError, 8_000, 32_000);
|
988
1014
|
this.setSelectDevice(this.evse.serialNumber ?? '', this.evse.deviceName ?? '', undefined, 'hub');
|
989
1015
|
if (this.validateDevice(this.evse.deviceName ?? '')) {
|
990
1016
|
await this.registerDevice(this.evse);
|
@@ -1329,15 +1355,21 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
1329
1355
|
this.genericSwitchInterval = setInterval(async () => {
|
1330
1356
|
if (this.genericSwitchLastEvent === 'Release') {
|
1331
1357
|
this.genericSwitchLastEvent = 'Single';
|
1332
|
-
await this.momentarySwitch?.triggerSwitchEvent('Single', this.momentarySwitch?.log);
|
1358
|
+
await this.momentarySwitch?.getChildEndpointByName('Momentaryswitch1')?.triggerSwitchEvent('Single', this.momentarySwitch?.log);
|
1359
|
+
await this.momentarySwitch?.getChildEndpointByName('Momentaryswitch2')?.triggerSwitchEvent('Double', this.momentarySwitch?.log);
|
1360
|
+
await this.momentarySwitch?.getChildEndpointByName('Momentaryswitch3')?.triggerSwitchEvent('Long', this.momentarySwitch?.log);
|
1333
1361
|
}
|
1334
1362
|
else if (this.genericSwitchLastEvent === 'Single') {
|
1335
1363
|
this.genericSwitchLastEvent = 'Double';
|
1336
|
-
await this.momentarySwitch?.triggerSwitchEvent('Double', this.momentarySwitch?.log);
|
1364
|
+
await this.momentarySwitch?.getChildEndpointByName('Momentaryswitch1')?.triggerSwitchEvent('Double', this.momentarySwitch?.log);
|
1365
|
+
await this.momentarySwitch?.getChildEndpointByName('Momentaryswitch2')?.triggerSwitchEvent('Long', this.momentarySwitch?.log);
|
1366
|
+
await this.momentarySwitch?.getChildEndpointByName('Momentaryswitch3')?.triggerSwitchEvent('Single', this.momentarySwitch?.log);
|
1337
1367
|
}
|
1338
1368
|
else if (this.genericSwitchLastEvent === 'Double') {
|
1339
1369
|
this.genericSwitchLastEvent = 'Long';
|
1340
|
-
await this.momentarySwitch?.triggerSwitchEvent('Long', this.momentarySwitch?.log);
|
1370
|
+
await this.momentarySwitch?.getChildEndpointByName('Momentaryswitch1')?.triggerSwitchEvent('Long', this.momentarySwitch?.log);
|
1371
|
+
await this.momentarySwitch?.getChildEndpointByName('Momentaryswitch2')?.triggerSwitchEvent('Single', this.momentarySwitch?.log);
|
1372
|
+
await this.momentarySwitch?.getChildEndpointByName('Momentaryswitch3')?.triggerSwitchEvent('Double', this.momentarySwitch?.log);
|
1341
1373
|
}
|
1342
1374
|
else if (this.genericSwitchLastEvent === 'Long') {
|
1343
1375
|
this.genericSwitchLastEvent = 'Press';
|
package/npm-shrinkwrap.json
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
{
|
2
2
|
"name": "matterbridge-example-dynamic-platform",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.5-dev-20250624-3a67316",
|
4
4
|
"lockfileVersion": 3,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "matterbridge-example-dynamic-platform",
|
9
|
-
"version": "1.2.
|
10
|
-
"license": "
|
9
|
+
"version": "1.2.5-dev-20250624-3a67316",
|
10
|
+
"license": "Apache-2.0",
|
11
11
|
"dependencies": {
|
12
|
-
"node-ansi-logger": "3.
|
13
|
-
"node-persist-manager": "
|
12
|
+
"node-ansi-logger": "^3.1.1",
|
13
|
+
"node-persist-manager": "^2.0.0"
|
14
14
|
},
|
15
15
|
"engines": {
|
16
|
-
"node": ">=18.0.0 <19.0.0 || >=20.0.0 <21.0.0 || >=22.0.0"
|
16
|
+
"node": ">=18.0.0 <19.0.0 || >=20.0.0 <21.0.0 || >=22.0.0 <23.0.0 || >=24.0.0 <25.0.0"
|
17
17
|
},
|
18
18
|
"funding": {
|
19
19
|
"type": "buymeacoffee",
|
@@ -21,12 +21,13 @@
|
|
21
21
|
}
|
22
22
|
},
|
23
23
|
"node_modules/node-ansi-logger": {
|
24
|
-
"version": "3.
|
25
|
-
"resolved": "https://registry.npmjs.org/node-ansi-logger/-/node-ansi-logger-3.
|
26
|
-
"integrity": "sha512-
|
27
|
-
"
|
24
|
+
"version": "3.1.1",
|
25
|
+
"resolved": "https://registry.npmjs.org/node-ansi-logger/-/node-ansi-logger-3.1.1.tgz",
|
26
|
+
"integrity": "sha512-tFeCSxwiRg5XaNda5nC27alzraZP76nLtUk1JDZqb9byhW4WYaSGL7/lmxFHEI16gypQDMEYljuF+wcG+cPPHw==",
|
27
|
+
"hasShrinkwrap": true,
|
28
|
+
"license": "Apache-2.0",
|
28
29
|
"engines": {
|
29
|
-
"node": ">=18.0.0"
|
30
|
+
"node": ">=18.0.0 <19.0.0 || >=20.0.0 <21.0.0 || >=22.0.0 <23.0.0 || >=24.0.0 <25.0.0"
|
30
31
|
},
|
31
32
|
"funding": {
|
32
33
|
"type": "buymeacoffee",
|
@@ -46,15 +47,15 @@
|
|
46
47
|
}
|
47
48
|
},
|
48
49
|
"node_modules/node-persist-manager": {
|
49
|
-
"version": "
|
50
|
-
"resolved": "https://registry.npmjs.org/node-persist-manager/-/node-persist-manager-
|
51
|
-
"integrity": "sha512-
|
50
|
+
"version": "2.0.0",
|
51
|
+
"resolved": "https://registry.npmjs.org/node-persist-manager/-/node-persist-manager-2.0.0.tgz",
|
52
|
+
"integrity": "sha512-jpgOqCCn4ZEnIr4WcvqkyyGmmLJarV6aUyBlDQdG1G84X9UUmOmI1W2OZtc9K0z375CYWhjtGEXaY7GXNiEOfA==",
|
52
53
|
"license": "MIT",
|
53
54
|
"dependencies": {
|
54
|
-
"node-persist": "
|
55
|
+
"node-persist": "4.0.4"
|
55
56
|
},
|
56
57
|
"engines": {
|
57
|
-
"node": ">=18.0.0"
|
58
|
+
"node": ">=18.0.0 <19.0.0 || >=20.0.0 <21.0.0 || >=22.0.0 <23.0.0 || >=24.0.0 <25.0.0"
|
58
59
|
},
|
59
60
|
"funding": {
|
60
61
|
"type": "buymeacoffee",
|
package/package.json
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
{
|
2
2
|
"name": "matterbridge-example-dynamic-platform",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.5-dev-20250624-3a67316",
|
4
4
|
"description": "Matterbridge dynamic plugin",
|
5
5
|
"author": "https://github.com/Luligu",
|
6
|
-
"license": "
|
6
|
+
"license": "Apache-2.0",
|
7
7
|
"homepage": "https://www.npmjs.com/package/matterbridge-example-dynamic-platform",
|
8
8
|
"type": "module",
|
9
9
|
"main": "dist/index.js",
|
@@ -31,10 +31,10 @@
|
|
31
31
|
"virtual devices"
|
32
32
|
],
|
33
33
|
"engines": {
|
34
|
-
"node": ">=18.0.0 <19.0.0 || >=20.0.0 <21.0.0 || >=22.0.0"
|
34
|
+
"node": ">=18.0.0 <19.0.0 || >=20.0.0 <21.0.0 || >=22.0.0 <23.0.0 || >=24.0.0 <25.0.0"
|
35
35
|
},
|
36
36
|
"dependencies": {
|
37
|
-
"node-ansi-logger": "3.
|
38
|
-
"node-persist-manager": "
|
37
|
+
"node-ansi-logger": "^3.1.1",
|
38
|
+
"node-persist-manager": "^2.0.0"
|
39
39
|
}
|
40
40
|
}
|
Binary file
|