@matterbridge/core 3.6.2-dev-20260317-e291a17 → 3.7.0-dev-20260318-5bb831c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/devices/basicVideoPlayer.d.ts +8 -9
- package/dist/devices/basicVideoPlayer.js +64 -16
- package/dist/devices/closure.d.ts +2 -3
- package/dist/devices/closure.js +16 -4
- package/dist/devices/closurePanel.d.ts +2 -3
- package/dist/devices/closurePanel.js +16 -4
- package/dist/devices/dishwasher.d.ts +1 -2
- package/dist/devices/dishwasher.js +8 -2
- package/dist/devices/evse.d.ts +3 -3
- package/dist/devices/evse.js +24 -6
- package/dist/devices/laundryWasher.d.ts +1 -2
- package/dist/devices/laundryWasher.js +8 -2
- package/dist/devices/microwaveOven.d.ts +1 -2
- package/dist/devices/microwaveOven.js +15 -3
- package/dist/devices/roboticVacuumCleaner.d.ts +5 -6
- package/dist/devices/roboticVacuumCleaner.js +40 -10
- package/dist/devices/temperatureControl.d.ts +2 -3
- package/dist/devices/temperatureControl.js +16 -4
- package/dist/devices/waterHeater.d.ts +3 -4
- package/dist/devices/waterHeater.js +24 -6
- package/dist/export.d.ts +1 -0
- package/dist/export.js +1 -0
- package/dist/jestutils/jestHelpers.js +1 -1
- package/dist/matterbridgeBehaviorsServer.d.ts +55 -53
- package/dist/matterbridgeBehaviorsServer.js +403 -139
- package/dist/matterbridgeEndpoint.d.ts +9 -7
- package/dist/matterbridgeEndpoint.js +11 -6
- package/dist/matterbridgeEndpointCommandHandler.d.ts +806 -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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
if (process.argv.includes('--loader') || process.argv.includes('-loader'))
|
|
2
|
+
console.log('\u001B[32mMatterbridgeEndpointTypes loaded.\u001B[40;0m');
|
|
3
|
+
export class CommandHandler {
|
|
4
|
+
handler = [];
|
|
5
|
+
hasHandler(command) {
|
|
6
|
+
return this.handler.some(({ command: registeredCommand }) => registeredCommand === command);
|
|
7
|
+
}
|
|
8
|
+
addHandler(command, handler) {
|
|
9
|
+
this.handler.push({ command, handler });
|
|
10
|
+
}
|
|
11
|
+
async executeHandler(command, ...args) {
|
|
12
|
+
for (const { command: registeredCommand, handler } of this.handler) {
|
|
13
|
+
if (registeredCommand === command) {
|
|
14
|
+
return await handler(...args);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const fallbackCommand = command.includes('.') ? command.split('.').pop() : undefined;
|
|
18
|
+
if (fallbackCommand === undefined)
|
|
19
|
+
return;
|
|
20
|
+
for (const { command: registeredCommand, handler } of this.handler) {
|
|
21
|
+
if (registeredCommand === fallbackCommand) {
|
|
22
|
+
return await handler(...args);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
removeHandler(command, handler) {
|
|
27
|
+
this.handler = this.handler.filter(({ command: registeredCommand, handler: registeredHandler }) => {
|
|
28
|
+
return registeredCommand !== command && registeredHandler !== handler;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -20,7 +20,7 @@ import { MeasurementType, Semtag } from '@matter/types/globals';
|
|
|
20
20
|
import { AnsiLogger } from 'node-ansi-logger';
|
|
21
21
|
import { MatterbridgeDeviceEnergyManagementModeServer, MatterbridgeDeviceEnergyManagementServer, MatterbridgeOperationalStateServer, MatterbridgePowerSourceServer } from './matterbridgeBehaviorsServer.js';
|
|
22
22
|
import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
23
|
-
import {
|
|
23
|
+
import { CommandHandlers } from './matterbridgeEndpointCommandHandler.js';
|
|
24
24
|
export declare function capitalizeFirstLetter(name: string): string;
|
|
25
25
|
export declare function lowercaseFirstLetter(name: string): string;
|
|
26
26
|
export declare function getSnapshot<T>(value: T): T;
|
|
@@ -34,7 +34,7 @@ export declare function getBehaviourTypesFromClusterClientIds(clusterClientList:
|
|
|
34
34
|
export declare function getBehaviourTypeFromClusterServerId(clusterId: ClusterId): Behavior.Type;
|
|
35
35
|
export declare function getBehaviourTypeFromClusterClientId(_clusterId: ClusterId): void;
|
|
36
36
|
export declare function getBehavior(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string): Behavior.Type | undefined;
|
|
37
|
-
export declare function invokeBehaviorCommand(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, command:
|
|
37
|
+
export declare function invokeBehaviorCommand(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, command: CommandHandlers, params?: Record<string, boolean | number | bigint | string | object | null>): Promise<boolean>;
|
|
38
38
|
export declare function invokeSubscribeHandler(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, attribute: string, newValue: unknown, oldValue: unknown): Promise<boolean>;
|
|
39
39
|
export declare function addRequiredClusterServers(endpoint: MatterbridgeEndpoint): void;
|
|
40
40
|
export declare function addOptionalClusterServers(endpoint: MatterbridgeEndpoint): void;
|
|
@@ -289,6 +289,7 @@ export async function invokeBehaviorCommand(endpoint, cluster, command, params)
|
|
|
289
289
|
endpoint.log?.error(`invokeBehaviorCommand error: command ${hk}${command}${er} not found on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
290
290
|
return false;
|
|
291
291
|
}
|
|
292
|
+
command = command.includes('.') ? command.split('.')[1] : command;
|
|
292
293
|
let invoked = true;
|
|
293
294
|
await endpoint.act(async (agent) => {
|
|
294
295
|
const behavior = agent[behaviorId];
|
|
@@ -1,90 +1,7 @@
|
|
|
1
|
-
import { HandlerFunction } from '@matter/general';
|
|
2
1
|
import { ClusterId, EndpointNumber } from '@matter/types/datatype';
|
|
3
2
|
import { Semtag } from '@matter/types/globals';
|
|
4
3
|
import type { DeviceTypeDefinition } from './matterbridgeDeviceTypes.js';
|
|
5
|
-
import type { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
6
4
|
export type PrimitiveTypes = boolean | number | bigint | string | object | undefined | null;
|
|
7
|
-
export type CommandHandlerData = {
|
|
8
|
-
request: Record<string, any>;
|
|
9
|
-
cluster: string;
|
|
10
|
-
attributes: Record<string, PrimitiveTypes>;
|
|
11
|
-
endpoint: MatterbridgeEndpoint;
|
|
12
|
-
};
|
|
13
|
-
export type CommandHandlerFunction = (data: CommandHandlerData) => void | Promise<void>;
|
|
14
|
-
export interface MatterbridgeEndpointCommands {
|
|
15
|
-
identify: HandlerFunction;
|
|
16
|
-
triggerEffect: HandlerFunction;
|
|
17
|
-
on: HandlerFunction;
|
|
18
|
-
off: HandlerFunction;
|
|
19
|
-
toggle: HandlerFunction;
|
|
20
|
-
offWithEffect: HandlerFunction;
|
|
21
|
-
moveToLevel: HandlerFunction;
|
|
22
|
-
moveToLevelWithOnOff: HandlerFunction;
|
|
23
|
-
moveToColor: HandlerFunction;
|
|
24
|
-
moveColor: HandlerFunction;
|
|
25
|
-
stepColor: HandlerFunction;
|
|
26
|
-
moveToHue: HandlerFunction;
|
|
27
|
-
moveHue: HandlerFunction;
|
|
28
|
-
stepHue: HandlerFunction;
|
|
29
|
-
enhancedMoveToHue: HandlerFunction;
|
|
30
|
-
enhancedMoveHue: HandlerFunction;
|
|
31
|
-
enhancedStepHue: HandlerFunction;
|
|
32
|
-
moveToSaturation: HandlerFunction;
|
|
33
|
-
moveSaturation: HandlerFunction;
|
|
34
|
-
stepSaturation: HandlerFunction;
|
|
35
|
-
moveToHueAndSaturation: HandlerFunction;
|
|
36
|
-
enhancedMoveToHueAndSaturation: HandlerFunction;
|
|
37
|
-
moveToColorTemperature: HandlerFunction;
|
|
38
|
-
upOrOpen: HandlerFunction;
|
|
39
|
-
downOrClose: HandlerFunction;
|
|
40
|
-
stopMotion: HandlerFunction;
|
|
41
|
-
goToLiftPercentage: HandlerFunction;
|
|
42
|
-
goToTiltPercentage: HandlerFunction;
|
|
43
|
-
moveTo: HandlerFunction;
|
|
44
|
-
setTarget: HandlerFunction;
|
|
45
|
-
lockDoor: HandlerFunction;
|
|
46
|
-
unlockDoor: HandlerFunction;
|
|
47
|
-
setpointRaiseLower: HandlerFunction;
|
|
48
|
-
setActivePresetRequest: HandlerFunction;
|
|
49
|
-
step: HandlerFunction;
|
|
50
|
-
changeToMode: HandlerFunction;
|
|
51
|
-
open: HandlerFunction;
|
|
52
|
-
close: HandlerFunction;
|
|
53
|
-
suppressAlarm: HandlerFunction;
|
|
54
|
-
enableDisableAlarm: HandlerFunction;
|
|
55
|
-
selfTestRequest: HandlerFunction;
|
|
56
|
-
resetCounts: HandlerFunction;
|
|
57
|
-
setUtcTime: HandlerFunction;
|
|
58
|
-
setTimeZone: HandlerFunction;
|
|
59
|
-
setDstOffset: HandlerFunction;
|
|
60
|
-
pauseRequest: HandlerFunction;
|
|
61
|
-
resumeRequest: HandlerFunction;
|
|
62
|
-
pause: HandlerFunction;
|
|
63
|
-
stop: HandlerFunction;
|
|
64
|
-
start: HandlerFunction;
|
|
65
|
-
resume: HandlerFunction;
|
|
66
|
-
goHome: HandlerFunction;
|
|
67
|
-
selectAreas: HandlerFunction;
|
|
68
|
-
boost: HandlerFunction;
|
|
69
|
-
cancelBoost: HandlerFunction;
|
|
70
|
-
enableCharging: HandlerFunction;
|
|
71
|
-
disable: HandlerFunction;
|
|
72
|
-
setTargets: HandlerFunction;
|
|
73
|
-
getTargets: HandlerFunction;
|
|
74
|
-
clearTargets: HandlerFunction;
|
|
75
|
-
powerAdjustRequest: HandlerFunction;
|
|
76
|
-
cancelPowerAdjustRequest: HandlerFunction;
|
|
77
|
-
setTemperature: HandlerFunction;
|
|
78
|
-
setCookingParameters: HandlerFunction;
|
|
79
|
-
addMoreTime: HandlerFunction;
|
|
80
|
-
play: HandlerFunction;
|
|
81
|
-
previous: HandlerFunction;
|
|
82
|
-
next: HandlerFunction;
|
|
83
|
-
skipForward: HandlerFunction;
|
|
84
|
-
skipBackward: HandlerFunction;
|
|
85
|
-
sendKey: HandlerFunction;
|
|
86
|
-
resetCondition: HandlerFunction;
|
|
87
|
-
}
|
|
88
5
|
export interface SerializedMatterbridgeEndpoint {
|
|
89
6
|
pluginName: string;
|
|
90
7
|
deviceName: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0-dev-20260318-5bb831c",
|
|
4
4
|
"description": "Matterbridge core library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -122,10 +122,10 @@
|
|
|
122
122
|
],
|
|
123
123
|
"dependencies": {
|
|
124
124
|
"@matter/main": "0.16.10",
|
|
125
|
-
"@matterbridge/dgram": "3.
|
|
126
|
-
"@matterbridge/thread": "3.
|
|
127
|
-
"@matterbridge/types": "3.
|
|
128
|
-
"@matterbridge/utils": "3.
|
|
125
|
+
"@matterbridge/dgram": "3.7.0-dev-20260318-5bb831c",
|
|
126
|
+
"@matterbridge/thread": "3.7.0-dev-20260318-5bb831c",
|
|
127
|
+
"@matterbridge/types": "3.7.0-dev-20260318-5bb831c",
|
|
128
|
+
"@matterbridge/utils": "3.7.0-dev-20260318-5bb831c",
|
|
129
129
|
"express": "5.2.1",
|
|
130
130
|
"multer": "2.1.1",
|
|
131
131
|
"node-ansi-logger": "3.2.0",
|