@matterbridge/core 3.7.2-dev-20260329-5cac980 → 3.7.2-dev-20260330-bb55c39
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.
|
@@ -13,8 +13,16 @@ declare const MatterbridgeDoorLockServer_base: import("@matter/node").ClusterBeh
|
|
|
13
13
|
};
|
|
14
14
|
}>>, typeof DoorLockServer, import("@matter/node/behaviors/door-lock").DoorLockInterface>;
|
|
15
15
|
export declare class MatterbridgeDoorLockServer extends MatterbridgeDoorLockServer_base {
|
|
16
|
+
protected internal: MatterbridgeDoorLockServer.Internal;
|
|
17
|
+
initialize(): Promise<void>;
|
|
16
18
|
lockDoor(request: DoorLock.LockDoorRequest): Promise<void>;
|
|
17
19
|
unlockDoor(request: DoorLock.UnlockDoorRequest): Promise<void>;
|
|
18
20
|
unlockWithTimeout(request: DoorLock.UnlockWithTimeoutRequest): Promise<void>;
|
|
19
21
|
}
|
|
22
|
+
export declare namespace MatterbridgeDoorLockServer {
|
|
23
|
+
class Internal {
|
|
24
|
+
enableTimeout: boolean;
|
|
25
|
+
unlockTimeout: NodeJS.Timeout | undefined;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
20
28
|
export {};
|
|
@@ -5,8 +5,17 @@ export class MatterbridgeDoorLockServer extends DoorLockServer.enable({
|
|
|
5
5
|
events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true },
|
|
6
6
|
commands: { lockDoor: true, unlockDoor: true, unlockWithTimeout: true },
|
|
7
7
|
}) {
|
|
8
|
+
async initialize() {
|
|
9
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
10
|
+
device.log.info(`Initializing MatterbridgeDoorLockServer (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
11
|
+
await super.initialize();
|
|
12
|
+
}
|
|
8
13
|
async lockDoor(request) {
|
|
9
14
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
15
|
+
if (!this.state.actuatorEnabled) {
|
|
16
|
+
device.log.warn(`Actuator disabled, cannot lock door (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
10
19
|
device.log.info(`Locking door (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
11
20
|
await device.commandHandler.executeHandler('DoorLock.lockDoor', {
|
|
12
21
|
command: 'lockDoor',
|
|
@@ -21,6 +30,10 @@ export class MatterbridgeDoorLockServer extends DoorLockServer.enable({
|
|
|
21
30
|
}
|
|
22
31
|
async unlockDoor(request) {
|
|
23
32
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
33
|
+
if (!this.state.actuatorEnabled) {
|
|
34
|
+
device.log.warn(`Actuator disabled, cannot unlock door (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
24
37
|
device.log.info(`Unlocking door (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
25
38
|
await device.commandHandler.executeHandler('DoorLock.unlockDoor', {
|
|
26
39
|
command: 'unlockDoor',
|
|
@@ -32,9 +45,25 @@ export class MatterbridgeDoorLockServer extends DoorLockServer.enable({
|
|
|
32
45
|
});
|
|
33
46
|
device.log.debug(`MatterbridgeDoorLockServer: unlockDoor called`);
|
|
34
47
|
await super.unlockDoor(request);
|
|
48
|
+
if (!this.internal.enableTimeout)
|
|
49
|
+
return;
|
|
50
|
+
if (this.state.autoRelockTime) {
|
|
51
|
+
clearTimeout(this.internal.unlockTimeout);
|
|
52
|
+
this.internal.unlockTimeout = setTimeout(async () => {
|
|
53
|
+
this.internal.unlockTimeout = undefined;
|
|
54
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
55
|
+
const state = this.endpoint.stateOf(MatterbridgeDoorLockServer);
|
|
56
|
+
device.log.info(`Auto-relocking door after ${state.autoRelockTime} seconds (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
57
|
+
await this.endpoint.act((agent) => agent.get(MatterbridgeDoorLockServer).lockDoor({ pinCode: request.pinCode }));
|
|
58
|
+
}, this.state.autoRelockTime * 1000).unref();
|
|
59
|
+
}
|
|
35
60
|
}
|
|
36
61
|
async unlockWithTimeout(request) {
|
|
37
62
|
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
63
|
+
if (!this.state.actuatorEnabled) {
|
|
64
|
+
device.log.warn(`Actuator disabled, cannot unlock door with timeout (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
38
67
|
device.log.info(`Unlocking door with timeout ${request.timeout} seconds (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
39
68
|
await device.commandHandler.executeHandler('DoorLock.unlockWithTimeout', {
|
|
40
69
|
command: 'unlockWithTimeout',
|
|
@@ -46,5 +75,23 @@ export class MatterbridgeDoorLockServer extends DoorLockServer.enable({
|
|
|
46
75
|
});
|
|
47
76
|
device.log.debug(`MatterbridgeDoorLockServer: unlockWithTimeout called`);
|
|
48
77
|
this.state.lockState = DoorLock.LockState.Unlocked;
|
|
78
|
+
if (!this.internal.enableTimeout)
|
|
79
|
+
return;
|
|
80
|
+
if (request.timeout) {
|
|
81
|
+
clearTimeout(this.internal.unlockTimeout);
|
|
82
|
+
this.internal.unlockTimeout = setTimeout(async () => {
|
|
83
|
+
this.internal.unlockTimeout = undefined;
|
|
84
|
+
const device = this.endpoint.stateOf(MatterbridgeServer);
|
|
85
|
+
device.log.info(`Locking door after ${request.timeout} seconds (endpoint ${this.endpoint.maybeId}.${this.endpoint.maybeNumber})`);
|
|
86
|
+
await this.endpoint.act((agent) => agent.get(MatterbridgeDoorLockServer).lockDoor({ pinCode: request.pinCode }));
|
|
87
|
+
}, request.timeout * 1000).unref();
|
|
88
|
+
}
|
|
49
89
|
}
|
|
50
90
|
}
|
|
91
|
+
(function (MatterbridgeDoorLockServer) {
|
|
92
|
+
class Internal {
|
|
93
|
+
enableTimeout = true;
|
|
94
|
+
unlockTimeout;
|
|
95
|
+
}
|
|
96
|
+
MatterbridgeDoorLockServer.Internal = Internal;
|
|
97
|
+
})(MatterbridgeDoorLockServer || (MatterbridgeDoorLockServer = {}));
|
|
@@ -32,6 +32,7 @@ export declare function generateUniqueId(deviceName: string): string;
|
|
|
32
32
|
export declare function createUniqueId(param1: string, param2: string, param3: string, param4: string): string;
|
|
33
33
|
export declare function getSemtag(semtag: Semtag, label?: string | null | undefined, mfgCode?: VendorId | null): Semtag;
|
|
34
34
|
export declare function featuresFor(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string): Record<string, boolean | undefined>;
|
|
35
|
+
export declare function internalFor<T extends object = Record<string, unknown>>(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string): Promise<T | undefined>;
|
|
35
36
|
export declare function getBehaviourTypesFromClusterServerIds(clusterServerList: ClusterId[]): Behavior.Type[];
|
|
36
37
|
export declare function getBehaviourTypesFromClusterClientIds(clusterClientList: ClusterId[]): Behavior.Type[];
|
|
37
38
|
export declare function getBehaviourTypeFromClusterServerId(clusterId: ClusterId): Behavior.Type;
|
|
@@ -174,6 +174,14 @@ export function featuresFor(endpoint, cluster) {
|
|
|
174
174
|
}
|
|
175
175
|
return endpoint.behaviors.supported[lowercaseFirstLetter(behaviorId)]['cluster']['supportedFeatures'];
|
|
176
176
|
}
|
|
177
|
+
export async function internalFor(endpoint, cluster) {
|
|
178
|
+
const behaviorId = getBehavior(endpoint, cluster)?.id;
|
|
179
|
+
if (!behaviorId) {
|
|
180
|
+
endpoint.log?.error(`internalFor error: cluster not found on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
return endpoint.act((agent) => agent[behaviorId]?.internal);
|
|
184
|
+
}
|
|
177
185
|
export function getBehaviourTypesFromClusterServerIds(clusterServerList) {
|
|
178
186
|
const behaviorTypes = [];
|
|
179
187
|
clusterServerList.forEach((clusterId) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/core",
|
|
3
|
-
"version": "3.7.2-dev-
|
|
3
|
+
"version": "3.7.2-dev-20260330-bb55c39",
|
|
4
4
|
"description": "Matterbridge core library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -126,10 +126,10 @@
|
|
|
126
126
|
],
|
|
127
127
|
"dependencies": {
|
|
128
128
|
"@matter/main": "0.16.10",
|
|
129
|
-
"@matterbridge/dgram": "3.7.2-dev-
|
|
130
|
-
"@matterbridge/thread": "3.7.2-dev-
|
|
131
|
-
"@matterbridge/types": "3.7.2-dev-
|
|
132
|
-
"@matterbridge/utils": "3.7.2-dev-
|
|
129
|
+
"@matterbridge/dgram": "3.7.2-dev-20260330-bb55c39",
|
|
130
|
+
"@matterbridge/thread": "3.7.2-dev-20260330-bb55c39",
|
|
131
|
+
"@matterbridge/types": "3.7.2-dev-20260330-bb55c39",
|
|
132
|
+
"@matterbridge/utils": "3.7.2-dev-20260330-bb55c39",
|
|
133
133
|
"express": "5.2.1",
|
|
134
134
|
"multer": "2.1.1",
|
|
135
135
|
"node-ansi-logger": "3.2.1-dev-20260327-7069fd7",
|