matterbridge-example-dynamic-platform 1.2.0 → 1.2.1
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 +13 -1
- package/README.md +1 -1
- package/dist/appliances.js +3 -62
- package/dist/platform.js +17 -23
- package/dist/robot.js +1 -1
- package/matterbridge-example-dynamic-platform.schema.json +1 -6
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -8,11 +8,23 @@ If you like this project and find it useful, please consider giving it a star on
|
|
8
8
|
<img src="bmc-button.svg" alt="Buy me a coffee" width="120">
|
9
9
|
</a>
|
10
10
|
|
11
|
+
## [1.2.1] - 2025-05-15
|
12
|
+
|
13
|
+
### Changed
|
14
|
+
|
15
|
+
- [package]: Require matterbridge 3.0.1.
|
16
|
+
- [package]: Updated package.
|
17
|
+
- [package]: Updated dependencies.
|
18
|
+
|
19
|
+
<a href="https://www.buymeacoffee.com/luligugithub">
|
20
|
+
<img src="bmc-button.svg" alt="Buy me a coffee" width="80">
|
21
|
+
</a>
|
22
|
+
|
11
23
|
## [1.2.0] - 2025-04-30
|
12
24
|
|
13
25
|
### Added
|
14
26
|
|
15
|
-
- [platform]: Added Robot Vacuum Cleaner device (supported by SmartThings, Alexa, Home Assistant and partially by Apple Home). Read carefully the readme please.
|
27
|
+
- [platform]: Added Robot Vacuum Cleaner device (supported by SmartThings, Alexa, Home Assistant and partially by Apple Home). Read carefully the readme please and also https://github.com/Luligu/matterbridge/discussions/264.
|
16
28
|
- [platform]: Added OnOff Mounted Switch device (supported by SmartThings, Alexa, Home Assistant).
|
17
29
|
- [platform]: Added Dimmer Mounted Switch device (supported by SmartThings, Alexa, Home Assistant).
|
18
30
|
- [platform]: Added Laundry Washer device (supported by SmartThings, Alexa and Home Assistant).
|
package/README.md
CHANGED
@@ -43,7 +43,7 @@ It exposes 38 devices:
|
|
43
43
|
- an airPurifier device with temperature and humidity sensor (supported by Apple Home)
|
44
44
|
- a pumpDevice device
|
45
45
|
- a waterValve device
|
46
|
-
- an airQuality device with all concentration measurements clusters (supported by Apple Home
|
46
|
+
- an airQuality device with all concentration measurements clusters (supported by Apple Home with the concentration measurements from version 18.5)
|
47
47
|
- a momentary switch
|
48
48
|
- a latching switch
|
49
49
|
- 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.
|
package/dist/appliances.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
import { MatterbridgeEndpoint, MatterbridgeServer, MatterbridgeOnOffServer,
|
2
|
-
import { ClusterBehavior } from 'matterbridge/matter';
|
1
|
+
import { MatterbridgeEndpoint, MatterbridgeServer, MatterbridgeOnOffServer, laundryWasher, laundryDryer, dishwasher, refrigerator, temperatureControlledCabinetCooler, oven, temperatureControlledCabinetHeater, microwaveOven, extractorHood, cooktop, cookSurface, powerSource, } from 'matterbridge';
|
2
|
+
import { ClusterBehavior, PositionTag, RefrigeratorTag } from 'matterbridge/matter';
|
3
3
|
import { OperationalState, TemperatureControl, DishwasherMode, LaundryWasherControls, LaundryWasherMode, LaundryDryerControls, OvenMode, ModeBase, RefrigeratorAndTemperatureControlledCabinetMode, MicrowaveOvenMode, MicrowaveOvenControl, OvenCavityOperationalState, } from 'matterbridge/matter/clusters';
|
4
|
-
import { DishwasherAlarmServer, LaundryDryerControlsServer, LaundryWasherControlsServer, MicrowaveOvenControlBehavior, MicrowaveOvenModeServer,
|
4
|
+
import { DishwasherAlarmServer, LaundryDryerControlsServer, LaundryWasherControlsServer, MicrowaveOvenControlBehavior, MicrowaveOvenModeServer, TemperatureControlBehavior, } from 'matterbridge/matter/behaviors';
|
5
5
|
export class Appliances extends MatterbridgeEndpoint {
|
6
6
|
constructor(deviceType, name, serial) {
|
7
7
|
super([deviceType, powerSource], { uniqueStorageKey: `${name}-${serial}` }, true);
|
@@ -111,21 +111,6 @@ export class Appliances extends MatterbridgeEndpoint {
|
|
111
111
|
});
|
112
112
|
}
|
113
113
|
}
|
114
|
-
createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
115
|
-
this.behaviors.require(MatterbridgeOperationalStateServer, {
|
116
|
-
phaseList: [],
|
117
|
-
currentPhase: null,
|
118
|
-
operationalStateList: [
|
119
|
-
{ operationalStateId: OperationalState.OperationalStateEnum.Stopped, operationalStateLabel: 'Stopped' },
|
120
|
-
{ operationalStateId: OperationalState.OperationalStateEnum.Running, operationalStateLabel: 'Running' },
|
121
|
-
{ operationalStateId: OperationalState.OperationalStateEnum.Paused, operationalStateLabel: 'Paused' },
|
122
|
-
{ operationalStateId: OperationalState.OperationalStateEnum.Error, operationalStateLabel: 'Error' },
|
123
|
-
],
|
124
|
-
operationalState,
|
125
|
-
operationalError: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
126
|
-
});
|
127
|
-
return this;
|
128
|
-
}
|
129
114
|
createDefaultOvenCavityOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
130
115
|
this.behaviors.require(OvenCavityOperationalStateServer, {
|
131
116
|
phaseList: [],
|
@@ -288,50 +273,6 @@ export class Appliances extends MatterbridgeEndpoint {
|
|
288
273
|
return endpoint;
|
289
274
|
}
|
290
275
|
}
|
291
|
-
class MatterbridgeOperationalStateServer extends OperationalStateBehavior {
|
292
|
-
initialize() {
|
293
|
-
const device = this.endpoint.stateOf(MatterbridgeServer).deviceCommand;
|
294
|
-
device.log.info('MatterbridgeOperationalStateServer initialized: setting operational state to Stopped');
|
295
|
-
this.state.operationalState = OperationalState.OperationalStateEnum.Stopped;
|
296
|
-
this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' };
|
297
|
-
}
|
298
|
-
pause() {
|
299
|
-
const device = this.endpoint.stateOf(MatterbridgeServer).deviceCommand;
|
300
|
-
device.log.info('MatterbridgeOperationalStateServer: pause called setting operational state to Paused');
|
301
|
-
this.state.operationalState = OperationalState.OperationalStateEnum.Paused;
|
302
|
-
this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' };
|
303
|
-
return {
|
304
|
-
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
305
|
-
};
|
306
|
-
}
|
307
|
-
stop() {
|
308
|
-
const device = this.endpoint.stateOf(MatterbridgeServer).deviceCommand;
|
309
|
-
device.log.info('MatterbridgeOperationalStateServer: stop called setting operational state to Stopped');
|
310
|
-
this.state.operationalState = OperationalState.OperationalStateEnum.Stopped;
|
311
|
-
this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' };
|
312
|
-
return {
|
313
|
-
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
314
|
-
};
|
315
|
-
}
|
316
|
-
start() {
|
317
|
-
const device = this.endpoint.stateOf(MatterbridgeServer).deviceCommand;
|
318
|
-
device.log.info('MatterbridgeOperationalStateServer: start called setting operational state to Running');
|
319
|
-
this.state.operationalState = OperationalState.OperationalStateEnum.Running;
|
320
|
-
this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' };
|
321
|
-
return {
|
322
|
-
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
323
|
-
};
|
324
|
-
}
|
325
|
-
resume() {
|
326
|
-
const device = this.endpoint.stateOf(MatterbridgeServer).deviceCommand;
|
327
|
-
device.log.info('MatterbridgeOperationalStateServer: resume called setting operational state to Running');
|
328
|
-
this.state.operationalState = OperationalState.OperationalStateEnum.Running;
|
329
|
-
this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' };
|
330
|
-
return {
|
331
|
-
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
332
|
-
};
|
333
|
-
}
|
334
|
-
}
|
335
276
|
class MatterbridgeLevelTemperatureControlServer extends TemperatureControlBehavior.with(TemperatureControl.Feature.TemperatureLevel) {
|
336
277
|
initialize() {
|
337
278
|
if (this.state.supportedTemperatureLevels.length >= 2) {
|
package/dist/platform.js
CHANGED
@@ -57,16 +57,14 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
57
57
|
fanModeLookup = ['Off', 'Low', 'Medium', 'High', 'On', 'Auto', 'Smart'];
|
58
58
|
constructor(matterbridge, log, config) {
|
59
59
|
super(matterbridge, log, config);
|
60
|
-
if (this.verifyMatterbridgeVersion === undefined || typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.0.
|
61
|
-
throw new Error(`This plugin requires Matterbridge version >= "3.0.
|
60
|
+
if (this.verifyMatterbridgeVersion === undefined || typeof this.verifyMatterbridgeVersion !== 'function' || !this.verifyMatterbridgeVersion('3.0.1')) {
|
61
|
+
throw new Error(`This plugin requires Matterbridge version >= "3.0.1". Please update Matterbridge from ${this.matterbridge.matterbridgeVersion} to the latest version in the frontend.`);
|
62
62
|
}
|
63
63
|
this.log.info('Initializing platform:', this.config.name);
|
64
64
|
if (config.whiteList === undefined)
|
65
65
|
config.whiteList = [];
|
66
66
|
if (config.blackList === undefined)
|
67
67
|
config.blackList = [];
|
68
|
-
if (config.enableConcentrationMeasurements === undefined)
|
69
|
-
config.enableConcentrationMeasurements = false;
|
70
68
|
if (config.enableRVC === undefined)
|
71
69
|
config.enableRVC = false;
|
72
70
|
}
|
@@ -837,9 +835,8 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
837
835
|
.createDefaultBridgedDeviceBasicInformationClusterServer('SmokeCo alarm sensor', 'serial_94745631225', 0xfff1, 'Matterbridge', 'Matterbridge SmokeCoAlarm', parseInt(this.version.replace(/\D/g, '')), this.version === '' ? 'Unknown' : this.version, parseInt(this.matterbridge.matterbridgeVersion.replace(/\D/g, '')), this.matterbridge.matterbridgeVersion)
|
838
836
|
.createDefaultIdentifyClusterServer()
|
839
837
|
.createDefaultSmokeCOAlarmClusterServer(SmokeCoAlarm.AlarmState.Normal, SmokeCoAlarm.AlarmState.Normal)
|
840
|
-
.createDefaultPowerSourceReplaceableBatteryClusterServer()
|
841
|
-
|
842
|
-
this.smokeCo.createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(100);
|
838
|
+
.createDefaultPowerSourceReplaceableBatteryClusterServer()
|
839
|
+
.createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(100);
|
843
840
|
this.setSelectDevice(this.smokeCo.serialNumber ?? '', this.smokeCo.deviceName ?? '', undefined, 'hub');
|
844
841
|
if (this.validateDevice(this.smokeCo.deviceName ?? '')) {
|
845
842
|
await this.registerDevice(this.smokeCo);
|
@@ -865,9 +862,8 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
865
862
|
.createDefaultBridgedDeviceBasicInformationClusterServer('Co alarm sensor', 'serial_947456317488', 0xfff1, 'Matterbridge', 'Matterbridge SmokeCoAlarm', parseInt(this.version.replace(/\D/g, '')), this.version === '' ? 'Unknown' : this.version, parseInt(this.matterbridge.matterbridgeVersion.replace(/\D/g, '')), this.matterbridge.matterbridgeVersion)
|
866
863
|
.createDefaultIdentifyClusterServer()
|
867
864
|
.createCoOnlySmokeCOAlarmClusterServer(SmokeCoAlarm.AlarmState.Normal)
|
868
|
-
.createDefaultPowerSourceReplaceableBatteryClusterServer()
|
869
|
-
|
870
|
-
this.coOnly.createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(100);
|
865
|
+
.createDefaultPowerSourceReplaceableBatteryClusterServer()
|
866
|
+
.createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(100);
|
871
867
|
this.setSelectDevice(this.coOnly.serialNumber ?? '', this.coOnly.deviceName ?? '', undefined, 'hub');
|
872
868
|
if (this.validateDevice(this.coOnly.deviceName ?? '')) {
|
873
869
|
await this.registerDevice(this.coOnly);
|
@@ -880,19 +876,17 @@ export class ExampleMatterbridgeDynamicPlatform extends MatterbridgeDynamicPlatf
|
|
880
876
|
.createDefaultBridgedDeviceBasicInformationClusterServer('Air quality sensor', 'serial_987484318322', 0xfff1, 'Matterbridge', 'Matterbridge Air Quality Sensor', parseInt(this.version.replace(/\D/g, '')), this.version === '' ? 'Unknown' : this.version, parseInt(this.matterbridge.matterbridgeVersion.replace(/\D/g, '')), this.matterbridge.matterbridgeVersion)
|
881
877
|
.createDefaultPowerSourceReplaceableBatteryClusterServer(50, PowerSource.BatChargeLevel.Warning, 2900, 'CR2450', 1)
|
882
878
|
.addRequiredClusterServers()
|
883
|
-
.addClusterServers([TemperatureMeasurement.Cluster.id, RelativeHumidityMeasurement.Cluster.id])
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
this.airQuality.createDefaultTvocMeasurementClusterServer(100);
|
895
|
-
}
|
879
|
+
.addClusterServers([TemperatureMeasurement.Cluster.id, RelativeHumidityMeasurement.Cluster.id])
|
880
|
+
.createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(10)
|
881
|
+
.createDefaultCarbonDioxideConcentrationMeasurementClusterServer(400)
|
882
|
+
.createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(1)
|
883
|
+
.createDefaultOzoneConcentrationMeasurementClusterServer(1)
|
884
|
+
.createDefaultFormaldehydeConcentrationMeasurementClusterServer(1)
|
885
|
+
.createDefaultPm1ConcentrationMeasurementClusterServer(100)
|
886
|
+
.createDefaultPm25ConcentrationMeasurementClusterServer(100)
|
887
|
+
.createDefaultPm10ConcentrationMeasurementClusterServer(100)
|
888
|
+
.createDefaultRadonConcentrationMeasurementClusterServer(100)
|
889
|
+
.createDefaultTvocMeasurementClusterServer(100);
|
896
890
|
this.setSelectDevice(this.airQuality.serialNumber ?? '', this.airQuality.deviceName ?? '', undefined, 'hub');
|
897
891
|
if (this.validateDevice(this.airQuality.deviceName ?? '')) {
|
898
892
|
await this.registerDevice(this.airQuality);
|
package/dist/robot.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Matterbridge, MatterbridgeServer, MatterbridgeEndpoint, roboticVacuumCleaner, dishwasher } from 'matterbridge';
|
2
|
-
import { LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, DeviceTypeId, VendorId
|
2
|
+
import { LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, DeviceTypeId, VendorId } from 'matterbridge/matter';
|
3
3
|
import { ModeBase, OperationalState, PowerSource, RvcRunMode, RvcCleanMode, RvcOperationalState, ServiceArea } from 'matterbridge/matter/clusters';
|
4
4
|
import { ActionsServer, RvcCleanModeBehavior, RvcOperationalStateBehavior, RvcRunModeBehavior, ServiceAreaBehavior } from 'matterbridge/matter/behaviors';
|
5
5
|
import { AnsiLogger } from 'matterbridge/logger';
|
@@ -39,13 +39,8 @@
|
|
39
39
|
"type": "boolean",
|
40
40
|
"default": true
|
41
41
|
},
|
42
|
-
"enableConcentrationMeasurements": {
|
43
|
-
"description": "Enable the ConcentrationMeasurements in the Air Quality device and SmokeCoSensor device (Apple Home 18.4 will discard these devices when enabled)",
|
44
|
-
"type": "boolean",
|
45
|
-
"default": false
|
46
|
-
},
|
47
42
|
"enableRVC": {
|
48
|
-
"description": "Enable the Robot Vacuum Cleaner (Apple Home
|
43
|
+
"description": "Enable the Robot Vacuum Cleaner (Apple Home will crash unless you use child bridge and put the rvc in the white list as a single device)",
|
49
44
|
"type": "boolean",
|
50
45
|
"default": false
|
51
46
|
},
|
package/npm-shrinkwrap.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "matterbridge-example-dynamic-platform",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.1",
|
4
4
|
"lockfileVersion": 3,
|
5
5
|
"requires": true,
|
6
6
|
"packages": {
|
7
7
|
"": {
|
8
8
|
"name": "matterbridge-example-dynamic-platform",
|
9
|
-
"version": "1.2.
|
9
|
+
"version": "1.2.1",
|
10
10
|
"license": "MIT",
|
11
11
|
"dependencies": {
|
12
12
|
"node-ansi-logger": "3.0.1",
|