@matterbridge/core 3.10.9-dev-20260908-a3f4064 → 3.10.9-dev-20260910-ca91bcb
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/cameraAvSettingsUserLevelManagementServer.d.ts +24 -0
- package/dist/behaviors/cameraAvSettingsUserLevelManagementServer.js +53 -0
- package/dist/behaviors/cameraAvStreamManagementServer.d.ts +80 -0
- package/dist/behaviors/cameraAvStreamManagementServer.js +414 -0
- package/dist/behaviors/chimeServer.d.ts +12 -0
- package/dist/behaviors/chimeServer.js +37 -0
- package/dist/behaviors/clients.d.ts +4 -0
- package/dist/behaviors/clients.js +33 -0
- package/dist/behaviors/ffmpeg.d.ts +4 -0
- package/dist/behaviors/ffmpeg.js +103 -0
- package/dist/behaviors/snapshot.d.ts +15 -0
- package/dist/behaviors/snapshot.js +139 -0
- package/dist/behaviors/webRtcTransportProviderServer.d.ts +28 -0
- package/dist/behaviors/webRtcTransportProviderServer.js +422 -0
- package/dist/behaviors/webRtcTransportRequestorServer.d.ts +10 -0
- package/dist/behaviors/webRtcTransportRequestorServer.js +24 -0
- package/dist/behaviors/weriftSession.d.ts +63 -0
- package/dist/behaviors/weriftSession.js +538 -0
- package/dist/devices/audioDoorbell.d.ts +20 -0
- package/dist/devices/audioDoorbell.js +49 -0
- package/dist/devices/camera.d.ts +37 -0
- package/dist/devices/camera.js +64 -0
- package/dist/devices/chime.d.ts +16 -0
- package/dist/devices/chime.js +37 -0
- package/dist/devices/doorbell.d.ts +11 -0
- package/dist/devices/doorbell.js +31 -0
- package/dist/devices/floodlightCamera.d.ts +19 -0
- package/dist/devices/floodlightCamera.js +81 -0
- package/dist/devices/intercom.d.ts +22 -0
- package/dist/devices/intercom.js +55 -0
- package/dist/devices/snapshotCamera.d.ts +20 -0
- package/dist/devices/snapshotCamera.js +51 -0
- package/dist/devices/videoDoorbell.d.ts +21 -0
- package/dist/devices/videoDoorbell.js +82 -0
- package/dist/matterbridgeEndpoint.d.ts +4 -1
- package/dist/matterbridgeEndpoint.js +4 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +3 -0
- package/dist/matterbridgeEndpointHelpers.js +51 -2
- package/dist/matterbridgeEndpointTypes.d.ts +15 -0
- package/dist/matterbridgeEndpointTypes.js +1 -2
- package/package.json +6 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
import { Lifecycle } from '@matter/general';
|
|
2
|
+
import { Lifecycle, Observable } from '@matter/general';
|
|
3
3
|
import { ClusterBehavior } from '@matter/node';
|
|
4
4
|
import { ActivatedCarbonFilterMonitoringServer } from '@matter/node/behaviors/activated-carbon-filter-monitoring';
|
|
5
5
|
import { AirQualityServer } from '@matter/node/behaviors/air-quality';
|
|
@@ -792,10 +792,59 @@ export function subscribeAttribute(endpoint, cluster, attribute, listener, log)
|
|
|
792
792
|
endpoint.log.error(`subscribeAttribute error: Attribute ${hk}${attribute.replace('$Changed', '')}${er} not found on Cluster ${'0x' + getClusterId(endpoint, clusterName)?.toString(16).padStart(4, '0')}:${clusterName} on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
793
793
|
return endpoint;
|
|
794
794
|
}
|
|
795
|
-
events[clusterName][attribute].on(
|
|
795
|
+
events[clusterName][attribute].on((newValue, oldValue, context) => {
|
|
796
|
+
listener(newValue, oldValue, context);
|
|
797
|
+
});
|
|
796
798
|
log?.info(`${db}Subscribed endpoint ${or}${endpoint.maybeId}${db}:${or}${endpoint.maybeNumber}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
|
|
797
799
|
return endpoint;
|
|
798
800
|
}
|
|
801
|
+
function getCommandObservable(endpoint, clusterName, commandName, create) {
|
|
802
|
+
const events = endpoint.events;
|
|
803
|
+
const clusterEvents = events?.[clusterName];
|
|
804
|
+
if (!clusterEvents)
|
|
805
|
+
return undefined;
|
|
806
|
+
const eventName = commandName + '$executed';
|
|
807
|
+
let observable = clusterEvents[eventName];
|
|
808
|
+
if (!observable && create) {
|
|
809
|
+
observable = Observable();
|
|
810
|
+
clusterEvents.addEvent(eventName, observable);
|
|
811
|
+
Object.defineProperty(clusterEvents, eventName, { value: observable, enumerable: true, configurable: true });
|
|
812
|
+
}
|
|
813
|
+
return observable;
|
|
814
|
+
}
|
|
815
|
+
export function subscribeCommand(endpoint, cluster, command, listener, log) {
|
|
816
|
+
const behavior = getBehavior(endpoint, cluster);
|
|
817
|
+
const clusterName = behavior?.id;
|
|
818
|
+
if (!behavior || !clusterName) {
|
|
819
|
+
endpoint.log.error(`subscribeCommand ${hk}${command}${er} error: cluster not found on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
820
|
+
return endpoint;
|
|
821
|
+
}
|
|
822
|
+
command = lowercaseFirstLetter(command);
|
|
823
|
+
if (!ClusterBehavior.isType(behavior) || !behavior.schema.commands(command)) {
|
|
824
|
+
endpoint.log.error(`subscribeCommand error: Command ${hk}${command}${er} not found on Cluster ${'0x' + getClusterId(endpoint, clusterName)?.toString(16).padStart(4, '0')}:${clusterName} on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
825
|
+
return endpoint;
|
|
826
|
+
}
|
|
827
|
+
const observable = getCommandObservable(endpoint, clusterName, command, true);
|
|
828
|
+
if (!observable) {
|
|
829
|
+
endpoint.log.error(`subscribeCommand error: Cluster ${'0x' + getClusterId(endpoint, clusterName)?.toString(16).padStart(4, '0')}:${clusterName} has no events on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
830
|
+
return endpoint;
|
|
831
|
+
}
|
|
832
|
+
observable.on((data) => {
|
|
833
|
+
listener(data);
|
|
834
|
+
});
|
|
835
|
+
log?.info(`${db}Subscribed endpoint ${or}${endpoint.maybeId}${db}:${or}${endpoint.maybeNumber}${db} command ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${command}${db}`);
|
|
836
|
+
return endpoint;
|
|
837
|
+
}
|
|
838
|
+
export function emitCommand(endpoint, cluster, command, request, context) {
|
|
839
|
+
if (!isCommandEndpoint(endpoint))
|
|
840
|
+
return;
|
|
841
|
+
const clusterName = lowercaseFirstLetter(cluster);
|
|
842
|
+
const commandName = lowercaseFirstLetter(command);
|
|
843
|
+
getCommandObservable(endpoint, clusterName, commandName, false)?.emit({ command: commandName, cluster: clusterName, request, endpoint, context });
|
|
844
|
+
}
|
|
845
|
+
function isCommandEndpoint(endpoint) {
|
|
846
|
+
return 'subscribeCommand' in endpoint && typeof endpoint.subscribeCommand === 'function';
|
|
847
|
+
}
|
|
799
848
|
export async function setCluster(endpoint, cluster, value, log) {
|
|
800
849
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
801
850
|
if (!clusterName) {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import type { Observable } from '@matter/general';
|
|
2
|
+
import type { ActionContext } from '@matter/node';
|
|
1
3
|
import type { ClusterId, EndpointNumber } from '@matter/types/datatype';
|
|
2
4
|
import type { Semtag } from '@matter/types/globals';
|
|
3
5
|
import type { DeviceTypeDefinition } from './matterbridgeDeviceTypes.js';
|
|
6
|
+
import type { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
4
7
|
export type PrimitiveTypes = boolean | number | bigint | string | object | undefined | null;
|
|
5
8
|
export interface SerializedMatterbridgeEndpoint {
|
|
6
9
|
pluginName: string;
|
|
@@ -29,3 +32,15 @@ export interface MatterbridgeEndpointOptions {
|
|
|
29
32
|
id?: string;
|
|
30
33
|
number?: EndpointNumber;
|
|
31
34
|
}
|
|
35
|
+
export interface SubscribeCommandData<R = any> {
|
|
36
|
+
command: string;
|
|
37
|
+
cluster: string;
|
|
38
|
+
request: R;
|
|
39
|
+
endpoint: MatterbridgeEndpoint;
|
|
40
|
+
context: ActionContext;
|
|
41
|
+
}
|
|
42
|
+
export type SubscribeCommandListener<R = any> = (data: SubscribeCommandData<R>) => void;
|
|
43
|
+
export type SubscribeCommandObservable = Observable<[data: SubscribeCommandData]>;
|
|
44
|
+
export type SubscribeCommandEvents = Record<string, SubscribeCommandObservable | undefined> & {
|
|
45
|
+
addEvent(name: string, event: SubscribeCommandObservable): void;
|
|
46
|
+
};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
logModuleLoaded('MatterbridgeEndpointTypes');
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/core",
|
|
3
|
-
"version": "3.10.9-dev-
|
|
3
|
+
"version": "3.10.9-dev-20260910-ca91bcb",
|
|
4
4
|
"description": "Matterbridge core library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -132,16 +132,17 @@
|
|
|
132
132
|
},
|
|
133
133
|
"dependencies": {
|
|
134
134
|
"@matter/main": "0.17.9",
|
|
135
|
-
"@matterbridge/dgram": "3.10.9-dev-
|
|
136
|
-
"@matterbridge/thread": "3.10.9-dev-
|
|
137
|
-
"@matterbridge/types": "3.10.9-dev-
|
|
138
|
-
"@matterbridge/utils": "3.10.9-dev-
|
|
135
|
+
"@matterbridge/dgram": "3.10.9-dev-20260910-ca91bcb",
|
|
136
|
+
"@matterbridge/thread": "3.10.9-dev-20260910-ca91bcb",
|
|
137
|
+
"@matterbridge/types": "3.10.9-dev-20260910-ca91bcb",
|
|
138
|
+
"@matterbridge/utils": "3.10.9-dev-20260910-ca91bcb",
|
|
139
139
|
"escape-html": "1.0.3",
|
|
140
140
|
"express": "5.2.1",
|
|
141
141
|
"express-rate-limit": "8.7.0",
|
|
142
142
|
"multer": "2.3.0",
|
|
143
143
|
"node-ansi-logger": "3.3.1",
|
|
144
144
|
"node-persist-manager": "2.1.1",
|
|
145
|
+
"werift": "0.24.4",
|
|
145
146
|
"ws": "8.21.3"
|
|
146
147
|
}
|
|
147
148
|
}
|