matterbridge-example-dynamic-platform 1.2.0-edge.7 → 1.2.0-edge.9

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
@@ -8,12 +8,12 @@ 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.0] - 2025-04-08
11
+ ## [1.2.0] - 2025-04-??
12
12
 
13
13
  ### Added
14
14
 
15
15
  - [platform]: Added Robot Vacuum Cleaner device (supported by SmartThings, Alexa, Home Assistant and Apple Home).
16
- - [platform]: Added Laundry Washer deice (supported by SmartThings, Alexa and Home Assistant).
16
+ - [platform]: Added Laundry Washer device (supported by SmartThings, Alexa and Home Assistant).
17
17
  - [platform]: Added Dishwasher device (supported by SmartThings, Alexa and Home Assistant).
18
18
  - [platform]: Added Temperature Controlled Cabinet Cooler device (supported by SmartThings, Alexa and Home Assistant).
19
19
  - [platform]: Added Temperature Controlled Cabinet Heater device (supported by SmartThings, Alexa and Home Assistant).
@@ -1,10 +1,7 @@
1
- import { DeviceTypeId, Matterbridge, MatterbridgeEndpoint, MatterbridgeServer, MatterbridgeOnOffServer, Status, VendorId, smokeCoAlarm, RefrigeratorTag, PositionTag, laundryWasher, laundryDryer, dishwasher, refrigerator, temperatureControlledCabinetCooler, oven, temperatureControlledCabinetHeater, microwaveOven, extractorHood, cooktop, cookSurface, } from 'matterbridge';
2
- import { ClusterBehavior, LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, EndpointServer, logEndpoint } from 'matterbridge/matter';
3
- import { OperationalState, TemperatureControl, DishwasherMode, LaundryWasherControls, LaundryWasherMode, LaundryDryerControls, OvenMode, RefrigeratorAndTemperatureControlledCabinetMode, MicrowaveOvenMode, MicrowaveOvenControl, } from 'matterbridge/matter/clusters';
1
+ import { MatterbridgeEndpoint, MatterbridgeServer, MatterbridgeOnOffServer, Status, RefrigeratorTag, PositionTag, laundryWasher, laundryDryer, dishwasher, refrigerator, temperatureControlledCabinetCooler, oven, temperatureControlledCabinetHeater, microwaveOven, extractorHood, cooktop, cookSurface, } from 'matterbridge';
2
+ import { ClusterBehavior } from 'matterbridge/matter';
3
+ import { OperationalState, TemperatureControl, DishwasherMode, LaundryWasherControls, LaundryWasherMode, LaundryDryerControls, OvenMode, RefrigeratorAndTemperatureControlledCabinetMode, MicrowaveOvenMode, MicrowaveOvenControl, OvenCavityOperationalState, } from 'matterbridge/matter/clusters';
4
4
  import { DishwasherAlarmServer, LaundryDryerControlsServer, LaundryWasherControlsServer, MicrowaveOvenControlBehavior, MicrowaveOvenModeServer, OperationalStateBehavior, TemperatureControlBehavior, } from 'matterbridge/matter/behaviors';
5
- import { OvenCavityOperationalState } from './implementations/ovenCavityOperationalStateCluster.js';
6
- import { AnsiLogger } from 'matterbridge/logger';
7
- import { Robot } from './robot.js';
8
5
  export class Appliances extends MatterbridgeEndpoint {
9
6
  constructor(deviceType, name, serial) {
10
7
  super(deviceType, { uniqueStorageKey: `${name}-${serial}` }, true);
@@ -514,22 +511,3 @@ class LaundryWasherModeServer extends LaundryWasherModeBehavior {
514
511
  }
515
512
  }
516
513
  }
517
- if (process.argv.includes('-testRobot')) {
518
- const matterbridge = await Matterbridge.loadInstance(false);
519
- matterbridge.log = new AnsiLogger({ logName: 'Matterbridge', logTimestampFormat: 4, logLevel: "debug" });
520
- matterbridge.environment.vars.set('log.level', MatterLogLevel.DEBUG);
521
- matterbridge.environment.vars.set('log.format', MatterLogFormat.ANSI);
522
- matterbridge.environment.vars.set('path.root', 'matterstorage');
523
- matterbridge.environment.vars.set('runtime.signals', true);
524
- matterbridge.environment.vars.set('runtime.exitcode', true);
525
- matterbridge.environment.vars.set('mdns.networkInterface', 'Wi-Fi');
526
- await matterbridge.startMatterStorage();
527
- const deviceType = smokeCoAlarm;
528
- const context = await matterbridge.createServerNodeContext('Jest', deviceType.name, DeviceTypeId(deviceType.code), VendorId(0xfff1), 'Matterbridge', 0x8000, 'Matterbridge device');
529
- const server = await matterbridge.createServerNode(context);
530
- const device = new Robot('Robot Vacuum', '99914248654');
531
- await server.add(device);
532
- logEndpoint(EndpointServer.forEndpoint(device));
533
- await matterbridge.startServerNode(server);
534
- logEndpoint(EndpointServer.forEndpoint(server));
535
- }
package/dist/robot.js CHANGED
@@ -1,41 +1,40 @@
1
- import { MatterbridgeServer, MatterbridgeEndpoint, roboticVacuumCleaner } from 'matterbridge';
2
- import { RvcOperationalState } from './implementations/roboticVacuumCleanerClusters.js';
3
- import { ClusterBehavior } from 'matterbridge/matter';
1
+ import { Matterbridge, MatterbridgeServer, MatterbridgeEndpoint, roboticVacuumCleaner, bridge, EndpointNumber, onOffOutlet } from 'matterbridge';
2
+ import { LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, EndpointServer, logEndpoint, DeviceTypeId, VendorId, } from 'matterbridge/matter';
4
3
  import { Status } from 'matterbridge/matter/types';
