@matterbridge/core 3.6.2-dev-20260317-e291a17 → 3.7.0-dev-20260318-5bb831c

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.
Files changed (33) hide show
  1. package/dist/devices/basicVideoPlayer.d.ts +8 -9
  2. package/dist/devices/basicVideoPlayer.js +64 -16
  3. package/dist/devices/closure.d.ts +2 -3
  4. package/dist/devices/closure.js +16 -4
  5. package/dist/devices/closurePanel.d.ts +2 -3
  6. package/dist/devices/closurePanel.js +16 -4
  7. package/dist/devices/dishwasher.d.ts +1 -2
  8. package/dist/devices/dishwasher.js +8 -2
  9. package/dist/devices/evse.d.ts +3 -3
  10. package/dist/devices/evse.js +24 -6
  11. package/dist/devices/laundryWasher.d.ts +1 -2
  12. package/dist/devices/laundryWasher.js +8 -2
  13. package/dist/devices/microwaveOven.d.ts +1 -2
  14. package/dist/devices/microwaveOven.js +15 -3
  15. package/dist/devices/roboticVacuumCleaner.d.ts +5 -6
  16. package/dist/devices/roboticVacuumCleaner.js +40 -10
  17. package/dist/devices/temperatureControl.d.ts +2 -3
  18. package/dist/devices/temperatureControl.js +16 -4
  19. package/dist/devices/waterHeater.d.ts +3 -4
  20. package/dist/devices/waterHeater.js +24 -6
  21. package/dist/export.d.ts +1 -0
  22. package/dist/export.js +1 -0
  23. package/dist/jestutils/jestHelpers.js +1 -1
  24. package/dist/matterbridgeBehaviorsServer.d.ts +55 -53
  25. package/dist/matterbridgeBehaviorsServer.js +403 -139
  26. package/dist/matterbridgeEndpoint.d.ts +9 -7
  27. package/dist/matterbridgeEndpoint.js +11 -6
  28. package/dist/matterbridgeEndpointCommandHandler.d.ts +806 -0
  29. package/dist/matterbridgeEndpointCommandHandler.js +31 -0
  30. package/dist/matterbridgeEndpointHelpers.d.ts +2 -2
  31. package/dist/matterbridgeEndpointHelpers.js +1 -0
  32. package/dist/matterbridgeEndpointTypes.d.ts +0 -83
  33. package/package.json +5 -5
@@ -1,4 +1,3 @@
1
- import { Bytes } from '@matter/general';
2
1
  import { Behavior } from '@matter/node';
3
2
  import { ActivatedCarbonFilterMonitoringServer } from '@matter/node/behaviors/activated-carbon-filter-monitoring';
4
3
  import { BooleanStateConfigurationServer } from '@matter/node/behaviors/boolean-state-configuration';
@@ -20,7 +19,6 @@ import { SwitchServer } from '@matter/node/behaviors/switch';
20
19
  import { ThermostatServer } from '@matter/node/behaviors/thermostat';
21
20
  import { ValveConfigurationAndControlServer } from '@matter/node/behaviors/valve-configuration-and-control';
22
21
  import { WindowCoveringServer } from '@matter/node/behaviors/window-covering';
23
- import { StatusResponse } from '@matter/types';
24
22
  import { BooleanStateConfiguration } from '@matter/types/clusters/boolean-state-configuration';
25
23
  import { ColorControl } from '@matter/types/clusters/color-control';
26
24
  import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
@@ -68,174 +66,312 @@ export class MatterbridgePowerSourceServer extends PowerSourceServer {
68
66
  }
69
67
  }
