@matterbridge/core 3.10.7-dev-20260822-149e3eb → 3.10.7-dev-20260823-6142c00
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/behaviors/colorControlServer.d.ts +2 -0
- package/dist/behaviors/colorControlServer.js +77 -0
- package/dist/behaviors/levelControlServer.d.ts +2 -0
- package/dist/behaviors/levelControlServer.js +37 -0
- package/dist/behaviors/onOffServer.js +66 -54
- package/dist/behaviors/operationalStateServer.d.ts +12 -1
- package/dist/behaviors/operationalStateServer.js +77 -2
- package/dist/behaviors/valveConfigurationAndControlServer.d.ts +20 -2
- package/dist/behaviors/valveConfigurationAndControlServer.js +98 -11
- package/dist/chipTests.js +84 -1
- package/dist/demoDevices.js +26 -5
- package/dist/devices/closure.d.ts +18 -2
- package/dist/devices/closure.js +86 -2
- package/dist/devices/irrigationSystem.d.ts +5 -1
- package/dist/devices/irrigationSystem.js +35 -3
- package/dist/matterbridge.js +3 -2
- package/dist/matterbridgeEndpoint.d.ts +2 -2
- package/dist/matterbridgeEndpoint.js +10 -3
- package/dist/matterbridgeEndpointHelpers.d.ts +1 -1
- package/dist/matterbridgeEndpointHelpers.js +10 -10
- package/package.json +5 -5
|
@@ -1,7 +1,17 @@
|
|
|
1
|
+
import { Millis, Seconds, Time } from '@matter/general';
|
|
1
2
|
import { ValveConfigurationAndControlServer } from '@matter/node/behaviors/valve-configuration-and-control';
|
|
3
|
+
import { Status, StatusResponseError } from '@matter/types';
|
|
2
4
|
import { ValveConfigurationAndControl } from '@matter/types/clusters/valve-configuration-and-control';
|
|
3
5
|
import { MatterbridgeServer } from './matterbridgeServer.js';
|
|
4
|
-
|
|
6
|
+
const MatterbridgeValveConfigurationAndControlServerBase = ValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level);
|
|
7
|
+
export class MatterbridgeValveConfigurationAndControlServer extends MatterbridgeValveConfigurationAndControlServerBase {
|
|
8
|
+
initialize() {
|
|
9
|
+
if (process.env.MATTERBRIDGE_CHIP_TEST) {
|
|
10
|
+
this.state.movementDuration = 2000;
|
|
11
|
+
this.state.autoClose = true;
|
|
12
|
+
}
|
|
13
|
+
return super.initialize();
|
|
14
|
+
}
|
|
5
15
|
async open(request) {
|
|
6
16
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
7
17
|
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})`);
|
|
@@ -14,13 +24,25 @@ export class MatterbridgeValveConfigurationAndControlServer extends ValveConfigu
|
|
|
14
24
|
context: this.context,
|
|
15
25
|
});
|
|
16
26
|
device.log.debug(`MatterbridgeValveConfigurationAndControlServer: open called with openDuration: ${request.openDuration} targetLevel: ${request.targetLevel}`);
|
|
27
|
+
if (this.#hasFault()) {
|
|
28
|
+
throw new ValveConfigurationAndControl.FailureDueToFaultError('Open ignored: the valve has a registered fault');
|
|
29
|
+
}
|
|
30
|
+
this.#stopMovementTimer();
|
|
31
|
+
this.#stopAutoCloseTimer();
|
|
17
32
|
this.state.targetState = ValveConfigurationAndControl.ValveState.Open;
|
|
18
|
-
this.state.currentState = ValveConfigurationAndControl.ValveState.
|
|
19
|
-
this.state.
|
|
20
|
-
this.state.
|
|
21
|
-
this.
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
this.state.currentState = ValveConfigurationAndControl.ValveState.Transitioning;
|
|
34
|
+
this.state.openDuration = request.openDuration === undefined ? this.state.defaultOpenDuration : request.openDuration;
|
|
35
|
+
this.state.remainingDuration = this.state.openDuration;
|
|
36
|
+
if (this.features.level) {
|
|
37
|
+
if (request.targetLevel !== undefined && request.targetLevel !== 100 && this.state.levelStep !== undefined && request.targetLevel % this.state.levelStep !== 0) {
|
|
38
|
+
throw new StatusResponseError(`Open TargetLevel ${request.targetLevel} is not a multiple of LevelStep ${this.state.levelStep}`, Status.ConstraintError);
|
|
39
|
+
}
|
|
40
|
+
this.state.targetLevel = request.targetLevel ?? this.state.defaultOpenLevel ?? 100;
|
|
41
|
+
}
|
|
42
|
+
if (this.state.movementDuration > 0)
|
|
43
|
+
this.#scheduleMovementComplete(ValveConfigurationAndControl.ValveState.Open, this.state.targetLevel ?? 100);
|
|
44
|
+
if (this.state.autoClose && this.state.remainingDuration !== null)
|
|
45
|
+
this.#scheduleAutoClose();
|
|
24
46
|
}
|
|
25
47
|
async close() {
|
|
26
48
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
@@ -34,11 +56,76 @@ export class MatterbridgeValveConfigurationAndControlServer extends ValveConfigu
|
|
|
34
56
|
context: this.context,
|
|
35
57
|
});
|
|
36
58
|
device.log.debug(`MatterbridgeValveConfigurationAndControlServer: close called`);
|
|
37
|
-
this
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
this
|
|
59
|
+
if (this.#hasFault()) {
|
|
60
|
+
throw new ValveConfigurationAndControl.FailureDueToFaultError('Close ignored: the valve has a registered fault');
|
|
61
|
+
}
|
|
62
|
+
this.#stopMovementTimer();
|
|
63
|
+
this.#stopAutoCloseTimer();
|
|
41
64
|
this.state.openDuration = null;
|
|
42
65
|
this.state.remainingDuration = null;
|
|
66
|
+
this.state.targetState = ValveConfigurationAndControl.ValveState.Closed;
|
|
67
|
+
this.state.currentState = ValveConfigurationAndControl.ValveState.Transitioning;
|
|
68
|
+
if (this.features.level)
|
|
69
|
+
this.state.targetLevel = 0;
|
|
70
|
+
if (this.state.movementDuration > 0)
|
|
71
|
+
this.#scheduleMovementComplete(ValveConfigurationAndControl.ValveState.Closed, 0);
|
|
72
|
+
}
|
|
73
|
+
#hasFault() {
|
|
74
|
+
const fault = this.state.valveFault;
|
|
75
|
+
return fault !== undefined && Object.values(fault).some((bit) => bit === true);
|
|
76
|
+
}
|
|
77
|
+
#stopMovementTimer() {
|
|
78
|
+
this.internal.movementTimer?.stop();
|
|
79
|
+
this.internal.movementTimer = undefined;
|
|
80
|
+
}
|
|
81
|
+
#stopAutoCloseTimer() {
|
|
82
|
+
this.internal.autoCloseTimer?.stop();
|
|
83
|
+
this.internal.autoCloseTimer = undefined;
|
|
84
|
+
}
|
|
85
|
+
#scheduleMovementComplete(finalState, finalLevel) {
|
|
86
|
+
this.internal.movementFinalState = finalState;
|
|
87
|
+
this.internal.movementFinalLevel = finalLevel;
|
|
88
|
+
this.internal.movementTimer = Time.getTimer('ValveConfigurationAndControl movement complete', Millis(this.state.movementDuration), this.callback(this.#completeMovement, { lock: true })).start();
|
|
89
|
+
}
|
|
90
|
+
#completeMovement() {
|
|
91
|
+
this.internal.movementTimer = undefined;
|
|
92
|
+
this.state.currentState = this.internal.movementFinalState;
|
|
93
|
+
if (this.features.level)
|
|
94
|
+
this.state.currentLevel = this.internal.movementFinalLevel;
|
|
95
|
+
this.state.targetState = null;
|
|
96
|
+
if (this.features.level)
|
|
97
|
+
this.state.targetLevel = null;
|
|
98
|
+
}
|
|
99
|
+
#scheduleAutoClose() {
|
|
100
|
+
this.internal.autoCloseTimer = Time.getPeriodicTimer('ValveConfigurationAndControl auto close', Seconds(1), this.callback(this.#tickAutoClose, { lock: true })).start();
|
|
101
|
+
}
|
|
102
|
+
#tickAutoClose() {
|
|
103
|
+
if (this.state.remainingDuration === null)
|
|
104
|
+
return;
|
|
105
|
+
const remaining = Math.max(0, this.state.remainingDuration - 1);
|
|
106
|
+
this.state.remainingDuration = remaining;
|
|
107
|
+
if (remaining === 0) {
|
|
108
|
+
this.#stopAutoCloseTimer();
|
|
109
|
+
void this.close();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async [Symbol.asyncDispose]() {
|
|
113
|
+
this.#stopMovementTimer();
|
|
114
|
+
this.#stopAutoCloseTimer();
|
|
115
|
+
await super[Symbol.asyncDispose]?.();
|
|
43
116
|
}
|
|
44
117
|
}
|
|
118
|
+
(function (MatterbridgeValveConfigurationAndControlServer) {
|
|
119
|
+
class Internal extends MatterbridgeValveConfigurationAndControlServerBase.Internal {
|
|
120
|
+
movementTimer;
|
|
121
|
+
movementFinalState = ValveConfigurationAndControl.ValveState.Closed;
|
|
122
|
+
movementFinalLevel = 0;
|
|
123
|
+
autoCloseTimer;
|
|
124
|
+
}
|
|
125
|
+
MatterbridgeValveConfigurationAndControlServer.Internal = Internal;
|
|
126
|
+
class State extends MatterbridgeValveConfigurationAndControlServerBase.State {
|
|
127
|
+
movementDuration = 0;
|
|
128
|
+
autoClose = false;
|
|
129
|
+
}
|
|
130
|
+
MatterbridgeValveConfigurationAndControlServer.State = State;
|
|
131
|
+
})(MatterbridgeValveConfigurationAndControlServer || (MatterbridgeValveConfigurationAndControlServer = {}));
|
package/dist/chipTests.js
CHANGED
|
@@ -6,9 +6,11 @@ import { BridgedDeviceBasicInformationServer } from '@matter/node/behaviors/brid
|
|
|
6
6
|
import { GeneralDiagnosticsServer } from '@matter/node/behaviors/general-diagnostics';
|
|
7
7
|
import { Status, StatusResponseError } from '@matter/types';
|
|
8
8
|
import { BooleanStateConfiguration } from '@matter/types/clusters/boolean-state-configuration';
|
|
9
|
+
import { ClosureControl } from '@matter/types/clusters/closure-control';
|
|
9
10
|
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
10
11
|
import { ElectricalEnergyMeasurement } from '@matter/types/clusters/electrical-energy-measurement';
|
|
11
12
|
import { ElectricalPowerMeasurement } from '@matter/types/clusters/electrical-power-measurement';
|
|
13
|
+
import { OperationalState } from '@matter/types/clusters/operational-state';
|
|
12
14
|
import { SmokeCoAlarm } from '@matter/types/clusters/smoke-co-alarm';
|
|
13
15
|
import { MatterbridgeOccupancySensingServer } from './behaviors/occupancySensingServer.js';
|
|
14
16
|
import { cliEmitter } from './cliEmitter.js';
|
|
@@ -47,6 +49,12 @@ const deviceEnergyManagementForecastTrigger = 0x009800000000000fn;
|
|
|
47
49
|
const deviceEnergyManagementForecastClearTrigger = 0x0098000000000010n;
|
|
48
50
|
const booleanStateConfigurationSensorTrigger = 0x0080000000000000n;
|
|
49
51
|
const booleanStateConfigurationSensorUntriggerTrigger = 0x0080000000000001n;
|
|
52
|
+
const closureControlErrorTrigger = 0x0104000000000000n;
|
|
53
|
+
const closureControlProtectedTrigger = 0x0104000000000001n;
|
|
54
|
+
const closureControlDisengagedTrigger = 0x0104000000000002n;
|
|
55
|
+
const closureControlSetupRequiredTrigger = 0x0104000000000003n;
|
|
56
|
+
const closureControlClearTrigger = 0x0104000000000004n;
|
|
57
|
+
const closureControlEndpointTriggerMask = 0x0000ffff00000000n;
|
|
50
58
|
export const chipTestEnableKey = Uint8Array.from({ length: 16 }, (_, index) => index);
|
|
51
59
|
const smokeCoAlarmChipTestEnableKey = Uint8Array.from([0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff]);
|
|
52
60
|
let chipTestMatterbridge;
|
|
@@ -198,6 +206,14 @@ async function handleChipTestEventTrigger(eventTrigger) {
|
|
|
198
206
|
if (eventTrigger === booleanStateConfigurationSensorTrigger || eventTrigger === booleanStateConfigurationSensorUntriggerTrigger) {
|
|
199
207
|
return await handleBooleanStateConfigurationTestEventTrigger(eventTrigger);
|
|
200
208
|
}
|
|
209
|
+
const closureControlTrigger = eventTrigger & ~closureControlEndpointTriggerMask;
|
|
210
|
+
if (closureControlTrigger === closureControlErrorTrigger ||
|
|
211
|
+
closureControlTrigger === closureControlProtectedTrigger ||
|
|
212
|
+
closureControlTrigger === closureControlDisengagedTrigger ||
|
|
213
|
+
closureControlTrigger === closureControlSetupRequiredTrigger ||
|
|
214
|
+
closureControlTrigger === closureControlClearTrigger) {
|
|
215
|
+
return await handleClosureControlTestEventTrigger(closureControlTrigger);
|
|
216
|
+
}
|
|
201
217
|
if (eventTrigger !== smokeCoAlarmWarningSmokeAlarmTrigger &&
|
|
202
218
|
eventTrigger !== smokeCoAlarmCriticalSmokeAlarmTrigger &&
|
|
203
219
|
eventTrigger !== smokeCoAlarmSmokeAlarmClearTrigger &&
|
|
@@ -354,6 +370,44 @@ async function applyBooleanStateConfigurationTestEventTrigger(endpoint, eventTri
|
|
|
354
370
|
return;
|
|
355
371
|
}
|
|
356
372
|
}
|
|
373
|
+
async function handleClosureControlTestEventTrigger(eventTrigger) {
|
|
374
|
+
if (!chipTestMatterbridge || chipTestActiveEndpointId === undefined)
|
|
375
|
+
return false;
|
|
376
|
+
const endpoint = getChipTestEndpoint(chipTestMatterbridge, chipTestActiveEndpointId);
|
|
377
|
+
if (!endpoint || !endpoint.hasClusterServer(ClosureControl.id))
|
|
378
|
+
return false;
|
|
379
|
+
await applyClosureControlTestEventTrigger(endpoint, eventTrigger, chipTestMatterbridge.log);
|
|
380
|
+
return true;
|
|
381
|
+
}
|
|
382
|
+
async function applyClosureControlTestEventTrigger(endpoint, eventTrigger, log) {
|
|
383
|
+
switch (eventTrigger) {
|
|
384
|
+
case closureControlErrorTrigger: {
|
|
385
|
+
const errorState = [ClosureControl.ClosureError.PhysicallyBlocked];
|
|
386
|
+
await endpoint.setCluster(ClosureControl, { mainState: ClosureControl.MainState.Error, currentErrorList: errorState }, log);
|
|
387
|
+
await endpoint.triggerEvent(ClosureControl, 'operationalError', { errorState }, log);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
case closureControlProtectedTrigger:
|
|
391
|
+
await endpoint.setCluster(ClosureControl, { mainState: ClosureControl.MainState.Protected }, log);
|
|
392
|
+
return;
|
|
393
|
+
case closureControlDisengagedTrigger:
|
|
394
|
+
await endpoint.setCluster(ClosureControl, { mainState: ClosureControl.MainState.Disengaged }, log);
|
|
395
|
+
await endpoint.triggerEvent(ClosureControl, 'engageStateChanged', { engageValue: false }, log);
|
|
396
|
+
return;
|
|
397
|
+
case closureControlSetupRequiredTrigger:
|
|
398
|
+
await endpoint.setCluster(ClosureControl, { mainState: ClosureControl.MainState.SetupRequired }, log);
|
|
399
|
+
return;
|
|
400
|
+
case closureControlClearTrigger: {
|
|
401
|
+
const wasDisengaged = endpoint.getAttribute(ClosureControl.id, 'mainState') === ClosureControl.MainState.Disengaged;
|
|
402
|
+
await endpoint.setCluster(ClosureControl, { mainState: ClosureControl.MainState.Stopped, currentErrorList: [] }, log);
|
|
403
|
+
if (wasDisengaged)
|
|
404
|
+
await endpoint.triggerEvent(ClosureControl, 'engageStateChanged', { engageValue: true }, log);
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
default:
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
357
411
|
const electricalPowerMeasurementIdleReading = { voltage: 220_000, activeCurrent: 1_000, activePower: 220_000_000, frequency: 50_000 };
|
|
358
412
|
const electricalEnergyMeasurementImportedEnergyPerTick = 278;
|
|
359
413
|
const electricalEnergyMeasurementExportedEnergyPerTick = 833;
|
|
@@ -526,6 +580,32 @@ async function handleChipTestAppPipeCommand(matterbridge, command) {
|
|
|
526
580
|
await endpoint.setStateOf(endpoint.behaviors.supported.soilMeasurement, { soilMoistureMeasuredValue: command.SoilMoistureValue ?? null });
|
|
527
581
|
matterbridge.log.info(`CHIP test app pipe set SoilMeasurement.SoilMoistureMeasuredValue to ${command.SoilMoistureValue ?? null} on endpoint ${endpointId}`);
|
|
528
582
|
return;
|
|
583
|
+
case 'OperationalStateChange':
|
|
584
|
+
switch (command.Operation) {
|
|
585
|
+
case 'Stop':
|
|
586
|
+
await endpoint.setStateOf(endpoint.behaviors.supported.operationalState, { operationalState: OperationalState.OperationalStateEnum.Stopped });
|
|
587
|
+
break;
|
|
588
|
+
case 'Start':
|
|
589
|
+
await endpoint.setStateOf(endpoint.behaviors.supported.operationalState, { operationalState: OperationalState.OperationalStateEnum.Running });
|
|
590
|
+
break;
|
|
591
|
+
case 'Pause':
|
|
592
|
+
await endpoint.setStateOf(endpoint.behaviors.supported.operationalState, { operationalState: OperationalState.OperationalStateEnum.Paused });
|
|
593
|
+
break;
|
|
594
|
+
case 'OnFault': {
|
|
595
|
+
const errorStateId = command.Param ?? OperationalState.ErrorState.NoError;
|
|
596
|
+
const isNoError = errorStateId === OperationalState.ErrorState.NoError;
|
|
597
|
+
await endpoint.setStateOf(endpoint.behaviors.supported.operationalState, {
|
|
598
|
+
operationalError: { errorStateId, errorStateDetails: isNoError ? 'Fully operational' : 'Simulated CHIP test fault' },
|
|
599
|
+
...(isNoError ? {} : { operationalState: OperationalState.OperationalStateEnum.Error }),
|
|
600
|
+
});
|
|
601
|
+
break;
|
|
602
|
+
}
|
|
603
|
+
default:
|
|
604
|
+
matterbridge.log.warn(`Ignoring unsupported CHIP test app pipe OperationalStateChange operation: ${JSON.stringify(command)}`);
|
|
605
|
+
return;
|
|
606
|
+
}
|
|
607
|
+
matterbridge.log.info(`CHIP test app pipe OperationalStateChange(${command.Operation}${command.Param === undefined ? '' : `, ${command.Param}`}) applied on endpoint ${endpointId}`);
|
|
608
|
+
return;
|
|
529
609
|
default:
|
|
530
610
|
matterbridge.log.warn(`Ignoring unsupported CHIP test app pipe command: ${JSON.stringify(command)}`);
|
|
531
611
|
}
|
|
@@ -553,5 +633,8 @@ function isChipTestAppPipeCommand(value) {
|
|
|
553
633
|
(!('NewState' in value) || typeof value.NewState === 'boolean') &&
|
|
554
634
|
(!('Occupancy' in value) || typeof value.Occupancy === 'number') &&
|
|
555
635
|
(!('SensorFault' in value) || typeof value.SensorFault === 'number') &&
|
|
556
|
-
(!('SoilMoistureValue' in value) || typeof value.SoilMoistureValue === 'number')
|
|
636
|
+
(!('SoilMoistureValue' in value) || typeof value.SoilMoistureValue === 'number') &&
|
|
637
|
+
(!('Device' in value) || typeof value.Device === 'string') &&
|
|
638
|
+
(!('Operation' in value) || typeof value.Operation === 'string') &&
|
|
639
|
+
(!('Param' in value) || typeof value.Param === 'number'));
|
|
557
640
|
}
|
package/dist/demoDevices.js
CHANGED
|
@@ -32,7 +32,7 @@ export async function createDemoDevices(matterbridge) {
|
|
|
32
32
|
description: 'Matterbridge demo devices',
|
|
33
33
|
author: 'Matterbridge',
|
|
34
34
|
enabled: false,
|
|
35
|
-
private:
|
|
35
|
+
private: true,
|
|
36
36
|
registeredDevices: 0,
|
|
37
37
|
});
|
|
38
38
|
const registerDevice = async (device, deviceName, serialNumber) => {
|
|
@@ -105,10 +105,11 @@ export async function createDemoDevices(matterbridge) {
|
|
|
105
105
|
await registerDevice(ep, 'Pump', 'ACTUATOR-05-05');
|
|
106
106
|
ep = new MatterbridgeEndpoint([getSupportedDeviceType('WaterValve'), bridgedNode, powerSource], { id: 'WaterValve', number: EndpointNumber(5_06) });
|
|
107
107
|
ep.createDefaultPowerSourceWiredClusterServer();
|
|
108
|
+
ep.createDefaultValveConfigurationAndControlClusterServer(undefined, undefined, 5000, true);
|
|
108
109
|
await registerDevice(ep, 'Water Valve', 'ACTUATOR-05-06');
|
|
109
|
-
ep = new IrrigationSystem('Irrigation System with 2 zones', 'ACTUATOR-05-07', { id: 'IrrigationSystem', number: EndpointNumber(5_07) });
|
|
110
|
-
ep.addZone(getSemtag(CommonNumberTag.One), 'IrrigationSystemZone1', EndpointNumber(5_07_1));
|
|
111
|
-
ep.addZone(getSemtag(CommonNumberTag.Two), 'IrrigationSystemZone2', EndpointNumber(5_07_2));
|
|
110
|
+
ep = new IrrigationSystem('Irrigation System with 2 zones', 'ACTUATOR-05-07', { id: 'IrrigationSystem', number: EndpointNumber(5_07), autoOpenClose: true });
|
|
111
|
+
ep.addZone(getSemtag(CommonNumberTag.One), 'IrrigationSystemZone1', EndpointNumber(5_07_1), 5000, true);
|
|
112
|
+
ep.addZone(getSemtag(CommonNumberTag.Two), 'IrrigationSystemZone2', EndpointNumber(5_07_2), 5000, true);
|
|
112
113
|
await registerDevice(ep, 'Irrigation System with 2 zones', 'ACTUATOR-05-07');
|
|
113
114
|
ep = new MatterbridgeEndpoint([getSupportedDeviceType('OnOffLightSwitch'), bridgedNode, powerSource], { id: 'OnOffLightSwitch', number: EndpointNumber(6_01) });
|
|
114
115
|
ep.createDefaultPowerSourceWiredClusterServer();
|
|
@@ -201,13 +202,18 @@ export async function createDemoDevices(matterbridge) {
|
|
|
201
202
|
await registerDevice(ep, 'Door Lock Controller', 'ENTRY-08-02');
|
|
202
203
|
ep = new MatterbridgeEndpoint([getSupportedDeviceType('WindowCovering'), bridgedNode, powerSource], { id: 'WindowCovering', number: EndpointNumber(8_03) });
|
|
203
204
|
await registerDevice(ep, 'Window Covering', 'ENTRY-08-03');
|
|
205
|
+
ep = new MatterbridgeEndpoint([getSupportedDeviceType('WindowCovering'), bridgedNode, powerSource], { id: 'WindowCoveringTilt', number: EndpointNumber(8_03_1) });
|
|
206
|
+
ep.createDefaultLiftTiltWindowCoveringClusterServer();
|
|
207
|
+
await registerDevice(ep, 'Window Covering Tilt', 'ENTRY-08-03-1');
|
|
204
208
|
ep = new MatterbridgeEndpoint([getSupportedDeviceType('WindowCoveringController'), bridgedNode, powerSource], { id: 'WindowCoveringController', number: EndpointNumber(8_04) });
|
|
205
209
|
await registerDevice(ep, 'Window Covering Controller', 'ENTRY-08-04');
|
|
206
|
-
ep = new Closure('Closure', 'ENTRY-08-05', { id: 'Closure', number: EndpointNumber(8_05) });
|
|
210
|
+
ep = new Closure('Closure', 'ENTRY-08-05', { id: 'Closure', number: EndpointNumber(8_05), movementDuration: 2000, calibrationDuration: 2000 });
|
|
207
211
|
await registerDevice(ep, 'Closure', 'ENTRY-08-05');
|
|
208
212
|
ep = new Closure('Closure Pedestrian', 'ENTRY-08-05-1', {
|
|
209
213
|
id: 'ClosurePedestrian',
|
|
210
214
|
number: EndpointNumber(8_05_1),
|
|
215
|
+
movementDuration: 2000,
|
|
216
|
+
calibrationDuration: 2000,
|
|
211
217
|
pedestrian: true,
|
|
212
218
|
tagList: [getSemtag(ClosureTag.Gate)],
|
|
213
219
|
});
|
|
@@ -215,6 +221,8 @@ export async function createDemoDevices(matterbridge) {
|
|
|
215
221
|
ep = new Closure('Closure Ventilation', 'ENTRY-08-05-2', {
|
|
216
222
|
id: 'ClosureVentilation',
|
|
217
223
|
number: EndpointNumber(8_05_2),
|
|
224
|
+
movementDuration: 2000,
|
|
225
|
+
calibrationDuration: 2000,
|
|
218
226
|
ventilation: true,
|
|
219
227
|
tagList: [getSemtag(ClosureTag.Window), getSemtag(ClosureWindowTag.Facade)],
|
|
220
228
|
});
|
|
@@ -222,10 +230,23 @@ export async function createDemoDevices(matterbridge) {
|
|
|
222
230
|
ep = new Closure('Closure Calibrate', 'ENTRY-08-05-3', {
|
|
223
231
|
id: 'ClosureCalibrate',
|
|
224
232
|
number: EndpointNumber(8_05_3),
|
|
233
|
+
movementDuration: 2000,
|
|
234
|
+
calibrationDuration: 2000,
|
|
225
235
|
calibration: true,
|
|
226
236
|
tagList: [getSemtag(ClosureTag.GarageDoor)],
|
|
227
237
|
});
|
|
228
238
|
await registerDevice(ep, 'Closure Calibrate', 'ENTRY-08-05-3');
|
|
239
|
+
ep = new Closure('Closure Complete', 'ENTRY-08-05-4', {
|
|
240
|
+
id: 'ClosureComplete',
|
|
241
|
+
number: EndpointNumber(8_05_4),
|
|
242
|
+
movementDuration: 2000,
|
|
243
|
+
calibrationDuration: 2000,
|
|
244
|
+
ventilation: true,
|
|
245
|
+
pedestrian: true,
|
|
246
|
+
calibration: true,
|
|
247
|
+
tagList: [getSemtag(ClosureTag.Door)],
|
|
248
|
+
});
|
|
249
|
+
await registerDevice(ep, 'Closure Complete', 'ENTRY-08-05-4');
|
|
229
250
|
ep = new MatterbridgeEndpoint([getSupportedDeviceType('ClosureController'), bridgedNode, powerSource], { id: 'ClosureController', number: EndpointNumber(8_07) });
|
|
230
251
|
await registerDevice(ep, 'Closure Controller', 'ENTRY-08-07');
|
|
231
252
|
ep = new MatterbridgeEndpoint([getSupportedDeviceType('Thermostat'), bridgedNode, powerSource], { id: 'Thermostat', number: EndpointNumber(9_01) });
|
|
@@ -5,7 +5,7 @@ import { Identify } from '@matter/types/clusters/identify';
|
|
|
5
5
|
import type { Semtag } from '@matter/types/globals';
|
|
6
6
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
7
7
|
import { type ClosureDimensionType, type ClosurePanelOptions } from './closurePanel.js';
|
|
8
|
-
declare const
|
|
8
|
+
declare const MatterbridgeClosureControlServerBase: import("@matter/node").ClusterBehavior.Type<typeof ClosureControlServer, import("@matter/types").ClusterType.WithSupportedFeatures<ClosureControl, {
|
|
9
9
|
calibration: true;
|
|
10
10
|
instantaneous: false;
|
|
11
11
|
manuallyOperable: false;
|
|
@@ -16,10 +16,24 @@ declare const MatterbridgeClosureControlServer_base: import("@matter/node").Clus
|
|
|
16
16
|
speed: true;
|
|
17
17
|
ventilation: false;
|
|
18
18
|
}>, import("@matter/types").ClusterType.Concrete, new () => {}, "closureControl">;
|
|
19
|
-
export declare class MatterbridgeClosureControlServer extends
|
|
19
|
+
export declare class MatterbridgeClosureControlServer extends MatterbridgeClosureControlServerBase {
|
|
20
|
+
readonly state: MatterbridgeClosureControlServer.State;
|
|
21
|
+
protected internal: MatterbridgeClosureControlServer.Internal;
|
|
20
22
|
moveTo: (request: ClosureControl.MoveToRequest) => Promise<void>;
|
|
23
|
+
private completeMoveTo;
|
|
21
24
|
stop: () => Promise<void>;
|
|
22
25
|
calibrate: () => Promise<void>;
|
|
26
|
+
private completeCalibrate;
|
|
27
|
+
}
|
|
28
|
+
export declare namespace MatterbridgeClosureControlServer {
|
|
29
|
+
class Internal extends MatterbridgeClosureControlServerBase.Internal {
|
|
30
|
+
movementTimer?: NodeJS.Timeout;
|
|
31
|
+
calibrateTimer?: NodeJS.Timeout;
|
|
32
|
+
}
|
|
33
|
+
class State extends MatterbridgeClosureControlServerBase.State {
|
|
34
|
+
movementDuration: number;
|
|
35
|
+
calibrationDuration: number;
|
|
36
|
+
}
|
|
23
37
|
}
|
|
24
38
|
export interface ClosureOptions {
|
|
25
39
|
identifyTime?: number;
|
|
@@ -31,6 +45,8 @@ export interface ClosureOptions {
|
|
|
31
45
|
overallCurrentState?: ClosureControl.OverallCurrentState;
|
|
32
46
|
overallTargetState?: ClosureControl.OverallTargetState;
|
|
33
47
|
latchControlModes?: ClosureControl.LatchControlModes;
|
|
48
|
+
movementDuration?: number;
|
|
49
|
+
calibrationDuration?: number;
|
|
34
50
|
ventilation?: boolean;
|
|
35
51
|
pedestrian?: boolean;
|
|
36
52
|
calibration?: boolean;
|
package/dist/devices/closure.js
CHANGED
|
@@ -9,7 +9,15 @@ import { closure, closurePanel, powerSource } from '../matterbridgeDeviceTypes.j
|
|
|
9
9
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
10
10
|
import { getSemtag } from '../matterbridgeEndpointHelpers.js';
|
|
11
11
|
import { createClosureDimensionClusterServer } from './closurePanel.js';
|
|
12
|
-
|
|
12
|
+
const targetToCurrentPosition = {
|
|
13
|
+
[ClosureControl.TargetPosition.MoveToFullyClosed]: ClosureControl.CurrentPosition.FullyClosed,
|
|
14
|
+
[ClosureControl.TargetPosition.MoveToFullyOpen]: ClosureControl.CurrentPosition.FullyOpened,
|
|
15
|
+
[ClosureControl.TargetPosition.MoveToPedestrianPosition]: ClosureControl.CurrentPosition.OpenedForPedestrian,
|
|
16
|
+
[ClosureControl.TargetPosition.MoveToVentilationPosition]: ClosureControl.CurrentPosition.OpenedForVentilation,
|
|
17
|
+
[ClosureControl.TargetPosition.MoveToSignaturePosition]: ClosureControl.CurrentPosition.OpenedAtSignature,
|
|
18
|
+
};
|
|
19
|
+
const MatterbridgeClosureControlServerBase = ClosureControlServer.with(ClosureControl.Feature.Positioning, ClosureControl.Feature.MotionLatching, ClosureControl.Feature.Speed, ClosureControl.Feature.Calibration);
|
|
20
|
+
export class MatterbridgeClosureControlServer extends MatterbridgeClosureControlServerBase {
|
|
13
21
|
moveTo = async (request) => {
|
|
14
22
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
15
23
|
device.log.info(`MoveTo (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
@@ -20,6 +28,15 @@ export class MatterbridgeClosureControlServer extends ClosureControlServer.with(
|
|
|
20
28
|
attributes: this.state,
|
|
21
29
|
endpoint: this.endpoint,
|
|
22
30
|
});
|
|
31
|
+
if (request.position !== undefined && !(request.position in targetToCurrentPosition)) {
|
|
32
|
+
throw new StatusResponse.ConstraintErrorError('ClosureControl.moveTo Position is not a valid TargetPositionEnum value');
|
|
33
|
+
}
|
|
34
|
+
if (request.latch !== undefined && typeof request.latch !== 'boolean') {
|
|
35
|
+
throw new StatusResponse.ConstraintErrorError('ClosureControl.moveTo Latch is not a boolean value');
|
|
36
|
+
}
|
|
37
|
+
if (request.speed !== undefined && !(request.speed in ThreeLevelAuto)) {
|
|
38
|
+
throw new StatusResponse.ConstraintErrorError('ClosureControl.moveTo Speed is not a valid ThreeLevelAutoEnum value');
|
|
39
|
+
}
|
|
23
40
|
if (request.position === undefined && request.latch === undefined && request.speed === undefined) {
|
|
24
41
|
throw new StatusResponse.InvalidCommandError('ClosureControl.moveTo requires at least one of position, latch, or speed to be present');
|
|
25
42
|
}
|
|
@@ -47,6 +64,38 @@ export class MatterbridgeClosureControlServer extends ClosureControlServer.with(
|
|
|
47
64
|
(nextTarget.latch === undefined || nextTarget.latch === currentState.latch) &&
|
|
48
65
|
nextTarget.speed === currentState.speed;
|
|
49
66
|
this.state.mainState = isAtTarget ? ClosureControl.MainState.Stopped : ClosureControl.MainState.Moving;
|
|
67
|
+
clearTimeout(this.internal.movementTimer);
|
|
68
|
+
if (isAtTarget) {
|
|
69
|
+
this.internal.movementTimer = undefined;
|
|
70
|
+
this.state.countdownTime = 0;
|
|
71
|
+
}
|
|
72
|
+
else if (currentState === null || this.state.movementDuration <= 0) {
|
|
73
|
+
this.internal.movementTimer = undefined;
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this.state.countdownTime = this.state.movementDuration / 1000;
|
|
77
|
+
const previousState = currentState;
|
|
78
|
+
this.internal.movementTimer = setTimeout(() => {
|
|
79
|
+
this.internal.movementTimer = undefined;
|
|
80
|
+
void this.completeMoveTo(nextTarget, previousState);
|
|
81
|
+
}, this.state.movementDuration);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
completeMoveTo = async (targetState, previousState) => {
|
|
85
|
+
const closure = this.endpoint;
|
|
86
|
+
let position = previousState.position;
|
|
87
|
+
if (targetState.position !== undefined && targetState.position !== null) {
|
|
88
|
+
const mappedPosition = targetToCurrentPosition[targetState.position];
|
|
89
|
+
if (mappedPosition !== undefined)
|
|
90
|
+
position = mappedPosition;
|
|
91
|
+
}
|
|
92
|
+
const latch = targetState.latch ?? previousState.latch;
|
|
93
|
+
const secureState = latch === true;
|
|
94
|
+
await closure.setState({ position, latch, speed: targetState.speed, secureState }, targetState, ClosureControl.MainState.Stopped, 0);
|
|
95
|
+
if (secureState !== previousState.secureState) {
|
|
96
|
+
await closure.triggerSecureStateChanged(secureState);
|
|
97
|
+
}
|
|
98
|
+
await closure.triggerMovementCompleted();
|
|
50
99
|
};
|
|
51
100
|
stop = async () => {
|
|
52
101
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
@@ -58,8 +107,13 @@ export class MatterbridgeClosureControlServer extends ClosureControlServer.with(
|
|
|
58
107
|
attributes: this.state,
|
|
59
108
|
endpoint: this.endpoint,
|
|
60
109
|
});
|
|
110
|
+
clearTimeout(this.internal.movementTimer);
|
|
111
|
+
this.internal.movementTimer = undefined;
|
|
112
|
+
clearTimeout(this.internal.calibrateTimer);
|
|
113
|
+
this.internal.calibrateTimer = undefined;
|
|
61
114
|
if ([ClosureControl.MainState.Moving, ClosureControl.MainState.WaitingForMotion, ClosureControl.MainState.Calibrating].includes(this.state.mainState)) {
|
|
62
115
|
this.state.mainState = ClosureControl.MainState.Stopped;
|
|
116
|
+
this.state.countdownTime = 0;
|
|
63
117
|
}
|
|
64
118
|
};
|
|
65
119
|
calibrate = async () => {
|
|
@@ -79,8 +133,36 @@ export class MatterbridgeClosureControlServer extends ClosureControlServer.with(
|
|
|
79
133
|
throw new StatusResponse.InvalidInStateError('ClosureControl.calibrate is only allowed while Stopped or SetupRequired');
|
|
80
134
|
}
|
|
81
135
|
this.state.mainState = ClosureControl.MainState.Calibrating;
|
|
136
|
+
clearTimeout(this.internal.calibrateTimer);
|
|
137
|
+
if (this.state.calibrationDuration <= 0) {
|
|
138
|
+
this.internal.calibrateTimer = undefined;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
this.state.countdownTime = this.state.calibrationDuration / 1000;
|
|
142
|
+
this.internal.calibrateTimer = setTimeout(() => {
|
|
143
|
+
this.internal.calibrateTimer = undefined;
|
|
144
|
+
void this.completeCalibrate();
|
|
145
|
+
}, this.state.calibrationDuration);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
completeCalibrate = async () => {
|
|
149
|
+
const closure = this.endpoint;
|
|
150
|
+
await closure.setAttribute(ClosureControl, 'countdownTime', 0);
|
|
151
|
+
await closure.setAttribute(ClosureControl, 'mainState', ClosureControl.MainState.Stopped);
|
|
82
152
|
};
|
|
83
153
|
}
|
|
154
|
+
(function (MatterbridgeClosureControlServer) {
|
|
155
|
+
class Internal extends MatterbridgeClosureControlServerBase.Internal {
|
|
156
|
+
movementTimer;
|
|
157
|
+
calibrateTimer;
|
|
158
|
+
}
|
|
159
|
+
MatterbridgeClosureControlServer.Internal = Internal;
|
|
160
|
+
class State extends MatterbridgeClosureControlServerBase.State {
|
|
161
|
+
movementDuration = 0;
|
|
162
|
+
calibrationDuration = 0;
|
|
163
|
+
}
|
|
164
|
+
MatterbridgeClosureControlServer.State = State;
|
|
165
|
+
})(MatterbridgeClosureControlServer || (MatterbridgeClosureControlServer = {}));
|
|
84
166
|
export class Closure extends MatterbridgeEndpoint {
|
|
85
167
|
constructor(name, serial, options = {}) {
|
|
86
168
|
const { identifyTime = 0, identifyType = Identify.IdentifyType.None, powerSourceType = 'Wired', countdownTime = 0, mainState = ClosureControl.MainState.Stopped, currentErrorList = [], overallCurrentState = {
|
|
@@ -92,7 +174,7 @@ export class Closure extends MatterbridgeEndpoint {
|
|
|
92
174
|
position: ClosureControl.TargetPosition.MoveToFullyClosed,
|
|
93
175
|
latch: true,
|
|
94
176
|
speed: ThreeLevelAuto.Auto,
|
|
95
|
-
}, latchControlModes = { remoteLatching: true, remoteUnlatching: true }, ventilation = false, pedestrian = false, calibration = false, id, number, tagList = [getSemtag(ClosureTag.Covering)], } = options;
|
|
177
|
+
}, latchControlModes = { remoteLatching: true, remoteUnlatching: true }, movementDuration = 0, calibrationDuration = 0, ventilation = false, pedestrian = false, calibration = false, id, number, tagList = [getSemtag(ClosureTag.Covering)], } = options;
|
|
96
178
|
super(powerSourceType === 'None' ? [closure] : [closure, powerSource], {
|
|
97
179
|
id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`,
|
|
98
180
|
number,
|
|
@@ -123,6 +205,8 @@ export class Closure extends MatterbridgeEndpoint {
|
|
|
123
205
|
overallCurrentState,
|
|
124
206
|
overallTargetState,
|
|
125
207
|
latchControlModes,
|
|
208
|
+
movementDuration,
|
|
209
|
+
calibrationDuration,
|
|
126
210
|
};
|
|
127
211
|
this.behaviors.require(calibration || ventilation || pedestrian
|
|
128
212
|
? MatterbridgeClosureControlServer.with(ClosureControl.Feature.Positioning, ClosureControl.Feature.MotionLatching, ClosureControl.Feature.Speed, ...(calibration ? [ClosureControl.Feature.Calibration] : []), ...(ventilation ? [ClosureControl.Feature.Ventilation] : []), ...(pedestrian ? [ClosureControl.Feature.Pedestrian] : []))
|
|
@@ -6,10 +6,14 @@ export interface IrrigationSystemOptions {
|
|
|
6
6
|
batteryPowered?: boolean;
|
|
7
7
|
operationalState?: OperationalState.OperationalStateEnum;
|
|
8
8
|
flowMeasuredValue?: number | null;
|
|
9
|
+
autoOpenClose?: boolean;
|
|
10
|
+
tagList?: Semtag[];
|
|
9
11
|
id?: string;
|
|
10
12
|
number?: EndpointNumber;
|
|
11
13
|
}
|
|
12
14
|
export declare class IrrigationSystem extends MatterbridgeEndpoint {
|
|
13
15
|
constructor(name: string, serial: string, options?: IrrigationSystemOptions);
|
|
14
|
-
addZone(tag: Semtag, id?: string, number?: EndpointNumber): this;
|
|
16
|
+
addZone(tag: Semtag, id?: string, number?: EndpointNumber, movementDuration?: number, autoClose?: boolean): this;
|
|
17
|
+
openAllZones(): Promise<void>;
|
|
18
|
+
closeAllZones(): Promise<void>;
|
|
15
19
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { CommonLocationTag } from '@matter/main/node';
|
|
2
2
|
import { OperationalState } from '@matter/types/clusters/operational-state';
|
|
3
3
|
import { fireAndForget } from '@matterbridge/utils';
|
|
4
|
+
import { MatterbridgeValveConfigurationAndControlServer } from '../behaviors/valveConfigurationAndControlServer.js';
|
|
4
5
|
import { irrigationSystem, powerSource, waterValve } from '../matterbridgeDeviceTypes.js';
|
|
5
6
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
6
7
|
import { getSemtag } from '../matterbridgeEndpointHelpers.js';
|
|
7
8
|
export class IrrigationSystem extends MatterbridgeEndpoint {
|
|
8
9
|
constructor(name, serial, options = {}) {
|
|
9
|
-
super([irrigationSystem, powerSource], { id: options.id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`, number: options.number });
|
|
10
|
+
super([irrigationSystem, powerSource], { id: options.id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`, number: options.number, tagList: options.tagList });
|
|
10
11
|
this.createDefaultIdentifyClusterServer();
|
|
11
12
|
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Irrigation System');
|
|
12
13
|
if (options.batteryPowered) {
|
|
@@ -20,11 +21,42 @@ export class IrrigationSystem extends MatterbridgeEndpoint {
|
|
|
20
21
|
this.createDefaultFlowMeasurementClusterServer(options.flowMeasuredValue);
|
|
21
22
|
fireAndForget(this.addFixedLabel('composed', 'IrrigationSystem'), this.log, 'IrrigationSystem addFixedLabel');
|
|
22
23
|
this.addRequiredClusterServers();
|
|
24
|
+
if (options.autoOpenClose !== true)
|
|
25
|
+
return;
|
|
26
|
+
this.subscribeAttribute(OperationalState, 'operationalState', (value) => {
|
|
27
|
+
switch (value) {
|
|
28
|
+
case OperationalState.OperationalStateEnum.Stopped:
|
|
29
|
+
this.log.info('IrrigationSystem operationalState changed to: Stopped');
|
|
30
|
+
fireAndForget(this.closeAllZones(), this.log, 'IrrigationSystem closeAllZones');
|
|
31
|
+
break;
|
|
32
|
+
case OperationalState.OperationalStateEnum.Running:
|
|
33
|
+
this.log.info('IrrigationSystem operationalState changed to: Running');
|
|
34
|
+
fireAndForget(this.openAllZones(), this.log, 'IrrigationSystem openAllZones');
|
|
35
|
+
break;
|
|
36
|
+
case OperationalState.OperationalStateEnum.Paused:
|
|
37
|
+
this.log.info('IrrigationSystem operationalState changed to: Paused');
|
|
38
|
+
fireAndForget(this.closeAllZones(), this.log, 'IrrigationSystem closeAllZones');
|
|
39
|
+
break;
|
|
40
|
+
case OperationalState.OperationalStateEnum.Error:
|
|
41
|
+
this.log.info('IrrigationSystem operationalState changed to: Error');
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
23
45
|
}
|
|
24
|
-
addZone(tag, id, number) {
|
|
46
|
+
addZone(tag, id, number, movementDuration, autoClose) {
|
|
25
47
|
this.addChildDeviceType(`Zone ${tag.tag}`, waterValve, { tagList: [getSemtag(tag), getSemtag(CommonLocationTag.Zone)], id, number })
|
|
26
|
-
.createDefaultValveConfigurationAndControlClusterServer()
|
|
48
|
+
.createDefaultValveConfigurationAndControlClusterServer(undefined, undefined, movementDuration, autoClose)
|
|
27
49
|
.addRequiredClusterServers();
|
|
28
50
|
return this;
|
|
29
51
|
}
|
|
52
|
+
async openAllZones() {
|
|
53
|
+
await Promise.all(this.getChildEndpoints()
|
|
54
|
+
.filter((child) => child.hasClusterServer(MatterbridgeValveConfigurationAndControlServer))
|
|
55
|
+
.map(async (child) => child.act(async (agent) => agent.get(MatterbridgeValveConfigurationAndControlServer).open({}))));
|
|
56
|
+
}
|
|
57
|
+
async closeAllZones() {
|
|
58
|
+
await Promise.all(this.getChildEndpoints()
|
|
59
|
+
.filter((child) => child.hasClusterServer(MatterbridgeValveConfigurationAndControlServer))
|
|
60
|
+
.map(async (child) => child.act(async (agent) => agent.get(MatterbridgeValveConfigurationAndControlServer).close())));
|
|
61
|
+
}
|
|
30
62
|
}
|
package/dist/matterbridge.js
CHANGED
|
@@ -760,7 +760,8 @@ export class Matterbridge extends EventEmitter {
|
|
|
760
760
|
this.log.debug(`Parsing plugin ${plg}${plugin.name}${db} from path ${CYAN}${plugin.path}${db} ` +
|
|
761
761
|
`with version ${CYAN}${plugin.version}${db} type ${CYAN}${plugin.type}${db} local ${CYAN}${isLocal}${db} linked ${CYAN}${isLinked}${db} ` +
|
|
762
762
|
`private ${CYAN}${plugin.private}${db} tarball ${CYAN}${plugin.tarballPath}${db}.`);
|
|
763
|
-
|
|
763
|
+
const linkLocalPlugins = process.env.MATTERBRIDGE_LINK_LOCAL_PLUGINS;
|
|
764
|
+
if ((isLocal && fs.existsSync(plugin.path) && !isLinked && !this.isShutdownCommand && linkLocalPlugins !== 'false') || linkLocalPlugins === 'test') {
|
|
764
765
|
const { execSync } = await import('node:child_process');
|
|
765
766
|
try {
|
|
766
767
|
this.log.info(`Linking matterbridge to local plugin ${plg}${plugin.name}${nf}...`);
|
|
@@ -774,7 +775,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
774
775
|
continue;
|
|
775
776
|
}
|
|
776
777
|
}
|
|
777
|
-
if ((!isLocal && !fs.existsSync(plugin.path) && !this.isShutdownCommand) || process.env.MATTERBRIDGE_REINSTALL_PLUGINS === '
|
|
778
|
+
if ((!isLocal && !fs.existsSync(plugin.path) && !this.isShutdownCommand) || process.env.MATTERBRIDGE_REINSTALL_PLUGINS === 'test') {
|
|
778
779
|
const { execSync } = await import('node:child_process');
|
|
779
780
|
const sudo = hasParameter('sudo') ||
|
|
780
781
|
(process.platform !== 'win32' && !hasParameter('docker') && !hasParameter('nosudo') && !isBun() && !process.env.PATH?.includes('/.nvm/versions/node/'));
|
|
@@ -206,7 +206,7 @@ export declare class MatterbridgeEndpoint extends Endpoint {
|
|
|
206
206
|
createDefaultDoorLockClusterServer(lockState?: DoorLock.LockState, lockType?: DoorLock.LockType, autoRelockTime?: number): this;
|
|
207
207
|
createUserPinDoorLockClusterServer(lockState?: DoorLock.LockState, lockType?: DoorLock.LockType, autoRelockTime?: number, minPinCodeLength?: number, maxPinCodeLength?: number): this;
|
|
208
208
|
createDefaultModeSelectClusterServer(description: string, supportedModes: ModeSelect.ModeOption[], currentMode?: number, startUpMode?: number): this;
|
|
209
|
-
createDefaultValveConfigurationAndControlClusterServer(valveState?: ValveConfigurationAndControl.ValveState, valveLevel?: number): this;
|
|
209
|
+
createDefaultValveConfigurationAndControlClusterServer(valveState?: ValveConfigurationAndControl.ValveState, valveLevel?: number, movementDuration?: number, autoClose?: boolean): this;
|
|
210
210
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode?: PumpConfigurationAndControl.OperationMode): this;
|
|
211
211
|
createDefaultSmokeCOAlarmClusterServer(smokeState?: SmokeCoAlarm.AlarmState, coState?: SmokeCoAlarm.AlarmState): this;
|
|
212
212
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState?: SmokeCoAlarm.AlarmState): this;
|
|
@@ -215,7 +215,7 @@ export declare class MatterbridgeEndpoint extends Endpoint {
|
|
|
215
215
|
createDefaultMomentarySwitchClusterServer(): this;
|
|
216
216
|
createDefaultLatchingSwitchClusterServer(): this;
|
|
217
217
|
triggerSwitchEvent(event: 'Single' | 'Double' | 'Long' | 'Press' | 'Release', log?: AnsiLogger): Promise<boolean>;
|
|
218
|
-
createDefaultOperationalStateClusterServer(operationalState?: OperationalState.OperationalStateEnum): this;
|
|
218
|
+
createDefaultOperationalStateClusterServer(operationalState?: OperationalState.OperationalStateEnum, operationalStateList?: OperationalState.OperationalStateStruct[], operationalError?: OperationalState.ErrorStateStruct, phaseList?: string[] | null, currentPhase?: number | null): this;
|
|
219
219
|
createDefaultBooleanStateClusterServer(contact?: boolean): this;
|
|
220
220
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault?: boolean, currentSensitivityLevel?: number, supportedSensitivityLevels?: number, defaultSensitivityLevel?: number): this;
|
|
221
221
|
createDefaultTemperatureMeasurementClusterServer(measuredValue?: number | null, minMeasuredValue?: number | null, maxMeasuredValue?: number | null, tolerance?: number): this;
|