5
- import { OperationalState, PowerSource, RvcRunMode, RvcCleanMode, ServiceArea } from 'matterbridge/matter/clusters';
6
- import { OnOffServer, ServiceAreaBehavior } from 'matterbridge/matter/behaviors';
4
+ import { OperationalState, PowerSource, RvcRunMode, RvcCleanMode, RvcOperationalState, ServiceArea, Actions } from 'matterbridge/matter/clusters';
5
+ import { ActionsServer, RvcCleanModeBehavior, RvcOperationalStateBehavior, RvcRunModeBehavior, ServiceAreaBehavior } from 'matterbridge/matter/behaviors';
6
+ import { AnsiLogger } from 'matterbridge/logger';
7
7
  export class Robot extends MatterbridgeEndpoint {
8
8
  constructor(name, serial) {
9
9
  super(roboticVacuumCleaner, { uniqueStorageKey: `${name}-${serial}` }, true);
10
10
  this.createDefaultIdentifyClusterServer()
11
11
  .createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Robot Vacuum Cleaner')
12
- .createDefaultOnOffClusterServer()
13
12
  .createDefaultRvcRunModeClusterServer()
14
13
  .createDefaultRvcOperationalStateClusterServer()
15
14
  .createDefaultRvcCleanModeClusterServer()
16
15
  .createDefaultServiceAreaClusterServer()
17
16
  .createDefaultPowerSourceRechargeableBatteryClusterServer(80, PowerSource.BatChargeLevel.Ok, 5900);
18
17
  }
19
- createDefaultRvcRunModeClusterServer() {
18
+ createDefaultRvcRunModeClusterServer(currentMode, supportedModes) {
20
19
  this.behaviors.require(MatterbridgeRvcRunModeServer, {
21
- supportedModes: [
20
+ supportedModes: supportedModes ?? [
22
21
  { label: 'Idle', mode: 1, modeTags: [{ value: RvcRunMode.ModeTag.Idle }] },
23
22
  { label: 'Cleaning', mode: 2, modeTags: [{ value: RvcRunMode.ModeTag.Cleaning }] },
24
23
  { label: 'Mapping', mode: 3, modeTags: [{ value: RvcRunMode.ModeTag.Mapping }] },
25
24
  { label: 'SpotCleaning', mode: 4, modeTags: [{ value: RvcRunMode.ModeTag.Cleaning }, { value: RvcRunMode.ModeTag.Max }] },
26
25
  ],
27
- currentMode: 1,
26
+ currentMode: currentMode ?? 1,
28
27
  });
29
28
  return this;
30
29
  }
31
- createDefaultRvcCleanModeClusterServer() {
30
+ createDefaultRvcCleanModeClusterServer(currentMode, supportedModes) {
32
31
  this.behaviors.require(MatterbridgeRvcCleanModeServer, {
33
- supportedModes: [
32
+ supportedModes: supportedModes ?? [
34
33
  { label: 'Vacuum', mode: 1, modeTags: [{ value: RvcCleanMode.ModeTag.Vacuum }] },
35
34
  { label: 'Mop', mode: 2, modeTags: [{ value: RvcCleanMode.ModeTag.Mop }] },
36
35
  { label: 'Clean', mode: 3, modeTags: [{ value: RvcCleanMode.ModeTag.DeepClean }] },
37
36
  ],
38
- currentMode: 1,
37
+ currentMode: currentMode ?? 1,
39
38
  });
40
39
  return this;
41
40
  }
@@ -69,11 +68,11 @@ export class Robot extends MatterbridgeEndpoint {
69
68
  });
70
69
  return this;
71
70
  }
72
- createDefaultRvcOperationalStateClusterServer() {
71
+ createDefaultRvcOperationalStateClusterServer(phaseList = null, currentPhase = null, operationalStateList, operationalState, operationalError) {
73
72
  this.behaviors.require(MatterbridgeRvcOperationalStateServer, {
74
- phaseList: [],
75
- currentPhase: null,
76
- operationalStateList: [
73
+ phaseList,
74
+ currentPhase,
75
+ operationalStateList: operationalStateList ?? [
77
76
  { operationalStateId: RvcOperationalState.OperationalState.Stopped, operationalStateLabel: 'Stopped' },
78
77
  { operationalStateId: RvcOperationalState.OperationalState.Running, operationalStateLabel: 'Running' },
79
78
  { operationalStateId: RvcOperationalState.OperationalState.Paused, operationalStateLabel: 'Paused' },
@@ -82,8 +81,8 @@ export class Robot extends MatterbridgeEndpoint {
82
81
  { operationalStateId: RvcOperationalState.OperationalState.Charging, operationalStateLabel: 'Charging' },
83
82
  { operationalStateId: RvcOperationalState.OperationalState.Docked, operationalStateLabel: 'Docked' },
84
83
  ],
85
- operationalState: RvcOperationalState.OperationalState.Docked,
86
- operationalError: { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' },
84
+ operationalState: operationalState ?? RvcOperationalState.OperationalState.Docked,
85
+ operationalError: operationalError ?? { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' },
87
86
  });
88
87
  return this;
89
88
  }
@@ -101,39 +100,39 @@ export class MatterbridgeServiceAreaServer extends ServiceAreaBehavior {
101
100
  }
102
101
  }
103
102
  this.state.selectedAreas = newAreas;
103
+ this.state.currentArea = newAreas[0];
104
+ device.log.info(`***MatterbridgeServiceAreaServer selectAreas called with: ${newAreas.map((area) => area.toString()).join(', ')}`);
104
105
  return { status: ServiceArea.SelectAreasStatus.Success, statusText: 'Succesfully selected new areas' };
105
106
  }
106
107
  }
107
- export const RvcRunModeBehavior = ClusterBehavior.withInterface().for(RvcRunMode.Cluster);
108
108
  export class MatterbridgeRvcRunModeServer extends RvcRunModeBehavior {
109
109
  initialize() {
110
110
  this.state.currentMode = 1;
111
111
  }
112
112
  changeToMode({ newMode }) {
113
113
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
114
- const supported = this.state.supportedModes.find((mode) => mode.mode === newMode);
115
- if (!supported) {
114
+ const changedMode = this.state.supportedModes.find((mode) => mode.mode === newMode);
115
+ if (!changedMode) {
116
116
  device.log.error('MatterbridgeRvcRunModeServer changeToMode called with unsupported newMode:', newMode);
117
117
  return { status: Status.InvalidCommand, statusText: 'Invalid command' };
118
118
  }
119
119
  device.changeToMode({ newMode });
120
120
  this.state.currentMode = newMode;
121
- if (supported.modeTags.find((tag) => tag.value === RvcRunMode.ModeTag.Cleaning)) {
121
+ if (changedMode.modeTags.find((tag) => tag.value === RvcRunMode.ModeTag.Cleaning)) {
122
122
  device.log.info('***MatterbridgeRvcRunModeServer changeToMode called with newMode Cleaning => Running');
123
123
  this.agent.get(MatterbridgeRvcOperationalStateServer).state.operationalState = RvcOperationalState.OperationalState.Running;
124
124
  return { status: Status.Success, statusText: 'Running' };
125
125
  }
126
- else if (supported.modeTags.find((tag) => tag.value === RvcRunMode.ModeTag.Idle)) {
126
+ else if (changedMode.modeTags.find((tag) => tag.value === RvcRunMode.ModeTag.Idle)) {
127
127
  device.log.info('***MatterbridgeRvcRunModeServer changeToMode called with newMode Idle => Docked');
128
128
  this.agent.get(MatterbridgeRvcOperationalStateServer).state.operationalState = RvcOperationalState.OperationalState.Docked;
129
129
  return { status: Status.Success, statusText: 'Docked' };
130
130
  }
131
- device.log.info(`***MatterbridgeRvcRunModeServer changeToMode called with newMode ${newMode} => ${supported.label}`);
131
+ device.log.info(`***MatterbridgeRvcRunModeServer changeToMode called with newMode ${newMode} => ${changedMode.label}`);
132
132
  this.agent.get(MatterbridgeRvcOperationalStateServer).state.operationalState = RvcOperationalState.OperationalState.Running;
133
133
  return { status: Status.Success, statusText: 'Success' };
134
134
  }
135
135
  }
136
- export const RvcCleanModeBehavior = ClusterBehavior.withInterface().for(RvcCleanMode.Cluster);
137
136
  export class MatterbridgeRvcCleanModeServer extends RvcCleanModeBehavior {
138
137
  initialize() {
139
138
  this.state.currentMode = 1;
@@ -151,29 +150,12 @@ export class MatterbridgeRvcCleanModeServer extends RvcCleanModeBehavior {
151
150
  return { status: Status.Success, statusText: 'Success' };
152
151
  }
153
152
  }
154
- export const RvcOperationalStateBehavior = ClusterBehavior.withInterface().for(RvcOperationalState.Cluster);
155
153
  export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateBehavior {
156
154
  initialize() {
157
155
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
158
156
  device.log.info('***MatterbridgeRvcOperationalStateServer initialized: setting operational state to Docked');
159
157
  this.state.operationalState = RvcOperationalState.OperationalState.Docked;
160
158
  this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
161
- this.reactTo(this.agent.get(OnOffServer).events.onOff$Changed, this.handleOnOffChange);
162
- }
163
- handleOnOffChange(onOff) {
164
- const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
165
- if (onOff) {
166
- device.log.info('***OnOffServer changed to ON: setting operational state to Running');
167
- this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 2;
168
- this.state.operationalState = RvcOperationalState.OperationalState.Running;
169
- this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
170
- }
171
- else {
172
- device.log.info('***OnOffServer changed to OFF: setting operational state to Docked');
173
- this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
174
- this.state.operationalState = RvcOperationalState.OperationalState.Docked;
175
- this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
176
- }
177
159
  }
178
160
  pause() {
179
161
  const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
@@ -206,3 +188,47 @@ export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateBe
206
188
  };
207
189
  }
208
190
  }
191
+ function createEndpointActionsClusterServer(endpoint, endpointLists) {
192
+ endpoint.behaviors.require(ActionsServer, {
193
+ actionList: [],
194
+ endpointLists,
195
+ });
196
+ return endpoint;
197
+ }
198
+ if (process.argv.includes('-testRobot')) {
199
+ const matterbridge = await Matterbridge.loadInstance(false);
200
+ matterbridge.log = new AnsiLogger({ logName: 'Matterbridge', logTimestampFormat: 4, logLevel: "debug" });
201
+ matterbridge.environment.vars.set('log.level', MatterLogLevel.DEBUG);
202
+ matterbridge.environment.vars.set('log.format', MatterLogFormat.ANSI);
203
+ matterbridge.environment.vars.set('path.root', 'matterstorage');
204
+ matterbridge.environment.vars.set('runtime.signals', true);
205
+ matterbridge.environment.vars.set('runtime.exitcode', true);
206
+ matterbridge.environment.vars.set('mdns.networkInterface', 'Wi-Fi');
207
+ await matterbridge.startMatterStorage();
208
+ const deviceType = bridge;
209
+ const context = await matterbridge.createServerNodeContext('Matterbridge', deviceType.name, DeviceTypeId(deviceType.code), VendorId(0xfff1), 'Matterbridge', 0x8000, 'Matterbridge device');
210
+ const server = (await matterbridge.createServerNode(context));
211
+ const aggregator = (await matterbridge.createAggregatorNode(context));
212
+ createEndpointActionsClusterServer(aggregator, [
213
+ {
214
+ endpointListId: 1,
215
+ name: 'Living room',
216
+ type: Actions.EndpointListType.Room,
217
+ endpoints: [EndpointNumber(2)],
218
+ },
219
+ ]);
220
+ await server.add(aggregator);
221
+ const outlet = new MatterbridgeEndpoint(onOffOutlet, { uniqueStorageKey: 'Outlet' }, true)
222
+ .createDefaultIdentifyClusterServer()
223
+ .createDefaultBridgedDeviceBasicInformationClusterServer('Outlet', '99914248654', 0xfff1, 'Matterbridge', 'Matterbridge Outlet')
224
+ .createDefaultOnOffClusterServer()
225
+ .createDefaultGroupsClusterServer()
226
+ .createDefaultPowerSourceRechargeableBatteryClusterServer(80, PowerSource.BatChargeLevel.Ok, 5900)
227
+ .addRequiredClusterServers();
228
+ await aggregator.add(outlet);
229
+ const device = new Robot('Robot Vacuum', '99914248654');
230
+ await aggregator.add(device);
231
+ await matterbridge.startServerNode(server);
232
+ logEndpoint(EndpointServer.forEndpoint(server));
233
+ matterbridge.log.info(`Matterbridge server started. ServerNode id ${server.id}-${server.number}. Aggregator id ${aggregator.id}-${aggregator.number}. Device id ${device.id}-${device.number}.`);
234
+ }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-example-dynamic-platform",
3
- "version": "1.2.0-edge.7",
3
+ "version": "1.2.0-edge.9",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge-example-dynamic-platform",
9
- "version": "1.2.0-edge.7",
9
+ "version": "1.2.0-edge.9",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "node-ansi-logger": "3.0.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge-example-dynamic-platform",
3
- "version": "1.2.0-edge.7",
3
+ "version": "1.2.0-edge.9",
4
4
  "description": "Matterbridge dynamic plugin",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "MIT",
@@ -1,113 +0,0 @@
1
- import { ClusterBehavior } from 'matterbridge/matter';
2
- import { Attribute, MutableCluster, OptionalAttribute, TlvEnum, TlvNullable, TlvUInt32, TlvFloat, FixedAttribute, BitFlag, ClusterType, ClusterRegistry, } from 'matterbridge/matter/types';
3
- export var CarbonMonoxideConcentrationMeasurement;
4
- (function (CarbonMonoxideConcentrationMeasurement) {
5
- let Feature;
6
- (function (Feature) {
7
- Feature["NumericMeasurement"] = "NumericMeasurement";
8
- Feature["LevelIndication"] = "LevelIndication";
9
- Feature["MediumLevel"] = "MediumLevel";
10
- Feature["CriticalLevel"] = "CriticalLevel";
11
- Feature["PeakMeasurement"] = "PeakMeasurement";
12
- Feature["AverageMeasurement"] = "AverageMeasurement";
13
- })(Feature = CarbonMonoxideConcentrationMeasurement.Feature || (CarbonMonoxideConcentrationMeasurement.Feature = {}));
14
- let MeasurementUnit;
15
- (function (MeasurementUnit) {
16
- MeasurementUnit[MeasurementUnit["Ppm"] = 0] = "Ppm";
17
- MeasurementUnit[MeasurementUnit["Ppb"] = 1] = "Ppb";
18
- MeasurementUnit[MeasurementUnit["Ppt"] = 2] = "Ppt";
19
- MeasurementUnit[MeasurementUnit["Mgm3"] = 3] = "Mgm3";
20
- MeasurementUnit[MeasurementUnit["Ugm3"] = 4] = "Ugm3";
21
- MeasurementUnit[MeasurementUnit["Ngm3"] = 5] = "Ngm3";
22
- MeasurementUnit[MeasurementUnit["Pm3"] = 6] = "Pm3";
23
- MeasurementUnit[MeasurementUnit["Bqm3"] = 7] = "Bqm3";
24
- })(MeasurementUnit = CarbonMonoxideConcentrationMeasurement.MeasurementUnit || (CarbonMonoxideConcentrationMeasurement.MeasurementUnit = {}));
25
- let LevelValue;
26
- (function (LevelValue) {
27
- LevelValue[LevelValue["Unknown"] = 0] = "Unknown";
28
- LevelValue[LevelValue["Low"] = 1] = "Low";
29
- LevelValue[LevelValue["Medium"] = 2] = "Medium";
30
- LevelValue[LevelValue["High"] = 3] = "High";
31
- LevelValue[LevelValue["Critical"] = 4] = "Critical";
32
- })(LevelValue = CarbonMonoxideConcentrationMeasurement.LevelValue || (CarbonMonoxideConcentrationMeasurement.LevelValue = {}));
33
- let MeasurementMedium;
34
- (function (MeasurementMedium) {
35
- MeasurementMedium[MeasurementMedium["Air"] = 0] = "Air";
36
- MeasurementMedium[MeasurementMedium["Water"] = 1] = "Water";
37
- MeasurementMedium[MeasurementMedium["Soil"] = 2] = "Soil";
38
- })(MeasurementMedium = CarbonMonoxideConcentrationMeasurement.MeasurementMedium || (CarbonMonoxideConcentrationMeasurement.MeasurementMedium = {}));
39
- CarbonMonoxideConcentrationMeasurement.NumericMeasurementComponent = MutableCluster.Component({
40
- attributes: {
41
- measuredValue: Attribute(0x0, TlvNullable(TlvFloat), { default: null }),
42
- minMeasuredValue: Attribute(0x1, TlvNullable(TlvFloat), { default: null }),
43
- maxMeasuredValue: Attribute(0x2, TlvNullable(TlvFloat), { default: null }),
44
- uncertainty: OptionalAttribute(0x7, TlvFloat),
45
- measurementUnit: FixedAttribute(0x8, TlvEnum()),
46
- },
47
- });
48
- CarbonMonoxideConcentrationMeasurement.PeakMeasurementComponent = MutableCluster.Component({
49
- attributes: {
50
- peakMeasuredValue: Attribute(0x3, TlvNullable(TlvFloat), { default: null }),
51
- peakMeasuredValueWindow: Attribute(0x4, TlvUInt32.bound({ max: 604800 }), { default: 1 }),
52
- },
53
- });
54
- CarbonMonoxideConcentrationMeasurement.AverageMeasurementComponent = MutableCluster.Component({
55
- attributes: {
56
- averageMeasuredValue: Attribute(0x5, TlvNullable(TlvFloat), { default: null }),
57
- averageMeasuredValueWindow: Attribute(0x6, TlvUInt32.bound({ max: 604800 }), { default: 1 }),
58
- },
59
- });
60
- CarbonMonoxideConcentrationMeasurement.LevelIndicationComponent = MutableCluster.Component({
61
- attributes: {
62
- levelValue: Attribute(0xa, TlvEnum(), { default: LevelValue.Unknown }),
63
- },
64
- });
65
- CarbonMonoxideConcentrationMeasurement.Base = MutableCluster.Component({
66
- id: 0x40c,
67
- name: 'CarbonMonoxideConcentrationMeasurement',
68
- revision: 3,
69
- features: {
70
- numericMeasurement: BitFlag(0),
71
- levelIndication: BitFlag(1),
72
- mediumLevel: BitFlag(2),
73
- criticalLevel: BitFlag(3),
74
- peakMeasurement: BitFlag(4),
75
- averageMeasurement: BitFlag(5),
76
- },
77
- attributes: {
78
- measurementMedium: FixedAttribute(0x9, TlvEnum()),
79
- },
80
- extensions: MutableCluster.Extensions({ flags: { numericMeasurement: true }, component: CarbonMonoxideConcentrationMeasurement.NumericMeasurementComponent }, { flags: { peakMeasurement: true }, component: CarbonMonoxideConcentrationMeasurement.PeakMeasurementComponent }, { flags: { averageMeasurement: true }, component: CarbonMonoxideConcentrationMeasurement.AverageMeasurementComponent }, { flags: { levelIndication: true }, component: CarbonMonoxideConcentrationMeasurement.LevelIndicationComponent }, { flags: { mediumLevel: true, levelIndication: false }, component: false }, { flags: { criticalLevel: true, levelIndication: false }, component: false }, { flags: { peakMeasurement: true, numericMeasurement: false }, component: false }, { flags: { averageMeasurement: true, numericMeasurement: false }, component: false }, { flags: { numericMeasurement: false, levelIndication: false }, component: false }),
81
- });
82
- CarbonMonoxideConcentrationMeasurement.ClusterInstance = MutableCluster.ExtensibleOnly(CarbonMonoxideConcentrationMeasurement.Base);
83
- CarbonMonoxideConcentrationMeasurement.Cluster = CarbonMonoxideConcentrationMeasurement.ClusterInstance;
84
- const MEA = { numericMeasurement: true };
85
- const PEA = { peakMeasurement: true };
86
- const AVG = { averageMeasurement: true };
87
- const LEV = { levelIndication: true };
88
- CarbonMonoxideConcentrationMeasurement.CompleteInstance = MutableCluster({
89
- id: CarbonMonoxideConcentrationMeasurement.Base.id,
90
- name: CarbonMonoxideConcentrationMeasurement.Base.name,
91
- revision: CarbonMonoxideConcentrationMeasurement.Base.revision,
92
- features: CarbonMonoxideConcentrationMeasurement.Base.features,
93
- attributes: {
94
- ...CarbonMonoxideConcentrationMeasurement.Base.attributes,
95
- measuredValue: MutableCluster.AsConditional(CarbonMonoxideConcentrationMeasurement.NumericMeasurementComponent.attributes.measuredValue, { mandatoryIf: [MEA] }),
96
- minMeasuredValue: MutableCluster.AsConditional(CarbonMonoxideConcentrationMeasurement.NumericMeasurementComponent.attributes.minMeasuredValue, { mandatoryIf: [MEA] }),
97
- maxMeasuredValue: MutableCluster.AsConditional(CarbonMonoxideConcentrationMeasurement.NumericMeasurementComponent.attributes.maxMeasuredValue, { mandatoryIf: [MEA] }),
98
- peakMeasuredValue: MutableCluster.AsConditional(CarbonMonoxideConcentrationMeasurement.PeakMeasurementComponent.attributes.peakMeasuredValue, { mandatoryIf: [PEA] }),
99
- peakMeasuredValueWindow: MutableCluster.AsConditional(CarbonMonoxideConcentrationMeasurement.PeakMeasurementComponent.attributes.peakMeasuredValueWindow, { mandatoryIf: [PEA] }),
100
- averageMeasuredValue: MutableCluster.AsConditional(CarbonMonoxideConcentrationMeasurement.AverageMeasurementComponent.attributes.averageMeasuredValue, { mandatoryIf: [AVG] }),
101
- averageMeasuredValueWindow: MutableCluster.AsConditional(CarbonMonoxideConcentrationMeasurement.AverageMeasurementComponent.attributes.averageMeasuredValueWindow, { mandatoryIf: [AVG] }),
102
- uncertainty: MutableCluster.AsConditional(CarbonMonoxideConcentrationMeasurement.NumericMeasurementComponent.attributes.uncertainty, { optionalIf: [MEA] }),
103
- measurementUnit: MutableCluster.AsConditional(CarbonMonoxideConcentrationMeasurement.NumericMeasurementComponent.attributes.measurementUnit, { mandatoryIf: [MEA] }),
104
- levelValue: MutableCluster.AsConditional(CarbonMonoxideConcentrationMeasurement.LevelIndicationComponent.attributes.levelValue, { mandatoryIf: [LEV] }),
105
- },
106
- });
107
- CarbonMonoxideConcentrationMeasurement.Complete = CarbonMonoxideConcentrationMeasurement.CompleteInstance;
108
- })(CarbonMonoxideConcentrationMeasurement || (CarbonMonoxideConcentrationMeasurement = {}));
109
- export const CarbonMonoxideConcentrationMeasurementCluster = CarbonMonoxideConcentrationMeasurement.Cluster;
110
- ClusterRegistry.register(ClusterType(CarbonMonoxideConcentrationMeasurement.Complete));
111
- export const CarbonMonoxideConcentrationMeasurementBehavior = ClusterBehavior.for(ClusterType(CarbonMonoxideConcentrationMeasurement.Base));
112
- export class CarbonMonoxideConcentrationMeasurementServer extends CarbonMonoxideConcentrationMeasurementBehavior.for(ClusterType(CarbonMonoxideConcentrationMeasurement.Base)) {
113
- }
@@ -1,30 +0,0 @@
1
- import { OperationalState } from 'matterbridge/matter/clusters';
2
- import { Attribute, EventPriority, MutableCluster, OptionalAttribute, TlvArray, Event, TlvEnum, TlvNullable, TlvString, TlvUInt32, TlvUInt8, OptionalEvent, ClusterRegistry, TlvNoArguments, Command, } from 'matterbridge/matter/types';
3
- export var OvenCavityOperationalState;
4
- (function (OvenCavityOperationalState) {
5
- OvenCavityOperationalState.ClusterInstance = MutableCluster({
6
- id: 0x48,
7
- name: 'OvenCavityOperationalState',
8
- revision: 2,
9
- attributes: {
10
- phaseList: Attribute(0x0, TlvNullable(TlvArray(TlvString, { maxLength: 32 }))),
11
- currentPhase: Attribute(0x1, TlvNullable(TlvUInt8)),
12
- countdownTime: OptionalAttribute(0x2, TlvNullable(TlvUInt32.bound({ max: 259200 })), { default: null }),
13
- operationalStateList: Attribute(0x3, TlvArray(OperationalState.TlvOperationalStateStruct), { default: [] }),
14
- operationalState: Attribute(0x4, TlvEnum()),
15
- operationalError: Attribute(0x5, OperationalState.TlvErrorStateStruct),
16
- },
17
- commands: {
18
- stop: Command(0x1, TlvNoArguments, 0x4, OperationalState.TlvOperationalCommandResponse),
19
- start: Command(0x2, TlvNoArguments, 0x4, OperationalState.TlvOperationalCommandResponse),
20
- },
21
- events: {
22
- operationalError: Event(0x0, EventPriority.Critical, OperationalState.TlvOperationalErrorEvent),
23
- operationCompletion: OptionalEvent(0x1, EventPriority.Info, OperationalState.TlvOperationCompletionEvent),
24
- },
25
- });
26
- OvenCavityOperationalState.Cluster = OvenCavityOperationalState.ClusterInstance;
27
- OvenCavityOperationalState.Complete = OvenCavityOperationalState.Cluster;
28
- })(OvenCavityOperationalState || (OvenCavityOperationalState = {}));
29
- export const OvenCavityOperationalStateCluster = OvenCavityOperationalState.Cluster;
30
- ClusterRegistry.register(OvenCavityOperationalState.Complete);
@@ -1,71 +0,0 @@
1
- import { OperationalState as OperationalStateNamespace } from 'matterbridge/matter/clusters';
2
- import { Attribute, ClusterRegistry, Event, EventPriority, MutableCluster, OptionalAttribute, OptionalCommand, OptionalEvent, TlvArray, TlvEnum, TlvField, TlvNoArguments, TlvNullable, TlvObject, TlvOptionalField, TlvString, TlvUInt32, TlvUInt8, } from 'matterbridge/matter/types';
3
- export var RvcOperationalState;
4
- (function (RvcOperationalState) {
5
- let OperationalState;
6
- (function (OperationalState) {
7
- OperationalState[OperationalState["Stopped"] = 0] = "Stopped";
8
- OperationalState[OperationalState["Running"] = 1] = "Running";
9
- OperationalState[OperationalState["Paused"] = 2] = "Paused";
10
- OperationalState[OperationalState["Error"] = 3] = "Error";
11
- OperationalState[OperationalState["SeekingCharger"] = 64] = "SeekingCharger";
12
- OperationalState[OperationalState["Charging"] = 65] = "Charging";
13
- OperationalState[OperationalState["Docked"] = 66] = "Docked";
14
- })(OperationalState = RvcOperationalState.OperationalState || (RvcOperationalState.OperationalState = {}));
15
- RvcOperationalState.TlvOperationalStateStruct = TlvObject({
16
- operationalStateId: TlvField(0, TlvEnum()),
17
- operationalStateLabel: TlvOptionalField(1, TlvString.bound({ maxLength: 64 })),
18
- });
19
- let ErrorState;
20
- (function (ErrorState) {
21
- ErrorState[ErrorState["NoError"] = 0] = "NoError";
22
- ErrorState[ErrorState["UnableToStartOrResume"] = 1] = "UnableToStartOrResume";
23
- ErrorState[ErrorState["UnableToCompleteOperation"] = 2] = "UnableToCompleteOperation";
24
- ErrorState[ErrorState["CommandInvalidInState"] = 3] = "CommandInvalidInState";
25
- ErrorState[ErrorState["FailedToFindChargingDock"] = 64] = "FailedToFindChargingDock";
26
- ErrorState[ErrorState["Stuck"] = 65] = "Stuck";
27
- ErrorState[ErrorState["DustBinMissing"] = 66] = "DustBinMissing";
28
- ErrorState[ErrorState["DustBinFull"] = 67] = "DustBinFull";
29
- ErrorState[ErrorState["WaterTankEmpty"] = 68] = "WaterTankEmpty";
30
- ErrorState[ErrorState["WaterTankMissing"] = 69] = "WaterTankMissing";
31
- ErrorState[ErrorState["WaterTankLidOpen"] = 70] = "WaterTankLidOpen";
32
- ErrorState[ErrorState["MopCleaningPadMissing"] = 71] = "MopCleaningPadMissing";
33
- })(ErrorState = RvcOperationalState.ErrorState || (RvcOperationalState.ErrorState = {}));
34
- RvcOperationalState.TlvErrorStateStruct = TlvObject({
35
- errorStateId: TlvField(0, TlvEnum()),
36
- errorStateLabel: TlvOptionalField(1, TlvString.bound({ maxLength: 64 })),
37
- errorStateDetails: TlvOptionalField(2, TlvString.bound({ maxLength: 64 })),
38
- });
39
- RvcOperationalState.TlvOperationalCommandResponse = TlvObject({
40
- commandResponseState: TlvField(0, RvcOperationalState.TlvErrorStateStruct),
41
- });
42
- RvcOperationalState.TlvOperationalErrorEvent = TlvObject({ errorState: TlvField(0, RvcOperationalState.TlvErrorStateStruct) });
43
- RvcOperationalState.ClusterInstance = MutableCluster({
44
- id: 0x61,
45
- name: 'RvcOperationalState',
46
- revision: 2,
47
- attributes: {
48
- phaseList: Attribute(0x0, TlvNullable(TlvArray(TlvString, { maxLength: 32 }))),
49
- currentPhase: Attribute(0x1, TlvNullable(TlvUInt8)),
50
- countdownTime: OptionalAttribute(0x2, TlvNullable(TlvUInt32.bound({ max: 259200 })), { default: null }),
51
- operationalStateList: Attribute(0x3, TlvArray(RvcOperationalState.TlvOperationalStateStruct), { default: [] }),
52
- operationalState: Attribute(0x4, TlvEnum()),
53
- operationalError: Attribute(0x5, RvcOperationalState.TlvErrorStateStruct),
54
- },
55
- commands: {
56
- pause: OptionalCommand(0x0, TlvNoArguments, 0x4, RvcOperationalState.TlvOperationalCommandResponse),
57
- stop: OptionalCommand(0x1, TlvNoArguments, 0x4, RvcOperationalState.TlvOperationalCommandResponse),
58
- start: OptionalCommand(0x2, TlvNoArguments, 0x4, RvcOperationalState.TlvOperationalCommandResponse),
59
- resume: OptionalCommand(0x3, TlvNoArguments, 0x4, RvcOperationalState.TlvOperationalCommandResponse),
60
- goHome: OptionalCommand(0x80, TlvNoArguments, 0x4, RvcOperationalState.TlvOperationalCommandResponse),
61
- },
62
- events: {
63
- operationalError: Event(0x0, EventPriority.Critical, RvcOperationalState.TlvOperationalErrorEvent),
64
- operationCompletion: OptionalEvent(0x1, EventPriority.Info, OperationalStateNamespace.TlvOperationCompletionEvent),
65
- },
66
- });
67
- RvcOperationalState.Cluster = RvcOperationalState.ClusterInstance;
68
- RvcOperationalState.Complete = RvcOperationalState.Cluster;
69
- })(RvcOperationalState || (RvcOperationalState = {}));
70
- export const RvcOperationalStateCluster = RvcOperationalState.Cluster;
71
- ClusterRegistry.register(RvcOperationalState.Complete);