@matterbridge/core 3.10.9-dev-20260907-5fcc59a → 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
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { StreamUsage } from '@matter/types';
|
|
2
|
+
import { CameraAvStreamManagement } from '@matter/types/clusters/camera-av-stream-management';
|
|
3
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
4
|
+
import { createDefaultCameraAvSettingsUserLevelManagementClusterServer } from '../behaviors/cameraAvSettingsUserLevelManagementServer.js';
|
|
5
|
+
import { createDefaultCameraAvStreamManagementClusterServer } from '../behaviors/cameraAvStreamManagementServer.js';
|
|
6
|
+
import { addWebRtcTransportRequestorClient } from '../behaviors/clients.js';
|
|
7
|
+
import { createDefaultWebRtcTransportProviderClusterServer } from '../behaviors/webRtcTransportProviderServer.js';
|
|
8
|
+
import { camera, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
9
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
10
|
+
export class Camera extends MatterbridgeEndpoint {
|
|
11
|
+
constructor(name, serial, options = {}) {
|
|
12
|
+
const { identifyTime = 0, identifyType = Identify.IdentifyType.None, powerSourceType = 'Wired', ptz = false, maxContentBufferSize = 4_194_304, maxNetworkBandwidth = 10_000_000, supportedStreamUsages = [StreamUsage.LiveView, StreamUsage.Recording], streamUsagePriorities = supportedStreamUsages, maxConcurrentEncoders = 1, maxEncodedPixelRate = 1920 * 1080 * 60, videoSensorParams = { sensorWidth: 1920, sensorHeight: 1080, maxFps: 60 }, minViewportResolution = { width: 640, height: 360 }, rateDistortionTradeOffPoints = [
|
|
13
|
+
{ codec: CameraAvStreamManagement.VideoCodec.H264, resolution: { width: 640, height: 480 }, minBitRate: 250_000 },
|
|
14
|
+
{ codec: CameraAvStreamManagement.VideoCodec.H264, resolution: { width: 1280, height: 720 }, minBitRate: 500_000 },
|
|
15
|
+
{ codec: CameraAvStreamManagement.VideoCodec.H264, resolution: { width: 1920, height: 1080 }, minBitRate: 1_000_000 },
|
|
16
|
+
], currentFrameRate = 30, viewport = { x1: 0, y1: 0, x2: videoSensorParams.sensorWidth, y2: videoSensorParams.sensorHeight }, microphoneCapabilities = { maxNumberOfChannels: 1, supportedCodecs: [CameraAvStreamManagement.AudioCodec.Opus], supportedSampleRates: [48000], supportedBitDepths: [16] }, snapshotCapabilities = [
|
|
17
|
+
{ resolution: { width: 640, height: 480 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
|
|
18
|
+
{ resolution: { width: 1280, height: 720 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
|
|
19
|
+
{ resolution: { width: 1920, height: 1080 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
|
|
20
|
+
], panMin = -170, panMax = 170, tiltMin = -20, tiltMax = 90, zoomMax = 10, mptzPosition = { pan: 0, tilt: 0, zoom: 1 }, weriftOfferOptions, id, number, tagList, mode, } = options;
|
|
21
|
+
super(powerSourceType === 'None' ? [camera] : [camera, powerSource], { id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`, number, tagList, mode });
|
|
22
|
+
if (identifyType !== Identify.IdentifyType.None) {
|
|
23
|
+
this.createDefaultIdentifyClusterServer(identifyTime, identifyType);
|
|
24
|
+
}
|
|
25
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Chime');
|
|
26
|
+
switch (powerSourceType) {
|
|
27
|
+
case 'Rechargeable':
|
|
28
|
+
this.createDefaultPowerSourceRechargeableBatteryClusterServer();
|
|
29
|
+
break;
|
|
30
|
+
case 'Replaceable':
|
|
31
|
+
this.createDefaultPowerSourceReplaceableBatteryClusterServer();
|
|
32
|
+
break;
|
|
33
|
+
case 'Battery':
|
|
34
|
+
this.createDefaultPowerSourceBatteryClusterServer();
|
|
35
|
+
break;
|
|
36
|
+
case 'Wired':
|
|
37
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
38
|
+
break;
|
|
39
|
+
case 'None':
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Camera');
|
|
43
|
+
createDefaultCameraAvStreamManagementClusterServer(this, {
|
|
44
|
+
maxContentBufferSize,
|
|
45
|
+
maxNetworkBandwidth,
|
|
46
|
+
supportedStreamUsages,
|
|
47
|
+
streamUsagePriorities,
|
|
48
|
+
maxConcurrentEncoders,
|
|
49
|
+
maxEncodedPixelRate,
|
|
50
|
+
videoSensorParams,
|
|
51
|
+
minViewportResolution,
|
|
52
|
+
rateDistortionTradeOffPoints,
|
|
53
|
+
currentFrameRate,
|
|
54
|
+
viewport,
|
|
55
|
+
microphoneCapabilities,
|
|
56
|
+
snapshotCapabilities,
|
|
57
|
+
});
|
|
58
|
+
if (ptz)
|
|
59
|
+
createDefaultCameraAvSettingsUserLevelManagementClusterServer(this, { panMin, panMax, tiltMin, tiltMax, zoomMax, mptzPosition });
|
|
60
|
+
createDefaultWebRtcTransportProviderClusterServer(this, weriftOfferOptions);
|
|
61
|
+
addWebRtcTransportRequestorClient(this);
|
|
62
|
+
this.addRequiredClusters();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Chime as ChimeCluster } from '@matter/types/clusters/chime';
|
|
2
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
3
|
+
import { type ChimeId } from '../behaviors/chimeServer.js';
|
|
4
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
5
|
+
import type { MatterbridgeEndpointOptions } from '../matterbridgeEndpointTypes.js';
|
|
6
|
+
export interface ChimeOptions extends MatterbridgeEndpointOptions {
|
|
7
|
+
identifyTime?: number;
|
|
8
|
+
identifyType?: Identify.IdentifyType;
|
|
9
|
+
powerSourceType?: 'Rechargeable' | 'Replaceable' | 'Battery' | 'Wired' | 'None';
|
|
10
|
+
installedChimeSounds?: ChimeCluster.ChimeSound[];
|
|
11
|
+
selectedChime?: ChimeId;
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class Chime extends MatterbridgeEndpoint {
|
|
15
|
+
constructor(name: string, serial: string, options?: ChimeOptions);
|
|
16
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
2
|
+
import { createDefaultChimeClusterServer } from '../behaviors/chimeServer.js';
|
|
3
|
+
import { chime, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
4
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
5
|
+
export class Chime extends MatterbridgeEndpoint {
|
|
6
|
+
constructor(name, serial, options = {}) {
|
|
7
|
+
const { identifyTime = 0, identifyType = Identify.IdentifyType.None, powerSourceType = 'Wired', installedChimeSounds = [
|
|
8
|
+
{
|
|
9
|
+
chimeId: 0,
|
|
10
|
+
name: 'Default Chime',
|
|
11
|
+
},
|
|
12
|
+
], selectedChime = 0, enabled = true, id, number, tagList, mode, } = options;
|
|
13
|
+
super(powerSourceType === 'None' ? [chime] : [chime, powerSource], { id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`, number, tagList, mode });
|
|
14
|
+
if (identifyType !== Identify.IdentifyType.None) {
|
|
15
|
+
this.createDefaultIdentifyClusterServer(identifyTime, identifyType);
|
|
16
|
+
}
|
|
17
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Chime');
|
|
18
|
+
switch (powerSourceType) {
|
|
19
|
+
case 'Rechargeable':
|
|
20
|
+
this.createDefaultPowerSourceRechargeableBatteryClusterServer();
|
|
21
|
+
break;
|
|
22
|
+
case 'Replaceable':
|
|
23
|
+
this.createDefaultPowerSourceReplaceableBatteryClusterServer();
|
|
24
|
+
break;
|
|
25
|
+
case 'Battery':
|
|
26
|
+
this.createDefaultPowerSourceBatteryClusterServer();
|
|
27
|
+
break;
|
|
28
|
+
case 'Wired':
|
|
29
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
30
|
+
break;
|
|
31
|
+
case 'None':
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
createDefaultChimeClusterServer(this, installedChimeSounds, selectedChime, enabled);
|
|
35
|
+
this.addRequiredClusters();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
2
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
3
|
+
import type { MatterbridgeEndpointOptions } from '../matterbridgeEndpointTypes.js';
|
|
4
|
+
export interface DoorbellOptions extends MatterbridgeEndpointOptions {
|
|
5
|
+
identifyTime?: number;
|
|
6
|
+
identifyType?: Identify.IdentifyType;
|
|
7
|
+
powerSourceType?: 'Rechargeable' | 'Replaceable' | 'Battery' | 'Wired' | 'None';
|
|
8
|
+
}
|
|
9
|
+
export declare class Doorbell extends MatterbridgeEndpoint {
|
|
10
|
+
constructor(name: string, serial: string, options?: DoorbellOptions);
|
|
11
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
2
|
+
import { addChimeClient } from '../behaviors/clients.js';
|
|
3
|
+
import { doorbell, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
4
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
5
|
+
export class Doorbell extends MatterbridgeEndpoint {
|
|
6
|
+
constructor(name, serial, options = {}) {
|
|
7
|
+
const { identifyTime = 0, identifyType = Identify.IdentifyType.None, powerSourceType = 'Wired', id, number, tagList, mode } = options;
|
|
8
|
+
super(powerSourceType === 'None' ? [doorbell] : [doorbell, powerSource], { id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`, number, tagList, mode });
|
|
9
|
+
this.createDefaultIdentifyClusterServer(identifyTime, identifyType);
|
|
10
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Doorbell');
|
|
11
|
+
switch (powerSourceType) {
|
|
12
|
+
case 'Rechargeable':
|
|
13
|
+
this.createDefaultPowerSourceRechargeableBatteryClusterServer();
|
|
14
|
+
break;
|
|
15
|
+
case 'Replaceable':
|
|
16
|
+
this.createDefaultPowerSourceReplaceableBatteryClusterServer();
|
|
17
|
+
break;
|
|
18
|
+
case 'Battery':
|
|
19
|
+
this.createDefaultPowerSourceBatteryClusterServer();
|
|
20
|
+
break;
|
|
21
|
+
case 'Wired':
|
|
22
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
23
|
+
break;
|
|
24
|
+
case 'None':
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
this.createDefaultMomentarySwitchClusterServer();
|
|
28
|
+
addChimeClient(this);
|
|
29
|
+
this.addRequiredClusters();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Semtag } from '@matter/types';
|
|
2
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
3
|
+
import type { MatterbridgeEndpointOptions } from '../matterbridgeEndpointTypes.js';
|
|
4
|
+
import type { CameraOptions } from './camera.js';
|
|
5
|
+
export type FloodlightCameraCameraOptions = Omit<CameraOptions, 'id' | 'number' | 'tagList' | 'mode' | 'powerSourceType'>;
|
|
6
|
+
export interface FloodlightCameraLightOptions {
|
|
7
|
+
name?: string;
|
|
8
|
+
tagList?: Semtag[];
|
|
9
|
+
onOff?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface FloodlightCameraOptions extends MatterbridgeEndpointOptions {
|
|
12
|
+
powerSourceType?: 'Rechargeable' | 'Replaceable' | 'Battery' | 'Wired' | 'None';
|
|
13
|
+
cameraOptions?: FloodlightCameraCameraOptions;
|
|
14
|
+
lightOptions?: FloodlightCameraLightOptions;
|
|
15
|
+
}
|
|
16
|
+
export declare class FloodlightCamera extends MatterbridgeEndpoint {
|
|
17
|
+
constructor(name: string, serial: string, options?: FloodlightCameraOptions);
|
|
18
|
+
addLight(name: string, tagList?: Semtag[], onOff?: boolean): MatterbridgeEndpoint;
|
|
19
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { StreamUsage } from '@matter/types';
|
|
2
|
+
import { CameraAvStreamManagement } from '@matter/types/clusters/camera-av-stream-management';
|
|
3
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
4
|
+
import { fireAndForget } from '@matterbridge/utils';
|
|
5
|
+
import { createDefaultCameraAvStreamManagementClusterServer } from '../behaviors/cameraAvStreamManagementServer.js';
|
|
6
|
+
import { addWebRtcTransportRequestorClient } from '../behaviors/clients.js';
|
|
7
|
+
import { createDefaultWebRtcTransportProviderClusterServer } from '../behaviors/webRtcTransportProviderServer.js';
|
|
8
|
+
import { camera, floodlightCamera, onOffLight, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
9
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
10
|
+
export class FloodlightCamera extends MatterbridgeEndpoint {
|
|
11
|
+
constructor(name, serial, options = {}) {
|
|
12
|
+
const { powerSourceType = 'Wired', cameraOptions = {}, lightOptions = {}, id, number, tagList, mode } = options;
|
|
13
|
+
super(powerSourceType === 'None' ? [floodlightCamera] : [floodlightCamera, powerSource], {
|
|
14
|
+
id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`,
|
|
15
|
+
number,
|
|
16
|
+
tagList,
|
|
17
|
+
mode,
|
|
18
|
+
});
|
|
19
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Floodlight Camera');
|
|
20
|
+
switch (powerSourceType) {
|
|
21
|
+
case 'Rechargeable':
|
|
22
|
+
this.createDefaultPowerSourceRechargeableBatteryClusterServer();
|
|
23
|
+
break;
|
|
24
|
+
case 'Replaceable':
|
|
25
|
+
this.createDefaultPowerSourceReplaceableBatteryClusterServer();
|
|
26
|
+
break;
|
|
27
|
+
case 'Battery':
|
|
28
|
+
this.createDefaultPowerSourceBatteryClusterServer();
|
|
29
|
+
break;
|
|
30
|
+
case 'Wired':
|
|
31
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
32
|
+
break;
|
|
33
|
+
case 'None':
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
fireAndForget(this.addFixedLabel('composed', 'FloodlightCamera'), this.log, 'Error adding composed label to floodlight camera');
|
|
37
|
+
this.addRequiredClusters();
|
|
38
|
+
const { identifyTime = 0, identifyType = Identify.IdentifyType.None, maxContentBufferSize = 4_194_304, maxNetworkBandwidth = 10_000_000, supportedStreamUsages = [StreamUsage.LiveView, StreamUsage.Recording], streamUsagePriorities = supportedStreamUsages, maxConcurrentEncoders = 1, maxEncodedPixelRate = 1920 * 1080 * 60, videoSensorParams = { sensorWidth: 1920, sensorHeight: 1080, maxFps: 60 }, minViewportResolution = { width: 640, height: 360 }, rateDistortionTradeOffPoints = [
|
|
39
|
+
{ codec: CameraAvStreamManagement.VideoCodec.H264, resolution: { width: 640, height: 480 }, minBitRate: 250_000 },
|
|
40
|
+
{ codec: CameraAvStreamManagement.VideoCodec.H264, resolution: { width: 1280, height: 720 }, minBitRate: 500_000 },
|
|
41
|
+
{ codec: CameraAvStreamManagement.VideoCodec.H264, resolution: { width: 1920, height: 1080 }, minBitRate: 1_000_000 },
|
|
42
|
+
], currentFrameRate = 30, viewport = { x1: 0, y1: 0, x2: videoSensorParams.sensorWidth, y2: videoSensorParams.sensorHeight }, microphoneCapabilities = { maxNumberOfChannels: 1, supportedCodecs: [CameraAvStreamManagement.AudioCodec.Opus], supportedSampleRates: [48000], supportedBitDepths: [16] }, snapshotCapabilities = [
|
|
43
|
+
{ resolution: { width: 640, height: 480 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
|
|
44
|
+
{ resolution: { width: 1280, height: 720 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
|
|
45
|
+
{ resolution: { width: 1920, height: 1080 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
|
|
46
|
+
], weriftOfferOptions, } = cameraOptions;
|
|
47
|
+
const cameraChild = this.addChildDeviceType('Camera', camera, {});
|
|
48
|
+
cameraChild.log.logName = 'Camera';
|
|
49
|
+
if (identifyType !== Identify.IdentifyType.None) {
|
|
50
|
+
cameraChild.createDefaultIdentifyClusterServer(identifyTime, identifyType);
|
|
51
|
+
}
|
|
52
|
+
createDefaultCameraAvStreamManagementClusterServer(cameraChild, {
|
|
53
|
+
maxContentBufferSize,
|
|
54
|
+
maxNetworkBandwidth,
|
|
55
|
+
supportedStreamUsages,
|
|
56
|
+
streamUsagePriorities,
|
|
57
|
+
maxConcurrentEncoders,
|
|
58
|
+
maxEncodedPixelRate,
|
|
59
|
+
videoSensorParams,
|
|
60
|
+
minViewportResolution,
|
|
61
|
+
rateDistortionTradeOffPoints,
|
|
62
|
+
currentFrameRate,
|
|
63
|
+
viewport,
|
|
64
|
+
microphoneCapabilities,
|
|
65
|
+
snapshotCapabilities,
|
|
66
|
+
});
|
|
67
|
+
createDefaultWebRtcTransportProviderClusterServer(cameraChild, weriftOfferOptions);
|
|
68
|
+
addWebRtcTransportRequestorClient(cameraChild);
|
|
69
|
+
cameraChild.addRequiredClusters();
|
|
70
|
+
const { name: lightName = 'Light', tagList: lightTagList = [], onOff: lightOnOff = false } = lightOptions;
|
|
71
|
+
this.addLight(lightName, lightTagList, lightOnOff);
|
|
72
|
+
}
|
|
73
|
+
addLight(name, tagList = [], onOff = false) {
|
|
74
|
+
const light = this.addChildDeviceType(name, onOffLight, tagList.length > 0 ? { tagList } : {});
|
|
75
|
+
light.log.logName = name;
|
|
76
|
+
light.createDefaultIdentifyClusterServer();
|
|
77
|
+
light.createDefaultOnOffClusterServer(onOff);
|
|
78
|
+
light.addRequiredClusters();
|
|
79
|
+
return light;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StreamUsage } from '@matter/types';
|
|
2
|
+
import { CameraAvStreamManagement } from '@matter/types/clusters/camera-av-stream-management';
|
|
3
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
4
|
+
import type { WeriftOfferOptions } from '../behaviors/weriftSession.js';
|
|
5
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
6
|
+
import type { MatterbridgeEndpointOptions } from '../matterbridgeEndpointTypes.js';
|
|
7
|
+
export interface IntercomOptions extends MatterbridgeEndpointOptions {
|
|
8
|
+
identifyTime?: number;
|
|
9
|
+
identifyType?: Identify.IdentifyType;
|
|
10
|
+
powerSourceType?: 'Rechargeable' | 'Replaceable' | 'Battery' | 'Wired' | 'None';
|
|
11
|
+
maxContentBufferSize?: number;
|
|
12
|
+
maxNetworkBandwidth?: number;
|
|
13
|
+
supportedStreamUsages?: StreamUsage[];
|
|
14
|
+
streamUsagePriorities?: StreamUsage[];
|
|
15
|
+
microphoneCapabilities?: CameraAvStreamManagement.AudioCapabilities;
|
|
16
|
+
speakerCapabilities?: CameraAvStreamManagement.AudioCapabilities;
|
|
17
|
+
twoWayTalkSupport?: CameraAvStreamManagement.TwoWayTalkSupportType;
|
|
18
|
+
weriftOfferOptions?: WeriftOfferOptions;
|
|
19
|
+
}
|
|
20
|
+
export declare class Intercom extends MatterbridgeEndpoint {
|
|
21
|
+
constructor(name: string, serial: string, options?: IntercomOptions);
|
|
22
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { StreamUsage } from '@matter/types';
|
|
2
|
+
import { CameraAvStreamManagement } from '@matter/types/clusters/camera-av-stream-management';
|
|
3
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
4
|
+
import { createDefaultIntercomCameraAvStreamManagementClusterServer } from '../behaviors/cameraAvStreamManagementServer.js';
|
|
5
|
+
import { addChimeClient, addWebRtcTransportProviderClient, addWebRtcTransportRequestorClient } from '../behaviors/clients.js';
|
|
6
|
+
import { createDefaultWebRtcTransportProviderClusterServer } from '../behaviors/webRtcTransportProviderServer.js';
|
|
7
|
+
import { createDefaultWebRtcTransportRequestorClusterServer } from '../behaviors/webRtcTransportRequestorServer.js';
|
|
8
|
+
import { intercom, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
9
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
10
|
+
export class Intercom extends MatterbridgeEndpoint {
|
|
11
|
+
constructor(name, serial, options = {}) {
|
|
12
|
+
const { identifyTime = 0, identifyType = Identify.IdentifyType.None, powerSourceType = 'Wired', maxContentBufferSize = 65_536, maxNetworkBandwidth = 128_000, supportedStreamUsages = [StreamUsage.LiveView], streamUsagePriorities = supportedStreamUsages, microphoneCapabilities = { maxNumberOfChannels: 1, supportedCodecs: [CameraAvStreamManagement.AudioCodec.Opus], supportedSampleRates: [48000], supportedBitDepths: [16] }, speakerCapabilities = { maxNumberOfChannels: 1, supportedCodecs: [CameraAvStreamManagement.AudioCodec.Opus], supportedSampleRates: [48000], supportedBitDepths: [16] }, twoWayTalkSupport = CameraAvStreamManagement.TwoWayTalkSupportType.FullDuplex, weriftOfferOptions, id, number, tagList, mode, } = options;
|
|
13
|
+
super(powerSourceType === 'None' ? [intercom] : [intercom, powerSource], {
|
|
14
|
+
id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`,
|
|
15
|
+
number,
|
|
16
|
+
tagList,
|
|
17
|
+
mode,
|
|
18
|
+
});
|
|
19
|
+
if (identifyType !== Identify.IdentifyType.None) {
|
|
20
|
+
this.createDefaultIdentifyClusterServer(identifyTime, identifyType);
|
|
21
|
+
}
|
|
22
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Intercom');
|
|
23
|
+
switch (powerSourceType) {
|
|
24
|
+
case 'Rechargeable':
|
|
25
|
+
this.createDefaultPowerSourceRechargeableBatteryClusterServer();
|
|
26
|
+
break;
|
|
27
|
+
case 'Replaceable':
|
|
28
|
+
this.createDefaultPowerSourceReplaceableBatteryClusterServer();
|
|
29
|
+
break;
|
|
30
|
+
case 'Battery':
|
|
31
|
+
this.createDefaultPowerSourceBatteryClusterServer();
|
|
32
|
+
break;
|
|
33
|
+
case 'Wired':
|
|
34
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
35
|
+
break;
|
|
36
|
+
case 'None':
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
createDefaultIntercomCameraAvStreamManagementClusterServer(this, {
|
|
40
|
+
maxContentBufferSize,
|
|
41
|
+
maxNetworkBandwidth,
|
|
42
|
+
supportedStreamUsages,
|
|
43
|
+
streamUsagePriorities,
|
|
44
|
+
microphoneCapabilities,
|
|
45
|
+
speakerCapabilities,
|
|
46
|
+
twoWayTalkSupport,
|
|
47
|
+
});
|
|
48
|
+
createDefaultWebRtcTransportProviderClusterServer(this, weriftOfferOptions);
|
|
49
|
+
createDefaultWebRtcTransportRequestorClusterServer(this);
|
|
50
|
+
addWebRtcTransportProviderClient(this);
|
|
51
|
+
addWebRtcTransportRequestorClient(this);
|
|
52
|
+
addChimeClient(this);
|
|
53
|
+
this.addRequiredClusters();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { StreamUsage } from '@matter/types';
|
|
2
|
+
import { CameraAvStreamManagement } from '@matter/types/clusters/camera-av-stream-management';
|
|
3
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
4
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
5
|
+
import type { MatterbridgeEndpointOptions } from '../matterbridgeEndpointTypes.js';
|
|
6
|
+
export interface SnapshotCameraOptions extends MatterbridgeEndpointOptions {
|
|
7
|
+
identifyTime?: number;
|
|
8
|
+
identifyType?: Identify.IdentifyType;
|
|
9
|
+
powerSourceType?: 'Rechargeable' | 'Replaceable' | 'Battery' | 'Wired' | 'None';
|
|
10
|
+
maxConcurrentEncoders?: number;
|
|
11
|
+
maxEncodedPixelRate?: number;
|
|
12
|
+
maxContentBufferSize?: number;
|
|
13
|
+
snapshotCapabilities?: CameraAvStreamManagement.SnapshotCapabilities[];
|
|
14
|
+
maxNetworkBandwidth?: number;
|
|
15
|
+
supportedStreamUsages?: StreamUsage[];
|
|
16
|
+
streamUsagePriorities?: StreamUsage[];
|
|
17
|
+
}
|
|
18
|
+
export declare class SnapshotCamera extends MatterbridgeEndpoint {
|
|
19
|
+
constructor(name: string, serial: string, options?: SnapshotCameraOptions);
|
|
20
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { StreamUsage } from '@matter/types';
|
|
2
|
+
import { CameraAvStreamManagement } from '@matter/types/clusters/camera-av-stream-management';
|
|
3
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
4
|
+
import { createDefaultSnapshotCameraAvStreamManagementClusterServer } from '../behaviors/cameraAvStreamManagementServer.js';
|
|
5
|
+
import { powerSource, snapshotCamera } from '../matterbridgeDeviceTypes.js';
|
|
6
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
7
|
+
export class SnapshotCamera extends MatterbridgeEndpoint {
|
|
8
|
+
constructor(name, serial, options = {}) {
|
|
9
|
+
const { identifyTime = 0, identifyType = Identify.IdentifyType.None, powerSourceType = 'Wired', maxConcurrentEncoders = 1, maxEncodedPixelRate = 10000000, maxContentBufferSize = 1024, snapshotCapabilities = [
|
|
10
|
+
{ resolution: { width: 640, height: 480 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
|
|
11
|
+
{ resolution: { width: 1280, height: 720 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
|
|
12
|
+
{ resolution: { width: 1920, height: 1080 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
|
|
13
|
+
], maxNetworkBandwidth = 10000, supportedStreamUsages = [StreamUsage.Recording], streamUsagePriorities = [StreamUsage.Recording], id, number, tagList, mode, } = options;
|
|
14
|
+
super(powerSourceType === 'None' ? [snapshotCamera] : [snapshotCamera, powerSource], {
|
|
15
|
+
id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`,
|
|
16
|
+
number,
|
|
17
|
+
tagList,
|
|
18
|
+
mode,
|
|
19
|
+
});
|
|
20
|
+
if (identifyType !== Identify.IdentifyType.None) {
|
|
21
|
+
this.createDefaultIdentifyClusterServer(identifyTime, identifyType);
|
|
22
|
+
}
|
|
23
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Snapshot Camera');
|
|
24
|
+
switch (powerSourceType) {
|
|
25
|
+
case 'Rechargeable':
|
|
26
|
+
this.createDefaultPowerSourceRechargeableBatteryClusterServer();
|
|
27
|
+
break;
|
|
28
|
+
case 'Replaceable':
|
|
29
|
+
this.createDefaultPowerSourceReplaceableBatteryClusterServer();
|
|
30
|
+
break;
|
|
31
|
+
case 'Battery':
|
|
32
|
+
this.createDefaultPowerSourceBatteryClusterServer();
|
|
33
|
+
break;
|
|
34
|
+
case 'Wired':
|
|
35
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
36
|
+
break;
|
|
37
|
+
case 'None':
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
createDefaultSnapshotCameraAvStreamManagementClusterServer(this, {
|
|
41
|
+
maxConcurrentEncoders,
|
|
42
|
+
maxEncodedPixelRate,
|
|
43
|
+
maxContentBufferSize,
|
|
44
|
+
snapshotCapabilities,
|
|
45
|
+
maxNetworkBandwidth,
|
|
46
|
+
supportedStreamUsages,
|
|
47
|
+
streamUsagePriorities,
|
|
48
|
+
});
|
|
49
|
+
this.addRequiredClusters();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Semtag } from '@matter/types';
|
|
2
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
3
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
4
|
+
import type { MatterbridgeEndpointOptions } from '../matterbridgeEndpointTypes.js';
|
|
5
|
+
import type { CameraOptions } from './camera.js';
|
|
6
|
+
export type VideoDoorbellCameraOptions = Omit<CameraOptions, 'id' | 'number' | 'tagList' | 'mode' | 'powerSourceType'>;
|
|
7
|
+
export interface VideoDoorbellDoorbellOptions {
|
|
8
|
+
name?: string;
|
|
9
|
+
tagList?: Semtag[];
|
|
10
|
+
identifyTime?: number;
|
|
11
|
+
identifyType?: Identify.IdentifyType;
|
|
12
|
+
}
|
|
13
|
+
export interface VideoDoorbellOptions extends MatterbridgeEndpointOptions {
|
|
14
|
+
powerSourceType?: 'Rechargeable' | 'Replaceable' | 'Battery' | 'Wired' | 'None';
|
|
15
|
+
cameraOptions?: VideoDoorbellCameraOptions;
|
|
16
|
+
doorbellOptions?: VideoDoorbellDoorbellOptions;
|
|
17
|
+
}
|
|
18
|
+
export declare class VideoDoorbell extends MatterbridgeEndpoint {
|
|
19
|
+
constructor(name: string, serial: string, options?: VideoDoorbellOptions);
|
|
20
|
+
addDoorbell(name: string, tagList?: Semtag[], identifyTime?: number, identifyType?: Identify.IdentifyType): MatterbridgeEndpoint;
|
|
21
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { StreamUsage } from '@matter/types';
|
|
2
|
+
import { CameraAvStreamManagement } from '@matter/types/clusters/camera-av-stream-management';
|
|
3
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
4
|
+
import { fireAndForget } from '@matterbridge/utils';
|
|
5
|
+
import { createDefaultCameraAvStreamManagementClusterServer } from '../behaviors/cameraAvStreamManagementServer.js';
|
|
6
|
+
import { addChimeClient, addWebRtcTransportRequestorClient } from '../behaviors/clients.js';
|
|
7
|
+
import { createDefaultWebRtcTransportProviderClusterServer } from '../behaviors/webRtcTransportProviderServer.js';
|
|
8
|
+
import { camera, doorbell, powerSource, videoDoorbell } from '../matterbridgeDeviceTypes.js';
|
|
9
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
10
|
+
export class VideoDoorbell extends MatterbridgeEndpoint {
|
|
11
|
+
constructor(name, serial, options = {}) {
|
|
12
|
+
const { powerSourceType = 'Wired', cameraOptions = {}, doorbellOptions = {}, id, number, tagList, mode } = options;
|
|
13
|
+
super(powerSourceType === 'None' ? [videoDoorbell] : [videoDoorbell, powerSource], {
|
|
14
|
+
id: id ?? `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}`,
|
|
15
|
+
number,
|
|
16
|
+
tagList,
|
|
17
|
+
mode,
|
|
18
|
+
});
|
|
19
|
+
this.createDefaultBasicInformationClusterServer(name, serial, 0xfff1, 'Matterbridge', 0x8000, 'Matterbridge Video Doorbell');
|
|
20
|
+
switch (powerSourceType) {
|
|
21
|
+
case 'Rechargeable':
|
|
22
|
+
this.createDefaultPowerSourceRechargeableBatteryClusterServer();
|
|
23
|
+
break;
|
|
24
|
+
case 'Replaceable':
|
|
25
|
+
this.createDefaultPowerSourceReplaceableBatteryClusterServer();
|
|
26
|
+
break;
|
|
27
|
+
case 'Battery':
|
|
28
|
+
this.createDefaultPowerSourceBatteryClusterServer();
|
|
29
|
+
break;
|
|
30
|
+
case 'Wired':
|
|
31
|
+
this.createDefaultPowerSourceWiredClusterServer();
|
|
32
|
+
break;
|
|
33
|
+
case 'None':
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
fireAndForget(this.addFixedLabel('composed', 'VideoDoorbell'), this.log, 'Error adding composed label to video doorbell');
|
|
37
|
+
this.addRequiredClusters();
|
|
38
|
+
const { identifyTime: cameraIdentifyTime = 0, identifyType: cameraIdentifyType = Identify.IdentifyType.None, maxContentBufferSize = 4_194_304, maxNetworkBandwidth = 10_000_000, supportedStreamUsages = [StreamUsage.LiveView, StreamUsage.Recording], streamUsagePriorities = supportedStreamUsages, maxConcurrentEncoders = 1, maxEncodedPixelRate = 1920 * 1080 * 60, videoSensorParams = { sensorWidth: 1920, sensorHeight: 1080, maxFps: 60 }, minViewportResolution = { width: 640, height: 360 }, rateDistortionTradeOffPoints = [
|
|
39
|
+
{ codec: CameraAvStreamManagement.VideoCodec.H264, resolution: { width: 640, height: 480 }, minBitRate: 250_000 },
|
|
40
|
+
{ codec: CameraAvStreamManagement.VideoCodec.H264, resolution: { width: 1280, height: 720 }, minBitRate: 500_000 },
|
|
41
|
+
{ codec: CameraAvStreamManagement.VideoCodec.H264, resolution: { width: 1920, height: 1080 }, minBitRate: 1_000_000 },
|
|
42
|
+
], currentFrameRate = 30, viewport = { x1: 0, y1: 0, x2: videoSensorParams.sensorWidth, y2: videoSensorParams.sensorHeight }, microphoneCapabilities = { maxNumberOfChannels: 1, supportedCodecs: [CameraAvStreamManagement.AudioCodec.Opus], supportedSampleRates: [48000], supportedBitDepths: [16] }, snapshotCapabilities = [
|
|
43
|
+
{ resolution: { width: 640, height: 480 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
|
|
44
|
+
{ resolution: { width: 1280, height: 720 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
|
|
45
|
+
{ resolution: { width: 1920, height: 1080 }, maxFrameRate: 10, imageCodec: CameraAvStreamManagement.ImageCodec.Jpeg, requiresEncodedPixels: false },
|
|
46
|
+
], weriftOfferOptions, } = cameraOptions;
|
|
47
|
+
const cameraChild = this.addChildDeviceType('Camera', camera, {});
|
|
48
|
+
cameraChild.log.logName = 'Camera';
|
|
49
|
+
if (cameraIdentifyType !== Identify.IdentifyType.None) {
|
|
50
|
+
cameraChild.createDefaultIdentifyClusterServer(cameraIdentifyTime, cameraIdentifyType);
|
|
51
|
+
}
|
|
52
|
+
createDefaultCameraAvStreamManagementClusterServer(cameraChild, {
|
|
53
|
+
maxContentBufferSize,
|
|
54
|
+
maxNetworkBandwidth,
|
|
55
|
+
supportedStreamUsages,
|
|
56
|
+
streamUsagePriorities,
|
|
57
|
+
maxConcurrentEncoders,
|
|
58
|
+
maxEncodedPixelRate,
|
|
59
|
+
videoSensorParams,
|
|
60
|
+
minViewportResolution,
|
|
61
|
+
rateDistortionTradeOffPoints,
|
|
62
|
+
currentFrameRate,
|
|
63
|
+
viewport,
|
|
64
|
+
microphoneCapabilities,
|
|
65
|
+
snapshotCapabilities,
|
|
66
|
+
});
|
|
67
|
+
createDefaultWebRtcTransportProviderClusterServer(cameraChild, weriftOfferOptions);
|
|
68
|
+
addWebRtcTransportRequestorClient(cameraChild);
|
|
69
|
+
cameraChild.addRequiredClusters();
|
|
70
|
+
const { name: doorbellName = 'Doorbell', tagList: doorbellTagList = [], identifyTime = 0, identifyType = Identify.IdentifyType.None } = doorbellOptions;
|
|
71
|
+
this.addDoorbell(doorbellName, doorbellTagList, identifyTime, identifyType);
|
|
72
|
+
}
|
|
73
|
+
addDoorbell(name, tagList = [], identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
74
|
+
const doorbellChild = this.addChildDeviceType(name, doorbell, tagList.length > 0 ? { tagList } : {});
|
|
75
|
+
doorbellChild.log.logName = name;
|
|
76
|
+
doorbellChild.createDefaultIdentifyClusterServer(identifyTime, identifyType);
|
|
77
|
+
doorbellChild.createDefaultMomentarySwitchClusterServer();
|
|
78
|
+
addChimeClient(doorbellChild);
|
|
79
|
+
doorbellChild.addRequiredClusters();
|
|
80
|
+
return doorbellChild;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -28,7 +28,7 @@ import type { MeasurementAccuracy, Semtag } from '@matter/types/globals';
|
|
|
28
28
|
import { AnsiLogger, LogLevel } from 'node-ansi-logger';
|
|
29
29
|
import type { DeviceTypeDefinition } from './matterbridgeDeviceTypes.js';
|
|
30
30
|
import { CommandHandler, type CommandHandlerData, type CommandHandlerExecutionResult, type CommandHandlerFunction, type CommandHandlers } from './matterbridgeEndpointCommandHandler.js';
|
|
31
|
-
import type { MatterbridgeEndpointOptions, SerializedMatterbridgeEndpoint } from './matterbridgeEndpointTypes.js';
|
|
31
|
+
import type { MatterbridgeEndpointOptions, SerializedMatterbridgeEndpoint, SubscribeCommandListener } from './matterbridgeEndpointTypes.js';
|
|
32
32
|
type FirstCommandParam<Params extends unknown[]> = Params extends [] ? undefined : Params[0];
|
|
33
33
|
type BehaviorCluster<T extends Behavior.Type> = T extends {
|
|
34
34
|
cluster: infer C extends ClusterType;
|
|
@@ -106,6 +106,9 @@ export declare class MatterbridgeEndpoint extends Endpoint {
|
|
|
106
106
|
subscribeAttribute<T extends Behavior.Type, A extends keyof Behavior.StateOf<T>>(cluster: T, attribute: A, listener: (newValue: Behavior.StateOf<T>[A], oldValue: Behavior.StateOf<T>[A], context: ActionContext) => void, log?: AnsiLogger): MatterbridgeEndpoint;
|
|
107
107
|
subscribeAttribute<T extends ClusterType, A extends keyof ClusterAttributesOf<T>>(cluster: T, attribute: A, listener: (newValue: ClusterAttributesOf<T>[A], oldValue: ClusterAttributesOf<T>[A], context: ActionContext) => void, log?: AnsiLogger): MatterbridgeEndpoint;
|
|
108
108
|
subscribeAttribute(cluster: ClusterId | string, attribute: string, listener: (newValue: any, oldValue: any, context: ActionContext) => void, log?: AnsiLogger): MatterbridgeEndpoint;
|
|
109
|
+
subscribeCommand<T extends Behavior.Type, C extends BehaviorCommandName<T>>(cluster: T, command: C, listener: SubscribeCommandListener<BehaviorCommandParams<T, C>>, log?: AnsiLogger): MatterbridgeEndpoint;
|
|
110
|
+
subscribeCommand<T extends ClusterType, C extends ClusterCommandName<T>>(cluster: T, command: C, listener: SubscribeCommandListener<ClusterCommandParams<T, C>>, log?: AnsiLogger): MatterbridgeEndpoint;
|
|
111
|
+
subscribeCommand(cluster: ClusterId | string, command: string, listener: SubscribeCommandListener, log?: AnsiLogger): MatterbridgeEndpoint;
|
|
109
112
|
setCluster<T extends Behavior.Type>(cluster: T, value: Behavior.StateOf<T>, log?: AnsiLogger): Promise<boolean>;
|
|
110
113
|
setCluster<T extends ClusterType>(cluster: T, value: Partial<ClusterAttributesOf<T>>, log?: AnsiLogger): Promise<boolean>;
|
|
111
114
|
setCluster(cluster: ClusterId | string, value: Record<string, boolean | number | bigint | string | object | undefined | null>, log?: AnsiLogger): Promise<boolean>;
|
|
@@ -85,7 +85,7 @@ import { MatterbridgeValveConfigurationAndControlServer } from './behaviors/valv
|
|
|
85
85
|
import { MatterbridgeWaterTankLevelMonitoringServer } from './behaviors/waterTankLevelMonitoringServer.js';
|
|
86
86
|
import { MatterbridgeWindowCoveringServer } from './behaviors/windowCoveringServer.js';
|
|
87
87
|
import { CommandHandler, } from './matterbridgeEndpointCommandHandler.js';
|
|
88
|
-
import { addClusterClients, addClusterServers, addFixedLabel, addOptionalClusterClients, addOptionalClusterServers, addRequiredClusterClients, addRequiredClusterServers, addUserLabel, checkNotLatinCharacters, createUniqueId, defaultFor, featuresFor, generateUniqueId, getApparentElectricalPowerMeasurementClusterServer, getAttribute, getAttributeId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getCluster, getClusterId, getDefaultDeviceEnergyManagementClusterServer, getDefaultDeviceEnergyManagementModeClusterServer, getDefaultElectricalEnergyMeasurementClusterServer, getDefaultElectricalPowerMeasurementClusterServer, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultOccupancySensingClusterServer, getDefaultOperationalStateClusterServer, getDefaultPowerSourceBatteryClusterServer, getDefaultPowerSourceRechargeableBatteryClusterServer, getDefaultPowerSourceReplaceableBatteryClusterServer, getDefaultPowerSourceWiredClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultSoilMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getExportedElectricalEnergyMeasurementClusterServer, getImportedElectricalEnergyMeasurementClusterServer, invokeBehaviorCommand, lowercaseFirstLetter, setAttribute, setCluster, subscribeAttribute, triggerEvent, updateAttribute, } from './matterbridgeEndpointHelpers.js';
|
|
88
|
+
import { addClusterClients, addClusterServers, addFixedLabel, addOptionalClusterClients, addOptionalClusterServers, addRequiredClusterClients, addRequiredClusterServers, addUserLabel, checkNotLatinCharacters, createUniqueId, defaultFor, featuresFor, generateUniqueId, getApparentElectricalPowerMeasurementClusterServer, getAttribute, getAttributeId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getCluster, getClusterId, getDefaultDeviceEnergyManagementClusterServer, getDefaultDeviceEnergyManagementModeClusterServer, getDefaultElectricalEnergyMeasurementClusterServer, getDefaultElectricalPowerMeasurementClusterServer, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultOccupancySensingClusterServer, getDefaultOperationalStateClusterServer, getDefaultPowerSourceBatteryClusterServer, getDefaultPowerSourceRechargeableBatteryClusterServer, getDefaultPowerSourceReplaceableBatteryClusterServer, getDefaultPowerSourceWiredClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultSoilMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getExportedElectricalEnergyMeasurementClusterServer, getImportedElectricalEnergyMeasurementClusterServer, invokeBehaviorCommand, lowercaseFirstLetter, setAttribute, setCluster, subscribeAttribute, subscribeCommand, triggerEvent, updateAttribute, } from './matterbridgeEndpointHelpers.js';
|
|
89
89
|
logModuleLoaded('MatterbridgeEndpoint');
|
|
90
90
|
const MATTERBRIDGE_ENDPOINT_BRAND = Symbol('MatterbridgeEndpoint.brand');
|
|
91
91
|
export function isMatterbridgeEndpoint(value) {
|
|
@@ -251,6 +251,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
251
251
|
subscribeAttribute(cluster, attribute, listener, log) {
|
|
252
252
|
return subscribeAttribute(this, cluster, attribute, listener, log);
|
|
253
253
|
}
|
|
254
|
+
subscribeCommand(cluster, command, listener, log) {
|
|
255
|
+
return subscribeCommand(this, cluster, command, listener, log);
|
|
256
|
+
}
|
|
254
257
|
async setCluster(cluster, value, log) {
|
|
255
258
|
return await setCluster(this, cluster, value, log);
|
|
256
259
|
}
|
|
@@ -24,6 +24,7 @@ import { MatterbridgeOperationalStateServer } from './behaviors/operationalState
|
|
|
24
24
|
import { MatterbridgePowerSourceServer } from './behaviors/powerSourceServer.js';
|
|
25
25
|
import type { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
26
26
|
import type { CommandHandlers } from './matterbridgeEndpointCommandHandler.js';
|
|
27
|
+
import type { SubscribeCommandListener } from './matterbridgeEndpointTypes.js';
|
|
27
28
|
export declare function capitalizeFirstLetter(name: string): string;
|
|
28
29
|
export declare function lowercaseFirstLetter(name: string): string;
|
|
29
30
|
export declare function getSnapshot<T>(value: T): T;
|
|
@@ -57,6 +58,8 @@ export declare function getAttribute(endpoint: MatterbridgeEndpoint, cluster: Be
|
|
|
57
58
|
export declare function setAttribute(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, attribute: string, value: boolean | number | bigint | string | object | null, log?: AnsiLogger): Promise<boolean>;
|
|
58
59
|
export declare function updateAttribute(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, attribute: string, value: boolean | number | bigint | string | object | null, log?: AnsiLogger): Promise<boolean>;
|
|
59
60
|
export declare function subscribeAttribute(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, attribute: string, listener: (newValue: any, oldValue: any, context: ActionContext) => void, log?: AnsiLogger): MatterbridgeEndpoint;
|
|
61
|
+
export declare function subscribeCommand(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, command: string, listener: SubscribeCommandListener, log?: AnsiLogger): MatterbridgeEndpoint;
|
|
62
|
+
export declare function emitCommand(endpoint: Endpoint, cluster: string, command: string, request: unknown, context: ActionContext): void;
|
|
60
63
|
export declare function setCluster(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, value: Record<string, boolean | number | bigint | string | object | undefined | null>, log?: AnsiLogger): Promise<boolean>;
|
|
61
64
|
export declare function getCluster(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, log?: AnsiLogger): Record<string, boolean | number | bigint | string | object | undefined | null> | undefined;
|
|
62
65
|
export declare function triggerEvent(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, event: string, payload: Record<string, boolean | number | bigint | string | object | undefined | null>, log?: AnsiLogger): Promise<boolean>;
|