matterbridge-example-dynamic-platform 1.3.0 → 1.3.1-dev-20250702-0cbab25
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 +16 -0
- package/README.md +4 -1
- package/dist/platform.js +49 -25
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -23,6 +23,22 @@ If you like this project and find it useful, please consider giving it a star on
|
|
23
23
|
<img src="bmc-button.svg" alt="Buy me a coffee" width="120">
|
24
24
|
</a>
|
25
25
|
|
26
|
+
## [1.3.1] - 2025-06-??
|
27
|
+
|
28
|
+
### Added
|
29
|
+
|
30
|
+
- [platform]: Added solarPower device type (not supported by the Home app).
|
31
|
+
- [platform]: Added batteryStoraga device type (not supported by the Home app).
|
32
|
+
|
33
|
+
### Changed
|
34
|
+
|
35
|
+
- [platform]: Changed imports from matterbridge/devices.
|
36
|
+
- [package]: Require matterbridge 3.1.1.
|
37
|
+
|
38
|
+
<a href="https://www.buymeacoffee.com/luligugithub">
|
39
|
+
<img src="bmc-button.svg" alt="Buy me a coffee" width="80">
|
40
|
+
</a>
|
41
|
+
|
26
42
|
## [1.3.0] - 2025-06-25
|
27
43
|
|
28
44
|
### Added
|
package/README.md
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
Matterbridge dynamic platform example plugin is a template to develop your own plugin using the dynamic platform.
|
19
19
|
|
20
|
-
It exposes
|
20
|
+
It exposes 44 virtual devices:
|
21
21
|
|
22
22
|
- a switch with onOff cluster
|
23
23
|
- a light with onOff
|
@@ -61,6 +61,9 @@ It exposes 41 virtual devices:
|
|
61
61
|
- a cooktop device (supported by SmartThings, Alexa and Home Assistant)
|
62
62
|
- a water heater device (supported by SmartThings and Home Assistant)
|
63
63
|
- a car charger device (supported by Home Assistant)
|
64
|
+
- a solar power device
|
65
|
+
- a battery storage device
|
66
|
+
- a heat pump device
|
64
67
|
|
65
68
|
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.
|
66
69
|
|
package/dist/platform.js
CHANGED
@@ -1,4 +1,5 @@
|
|
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,
|
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, cooktop, extractorHood, microwaveOven, oven, refrigerator, dishwasher, onOffMountedSwitch, dimmableMountedSwitch, extendedColorLight, HeatPump, } from 'matterbridge';
|
2
|
+
import { RoboticVacuumCleaner, LaundryWasher, WaterHeater, Evse, SolarPower, BatteryStorage, LaundryDryer } from 'matterbridge/devices';
|
2
3
|
import { isValidBoolean, isValidNumber } from 'matterbridge/utils';
|
3
4
|
import { LocationTag, NumberTag, PositionTag } from 'matterbridge/matter';
|
4
5
|
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';
|
@@ -37,6 +38,11 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
37
38
|
vacuum;
|
38
39
|
waterHeater;
|
39
40
|
evse;
|
41
|
+
laundryWasher;
|
42
|
+
laundryDryer;
|
43
|
+
solarPower;
|
44
|
+
batteryStorage;
|
45
|
+
heatPump;
|
40
46
|
switchInterval;
|
41
47
|
lightInterval;
|
42
48
|
outletInterval;
|
@@ -59,8 +65,8 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
59
65
|
fanModeLookup = ['Off', 'Low', 'Medium', 'High', 'On', 'Auto', 'Smart'];
|
60
66
|
constructor(matterbridge, log, config) {
|
61
67
|
super(matterbridge, log, config);
|
62
|
-
if (this.verifyMatterbridgeVersion === undefined || typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.
|
63
|
-
throw new Error(`This plugin requires Matterbridge version >= "3.
|
68
|
+
if (this.verifyMatterbridgeVersion === undefined || typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.1.1')) {
|
69
|
+
throw new Error(`This plugin requires Matterbridge version >= "3.1.1". Please update Matterbridge from ${this.matterbridge.matterbridgeVersion} to the latest version in the frontend.`);
|
64
70
|
}
|
65
71
|
this.log.info('Initializing platform:', this.config.name);
|
66
72
|
if (config.whiteList === undefined)
|
@@ -992,75 +998,93 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
992
998
|
this.latchingSwitch = undefined;
|
993
999
|
}
|
994
1000
|
if (this.config.enableRVC === true) {
|
995
|
-
const robot = new RoboticVacuumCleaner('Robot Vacuum', '
|
1001
|
+
const robot = new RoboticVacuumCleaner('Robot Vacuum', 'RVC1238777820');
|
996
1002
|
this.setSelectDevice(robot.serialNumber ?? '', robot.deviceName ?? '', undefined, 'hub');
|
997
1003
|
if (this.validateDevice(robot.deviceName ?? '')) {
|
998
1004
|
await this.registerDevice(robot);
|
999
1005
|
this.bridgedDevices.set(robot.deviceName ?? '', robot);
|
1000
1006
|
}
|
1001
1007
|
}
|
1002
|
-
this.waterHeater = new WaterHeater('Water Heater', '
|
1008
|
+
this.waterHeater = new WaterHeater('Water Heater', 'WH3456177820', 50, 60, 20, 80, undefined, 85, 220_000, 1_000, 220_000, 12_000_000, 500_000, 3_000_000);
|
1003
1009
|
this.setSelectDevice(this.waterHeater.serialNumber ?? '', this.waterHeater.deviceName ?? '', undefined, 'hub');
|
1004
1010
|
if (this.validateDevice(this.waterHeater.deviceName ?? '')) {
|
1005
1011
|
await this.registerDevice(this.waterHeater);
|
1006
1012
|
this.bridgedDevices.set(this.waterHeater.deviceName ?? '', this.waterHeater);
|
1007
1013
|
}
|
1008
|
-
this.evse = new Evse('Evse', '
|
1014
|
+
this.evse = new Evse('Evse', 'EV3456127820', 1, [
|
1009
1015
|
{ label: 'On demand', mode: 1, modeTags: [{ value: EnergyEvseMode.ModeTag.Manual }] },
|
1010
1016
|
{ label: 'Scheduled', mode: 2, modeTags: [{ value: EnergyEvseMode.ModeTag.TimeOfUse }] },
|
1011
1017
|
{ label: 'Solar Charging', mode: 3, modeTags: [{ value: EnergyEvseMode.ModeTag.SolarCharging }] },
|
1012
1018
|
{ label: 'Solar Charging Scheduled', mode: 4, modeTags: [{ value: EnergyEvseMode.ModeTag.SolarCharging }, { value: EnergyEvseMode.ModeTag.TimeOfUse }] },
|
1013
|
-
], EnergyEvse.State.
|
1019
|
+
], EnergyEvse.State.PluggedInCharging, EnergyEvse.SupplyState.ChargingEnabled, EnergyEvse.FaultState.NoError, 220_000, 10_000, 2_200_000, 1_000_000, 500_000, 32_000_000);
|
1014
1020
|
this.setSelectDevice(this.evse.serialNumber ?? '', this.evse.deviceName ?? '', undefined, 'hub');
|
1015
1021
|
if (this.validateDevice(this.evse.deviceName ?? '')) {
|
1016
1022
|
await this.registerDevice(this.evse);
|
1017
1023
|
this.bridgedDevices.set(this.evse.deviceName ?? '', this.evse);
|
1018
1024
|
}
|
1019
|
-
|
1020
|
-
this.setSelectDevice(
|
1021
|
-
if (this.validateDevice(
|
1022
|
-
await this.registerDevice(
|
1023
|
-
this.bridgedDevices.set(
|
1024
|
-
}
|
1025
|
-
|
1026
|
-
this.setSelectDevice(
|
1027
|
-
if (this.validateDevice(
|
1028
|
-
await this.registerDevice(
|
1029
|
-
this.bridgedDevices.set(
|
1030
|
-
}
|
1031
|
-
|
1025
|
+
this.solarPower = new SolarPower('Solar Power', 'SP3456127821', 220_000, 10_000, 2200_000, 2_200_000, -10_000_000, 500_000);
|
1026
|
+
this.setSelectDevice(this.solarPower.serialNumber ?? '', this.solarPower.deviceName ?? '', undefined, 'hub');
|
1027
|
+
if (this.validateDevice(this.solarPower.deviceName ?? '')) {
|
1028
|
+
await this.registerDevice(this.solarPower);
|
1029
|
+
this.bridgedDevices.set(this.solarPower.deviceName ?? '', this.solarPower);
|
1030
|
+
}
|
1031
|
+
this.batteryStorage = new BatteryStorage('Battery Storage', 'BS3456127822', 75, PowerSource.BatChargeLevel.Ok, 220_000, 10_000, 2_200_000, 1_000_000, 2_000_000, -2_000_000, 3_000_000);
|
1032
|
+
this.setSelectDevice(this.batteryStorage.serialNumber ?? '', this.batteryStorage.deviceName ?? '', undefined, 'hub');
|
1033
|
+
if (this.validateDevice(this.batteryStorage.deviceName ?? '')) {
|
1034
|
+
await this.registerDevice(this.batteryStorage);
|
1035
|
+
this.bridgedDevices.set(this.batteryStorage.deviceName ?? '', this.batteryStorage);
|
1036
|
+
}
|
1037
|
+
this.heatPump = new HeatPump('Heat Pump', 'HP1234567890', 220_000, 10_000, 2_200_000, 1_000_000, 500_000, 3_000_000);
|
1038
|
+
this.setSelectDevice(this.heatPump.serialNumber ?? '', this.heatPump.deviceName ?? '', undefined, 'hub');
|
1039
|
+
if (this.validateDevice(this.heatPump.deviceName ?? '')) {
|
1040
|
+
await this.registerDevice(this.heatPump);
|
1041
|
+
this.bridgedDevices.set(this.heatPump.deviceName ?? '', this.heatPump);
|
1042
|
+
}
|
1043
|
+
this.laundryWasher = new LaundryWasher('Laundry Washer', 'LW1234567890');
|
1044
|
+
this.setSelectDevice(this.laundryWasher.serialNumber ?? '', this.laundryWasher.deviceName ?? '', undefined, 'hub');
|
1045
|
+
if (this.validateDevice(this.laundryWasher.deviceName ?? '')) {
|
1046
|
+
await this.registerDevice(this.laundryWasher);
|
1047
|
+
this.bridgedDevices.set(this.laundryWasher.deviceName ?? '', this.laundryWasher);
|
1048
|
+
}
|
1049
|
+
this.laundryDryer = new LaundryDryer('Laundry Dryer', 'LDW1235227890');
|
1050
|
+
this.setSelectDevice(this.laundryDryer.serialNumber ?? '', this.laundryDryer.deviceName ?? '', undefined, 'hub');
|
1051
|
+
if (this.validateDevice(this.laundryDryer.deviceName ?? '')) {
|
1052
|
+
await this.registerDevice(this.laundryDryer);
|
1053
|
+
this.bridgedDevices.set(this.laundryDryer.deviceName ?? '', this.laundryDryer);
|
1054
|
+
}
|
1055
|
+
const dishwasherDevice = new Appliances(dishwasher, 'Dishwasher', 'DW0987654321');
|
1032
1056
|
this.setSelectDevice(dishwasherDevice.serialNumber ?? '', dishwasherDevice.deviceName ?? '', undefined, 'hub');
|
1033
1057
|
if (this.validateDevice(dishwasherDevice.deviceName ?? '')) {
|
1034
1058
|
await this.registerDevice(dishwasherDevice);
|
1035
1059
|
this.bridgedDevices.set(dishwasherDevice.deviceName ?? '', dishwasherDevice);
|
1036
1060
|
}
|
1037
|
-
const refrigeratorDevice = new Appliances(refrigerator, 'Refrigerator', '
|
1061
|
+
const refrigeratorDevice = new Appliances(refrigerator, 'Refrigerator', 'RE9987654322');
|
1038
1062
|
refrigeratorDevice.addFixedLabel('composed', 'Refrigerator');
|
1039
1063
|
this.setSelectDevice(refrigeratorDevice.serialNumber ?? '', refrigeratorDevice.deviceName ?? '', undefined, 'hub');
|
1040
1064
|
if (this.validateDevice(refrigeratorDevice.deviceName ?? '')) {
|
1041
1065
|
await this.registerDevice(refrigeratorDevice);
|
1042
1066
|
this.bridgedDevices.set(refrigeratorDevice.deviceName ?? '', refrigeratorDevice);
|
1043
1067
|
}
|
1044
|
-
const ovenDevice = new Appliances(oven, 'Oven', '
|
1068
|
+
const ovenDevice = new Appliances(oven, 'Oven', 'OV1298867891');
|
1045
1069
|
ovenDevice.addFixedLabel('composed', 'Oven');
|
1046
1070
|
this.setSelectDevice(ovenDevice.serialNumber ?? '', ovenDevice.deviceName ?? '', undefined, 'hub');
|
1047
1071
|
if (this.validateDevice(ovenDevice.deviceName ?? '')) {
|
1048
1072
|
await this.registerDevice(ovenDevice);
|
1049
1073
|
this.bridgedDevices.set(ovenDevice.deviceName ?? '', ovenDevice);
|
1050
1074
|
}
|
1051
|
-
const microwaveOvenDevice = new Appliances(microwaveOven, 'Microwave Oven', '
|
1075
|
+
const microwaveOvenDevice = new Appliances(microwaveOven, 'Microwave Oven', 'MO1234567892');
|
1052
1076
|
this.setSelectDevice(microwaveOvenDevice.serialNumber ?? '', microwaveOvenDevice.deviceName ?? '', undefined, 'hub');
|
1053
1077
|
if (this.validateDevice(microwaveOvenDevice.deviceName ?? '')) {
|
1054
1078
|
await this.registerDevice(microwaveOvenDevice);
|
1055
1079
|
this.bridgedDevices.set(microwaveOvenDevice.deviceName ?? '', microwaveOvenDevice);
|
1056
1080
|
}
|
1057
|
-
const extractorHoodDevice = new Appliances(extractorHood, 'Extractor Hood', '
|
1081
|
+
const extractorHoodDevice = new Appliances(extractorHood, 'Extractor Hood', 'EH1234567893');
|
1058
1082
|
this.setSelectDevice(extractorHoodDevice.serialNumber ?? '', extractorHoodDevice.deviceName ?? '', undefined, 'hub');
|
1059
1083
|
if (this.validateDevice(extractorHoodDevice.deviceName ?? '')) {
|
1060
1084
|
await this.registerDevice(extractorHoodDevice);
|
1061
1085
|
this.bridgedDevices.set(extractorHoodDevice.deviceName ?? '', extractorHoodDevice);
|
1062
1086
|
}
|
1063
|
-
const cooktopDevice = new Appliances(cooktop, 'Cooktop', '
|
1087
|
+
const cooktopDevice = new Appliances(cooktop, 'Cooktop', 'CT1255887894');
|
1064
1088
|
this.setSelectDevice(cooktopDevice.serialNumber ?? '', cooktopDevice.deviceName ?? '', undefined, 'hub');
|
1065
1089
|
if (this.validateDevice(cooktopDevice.deviceName ?? '')) {
|
1066
1090
|
await this.registerDevice(cooktopDevice);
|
package/npm-shrinkwrap.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "matterbridge-example-dynamic-platform",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.1-dev-20250702-0cbab25",
|
4
4
|
"lockfileVersion": 3,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "matterbridge-example-dynamic-platform",
|
9
|
-
"version": "1.3.
|
9
|
+
"version": "1.3.1-dev-20250702-0cbab25",
|
10
10
|
"license": "Apache-2.0",
|
11
11
|
"dependencies": {
|
12
12
|
"node-ansi-logger": "3.1.1",
|