70
68
  export class MatterbridgeIdentifyServer extends IdentifyServer {
71
- identify(request) {
69
+ async identify(request) {
72
70
  const device = this.endpoint.stateOf(MatterbridgeServer);
73
71
  device.log.info(`Identifying device for ${request.identifyTime} seconds (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
74
- device.commandHandler.executeHandler('identify', { request, cluster: IdentifyServer.id, attributes: this.state, endpoint: this.endpoint });
72
+ await device.commandHandler.executeHandler('Identify.identify', {
73
+ command: 'identify',
74
+ request,
75
+ cluster: IdentifyServer.id,
76
+ attributes: this.state,
77
+ endpoint: this.endpoint,
78
+ });
75
79
  device.log.debug(`MatterbridgeIdentifyServer: identify called`);
76
80
  super.identify(request);
77
81
  }
78
- triggerEffect(request) {
82
+ async triggerEffect(request) {
79
83
  const device = this.endpoint.stateOf(MatterbridgeServer);
80
84
  device.log.info(`Triggering effect ${request.effectIdentifier} variant ${request.effectVariant} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
81
- device.commandHandler.executeHandler('triggerEffect', { request, cluster: IdentifyServer.id, attributes: this.state, endpoint: this.endpoint });
85
+ await device.commandHandler.executeHandler('Identify.triggerEffect', {
86
+ command: 'triggerEffect',
87
+ request,
88
+ cluster: IdentifyServer.id,
89
+ attributes: this.state,
90
+ endpoint: this.endpoint,
91
+ });
82
92
  device.log.debug(`MatterbridgeIdentifyServer: triggerEffect called`);
83
93
  super.triggerEffect(request);
84
94
  }
85
95
  }
86
96
  export class MatterbridgeOnOffServer extends OnOffServer {
87
- on() {
97
+ async on() {
88
98
  const device = this.endpoint.stateOf(MatterbridgeServer);
89
99
  device.log.info(`Switching device on (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
90
- device.commandHandler.executeHandler('on', { request: {}, cluster: OnOffServer.id, attributes: this.state, endpoint: this.endpoint });
100
+ await device.commandHandler.executeHandler('OnOff.on', {
101
+ command: 'on',
102
+ request: {},
103
+ cluster: OnOffServer.id,
104
+ attributes: this.state,
105
+ endpoint: this.endpoint,
106
+ });
91
107
  device.log.debug(`MatterbridgeOnOffServer: on called`);
92
108
  super.on();
93
109
  }
94
- off() {
110
+ async off() {
95
111
  const device = this.endpoint.stateOf(MatterbridgeServer);
96
112
  device.log.info(`Switching device off (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
97
- device.commandHandler.executeHandler('off', { request: {}, cluster: OnOffServer.id, attributes: this.state, endpoint: this.endpoint });
113
+ await device.commandHandler.executeHandler('OnOff.off', {
114
+ command: 'off',
115
+ request: {},
116
+ cluster: OnOffServer.id,
117
+ attributes: this.state,
118
+ endpoint: this.endpoint,
119
+ });
98
120
  device.log.debug(`MatterbridgeOnOffServer: off called`);
99
121
  super.off();
100
122
  }
101
- toggle() {
123
+ async toggle() {
102
124
  const device = this.endpoint.stateOf(MatterbridgeServer);
103
125
  device.log.info(`Toggle device on/off (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
104
- device.commandHandler.executeHandler('toggle', { request: {}, cluster: OnOffServer.id, attributes: this.state, endpoint: this.endpoint });
126
+ await device.commandHandler.executeHandler('OnOff.toggle', {
127
+ command: 'toggle',
128
+ request: {},
129
+ cluster: OnOffServer.id,
130
+ attributes: this.state,
131
+ endpoint: this.endpoint,
132
+ });
105
133
  device.log.debug(`MatterbridgeOnOffServer: toggle called`);
106
134
  super.toggle();
107
135
  }
108
136
  }
109
137
  export class MatterbridgeLevelControlServer extends LevelControlServer {
110
- moveToLevel(request) {
138
+ async moveToLevel(request) {
111
139
  const device = this.endpoint.stateOf(MatterbridgeServer);
112
140
  device.log.info(`Setting level to ${request.level} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
113
- device.commandHandler.executeHandler('moveToLevel', { request, cluster: LevelControlServer.id, attributes: this.state, endpoint: this.endpoint });
141
+ await device.commandHandler.executeHandler('LevelControl.moveToLevel', {
142
+ command: 'moveToLevel',
143
+ request,
144
+ cluster: LevelControlServer.id,
145
+ attributes: this.state,
146
+ endpoint: this.endpoint,
147
+ });
114
148
  device.log.debug(`MatterbridgeLevelControlServer: moveToLevel called`);
115
149
  super.moveToLevel(request);
116
150
  }
117
- moveToLevelWithOnOff(request) {
151
+ async moveToLevelWithOnOff(request) {
118
152
  const device = this.endpoint.stateOf(MatterbridgeServer);
119
153
  device.log.info(`Setting level to ${request.level} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
120
- device.commandHandler.executeHandler('moveToLevelWithOnOff', { request, cluster: LevelControlServer.id, attributes: this.state, endpoint: this.endpoint });
154
+ await device.commandHandler.executeHandler('LevelControl.moveToLevelWithOnOff', {
155
+ command: 'moveToLevelWithOnOff',
156
+ request,
157
+ cluster: LevelControlServer.id,
158
+ attributes: this.state,
159
+ endpoint: this.endpoint,
160
+ });
121
161
  device.log.debug(`MatterbridgeLevelControlServer: moveToLevelWithOnOff called`);
122
162
  super.moveToLevelWithOnOff(request);
123
163
  }
124
164
  }
125
165
  export class MatterbridgeColorControlServer extends ColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature) {
126
- moveToHue(request) {
166
+ async moveToHue(request) {
127
167
  const device = this.endpoint.stateOf(MatterbridgeServer);
128
168
  device.log.info(`Setting hue to ${request.hue} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
129
- device.commandHandler.executeHandler('moveToHue', { request, cluster: ColorControlServer.id, attributes: this.state, endpoint: this.endpoint });
169
+ await device.commandHandler.executeHandler('ColorControl.moveToHue', {
170
+ command: 'moveToHue',
171
+ request,
172
+ cluster: ColorControlServer.id,
173
+ attributes: this.state,
174
+ endpoint: this.endpoint,
175
+ });
130
176
  device.log.debug(`MatterbridgeColorControlServer: moveToHue called`);
131
177
  super.moveToHue(request);
132
178
  }
133
- moveToSaturation(request) {
179
+ async moveToSaturation(request) {
134
180
  const device = this.endpoint.stateOf(MatterbridgeServer);
135
181
  device.log.info(`Setting saturation to ${request.saturation} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
136
- device.commandHandler.executeHandler('moveToSaturation', { request, cluster: ColorControlServer.id, attributes: this.state, endpoint: this.endpoint });
182
+ await device.commandHandler.executeHandler('ColorControl.moveToSaturation', {
183
+ command: 'moveToSaturation',
184
+ request,
185
+ cluster: ColorControlServer.id,
186
+ attributes: this.state,
187
+ endpoint: this.endpoint,
188
+ });
137
189
  device.log.debug(`MatterbridgeColorControlServer: moveToSaturation called`);
138
190
  super.moveToSaturation(request);
139
191
  }
140
- moveToHueAndSaturation(request) {
192
+ async moveToHueAndSaturation(request) {
141
193
  const device = this.endpoint.stateOf(MatterbridgeServer);
142
194
  device.log.info(`Setting hue to ${request.hue} and saturation to ${request.saturation} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
143
- device.commandHandler.executeHandler('moveToHueAndSaturation', { request, cluster: ColorControlServer.id, attributes: this.state, endpoint: this.endpoint });
195
+ await device.commandHandler.executeHandler('ColorControl.moveToHueAndSaturation', {
196
+ command: 'moveToHueAndSaturation',
197
+ request,
198
+ cluster: ColorControlServer.id,
199
+ attributes: this.state,
200
+ endpoint: this.endpoint,
201
+ });
144
202
  device.log.debug(`MatterbridgeColorControlServer: moveToHueAndSaturation called`);
145
203
  super.moveToHueAndSaturation(request);
146
204
  }
147
- moveToColor(request) {
205
+ async moveToColor(request) {
148
206
  const device = this.endpoint.stateOf(MatterbridgeServer);
149
207
  device.log.info(`Setting color to ${request.colorX}, ${request.colorY} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
150
- device.commandHandler.executeHandler('moveToColor', { request, cluster: ColorControlServer.id, attributes: this.state, endpoint: this.endpoint });
208
+ await device.commandHandler.executeHandler('ColorControl.moveToColor', {
209
+ command: 'moveToColor',
210
+ request,
211
+ cluster: ColorControlServer.id,
212
+ attributes: this.state,
213
+ endpoint: this.endpoint,
214
+ });
151
215
  device.log.debug(`MatterbridgeColorControlServer: moveToColor called`);
152
216
  super.moveToColor(request);
153
217
  }
154
- moveToColorTemperature(request) {
218
+ async moveToColorTemperature(request) {
155
219
  const device = this.endpoint.stateOf(MatterbridgeServer);
156
220
  device.log.info(`Setting color temperature to ${request.colorTemperatureMireds} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
157
- device.commandHandler.executeHandler('moveToColorTemperature', { request, cluster: ColorControlServer.id, attributes: this.state, endpoint: this.endpoint });
221
+ await device.commandHandler.executeHandler('ColorControl.moveToColorTemperature', {
222
+ command: 'moveToColorTemperature',
223
+ request,
224
+ cluster: ColorControlServer.id,
225
+ attributes: this.state,
226
+ endpoint: this.endpoint,
227
+ });
158
228
  device.log.debug(`MatterbridgeColorControlServer: moveToColorTemperature called`);
159
229
  super.moveToColorTemperature(request);
160
230
  }
161
231
  }
162
232
  export class MatterbridgeEnhancedColorControlServer extends ColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.EnhancedHue, ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature) {
163
- moveToHue(request) {
233
+ async moveToHue(request) {
164
234
  const device = this.endpoint.stateOf(MatterbridgeServer);
165
235
  device.log.info(`Setting hue to ${request.hue} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
166
- device.commandHandler.executeHandler('moveToHue', { request, cluster: ColorControlServer.id, attributes: this.state, endpoint: this.endpoint });
236
+ await device.commandHandler.executeHandler('ColorControl.moveToHue', {
237
+ command: 'moveToHue',
238
+ request,
239
+ cluster: ColorControlServer.id,
240
+ attributes: this.state,
241
+ endpoint: this.endpoint,
242
+ });
167
243
  device.log.debug(`MatterbridgeColorControlServer: moveToHue called`);
168
244
  super.moveToHue(request);
169
245
  }
170
- enhancedMoveToHue(request) {
246
+ async enhancedMoveToHue(request) {
171
247
  const device = this.endpoint.stateOf(MatterbridgeServer);
172
248
  device.log.info(`Setting enhanced hue to ${request.enhancedHue} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
173
- device.commandHandler.executeHandler('enhancedMoveToHue', { request, cluster: ColorControlServer.id, attributes: this.state, endpoint: this.endpoint });
249
+ await device.commandHandler.executeHandler('ColorControl.enhancedMoveToHue', {
250
+ command: 'enhancedMoveToHue',
251
+ request,
252
+ cluster: ColorControlServer.id,
253
+ attributes: this.state,
254
+ endpoint: this.endpoint,
255
+ });
174
256
  device.log.debug(`MatterbridgeColorControlServer: enhancedMoveToHue called`);
175
257
  super.enhancedMoveToHue(request);
176
258
  }
177
- moveToSaturation(request) {
259
+ async moveToSaturation(request) {
178
260
  const device = this.endpoint.stateOf(MatterbridgeServer);
179
261
  device.log.info(`Setting saturation to ${request.saturation} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
180
- device.commandHandler.executeHandler('moveToSaturation', { request, cluster: ColorControlServer.id, attributes: this.state, endpoint: this.endpoint });
262
+ await device.commandHandler.executeHandler('ColorControl.moveToSaturation', {
263
+ command: 'moveToSaturation',
264
+ request,
265
+ cluster: ColorControlServer.id,
266
+ attributes: this.state,
267
+ endpoint: this.endpoint,
268
+ });
181
269
  device.log.debug(`MatterbridgeColorControlServer: moveToSaturation called`);
182
270
  super.moveToSaturation(request);
183
271
  }
184
- moveToHueAndSaturation(request) {
272
+ async moveToHueAndSaturation(request) {
185
273
  const device = this.endpoint.stateOf(MatterbridgeServer);
186
274
  device.log.info(`Setting hue to ${request.hue} and saturation to ${request.saturation} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
187
- device.commandHandler.executeHandler('moveToHueAndSaturation', { request, cluster: ColorControlServer.id, attributes: this.state, endpoint: this.endpoint });
275
+ await device.commandHandler.executeHandler('ColorControl.moveToHueAndSaturation', {
276
+ command: 'moveToHueAndSaturation',
277
+ request,
278
+ cluster: ColorControlServer.id,
279
+ attributes: this.state,
280
+ endpoint: this.endpoint,
281
+ });
188
282
  device.log.debug(`MatterbridgeColorControlServer: moveToHueAndSaturation called`);
189
283
  super.moveToHueAndSaturation(request);
190
284
  }
191
- enhancedMoveToHueAndSaturation(request) {
285
+ async enhancedMoveToHueAndSaturation(request) {
192
286
  const device = this.endpoint.stateOf(MatterbridgeServer);
193
287
  device.log.info(`Setting enhanced hue to ${request.enhancedHue} and saturation to ${request.saturation} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
194
- device.commandHandler.executeHandler('enhancedMoveToHueAndSaturation', { request, cluster: ColorControlServer.id, attributes: this.state, endpoint: this.endpoint });
288
+ await device.commandHandler.executeHandler('ColorControl.enhancedMoveToHueAndSaturation', {
289
+ command: 'enhancedMoveToHueAndSaturation',
290
+ request,
291
+ cluster: ColorControlServer.id,
292
+ attributes: this.state,
293
+ endpoint: this.endpoint,
294
+ });
195
295
  device.log.debug(`MatterbridgeColorControlServer: enhancedMoveToHueAndSaturation called`);
196
296
  super.enhancedMoveToHueAndSaturation(request);
197
297
  }
198
- moveToColor(request) {
298
+ async moveToColor(request) {
199
299
  const device = this.endpoint.stateOf(MatterbridgeServer);
200
300
  device.log.info(`Setting color to ${request.colorX}, ${request.colorY} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
201
- device.commandHandler.executeHandler('moveToColor', { request, cluster: ColorControlServer.id, attributes: this.state, endpoint: this.endpoint });
301
+ await device.commandHandler.executeHandler('ColorControl.moveToColor', {
302
+ command: 'moveToColor',
303
+ request,
304
+ cluster: ColorControlServer.id,
305
+ attributes: this.state,
306
+ endpoint: this.endpoint,
307
+ });
202
308
  device.log.debug(`MatterbridgeColorControlServer: moveToColor called`);
203
309
  super.moveToColor(request);
204
310
  }
205
- moveToColorTemperature(request) {
311
+ async moveToColorTemperature(request) {
206
312
  const device = this.endpoint.stateOf(MatterbridgeServer);
207
313
  device.log.info(`Setting color temperature to ${request.colorTemperatureMireds} with transitionTime ${request.transitionTime} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
208
- device.commandHandler.executeHandler('moveToColorTemperature', { request, cluster: ColorControlServer.id, attributes: this.state, endpoint: this.endpoint });
314
+ await device.commandHandler.executeHandler('ColorControl.moveToColorTemperature', {
315
+ command: 'moveToColorTemperature',
316
+ request,
317
+ cluster: ColorControlServer.id,
318
+ attributes: this.state,
319
+ endpoint: this.endpoint,
320
+ });
209
321
  device.log.debug(`MatterbridgeColorControlServer: moveToColorTemperature called`);
210
322
  super.moveToColorTemperature(request);
211
323
  }
212
324
  }
213
325
  export class MatterbridgeLiftWindowCoveringServer extends WindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift) {
214
- upOrOpen() {
326
+ async upOrOpen() {
215
327
  const device = this.endpoint.stateOf(MatterbridgeServer);
216
328
  device.log.info(`Opening cover (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
217
- device.commandHandler.executeHandler(`upOrOpen`, { request: {}, cluster: WindowCoveringServer.id, attributes: this.state, endpoint: this.endpoint });
329
+ await device.commandHandler.executeHandler('WindowCovering.upOrOpen', {
330
+ command: 'upOrOpen',
331
+ request: {},
332
+ cluster: WindowCoveringServer.id,
333
+ attributes: this.state,
334
+ endpoint: this.endpoint,
335
+ });
218
336
  device.log.debug(`MatterbridgeWindowCoveringServer: upOrOpen called`);
219
337
  super.upOrOpen();
220
338
  }
221
- downOrClose() {
339
+ async downOrClose() {
222
340
  const device = this.endpoint.stateOf(MatterbridgeServer);
223
341
  device.log.info(`Closing cover (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
224
- device.commandHandler.executeHandler(`downOrClose`, { request: {}, cluster: WindowCoveringServer.id, attributes: this.state, endpoint: this.endpoint });
342
+ await device.commandHandler.executeHandler('WindowCovering.downOrClose', {
343
+ command: 'downOrClose',
344
+ request: {},
345
+ cluster: WindowCoveringServer.id,
346
+ attributes: this.state,
347
+ endpoint: this.endpoint,
348
+ });
225
349
  device.log.debug(`MatterbridgeWindowCoveringServer: downOrClose called`);
226
350
  super.downOrClose();
227
351
  }
228
- stopMotion() {
352
+ async stopMotion() {
229
353
  const device = this.endpoint.stateOf(MatterbridgeServer);
230
354
  device.log.info(`Stopping cover (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
231
- device.commandHandler.executeHandler('stopMotion', { request: {}, cluster: WindowCoveringServer.id, attributes: this.state, endpoint: this.endpoint });
355
+ await device.commandHandler.executeHandler('WindowCovering.stopMotion', {
356
+ command: 'stopMotion',
357
+ request: {},
358
+ cluster: WindowCoveringServer.id,
359
+ attributes: this.state,
360
+ endpoint: this.endpoint,
361
+ });
232
362
  device.log.debug(`MatterbridgeWindowCoveringServer: stopMotion called`);
233
363
  super.stopMotion();
234
364
  }
235
- goToLiftPercentage(request) {
365
+ async goToLiftPercentage(request) {
236
366
  const device = this.endpoint.stateOf(MatterbridgeServer);
237
367
  device.log.info(`Setting cover lift percentage to ${request.liftPercent100thsValue} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
238
- device.commandHandler.executeHandler('goToLiftPercentage', { request, cluster: WindowCoveringServer.id, attributes: this.state, endpoint: this.endpoint });
368
+ await device.commandHandler.executeHandler('WindowCovering.goToLiftPercentage', {
369
+ command: 'goToLiftPercentage',
370
+ request,
371
+ cluster: WindowCoveringServer.id,
372
+ attributes: this.state,
373
+ endpoint: this.endpoint,
374
+ });
239
375
  device.log.debug(`MatterbridgeWindowCoveringServer: goToLiftPercentage with ${request.liftPercent100thsValue}`);
240
376
  super.goToLiftPercentage(request);
241
377
  }
@@ -243,38 +379,68 @@ export class MatterbridgeLiftWindowCoveringServer extends WindowCoveringServer.w
243
379
  }
244
380
  }
245
381
  export class MatterbridgeLiftTiltWindowCoveringServer extends WindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt) {
246
- upOrOpen() {
382
+ async upOrOpen() {
247
383
  const device = this.endpoint.stateOf(MatterbridgeServer);
248
384
  device.log.info(`Opening cover (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
249
- device.commandHandler.executeHandler(`upOrOpen`, { request: {}, cluster: WindowCoveringServer.id, attributes: this.state, endpoint: this.endpoint });
385
+ await device.commandHandler.executeHandler('WindowCovering.upOrOpen', {
386
+ command: 'upOrOpen',
387
+ request: {},
388
+ cluster: WindowCoveringServer.id,
389
+ attributes: this.state,
390
+ endpoint: this.endpoint,
391
+ });
250
392
  device.log.debug(`MatterbridgeLiftTiltWindowCoveringServer: upOrOpen called`);
251
393
  super.upOrOpen();
252
394
  }
253
- downOrClose() {
395
+ async downOrClose() {
254
396
  const device = this.endpoint.stateOf(MatterbridgeServer);
255
397
  device.log.info(`Closing cover (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
256
- device.commandHandler.executeHandler(`downOrClose`, { request: {}, cluster: WindowCoveringServer.id, attributes: this.state, endpoint: this.endpoint });
398
+ await device.commandHandler.executeHandler('WindowCovering.downOrClose', {
399
+ command: 'downOrClose',
400
+ request: {},
401
+ cluster: WindowCoveringServer.id,
402
+ attributes: this.state,
403
+ endpoint: this.endpoint,
404
+ });
257
405
  device.log.debug(`MatterbridgeLiftTiltWindowCoveringServer: downOrClose called`);
258
406
  super.downOrClose();
259
407
  }
260
- stopMotion() {
408
+ async stopMotion() {
261
409
  const device = this.endpoint.stateOf(MatterbridgeServer);
262
410
  device.log.info(`Stopping cover (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
263
- device.commandHandler.executeHandler('stopMotion', { request: {}, cluster: WindowCoveringServer.id, attributes: this.state, endpoint: this.endpoint });
411
+ await device.commandHandler.executeHandler('WindowCovering.stopMotion', {
412
+ command: 'stopMotion',
413
+ request: {},
414
+ cluster: WindowCoveringServer.id,
415
+ attributes: this.state,
416
+ endpoint: this.endpoint,
417
+ });
264
418
  device.log.debug(`MatterbridgeLiftTiltWindowCoveringServer: stopMotion called`);
265
419
  super.stopMotion();
266
420
  }
267
- goToLiftPercentage(request) {
421
+ async goToLiftPercentage(request) {
268
422
  const device = this.endpoint.stateOf(MatterbridgeServer);
269
423
  device.log.info(`Setting cover lift percentage to ${request.liftPercent100thsValue} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
270
- device.commandHandler.executeHandler('goToLiftPercentage', { request, cluster: WindowCoveringServer.id, attributes: this.state, endpoint: this.endpoint });
424
+ await device.commandHandler.executeHandler('WindowCovering.goToLiftPercentage', {
425
+ command: 'goToLiftPercentage',
426
+ request,
427
+ cluster: WindowCoveringServer.id,
428
+ attributes: this.state,
429
+ endpoint: this.endpoint,
430
+ });
271
431
  device.log.debug(`MatterbridgeLiftTiltWindowCoveringServer: goToLiftPercentage with ${request.liftPercent100thsValue}`);
272
432
  super.goToLiftPercentage(request);
273
433
  }
274
- goToTiltPercentage(request) {
434
+ async goToTiltPercentage(request) {
275
435
  const device = this.endpoint.stateOf(MatterbridgeServer);
276
436
  device.log.info(`Setting cover tilt percentage to ${request.tiltPercent100thsValue} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
277
- device.commandHandler.executeHandler('goToTiltPercentage', { request, cluster: WindowCoveringServer.id, attributes: this.state, endpoint: this.endpoint });
437
+ await device.commandHandler.executeHandler('WindowCovering.goToTiltPercentage', {
438
+ command: 'goToTiltPercentage',
439
+ request,
440
+ cluster: WindowCoveringServer.id,
441
+ attributes: this.state,
442
+ endpoint: this.endpoint,
443
+ });
278
444
  device.log.debug(`MatterbridgeLiftTiltWindowCoveringServer: goToTiltPercentage with ${request.tiltPercent100thsValue}`);
279
445
  super.goToTiltPercentage(request);
280
446
  }
@@ -282,26 +448,44 @@ export class MatterbridgeLiftTiltWindowCoveringServer extends WindowCoveringServ
282
448
  }
283
449
  }
284
450
  export class MatterbridgeDoorLockServer extends DoorLockServer {
285
- lockDoor() {
451
+ async lockDoor() {
286
452
  const device = this.endpoint.stateOf(MatterbridgeServer);
287
453
  device.log.info(`Locking door (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
288
- device.commandHandler.executeHandler('lockDoor', { request: {}, cluster: DoorLockServer.id, attributes: this.state, endpoint: this.endpoint });
454
+ await device.commandHandler.executeHandler('DoorLock.lockDoor', {
455
+ command: 'lockDoor',
456
+ request: {},
457
+ cluster: DoorLockServer.id,
458
+ attributes: this.state,
459
+ endpoint: this.endpoint,
460
+ });
289
461
  device.log.debug(`MatterbridgeDoorLockServer: lockDoor called`);
290
462
  super.lockDoor();
291
463
  }
292
- unlockDoor() {
464
+ async unlockDoor() {
293
465
  const device = this.endpoint.stateOf(MatterbridgeServer);
294
466
  device.log.info(`Unlocking door (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
295
- device.commandHandler.executeHandler('unlockDoor', { request: {}, cluster: DoorLockServer.id, attributes: this.state, endpoint: this.endpoint });
467
+ await device.commandHandler.executeHandler('DoorLock.unlockDoor', {
468
+ command: 'unlockDoor',
469
+ request: {},
470
+ cluster: DoorLockServer.id,
471
+ attributes: this.state,
472
+ endpoint: this.endpoint,
473
+ });
296
474
  device.log.debug(`MatterbridgeDoorLockServer: unlockDoor called`);
297
475
  super.unlockDoor();
298
476
  }
299
477
  }
300
478
  export class MatterbridgeFanControlServer extends FanControlServer.with(FanControl.Feature.Auto, FanControl.Feature.Step) {
301
- step(request) {
479
+ async step(request) {
302
480
  const device = this.endpoint.stateOf(MatterbridgeServer);
303
481
  device.log.info(`Stepping fan with direction ${request.direction} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
304
- device.commandHandler.executeHandler('step', { request, cluster: FanControlServer.id, attributes: this.state, endpoint: this.endpoint });
482
+ await device.commandHandler.executeHandler('FanControl.step', {
483
+ command: 'step',
484
+ request,
485
+ cluster: FanControlServer.id,
486
+ attributes: this.state,
487
+ endpoint: this.endpoint,
488
+ });
305
489
  const lookupStepDirection = ['Increase', 'Decrease'];
306
490
  device.log.debug(`MatterbridgeFanControlServer: step called with direction: ${lookupStepDirection[request.direction]} wrap: ${request.wrap} lowestOff: ${request.lowestOff}`);
307
491
  device.log.debug(`- current percentCurrent: ${this.state.percentCurrent}`);
@@ -334,68 +518,64 @@ export class MatterbridgeThermostatServer extends ThermostatServer.with(Thermost
334
518
  });
335
519
  });
336
520
  }
337
- setpointRaiseLower(request) {
521
+ async setpointRaiseLower(request) {
338
522
  const device = this.endpoint.stateOf(MatterbridgeServer);
339
523
  device.log.info(`Setting setpoint by ${request.amount} in mode ${request.mode} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
340
- device.commandHandler.executeHandler('setpointRaiseLower', { request, cluster: ThermostatServer.id, attributes: this.state, endpoint: this.endpoint });
524
+ await device.commandHandler.executeHandler('Thermostat.setpointRaiseLower', {
525
+ command: 'setpointRaiseLower',
526
+ request,
527
+ cluster: ThermostatServer.id,
528
+ attributes: this.state,
529
+ endpoint: this.endpoint,
530
+ });
341
531
  const lookupSetpointAdjustMode = ['Heat', 'Cool', 'Both'];
342
532
  device.log.debug(`MatterbridgeThermostatServer: setpointRaiseLower called with mode: ${lookupSetpointAdjustMode[request.mode]} amount: ${request.amount / 10}`);
343
- if (this.state.occupiedHeatingSetpoint !== undefined)
344
- device.log.debug(`- current occupiedHeatingSetpoint: ${this.state.occupiedHeatingSetpoint / 100}`);
345
- if (this.state.occupiedCoolingSetpoint !== undefined)
346
- device.log.debug(`- current occupiedCoolingSetpoint: ${this.state.occupiedCoolingSetpoint / 100}`);
347
- if ((request.mode === Thermostat.SetpointRaiseLowerMode.Heat || request.mode === Thermostat.SetpointRaiseLowerMode.Both) && this.state.occupiedHeatingSetpoint !== undefined) {
348
- const setpoint = this.state.occupiedHeatingSetpoint / 100 + request.amount / 10;
349
- this.state.occupiedHeatingSetpoint = setpoint * 100;
350
- device.log.debug(`Set occupiedHeatingSetpoint to ${setpoint}`);
351
- }
352
- if ((request.mode === Thermostat.SetpointRaiseLowerMode.Cool || request.mode === Thermostat.SetpointRaiseLowerMode.Both) && this.state.occupiedCoolingSetpoint !== undefined) {
353
- const setpoint = this.state.occupiedCoolingSetpoint / 100 + request.amount / 10;
354
- this.state.occupiedCoolingSetpoint = setpoint * 100;
355
- device.log.debug(`Set occupiedCoolingSetpoint to ${setpoint}`);
356
- }
533
+ await super.setpointRaiseLower(request);
357
534
  }
358
535
  }
359
536
  export class MatterbridgePresetThermostatServer extends ThermostatServer.with(Thermostat.Feature.Presets, Thermostat.Feature.Cooling, Thermostat.Feature.Heating, Thermostat.Feature.AutoMode) {
360
- setpointRaiseLower(request) {
537
+ async setpointRaiseLower(request) {
361
538
  const device = this.endpoint.stateOf(MatterbridgeServer);
362
539
  device.log.info(`Setting setpoint by ${request.amount} in mode ${request.mode} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
363
- device.commandHandler.executeHandler('setpointRaiseLower', { request, cluster: ThermostatServer.id, attributes: this.state, endpoint: this.endpoint });
540
+ await device.commandHandler.executeHandler('Thermostat.setpointRaiseLower', {
541
+ command: 'setpointRaiseLower',
542
+ request,
543
+ cluster: ThermostatServer.id,
544
+ attributes: this.state,
545
+ endpoint: this.endpoint,
546
+ });
364
547
  const lookupSetpointAdjustMode = ['Heat', 'Cool', 'Both'];
365
- device.log.debug(`MatterbridgeThermostatServer: setpointRaiseLower called with mode: ${lookupSetpointAdjustMode[request.mode]} amount: ${request.amount / 10}`);
366
- if (this.state.occupiedHeatingSetpoint !== undefined)
367
- device.log.debug(`- current occupiedHeatingSetpoint: ${this.state.occupiedHeatingSetpoint / 100}`);
368
- if (this.state.occupiedCoolingSetpoint !== undefined)
369
- device.log.debug(`- current occupiedCoolingSetpoint: ${this.state.occupiedCoolingSetpoint / 100}`);
370
- if ((request.mode === Thermostat.SetpointRaiseLowerMode.Heat || request.mode === Thermostat.SetpointRaiseLowerMode.Both) && this.state.occupiedHeatingSetpoint !== undefined) {
371
- const setpoint = this.state.occupiedHeatingSetpoint / 100 + request.amount / 10;
372
- this.state.occupiedHeatingSetpoint = setpoint * 100;
373
- device.log.debug(`Set occupiedHeatingSetpoint to ${setpoint}`);
374
- }
375
- if ((request.mode === Thermostat.SetpointRaiseLowerMode.Cool || request.mode === Thermostat.SetpointRaiseLowerMode.Both) && this.state.occupiedCoolingSetpoint !== undefined) {
376
- const setpoint = this.state.occupiedCoolingSetpoint / 100 + request.amount / 10;
377
- this.state.occupiedCoolingSetpoint = setpoint * 100;
378
- device.log.debug(`Set occupiedCoolingSetpoint to ${setpoint}`);
379
- }
380
- }
381
- setActivePresetRequest(request) {
382
- const device = this.endpoint.stateOf(MatterbridgeServer);
383
- device.log.info(`Setting preset to ${request.presetHandle} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
384
- device.commandHandler.executeHandler('setActivePresetRequest', { request, cluster: ThermostatServer.id, attributes: this.state, endpoint: this.endpoint });
385
- if (request.presetHandle !== null) {
386
- const preset = this.state.persistedPresets?.find((storedPreset) => storedPreset.presetHandle !== null && Bytes.areEqual(storedPreset.presetHandle, request.presetHandle));
387
- if (preset === undefined)
388
- throw new StatusResponse.InvalidCommandError('Requested PresetHandle not found');
389
- }
390
- this.state.activePresetHandle = request.presetHandle;
391
- device.log.debug(`MatterbridgePresetThermostatServer: setActivePresetRequest called with presetHandle: ${request.presetHandle}`);
548
+ device.log.debug(`MatterbridgePresetThermostatServer: setpointRaiseLower called with mode: ${lookupSetpointAdjustMode[request.mode]} amount: ${request.amount / 10}`);
549
+ await super.setpointRaiseLower(request);
550
+ }
551
+ async setActivePresetRequest(request) {
552
+ const device = this.endpoint.stateOf(MatterbridgeServer);
553
+ const presetHandle = request.presetHandle ? `0x${Buffer.from(request.presetHandle).toString('hex')}` : 'null';
554
+ device.log.info(`Setting preset to ${presetHandle} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
555
+ await device.commandHandler.executeHandler('Thermostat.setActivePresetRequest', {
556
+ command: 'setActivePresetRequest',
557
+ request,
558
+ cluster: ThermostatServer.id,
559
+ attributes: this.state,
560
+ endpoint: this.endpoint,
561
+ });
562
+ device.log.debug(`MatterbridgePresetThermostatServer: setActivePresetRequest called with presetHandle: ${presetHandle}`);
563
+ await super.setActivePresetRequest(request);
564
+ const activePresetHandle = this.state.activePresetHandle ? `0x${Buffer.from(this.state.activePresetHandle).toString('hex')}` : 'null';
565
+ device.log.debug(`MatterbridgePresetThermostatServer: setActivePresetRequest completed with activePresetHandle: ${activePresetHandle} occupiedHeatingSetpoint: ${this.state.occupiedHeatingSetpoint} occupiedCoolingSetpoint: ${this.state.occupiedCoolingSetpoint}`);
392
566
  }
393
567
  }
394
568
  export class MatterbridgeValveConfigurationAndControlServer extends ValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level) {
395
- open(request) {
569
+ async open(request) {
396
570
  const device = this.endpoint.stateOf(MatterbridgeServer);
397
571
  device.log.info(`Opening valve to ${request.targetLevel ? request.targetLevel + '%' : 'fully opened'} ${request.openDuration ? 'for ' + request.openDuration + 's' : 'until closed'} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
398
- device.commandHandler.executeHandler('open', { request, cluster: ValveConfigurationAndControlServer.id, attributes: this.state, endpoint: this.endpoint });
572
+ await device.commandHandler.executeHandler('ValveConfigurationAndControl.open', {
573
+ command: 'open',
574
+ request,
575
+ cluster: ValveConfigurationAndControlServer.id,
576
+ attributes: this.state,
577
+ endpoint: this.endpoint,
578
+ });
399
579
  device.log.debug(`MatterbridgeValveConfigurationAndControlServer: open called with openDuration: ${request.openDuration} targetLevel: ${request.targetLevel}`);
400
580
  this.state.targetState = ValveConfigurationAndControl.ValveState.Open;
401
581
  this.state.currentState = ValveConfigurationAndControl.ValveState.Open;
@@ -405,10 +585,16 @@ export class MatterbridgeValveConfigurationAndControlServer extends ValveConfigu
405
585
  if (this.state.openDuration === null)
406
586
  this.state.remainingDuration = null;
407
587
  }
408
- close() {
588
+ async close() {
409
589
  const device = this.endpoint.stateOf(MatterbridgeServer);
410
590
  device.log.info(`Closing valve (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
411
- device.commandHandler.executeHandler('close', { request: {}, cluster: ValveConfigurationAndControlServer.id, attributes: this.state, endpoint: this.endpoint });
591
+ await device.commandHandler.executeHandler('ValveConfigurationAndControl.close', {
592
+ command: 'close',
593
+ request: {},
594
+ cluster: ValveConfigurationAndControlServer.id,
595
+ attributes: this.state,
596
+ endpoint: this.endpoint,
597
+ });
412
598
  device.log.debug(`MatterbridgeValveConfigurationAndControlServer: close called`);
413
599
  this.state.targetState = ValveConfigurationAndControl.ValveState.Closed;
414
600
  this.state.currentState = ValveConfigurationAndControl.ValveState.Closed;
@@ -419,18 +605,30 @@ export class MatterbridgeValveConfigurationAndControlServer extends ValveConfigu
419
605
  }
420
606
  }
421
607
  export class MatterbridgeSmokeCoAlarmServer extends SmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm) {
422
- selfTestRequest() {
608
+ async selfTestRequest() {
423
609
  const device = this.endpoint.stateOf(MatterbridgeServer);
424
610
  device.log.info(`Testing SmokeCOAlarm (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
425
- device.commandHandler.executeHandler('selfTestRequest', { request: {}, cluster: SmokeCoAlarmServer.id, attributes: this.state, endpoint: this.endpoint });
611
+ await device.commandHandler.executeHandler('SmokeCoAlarm.selfTestRequest', {
612
+ command: 'selfTestRequest',
613
+ request: {},
614
+ cluster: SmokeCoAlarmServer.id,
615
+ attributes: this.state,
616
+ endpoint: this.endpoint,
617
+ });
426
618
  device.log.debug(`MatterbridgeSmokeCoAlarmServer: selfTestRequest called`);
427
619
  }
428
620
  }
429
621
  export class MatterbridgeBooleanStateConfigurationServer extends BooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel) {
430
- enableDisableAlarm(request) {
622
+ async enableDisableAlarm(request) {
431
623
  const device = this.endpoint.stateOf(MatterbridgeServer);
432
624
  device.log.info(`Enabling/disabling alarm ${request.alarmsToEnableDisable} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
433
- device.commandHandler.executeHandler('enableDisableAlarm', { request, cluster: BooleanStateConfigurationServer.id, attributes: this.state, endpoint: this.endpoint });
625
+ await device.commandHandler.executeHandler('BooleanStateConfiguration.enableDisableAlarm', {
626
+ command: 'enableDisableAlarm',
627
+ request,
628
+ cluster: BooleanStateConfigurationServer.id,
629
+ attributes: this.state,
630
+ endpoint: this.endpoint,
631
+ });
434
632
  device.log.debug(`MatterbridgeBooleanStateConfigurationServer: enableDisableAlarm called`);
435
633
  }
436
634
  }
@@ -446,10 +644,16 @@ export class MatterbridgeOperationalStateServer extends OperationalStateServer {
446
644
  this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateDetails: 'Fully operational' };
447
645
  super.initialize();
448
646
  }
449
- pause() {
647
+ async pause() {
450
648
  const device = this.endpoint.stateOf(MatterbridgeServer);
451
649
  device.log.info(`Pause (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
452
- device.commandHandler.executeHandler('pause', { request: {}, cluster: OperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
650
+ await device.commandHandler.executeHandler('OperationalState.pause', {
651
+ command: 'pause',
652
+ request: {},
653
+ cluster: OperationalStateServer.id,
654
+ attributes: this.state,
655
+ endpoint: this.endpoint,
656
+ });
453
657
  device.log.debug('MatterbridgeOperationalStateServer: pause called setting operational state to Paused');
454
658
  this.state.operationalState = OperationalState.OperationalStateEnum.Paused;
455
659
  this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateDetails: 'Fully operational' };
@@ -457,10 +661,16 @@ export class MatterbridgeOperationalStateServer extends OperationalStateServer {
457
661
  commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateDetails: 'Fully operational' },
458
662
  };
459
663
  }
460
- stop() {
664
+ async stop() {
461
665
  const device = this.endpoint.stateOf(MatterbridgeServer);
462
666
  device.log.info(`Stop (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
463
- device.commandHandler.executeHandler('stop', { request: {}, cluster: OperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
667
+ await device.commandHandler.executeHandler('OperationalState.stop', {
668
+ command: 'stop',
669
+ request: {},
670
+ cluster: OperationalStateServer.id,
671
+ attributes: this.state,
672
+ endpoint: this.endpoint,
673
+ });
464
674
  device.log.debug('MatterbridgeOperationalStateServer: stop called setting operational state to Stopped');
465
675
  this.state.operationalState = OperationalState.OperationalStateEnum.Stopped;
466
676
  this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateDetails: 'Fully operational' };
@@ -468,10 +678,16 @@ export class MatterbridgeOperationalStateServer extends OperationalStateServer {
468
678
  commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateDetails: 'Fully operational' },
469
679
  };
470
680
  }
471
- start() {
681
+ async start() {
472
682
  const device = this.endpoint.stateOf(MatterbridgeServer);
473
683
  device.log.info(`Start (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
474
- device.commandHandler.executeHandler('start', { request: {}, cluster: OperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
684
+ await device.commandHandler.executeHandler('OperationalState.start', {
685
+ command: 'start',
686
+ request: {},
687
+ cluster: OperationalStateServer.id,
688
+ attributes: this.state,
689
+ endpoint: this.endpoint,
690
+ });
475
691
  device.log.debug('MatterbridgeOperationalStateServer: start called setting operational state to Running');
476
692
  this.state.operationalState = OperationalState.OperationalStateEnum.Running;
477
693
  this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateDetails: 'Fully operational' };
@@ -479,10 +695,16 @@ export class MatterbridgeOperationalStateServer extends OperationalStateServer {
479
695
  commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateDetails: 'Fully operational' },
480
696
  };
481
697
  }
482
- resume() {
698
+ async resume() {
483
699
  const device = this.endpoint.stateOf(MatterbridgeServer);
484
700
  device.log.info(`Resume (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
485
- device.commandHandler.executeHandler('resume', { request: {}, cluster: OperationalStateServer.id, attributes: this.state, endpoint: this.endpoint });
701
+ await device.commandHandler.executeHandler('OperationalState.resume', {
702
+ command: 'resume',
703
+ request: {},
704
+ cluster: OperationalStateServer.id,
705
+ attributes: this.state,
706
+ endpoint: this.endpoint,
707
+ });
486
708
  device.log.debug('MatterbridgeOperationalStateServer: resume called setting operational state to Running');
487
709
  this.state.operationalState = OperationalState.OperationalStateEnum.Running;
488
710
  this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateDetails: 'Fully operational' };
@@ -492,10 +714,16 @@ export class MatterbridgeOperationalStateServer extends OperationalStateServer {
492
714
  }
493
715
  }
494
716
  export class MatterbridgeServiceAreaServer extends ServiceAreaServer {
495
- selectAreas(request) {
717
+ async selectAreas(request) {
496
718
  const device = this.endpoint.stateOf(MatterbridgeServer);
497
719
  device.log.info(`Selecting areas ${request.newAreas} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
498
- device.commandHandler.executeHandler('selectAreas', { request, cluster: ServiceAreaServer.id, attributes: this.state, endpoint: this.endpoint });
720
+ await device.commandHandler.executeHandler('ServiceArea.selectAreas', {
721
+ command: 'selectAreas',
722
+ request,
723
+ cluster: ServiceAreaServer.id,
724
+ attributes: this.state,
725
+ endpoint: this.endpoint,
726
+ });
499
727
  for (const area of request.newAreas) {
500
728
  const supportedArea = this.state.supportedAreas.find((supportedArea) => supportedArea.areaId === area);
501
729
  if (!supportedArea) {
@@ -505,49 +733,79 @@ export class MatterbridgeServiceAreaServer extends ServiceAreaServer {
505
733
  }
506
734
  this.state.selectedAreas = request.newAreas;
507
735
  device.log.debug(`MatterbridgeServiceAreaServer selectAreas called with: ${request.newAreas.map((area) => area.toString()).join(', ')}`);
508
- return super.selectAreas(request);
736
+ return await super.selectAreas(request);
509
737
  }
510
738
  }
511
739
  export class MatterbridgeModeSelectServer extends ModeSelectServer {
512
- changeToMode(request) {
740
+ async changeToMode(request) {
513
741
  const device = this.endpoint.stateOf(MatterbridgeServer);
514
742
  device.log.info(`Changing mode to ${request.newMode} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
515
- device.commandHandler.executeHandler('changeToMode', { request, cluster: ModeSelectServer.id, attributes: this.state, endpoint: this.endpoint });
743
+ await device.commandHandler.executeHandler('ModeSelect.changeToMode', {
744
+ command: 'changeToMode',
745
+ request,
746
+ cluster: ModeSelectServer.id,
747
+ attributes: this.state,
748
+ endpoint: this.endpoint,
749
+ });
516
750
  device.log.debug(`MatterbridgeModeSelectServer: changeToMode called with mode: ${request.newMode}`);
517
751
  super.changeToMode(request);
518
752
  }
519
753
  }
520
754
  export class MatterbridgeHepaFilterMonitoringServer extends HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition) {
521
- resetCondition() {
755
+ async resetCondition() {
522
756
  const device = this.endpoint.stateOf(MatterbridgeServer);
523
757
  device.log.info(`Resetting condition (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
524
- device.commandHandler.executeHandler('resetCondition', { cluster: MatterbridgeHepaFilterMonitoringServer.id, attributes: this.state, endpoint: this.endpoint });
758
+ await device.commandHandler.executeHandler('HepaFilterMonitoring.resetCondition', {
759
+ command: 'resetCondition',
760
+ request: {},
761
+ cluster: MatterbridgeHepaFilterMonitoringServer.id,
762
+ attributes: this.state,
763
+ endpoint: this.endpoint,
764
+ });
525
765
  this.state.condition = 100;
526
766
  this.state.lastChangedTime = Math.floor(new Date().getTime() / 1000);
527
767
  device.log.debug(`MatterbridgeHepaFilterMonitoringServer: resetCondition called`);
528
768
  }
529
769
  }
530
770
  export class MatterbridgeActivatedCarbonFilterMonitoringServer extends ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition) {
531
- resetCondition() {
771
+ async resetCondition() {
532
772
  const device = this.endpoint.stateOf(MatterbridgeServer);
533
773
  device.log.info(`Resetting condition (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
534
- device.commandHandler.executeHandler('resetCondition', { cluster: MatterbridgeActivatedCarbonFilterMonitoringServer.id, attributes: this.state, endpoint: this.endpoint });
774
+ await device.commandHandler.executeHandler('ActivatedCarbonFilterMonitoring.resetCondition', {
775
+ command: 'resetCondition',
776
+ request: {},
777
+ cluster: MatterbridgeActivatedCarbonFilterMonitoringServer.id,
778
+ attributes: this.state,
779
+ endpoint: this.endpoint,
780
+ });
535
781
  this.state.condition = 100;
536
782
  this.state.lastChangedTime = Math.floor(new Date().getTime() / 1000);
537
783
  device.log.debug(`MatterbridgeActivatedCarbonFilterMonitoringServer: resetCondition called`);
538
784
  }
539
785
  }
540
786
  export class MatterbridgeDeviceEnergyManagementServer extends DeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.PowerAdjustment) {
541
- powerAdjustRequest(request) {
787
+ async powerAdjustRequest(request) {
542
788
  const device = this.endpoint.stateOf(MatterbridgeServer);
543
789
  device.log.info(`Adjusting power to ${request.power} duration ${request.duration} cause ${request.cause} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
544
- device.commandHandler.executeHandler('powerAdjustRequest', { request, cluster: DeviceEnergyManagementServer.id, attributes: this.state, endpoint: this.endpoint });
790
+ await device.commandHandler.executeHandler('DeviceEnergyManagement.powerAdjustRequest', {
791
+ command: 'powerAdjustRequest',
792
+ request,
793
+ cluster: DeviceEnergyManagementServer.id,
794
+ attributes: this.state,
795
+ endpoint: this.endpoint,
796
+ });
545
797
  device.log.debug(`MatterbridgeDeviceEnergyManagementServer powerAdjustRequest called with power ${request.power} duration ${request.duration} cause ${request.cause}`);
546
798
  }
547
- cancelPowerAdjustRequest() {
799
+ async cancelPowerAdjustRequest() {
548
800
  const device = this.endpoint.stateOf(MatterbridgeServer);
549
801
  device.log.info(`Cancelling power adjustment (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
550
- device.commandHandler.executeHandler('cancelPowerAdjustRequest', { cluster: DeviceEnergyManagementServer.id, attributes: this.state, endpoint: this.endpoint });
802
+ await device.commandHandler.executeHandler('DeviceEnergyManagement.cancelPowerAdjustRequest', {
803
+ command: 'cancelPowerAdjustRequest',
804
+ request: {},
805
+ cluster: DeviceEnergyManagementServer.id,
806
+ attributes: this.state,
807
+ endpoint: this.endpoint,
808
+ });
551
809
  device.log.debug(`MatterbridgeDeviceEnergyManagementServer cancelPowerAdjustRequest called`);
552
810
  }
553
811
  }
@@ -555,7 +813,13 @@ export class MatterbridgeDeviceEnergyManagementModeServer extends DeviceEnergyMa
555
813
  async changeToMode(request) {
556
814
  const device = this.endpoint.stateOf(MatterbridgeServer);
557
815
  device.log.info(`Changing mode to ${request.newMode} (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
558
- device.commandHandler.executeHandler('changeToMode', { request, cluster: DeviceEnergyManagementModeServer.id, attributes: this.state, endpoint: this.endpoint });
816
+ await device.commandHandler.executeHandler('DeviceEnergyManagementMode.changeToMode', {
817
+ command: 'changeToMode',
818
+ request,
819
+ cluster: DeviceEnergyManagementModeServer.id,
820
+ attributes: this.state,
821
+ endpoint: this.endpoint,
822
+ });
559
823
  const supported = this.state.supportedModes.find((mode) => mode.mode === request.newMode);
560
824
  if (!supported) {
561
825
  device.log.error(`MatterbridgeDeviceEnergyManagementModeServer changeToMode called with unsupported newMode: ${request.newMode}`);