matterbridge 3.0.1 → 3.0.2-dev-20250508-7214e17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/README.md +1 -1
- package/dist/cli.js +2 -37
- package/dist/cluster/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -23
- package/dist/deviceManager.js +1 -94
- package/dist/frontend.js +15 -328
- package/dist/index.js +2 -28
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.js +0 -2
- package/dist/matter/types.js +0 -2
- package/dist/matterbridge.js +80 -747
- package/dist/matterbridgeAccessoryPlatform.js +0 -34
- package/dist/matterbridgeBehaviors.js +109 -48
- package/dist/matterbridgeDeviceTypes.js +12 -431
- package/dist/matterbridgeDynamicPlatform.js +0 -34
- package/dist/matterbridgeEndpoint.js +13 -814
- package/dist/matterbridgeEndpointHelpers.js +29 -148
- package/dist/matterbridgePlatform.js +7 -225
- package/dist/matterbridgeTypes.js +0 -24
- package/dist/pluginManager.js +3 -264
- package/dist/roboticVacuumCleaner.js +87 -0
- package/dist/shelly.js +6 -146
- package/dist/storage/export.js +0 -1
- package/dist/update.js +1 -53
- package/dist/utils/colorUtils.js +2 -205
- package/dist/utils/{parameter.js → commandLine.js} +1 -54
- package/dist/utils/copyDirectory.js +1 -37
- package/dist/utils/createZip.js +2 -42
- package/dist/utils/deepCopy.js +8 -43
- package/dist/utils/deepEqual.js +7 -69
- package/dist/utils/export.js +2 -2
- package/dist/utils/hex.js +27 -0
- package/dist/utils/isvalid.js +3 -93
- package/dist/utils/network.js +7 -78
- package/dist/utils/wait.js +5 -48
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -2
- package/dist/cli.d.ts +0 -29
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cluster/export.d.ts +0 -2
- package/dist/cluster/export.d.ts.map +0 -1
- package/dist/cluster/export.js.map +0 -1
- package/dist/defaultConfigSchema.d.ts +0 -27
- package/dist/defaultConfigSchema.d.ts.map +0 -1
- package/dist/defaultConfigSchema.js.map +0 -1
- package/dist/deviceManager.d.ts +0 -114
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/frontend.d.ts +0 -240
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/index.d.ts +0 -35
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger/export.d.ts +0 -2
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/behaviors.d.ts +0 -2
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts +0 -2
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts +0 -2
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts +0 -2
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts +0 -5
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts +0 -3
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -433
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -40
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -1166
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -494
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -40
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -956
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -2706
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -294
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -187
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -273
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/shelly.d.ts +0 -92
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.js.map +0 -1
- package/dist/storage/export.d.ts +0 -2
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/update.d.ts +0 -32
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -61
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -32
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -38
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -31
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -53
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/export.d.ts +0 -10
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/isvalid.d.ts +0 -95
- package/dist/utils/isvalid.d.ts.map +0 -1
- package/dist/utils/isvalid.js.map +0 -1
- package/dist/utils/network.d.ts +0 -69
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/parameter.d.ts +0 -58
- package/dist/utils/parameter.d.ts.map +0 -1
- package/dist/utils/parameter.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -43
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
|
@@ -1,38 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the class MatterbridgeAccessoryPlatform.
|
|
3
|
-
*
|
|
4
|
-
* @file matterbridgeAccessoryPlatform.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2023-12-29
|
|
7
|
-
* @version 1.0.5
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2023, 2024, 2025 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License. *
|
|
22
|
-
*/
|
|
23
1
|
import { MatterbridgePlatform } from './matterbridgePlatform.js';
|
|
24
|
-
/**
|
|
25
|
-
* Represents a Matterbridge accessory platform.
|
|
26
|
-
*
|
|
27
|
-
* This class extends the MatterbridgePlatform class.
|
|
28
|
-
*/
|
|
29
2
|
export class MatterbridgeAccessoryPlatform extends MatterbridgePlatform {
|
|
30
|
-
/**
|
|
31
|
-
* Creates an instance of MatterbridgeAccessoryPlatform.
|
|
32
|
-
* @param {Matterbridge} matterbridge - The Matterbridge instance.
|
|
33
|
-
* @param {AnsiLogger} log - The logger instance.
|
|
34
|
-
* @param {PlatformConfig} config - The platform configuration.
|
|
35
|
-
*/
|
|
36
3
|
constructor(matterbridge, log, config) {
|
|
37
4
|
super(matterbridge, log, config);
|
|
38
5
|
this.type = 'AccessoryPlatform';
|
|
@@ -40,4 +7,3 @@ export class MatterbridgeAccessoryPlatform extends MatterbridgePlatform {
|
|
|
40
7
|
this.log.debug(`Matterbridge${this.type} loaded`);
|
|
41
8
|
}
|
|
42
9
|
}
|
|
43
|
-
//# sourceMappingURL=matterbridgeAccessoryPlatform.js.map
|
|
@@ -1,31 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
|
|
3
|
-
*
|
|
4
|
-
* @file matterbridgeBehaviors.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2024-11-07
|
|
7
|
-
* @version 1.0.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2024, 2025, 2026 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License. *
|
|
22
|
-
*/
|
|
23
|
-
/* eslint-disable @typescript-eslint/no-namespace */
|
|
24
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
25
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
26
|
-
// @matter
|
|
27
1
|
import { Behavior } from '@matter/main';
|
|
28
|
-
// @matter clusters
|
|
29
2
|
import { BooleanStateConfiguration } from '@matter/main/clusters/boolean-state-configuration';
|
|
30
3
|
import { ColorControl } from '@matter/main/clusters/color-control';
|
|
31
4
|
import { FanControl } from '@matter/main/clusters/fan-control';
|
|
@@ -35,7 +8,9 @@ import { ValveConfigurationAndControl } from '@matter/main/clusters/valve-config
|
|
|
35
8
|
import { SmokeCoAlarm } from '@matter/main/clusters/smoke-co-alarm';
|
|
36
9
|
import { BooleanStateConfigurationServer } from '@matter/main/behaviors/boolean-state-configuration';
|
|
37
10
|
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
38
|
-
|
|
11
|
+
import { ModeBase } from '@matter/main/clusters/mode-base';
|
|
12
|
+
import { RvcRunMode } from '@matter/main/clusters/rvc-run-mode';
|
|
13
|
+
import { RvcOperationalState } from '@matter/main/clusters/rvc-operational-state';
|
|
39
14
|
import { IdentifyServer } from '@matter/main/behaviors/identify';
|
|
40
15
|
import { OnOffServer } from '@matter/main/behaviors/on-off';
|
|
41
16
|
import { LevelControlServer } from '@matter/main/behaviors/level-control';
|
|
@@ -49,10 +24,15 @@ import { ModeSelectServer } from '@matter/main/behaviors/mode-select';
|
|
|
49
24
|
import { SmokeCoAlarmServer } from '@matter/main/behaviors/smoke-co-alarm';
|
|
50
25
|
import { SwitchServer } from '@matter/main/behaviors/switch';
|
|
51
26
|
import { OperationalStateServer } from '@matter/main/behaviors/operational-state';
|
|
27
|
+
import { RvcRunModeServer } from '@matter/main/behaviors/rvc-run-mode';
|
|
28
|
+
import { RvcCleanModeServer } from '@matter/main/behaviors/rvc-clean-mode';
|
|
29
|
+
import { RvcOperationalStateServer } from '@matter/main/behaviors/rvc-operational-state';
|
|
30
|
+
import { ServiceAreaServer } from '@matter/main/behaviors/service-area';
|
|
31
|
+
import { ServiceArea } from '@matter/main/clusters/service-area';
|
|
52
32
|
export class MatterbridgeServerDevice {
|
|
53
33
|
log;
|
|
54
34
|
commandHandler;
|
|
55
|
-
device;
|
|
35
|
+
device;
|
|
56
36
|
endpointId = undefined;
|
|
57
37
|
endpointNumber = undefined;
|
|
58
38
|
constructor(log, commandHandler, device) {
|
|
@@ -186,6 +166,14 @@ export class MatterbridgeServerDevice {
|
|
|
186
166
|
this.log.info(`Resume (endpoint ${this.endpointId}.${this.endpointNumber})`);
|
|
187
167
|
this.commandHandler.executeHandler('resume', { request: {}, attributes: {}, endpoint: { number: this.endpointNumber, uniqueStorageKey: this.endpointId } });
|
|
188
168
|
}
|
|
169
|
+
goHome() {
|
|
170
|
+
this.log.info(`GoHome (endpoint ${this.endpointId}.${this.endpointNumber})`);
|
|
171
|
+
this.commandHandler.executeHandler('goHome', { request: {}, attributes: {}, endpoint: { number: this.endpointNumber, uniqueStorageKey: this.endpointId } });
|
|
172
|
+
}
|
|
173
|
+
selectAreas({ newAreas }) {
|
|
174
|
+
this.log.info(`Selecting areas ${newAreas} (endpoint ${this.endpointId}.${this.endpointNumber})`);
|
|
175
|
+
this.commandHandler.executeHandler('selectAreas', { request: { newAreas }, attributes: {}, endpoint: { number: this.endpointNumber, uniqueStorageKey: this.endpointId } });
|
|
176
|
+
}
|
|
189
177
|
}
|
|
190
178
|
export class MatterbridgeServer extends Behavior {
|
|
191
179
|
static id = 'matterbridge';
|
|
@@ -308,7 +296,6 @@ export class MatterbridgeWindowCoveringServer extends WindowCoveringServer.with(
|
|
|
308
296
|
super.goToLiftPercentage({ liftPercent100thsValue });
|
|
309
297
|
}
|
|
310
298
|
async handleMovement(type, reversed, direction, targetPercent100ths) {
|
|
311
|
-
// Do nothing here, as the device will handle the movement
|
|
312
299
|
}
|
|
313
300
|
}
|
|
314
301
|
export class MatterbridgeDoorLockServer extends DoorLockServer {
|
|
@@ -355,8 +342,6 @@ export class MatterbridgeFanControlServer extends FanControlServer.with(FanContr
|
|
|
355
342
|
this.state.percentCurrent = Math.max(this.state.percentCurrent - 10, lowestOff ? 0 : 10);
|
|
356
343
|
}
|
|
357
344
|
device.log.debug('Set percentCurrent to:', this.state.percentCurrent);
|
|
358
|
-
// step is not implemented in matter.js
|
|
359
|
-
// super.step();
|
|
360
345
|
}
|
|
361
346
|
}
|
|
362
347
|
export class MatterbridgeThermostatServer extends ThermostatServer.with(Thermostat.Feature.Cooling, Thermostat.Feature.Heating, Thermostat.Feature.AutoMode) {
|
|
@@ -377,8 +362,6 @@ export class MatterbridgeThermostatServer extends ThermostatServer.with(Thermost
|
|
|
377
362
|
this.state.occupiedCoolingSetpoint = setpoint * 100;
|
|
378
363
|
device.log.debug('Set occupiedCoolingSetpoint to:', setpoint);
|
|
379
364
|
}
|
|
380
|
-
// setpointRaiseLower is not implemented in matter.js
|
|
381
|
-
// super.setpointRaiseLower();
|
|
382
365
|
}
|
|
383
366
|
}
|
|
384
367
|
export class MatterbridgeValveConfigurationAndControlServer extends ValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level) {
|
|
@@ -388,8 +371,6 @@ export class MatterbridgeValveConfigurationAndControlServer extends ValveConfigu
|
|
|
388
371
|
device.open({ openDuration, targetLevel });
|
|
389
372
|
this.state.targetLevel = targetLevel ?? 100;
|
|
390
373
|
this.state.currentLevel = targetLevel ?? 100;
|
|
391
|
-
// open is not implemented in matter.js
|
|
392
|
-
// super.open();
|
|
393
374
|
}
|
|
394
375
|
close() {
|
|
395
376
|
const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
|
|
@@ -397,8 +378,6 @@ export class MatterbridgeValveConfigurationAndControlServer extends ValveConfigu
|
|
|
397
378
|
device.close();
|
|
398
379
|
this.state.targetLevel = 0;
|
|
399
380
|
this.state.currentLevel = 0;
|
|
400
|
-
// close is not implemented in matter.js
|
|
401
|
-
// super.close();
|
|
402
381
|
}
|
|
403
382
|
}
|
|
404
383
|
export class MatterbridgeSmokeCoAlarmServer extends SmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm) {
|
|
@@ -406,8 +385,6 @@ export class MatterbridgeSmokeCoAlarmServer extends SmokeCoAlarmServer.with(Smok
|
|
|
406
385
|
const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
|
|
407
386
|
device.log.debug(`MatterbridgeSmokeCoAlarmServer: selfTestRequest called`);
|
|
408
387
|
device.selfTestRequest();
|
|
409
|
-
// selfTestRequest is not implemented in matter.js
|
|
410
|
-
// super.selfTestRequest();
|
|
411
388
|
}
|
|
412
389
|
}
|
|
413
390
|
export class MatterbridgeBooleanStateConfigurationServer extends BooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel) {
|
|
@@ -415,13 +392,10 @@ export class MatterbridgeBooleanStateConfigurationServer extends BooleanStateCon
|
|
|
415
392
|
const device = this.agent.get(MatterbridgeServer).state.deviceCommand;
|
|
416
393
|
device.log.debug(`MatterbridgeBooleanStateConfigurationServer: enableDisableAlarm called`);
|
|
417
394
|
device.enableDisableAlarm({ alarmsToEnableDisable });
|
|
418
|
-
// enableDisableAlarm is not implemented in matter.js
|
|
419
|
-
// super.enableDisableAlarm({ alarmsToEnableDisable });
|
|
420
395
|
}
|
|
421
396
|
}
|
|
422
397
|
export class MatterbridgeSwitchServer extends SwitchServer {
|
|
423
398
|
initialize() {
|
|
424
|
-
// Do nothing here, as the device will handle the switch logic: we need to convert something like "single" into the oppropriate states and events sequences
|
|
425
399
|
}
|
|
426
400
|
}
|
|
427
401
|
export class MatterbridgeOperationalStateServer extends OperationalStateServer {
|
|
@@ -437,7 +411,6 @@ export class MatterbridgeOperationalStateServer extends OperationalStateServer {
|
|
|
437
411
|
device.pause();
|
|
438
412
|
this.state.operationalState = OperationalState.OperationalStateEnum.Paused;
|
|
439
413
|
this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' };
|
|
440
|
-
// pause is not implemented in matter.js
|
|
441
414
|
return {
|
|
442
415
|
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
|
443
416
|
};
|
|
@@ -448,7 +421,6 @@ export class MatterbridgeOperationalStateServer extends OperationalStateServer {
|
|
|
448
421
|
device.stop();
|
|
449
422
|
this.state.operationalState = OperationalState.OperationalStateEnum.Stopped;
|
|
450
423
|
this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' };
|
|
451
|
-
// stop is not implemented in matter.js
|
|
452
424
|
return {
|
|
453
425
|
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
|
454
426
|
};
|
|
@@ -459,7 +431,6 @@ export class MatterbridgeOperationalStateServer extends OperationalStateServer {
|
|
|
459
431
|
device.start();
|
|
460
432
|
this.state.operationalState = OperationalState.OperationalStateEnum.Running;
|
|
461
433
|
this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' };
|
|
462
|
-
// start is not implemented in matter.js
|
|
463
434
|
return {
|
|
464
435
|
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
|
465
436
|
};
|
|
@@ -470,10 +441,100 @@ export class MatterbridgeOperationalStateServer extends OperationalStateServer {
|
|
|
470
441
|
device.resume();
|
|
471
442
|
this.state.operationalState = OperationalState.OperationalStateEnum.Running;
|
|
472
443
|
this.state.operationalError = { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' };
|
|
473
|
-
// resume is not implemented in matter.js
|
|
474
444
|
return {
|
|
475
445
|
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
|
476
446
|
};
|
|
477
447
|
}
|
|
478
448
|
}
|
|
479
|
-
|
|
449
|
+
export class MatterbridgeRvcRunModeServer extends RvcRunModeServer {
|
|
450
|
+
changeToMode({ newMode }) {
|
|
451
|
+
const device = this.endpoint.stateOf(MatterbridgeServer).deviceCommand;
|
|
452
|
+
const supported = this.state.supportedModes.find((mode) => mode.mode === newMode);
|
|
453
|
+
if (!supported) {
|
|
454
|
+
device.log.error(`MatterbridgeRvcRunModeServer changeToMode called with unsupported newMode: ${newMode}`);
|
|
455
|
+
return { status: ModeBase.ModeChangeStatus.UnsupportedMode, statusText: 'Unsupported mode' };
|
|
456
|
+
}
|
|
457
|
+
device.changeToMode({ newMode });
|
|
458
|
+
this.state.currentMode = newMode;
|
|
459
|
+
if (supported.modeTags.find((tag) => tag.value === RvcRunMode.ModeTag.Cleaning)) {
|
|
460
|
+
device.log.info('MatterbridgeRvcRunModeServer changeToMode called with newMode Cleaning => Running');
|
|
461
|
+
this.agent.get(MatterbridgeRvcOperationalStateServer).state.operationalState = RvcOperationalState.OperationalState.Running;
|
|
462
|
+
return { status: ModeBase.ModeChangeStatus.Success, statusText: 'Running' };
|
|
463
|
+
}
|
|
464
|
+
else if (supported.modeTags.find((tag) => tag.value === RvcRunMode.ModeTag.Idle)) {
|
|
465
|
+
device.log.info('MatterbridgeRvcRunModeServer changeToMode called with newMode Idle => Docked');
|
|
466
|
+
this.agent.get(MatterbridgeRvcOperationalStateServer).state.operationalState = RvcOperationalState.OperationalState.Docked;
|
|
467
|
+
return { status: ModeBase.ModeChangeStatus.Success, statusText: 'Docked' };
|
|
468
|
+
}
|
|
469
|
+
device.log.info(`MatterbridgeRvcRunModeServer changeToMode called with newMode ${newMode} => ${supported.label}`);
|
|
470
|
+
this.agent.get(MatterbridgeRvcOperationalStateServer).state.operationalState = RvcOperationalState.OperationalState.Running;
|
|
471
|
+
return { status: ModeBase.ModeChangeStatus.Success, statusText: 'Success' };
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
export class MatterbridgeRvcCleanModeServer extends RvcCleanModeServer {
|
|
475
|
+
changeToMode({ newMode }) {
|
|
476
|
+
const device = this.endpoint.stateOf(MatterbridgeServer).deviceCommand;
|
|
477
|
+
const supported = this.state.supportedModes.find((mode) => mode.mode === newMode);
|
|
478
|
+
if (!supported) {
|
|
479
|
+
device.log.error(`MatterbridgeRvcCleanModeServer changeToMode called with unsupported newMode: ${newMode}`);
|
|
480
|
+
return { status: ModeBase.ModeChangeStatus.UnsupportedMode, statusText: 'Unsupported mode' };
|
|
481
|
+
}
|
|
482
|
+
device.changeToMode({ newMode });
|
|
483
|
+
this.state.currentMode = newMode;
|
|
484
|
+
device.log.info(`MatterbridgeRvcCleanModeServer changeToMode called with newMode ${newMode} => ${supported.label}`);
|
|
485
|
+
return { status: ModeBase.ModeChangeStatus.Success, statusText: 'Success' };
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
export class MatterbridgeRvcOperationalStateServer extends RvcOperationalStateServer {
|
|
489
|
+
pause() {
|
|
490
|
+
const device = this.endpoint.stateOf(MatterbridgeServer).deviceCommand;
|
|
491
|
+
device.log.info('MatterbridgeRvcOperationalStateServer: pause called setting operational state to Paused and currentMode to Idle');
|
|
492
|
+
device.pause();
|
|
493
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
494
|
+
this.state.operationalState = RvcOperationalState.OperationalState.Paused;
|
|
495
|
+
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
496
|
+
return {
|
|
497
|
+
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
resume() {
|
|
501
|
+
const device = this.endpoint.stateOf(MatterbridgeServer).deviceCommand;
|
|
502
|
+
device.log.info('MatterbridgeRvcOperationalStateServer: resume called setting operational state to Running and currentMode to Cleaning');
|
|
503
|
+
device.resume();
|
|
504
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 2;
|
|
505
|
+
this.state.operationalState = RvcOperationalState.OperationalState.Running;
|
|
506
|
+
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
507
|
+
return {
|
|
508
|
+
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
goHome() {
|
|
512
|
+
const device = this.endpoint.stateOf(MatterbridgeServer).deviceCommand;
|
|
513
|
+
device.log.info('MatterbridgeRvcOperationalStateServer: goHome called setting operational state to Docked and currentMode to Idle');
|
|
514
|
+
device.goHome();
|
|
515
|
+
this.agent.get(MatterbridgeRvcRunModeServer).state.currentMode = 1;
|
|
516
|
+
this.state.operationalState = RvcOperationalState.OperationalState.Docked;
|
|
517
|
+
this.state.operationalError = { errorStateId: RvcOperationalState.ErrorState.NoError, errorStateLabel: 'No Error', errorStateDetails: 'Fully operational' };
|
|
518
|
+
return {
|
|
519
|
+
commandResponseState: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
export class MatterbridgeServiceAreaServer extends ServiceAreaServer {
|
|
524
|
+
selectAreas({ newAreas }) {
|
|
525
|
+
const device = this.endpoint.stateOf(MatterbridgeServer).deviceCommand;
|
|
526
|
+
for (const area of newAreas) {
|
|
527
|
+
const supportedArea = this.state.supportedAreas.find((supportedArea) => supportedArea.areaId === area);
|
|
528
|
+
if (!supportedArea) {
|
|
529
|
+
device.log.error(`MatterbridgeServiceAreaServer selectAreas called with unsupported area: ${area}`);
|
|
530
|
+
return { status: ServiceArea.SelectAreasStatus.UnsupportedArea, statusText: 'Unsupported areas' };
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
device.selectAreas({ newAreas });
|
|
534
|
+
this.state.selectedAreas = newAreas;
|
|
535
|
+
this.state.currentArea = newAreas[0];
|
|
536
|
+
device.log.info(`MatterbridgeServiceAreaServer selectAreas called with: ${newAreas.map((area) => area.toString()).join(', ')}`);
|
|
537
|
+
device.selectAreas({ newAreas });
|
|
538
|
+
return { status: ServiceArea.SelectAreasStatus.Success, statusText: 'Succesfully selected new areas' };
|
|
539
|
+
}
|
|
540
|
+
}
|