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