@matterbridge/core 3.8.0 → 3.8.1-dev-20260607-08cd4da
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/doorLockServer.d.ts +2 -2
- package/dist/devices/extractorHood.js +8 -8
- package/dist/jestutils/jestMatterTest.js +7 -6
- package/dist/jestutils/jestMatterbridgeEndpointSpy.d.ts +6 -5
- package/dist/jestutils/jestMatterbridgePlatformSpy.d.ts +4 -4
- package/dist/jestutils/jestMatterbridgeTest.js +1 -1
- package/dist/matterNode.js +3 -4
- package/dist/matterbridge.js +2 -2
- package/dist/matterbridgeEndpoint.d.ts +4 -4
- package/dist/matterbridgeEndpoint.js +18 -18
- package/dist/matterbridgeEndpointHelpers.d.ts +1 -1
- package/dist/matterbridgeEndpointHelpers.js +5 -9
- package/package.json +5 -5
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DoorLockServer } from '@matter/node/behaviors/door-lock';
|
|
2
2
|
import { DoorLock } from '@matter/types/clusters/door-lock';
|
|
3
3
|
declare const MatterbridgeDoorLockServer_base: import("@matter/node").ClusterBehavior.Type<import("@matter/node").ClusterBehavior.Type<typeof DoorLockServer, import("@matter/types").ClusterType.WithSupportedFeatures<DoorLock, {
|
|
4
|
+
user: true;
|
|
4
5
|
pinCredential: true;
|
|
5
6
|
rfidCredential: false;
|
|
6
7
|
fingerCredentials: false;
|
|
@@ -8,13 +9,13 @@ declare const MatterbridgeDoorLockServer_base: import("@matter/node").ClusterBeh
|
|
|
8
9
|
doorPositionSensor: false;
|
|
9
10
|
faceCredentials: false;
|
|
10
11
|
credentialOverTheAirAccess: false;
|
|
11
|
-
user: true;
|
|
12
12
|
yearDayAccessSchedules: false;
|
|
13
13
|
holidaySchedules: false;
|
|
14
14
|
unbolting: false;
|
|
15
15
|
aliroProvisioning: false;
|
|
16
16
|
aliroBleuwb: false;
|
|
17
17
|
}>, import("@matter/types").ClusterType.Concrete, typeof import("@matter/node/behaviors/door-lock").DoorLockBaseServer.Internal, "doorLock">, import("@matter/types").ClusterType.WithEnabledAttributes<import("@matter/types").ClusterType.WithEnabledEvents<import("@matter/types").ClusterType.WithSupportedFeatures<DoorLock, {
|
|
18
|
+
user: true;
|
|
18
19
|
pinCredential: true;
|
|
19
20
|
rfidCredential: false;
|
|
20
21
|
fingerCredentials: false;
|
|
@@ -22,7 +23,6 @@ declare const MatterbridgeDoorLockServer_base: import("@matter/node").ClusterBeh
|
|
|
22
23
|
doorPositionSensor: false;
|
|
23
24
|
faceCredentials: false;
|
|
24
25
|
credentialOverTheAirAccess: false;
|
|
25
|
-
user: true;
|
|
26
26
|
yearDayAccessSchedules: false;
|
|
27
27
|
holidaySchedules: false;
|
|
28
28
|
unbolting: false;
|
|
@@ -10,26 +10,26 @@ export class ExtractorHood extends MatterbridgeEndpoint {
|
|
|
10
10
|
this.createBaseFanControlClusterServer();
|
|
11
11
|
this.createDefaultHepaFilterMonitoringClusterServer(hepaCondition, hepaChangeIndication, hepaInPlaceIndicator, hepaLastChangedTime, hepaReplacementProductList);
|
|
12
12
|
this.createDefaultActivatedCarbonFilterMonitoringClusterServer(activatedCarbonCondition, activatedCarbonChangeIndication, activatedCarbonInPlaceIndicator, activatedCarbonLastChangedTime, activatedCarbonReplacementProductList);
|
|
13
|
-
|
|
13
|
+
this.subscribeAttribute('fanControl', 'fanMode', (newValue, oldValue, context) => {
|
|
14
14
|
if (context.offline === true)
|
|
15
15
|
return;
|
|
16
16
|
this.log.info(`Fan control fanMode attribute changed: ${newValue}`);
|
|
17
|
-
})
|
|
18
|
-
|
|
17
|
+
});
|
|
18
|
+
this.subscribeAttribute('fanControl', 'percentSetting', (newValue, oldValue, context) => {
|
|
19
19
|
if (context.offline === true)
|
|
20
20
|
return;
|
|
21
21
|
this.log.info(`Fan control percentSetting attribute changed: ${newValue}`);
|
|
22
22
|
void this.setAttribute('fanControl', 'percentCurrent', newValue, this.log).catch(() => { });
|
|
23
|
-
})
|
|
24
|
-
|
|
23
|
+
});
|
|
24
|
+
this.subscribeAttribute('hepaFilterMonitoring', 'lastChangedTime', (newValue, oldValue, context) => {
|
|
25
25
|
if (context.offline === true)
|
|
26
26
|
return;
|
|
27
27
|
this.log.info(`Hepa filter monitoring lastChangedTime attribute changed: ${newValue}`);
|
|
28
|
-
})
|
|
29
|
-
|
|
28
|
+
});
|
|
29
|
+
this.subscribeAttribute('activatedCarbonFilterMonitoring', 'lastChangedTime', (newValue, oldValue, context) => {
|
|
30
30
|
if (context.offline === true)
|
|
31
31
|
return;
|
|
32
32
|
this.log.info(`Activated carbon filter monitoring lastChangedTime attribute changed: ${newValue}`);
|
|
33
|
-
})
|
|
33
|
+
});
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -56,10 +56,10 @@ export function getPlatformMatterbridge() {
|
|
|
56
56
|
matterbridgePluginDirectory: path.join(HOMEDIR, 'Matterbridge'),
|
|
57
57
|
matterbridgeCertDirectory: path.join(HOMEDIR, '.mattercert'),
|
|
58
58
|
globalModulesDirectory: path.join(HOMEDIR, 'node_modules'),
|
|
59
|
-
matterbridgeVersion: '3.8.
|
|
60
|
-
matterbridgeLatestVersion: '3.8.
|
|
61
|
-
matterbridgeDevVersion: '3.8.
|
|
62
|
-
frontendVersion: '3.8.
|
|
59
|
+
matterbridgeVersion: '3.8.1',
|
|
60
|
+
matterbridgeLatestVersion: '3.8.1',
|
|
61
|
+
matterbridgeDevVersion: '3.8.1',
|
|
62
|
+
frontendVersion: '3.8.1',
|
|
63
63
|
bridgeMode: '',
|
|
64
64
|
restartMode: '',
|
|
65
65
|
virtualMode: 'mounted_switch',
|
|
@@ -144,8 +144,9 @@ export async function createServerNode(port, deviceType = DeviceTypeId(0x000e),
|
|
|
144
144
|
vendorId: VendorId(0xfff1),
|
|
145
145
|
vendorName: 'Matterbridge',
|
|
146
146
|
productId: 0x8000,
|
|
147
|
-
productName: 'Matterbridge ' + NAME,
|
|
148
|
-
|
|
147
|
+
productName: ('Matterbridge ' + NAME).slice(0, 32),
|
|
148
|
+
productLabel: ('Label ' + NAME).slice(0, 64),
|
|
149
|
+
nodeLabel: (NAME + 'ServerNode').slice(0, 32),
|
|
149
150
|
hardwareVersion: 1,
|
|
150
151
|
softwareVersion: 1,
|
|
151
152
|
reachable: true,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
1
2
|
export declare const setClusterMatterbridgeEndpointSpy: import("jest-mock").SpiedFunction<{
|
|
2
3
|
<T extends import("@matter/node").Behavior.Type>(cluster: T, value: import("@matter/node").Behavior.StateOf<T>, log?: import("node-ansi-logger").AnsiLogger): Promise<boolean>;
|
|
3
|
-
<T extends import("@matter/types").ClusterType>(cluster: T, value: T["Typing"] extends {
|
|
4
|
+
<T extends import("@matter/types").ClusterType>(cluster: T, value: Partial<T["Typing"] extends {
|
|
4
5
|
Attributes: infer Attributes;
|
|
5
|
-
} ? Attributes : {}
|
|
6
|
+
} ? Attributes : {}>, log?: import("node-ansi-logger").AnsiLogger): Promise<boolean>;
|
|
6
7
|
(cluster: import("@matter/types").ClusterId | string, value: Record<string, boolean | number | bigint | string | object | undefined | null>, log?: import("node-ansi-logger").AnsiLogger): Promise<boolean>;
|
|
7
8
|
}>;
|
|
8
9
|
export declare const setAttributeMatterbridgeEndpointSpy: import("jest-mock").SpiedFunction<{
|
|
@@ -24,15 +25,15 @@ export declare const updateAttributeMatterbridgeEndpointSpy: import("jest-mock")
|
|
|
24
25
|
(cluster: import("@matter/types").ClusterId | string, attribute: string, value: boolean | number | bigint | string | object | null, log?: import("node-ansi-logger").AnsiLogger): Promise<boolean>;
|
|
25
26
|
}>;
|
|
26
27
|
export declare const subscribeAttributeMatterbridgeEndpointSpy: import("jest-mock").SpiedFunction<{
|
|
27
|
-
<T extends import("@matter/node").Behavior.Type, A extends keyof import("@matter/node").Behavior.StateOf<T>>(cluster: T, attribute: A, listener: (newValue: import("@matter/node").Behavior.StateOf<T>[A], oldValue: import("@matter/node").Behavior.StateOf<T>[A], context: import("@matter/node").ActionContext) => void, log?: import("node-ansi-logger").AnsiLogger):
|
|
28
|
+
<T extends import("@matter/node").Behavior.Type, A extends keyof import("@matter/node").Behavior.StateOf<T>>(cluster: T, attribute: A, listener: (newValue: import("@matter/node").Behavior.StateOf<T>[A], oldValue: import("@matter/node").Behavior.StateOf<T>[A], context: import("@matter/node").ActionContext) => void, log?: import("node-ansi-logger").AnsiLogger): MatterbridgeEndpoint;
|
|
28
29
|
<T extends import("@matter/types").ClusterType, A extends keyof (T["Typing"] extends {
|
|
29
30
|
Attributes: infer Attributes;
|
|
30
31
|
} ? Attributes : {})>(cluster: T, attribute: A, listener: (newValue: (T["Typing"] extends {
|
|
31
32
|
Attributes: infer Attributes;
|
|
32
33
|
} ? Attributes : {})[A], oldValue: (T["Typing"] extends {
|
|
33
34
|
Attributes: infer Attributes;
|
|
34
|
-
} ? Attributes : {})[A], context: import("@matter/node").ActionContext) => void, log?: import("node-ansi-logger").AnsiLogger):
|
|
35
|
-
(cluster: import("@matter/types").ClusterId | string, attribute: string, listener: (newValue: any, oldValue: any, context: import("@matter/node").ActionContext) => void, log?: import("node-ansi-logger").AnsiLogger):
|
|
35
|
+
} ? Attributes : {})[A], context: import("@matter/node").ActionContext) => void, log?: import("node-ansi-logger").AnsiLogger): MatterbridgeEndpoint;
|
|
36
|
+
(cluster: import("@matter/types").ClusterId | string, attribute: string, listener: (newValue: any, oldValue: any, context: import("@matter/node").ActionContext) => void, log?: import("node-ansi-logger").AnsiLogger): MatterbridgeEndpoint;
|
|
36
37
|
}>;
|
|
37
38
|
export declare const triggerEventMatterbridgeEndpointSpy: import("jest-mock").SpiedFunction<{
|
|
38
39
|
<T extends import("@matter/node").Behavior.Type, E extends keyof ((T extends {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const destroyMatterbridgePlatformSpy: import("jest-mock").SpiedGetter<string | boolean | import("node-ansi-logger").AnsiLogger |
|
|
1
|
+
export declare const destroyMatterbridgePlatformSpy: import("jest-mock").SpiedGetter<string | boolean | import("node-ansi-logger").AnsiLogger | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | Promise<void> | import("node-persist-manager").NodeStorage> | import("jest-mock").SpiedSetter<string | boolean | import("node-ansi-logger").AnsiLogger | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | Promise<void> | import("node-persist-manager").NodeStorage>;
|
|
2
2
|
export declare const onStartMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(reason?: string) => Promise<void>>;
|
|
3
3
|
export declare const onConfigureMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<() => Promise<void>>;
|
|
4
4
|
export declare const onShutdownMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(reason?: string) => Promise<void>>;
|
|
@@ -24,7 +24,7 @@ export declare const registerVirtualDeviceMatterbridgePlatformSpy: import("jest-
|
|
|
24
24
|
export declare const registerDeviceMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(device: import("../matterbridgeEndpoint.js").MatterbridgeEndpoint) => Promise<void>>;
|
|
25
25
|
export declare const unregisterDeviceMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(device: import("../matterbridgeEndpoint.js").MatterbridgeEndpoint) => Promise<void>>;
|
|
26
26
|
export declare const unregisterAllDevicesMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(delay?: number) => Promise<void>>;
|
|
27
|
-
export declare const saveSelectsMatterbridgePlatformSpy: import("jest-mock").SpiedGetter<string | boolean | import("node-ansi-logger").AnsiLogger |
|
|
27
|
+
export declare const saveSelectsMatterbridgePlatformSpy: import("jest-mock").SpiedGetter<string | boolean | import("node-ansi-logger").AnsiLogger | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | Promise<void> | import("node-persist-manager").NodeStorage> | import("jest-mock").SpiedSetter<string | boolean | import("node-ansi-logger").AnsiLogger | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | Promise<void> | import("node-persist-manager").NodeStorage>;
|
|
28
28
|
export declare const clearSelectMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<() => Promise<void>>;
|
|
29
29
|
export declare const clearDeviceSelectMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(serial: string) => Promise<void>>;
|
|
30
30
|
export declare const clearEntitySelectMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(name: string) => Promise<void>>;
|
|
@@ -56,5 +56,5 @@ export declare const getSelectEntitiesMatterbridgePlatformSpy: import("jest-mock
|
|
|
56
56
|
export declare const verifyMatterbridgeVersionMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(requiredVersion: string, destroy?: boolean) => boolean>;
|
|
57
57
|
export declare const validateDeviceMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(device: string | string[], log?: boolean) => boolean>;
|
|
58
58
|
export declare const validateEntityMatterbridgePlatformSpy: import("jest-mock").SpiedFunction<(device: string, entity: string, log?: boolean) => boolean>;
|
|
59
|
-
export declare const clearEndpointNumbersMatterbridgePlatformSpy: import("jest-mock").SpiedGetter<string | boolean | import("node-ansi-logger").AnsiLogger |
|
|
60
|
-
export declare const checkEndpointNumbersMatterbridgePlatformSpy: import("jest-mock").SpiedGetter<string | boolean | import("node-ansi-logger").AnsiLogger |
|
|
59
|
+
export declare const clearEndpointNumbersMatterbridgePlatformSpy: import("jest-mock").SpiedGetter<string | boolean | import("node-ansi-logger").AnsiLogger | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | Promise<void> | import("node-persist-manager").NodeStorage> | import("jest-mock").SpiedSetter<string | boolean | import("node-ansi-logger").AnsiLogger | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | Promise<void> | import("node-persist-manager").NodeStorage>;
|
|
60
|
+
export declare const checkEndpointNumbersMatterbridgePlatformSpy: import("jest-mock").SpiedGetter<string | boolean | import("node-ansi-logger").AnsiLogger | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | Promise<void> | import("node-persist-manager").NodeStorage> | import("jest-mock").SpiedSetter<string | boolean | import("node-ansi-logger").AnsiLogger | import("../matterbridgePlatform.js").PlatformConfig | import("../matterbridgePlatform.js").PlatformMatterbridge | Promise<void> | import("node-persist-manager").NodeStorage>;
|
|
@@ -109,7 +109,7 @@ export async function createMatterbridgeEnvironment() {
|
|
|
109
109
|
matterbridge = await Matterbridge.loadInstance(false);
|
|
110
110
|
expect(matterbridge).toBeDefined();
|
|
111
111
|
expect(matterbridge).toBeInstanceOf(Matterbridge);
|
|
112
|
-
matterbridge.matterbridgeVersion = '3.8.
|
|
112
|
+
matterbridge.matterbridgeVersion = '3.8.1';
|
|
113
113
|
matterbridge.bridgeMode = 'bridge';
|
|
114
114
|
matterbridge.rootDirectory = path.join(HOMEDIR);
|
|
115
115
|
matterbridge.homeDirectory = path.join(HOMEDIR);
|
package/dist/matterNode.js
CHANGED
|
@@ -13,7 +13,7 @@ import { BroadcastServer } from '@matterbridge/thread/server';
|
|
|
13
13
|
import { dev, MATTER_LOGGER_FILE, MATTER_STORAGE_DIR, MATTERBRIDGE_LOGGER_FILE, NODE_STORAGE_DIR, plg } from '@matterbridge/types';
|
|
14
14
|
import { getIntParameter, getParameter, hasParameter } from '@matterbridge/utils/cli';
|
|
15
15
|
import { copyDirectory } from '@matterbridge/utils/copy-dir';
|
|
16
|
-
import { inspectError } from '@matterbridge/utils/error';
|
|
16
|
+
import { getErrorMessage, inspectError } from '@matterbridge/utils/error';
|
|
17
17
|
import { isValidNumber, isValidString, parseVersionString } from '@matterbridge/utils/validate';
|
|
18
18
|
import { wait, withTimeout } from '@matterbridge/utils/wait';
|
|
19
19
|
import { AnsiLogger, BLUE, CYAN, db, debugStringify, er, nf, or, zb } from 'node-ansi-logger';
|
|
@@ -22,7 +22,6 @@ import { toBaseDevice } from './deviceManager.js';
|
|
|
22
22
|
import { addVirtualDevice } from './helpers.js';
|
|
23
23
|
import { bridge } from './matterbridgeDeviceTypes.js';
|
|
24
24
|
import { PluginManager } from './pluginManager.js';
|
|
25
|
-
import { getErrorMessage } from './utils/export.js';
|
|
26
25
|
export class MatterNode extends EventEmitter {
|
|
27
26
|
matterbridge;
|
|
28
27
|
pluginName;
|
|
@@ -852,7 +851,7 @@ export class MatterNode extends EventEmitter {
|
|
|
852
851
|
for (const sub of subscriptions) {
|
|
853
852
|
if (device.hasAttributeServer(sub.cluster, sub.attribute)) {
|
|
854
853
|
this.log.debug(`Subscribing to endpoint ${plg}${plugin.name}${db}:${dev}${device.deviceName}${db}:${or}${device.id}${db}:${or}${device.number}${db} attribute ${dev}${sub.cluster}${db}.${dev}${sub.attribute}${db} changes...`);
|
|
855
|
-
|
|
854
|
+
device.subscribeAttribute(sub.cluster, sub.attribute, (value) => {
|
|
856
855
|
if (!device.plugin || !device.serialNumber || !device.uniqueId)
|
|
857
856
|
return;
|
|
858
857
|
this.log.debug(`Bridged endpoint ${plg}${plugin.name}${db}:${dev}${device.deviceName}${db}:${or}${device.id}${db}:${or}${device.number}${db} attribute ${dev}${sub.cluster}${db}.${dev}${sub.attribute}${db} changed to ${CYAN}${value}${db}`);
|
|
@@ -876,7 +875,7 @@ export class MatterNode extends EventEmitter {
|
|
|
876
875
|
for (const child of device.getChildEndpoints()) {
|
|
877
876
|
if (child.hasAttributeServer(sub.cluster, sub.attribute)) {
|
|
878
877
|
this.log.debug(`Subscribing to child endpoint ${plg}${plugin.name}${db}:${dev}${device.deviceName}${db}:${or}${child.id}${db}:${or}${child.number}${db} attribute ${dev}${sub.cluster}${db}.${dev}${sub.attribute}${db} changes...`);
|
|
879
|
-
|
|
878
|
+
child.subscribeAttribute(sub.cluster, sub.attribute, (value) => {
|
|
880
879
|
if (!device.plugin || !device.serialNumber || !device.uniqueId)
|
|
881
880
|
return;
|
|
882
881
|
this.log.debug(`Bridged child endpoint ${plg}${plugin.name}${db}:${dev}${device.deviceName}${db}:${or}${child.id}${db}:${or}${child.number}${db} attribute ${dev}${sub.cluster}${db}.${dev}${sub.attribute}${db} changed to ${CYAN}${value}${db}`);
|
package/dist/matterbridge.js
CHANGED
|
@@ -2105,7 +2105,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
2105
2105
|
for (const sub of subscriptions) {
|
|
2106
2106
|
if (device.hasAttributeServer(sub.cluster, sub.attribute)) {
|
|
2107
2107
|
this.log.debug(`Subscribing to endpoint ${or}${device.id}${db}:${or}${device.number}${db} attribute ${dev}${sub.cluster}${db}.${dev}${sub.attribute}${db} changes...`);
|
|
2108
|
-
|
|
2108
|
+
device.subscribeAttribute(sub.cluster, sub.attribute, (value) => {
|
|
2109
2109
|
this.log.debug(`Bridged endpoint ${or}${device.id}${db}:${or}${device.number}${db} attribute ${dev}${sub.cluster}${db}.${dev}${sub.attribute}${db} changed to ${CYAN}${isValidObject(value) ? debugStringify(value) : value}${db}`);
|
|
2110
2110
|
this.frontend.wssSendAttributeChangedMessage(device.plugin, device.serialNumber, device.uniqueId, device.number, device.id, sub.cluster, sub.attribute, value);
|
|
2111
2111
|
});
|
|
@@ -2113,7 +2113,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
2113
2113
|
for (const child of device.getChildEndpoints()) {
|
|
2114
2114
|
if (child.hasAttributeServer(sub.cluster, sub.attribute)) {
|
|
2115
2115
|
this.log.debug(`Subscribing to child endpoint ${or}${child.id}${db}:${or}${child.number}${db} attribute ${dev}${sub.cluster}${db}.${dev}${sub.attribute}${db} changes...`);
|
|
2116
|
-
|
|
2116
|
+
child.subscribeAttribute(sub.cluster, sub.attribute, (value) => {
|
|
2117
2117
|
this.log.debug(`Bridged child endpoint ${or}${child.id}${db}:${or}${child.number}${db} attribute ${dev}${sub.cluster}${db}.${dev}${sub.attribute}${db} changed to ${CYAN}${isValidObject(value) ? debugStringify(value) : value}${db}`);
|
|
2118
2118
|
this.frontend.wssSendAttributeChangedMessage(device.plugin, device.serialNumber, device.uniqueId, child.number, child.id, sub.cluster, sub.attribute, value);
|
|
2119
2119
|
});
|
|
@@ -96,11 +96,11 @@ export declare class MatterbridgeEndpoint extends Endpoint {
|
|
|
96
96
|
updateAttribute<T extends Behavior.Type, A extends keyof Behavior.StateOf<T>>(cluster: T, attribute: A, value: Behavior.StateOf<T>[A], log?: AnsiLogger): Promise<boolean>;
|
|
97
97
|
updateAttribute<T extends ClusterType, A extends keyof ClusterAttributesOf<T>>(cluster: T, attribute: A, value: ClusterAttributesOf<T>[A], log?: AnsiLogger): Promise<boolean>;
|
|
98
98
|
updateAttribute(cluster: ClusterId | string, attribute: string, value: boolean | number | bigint | string | object | null, log?: AnsiLogger): Promise<boolean>;
|
|
99
|
-
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):
|
|
100
|
-
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):
|
|
101
|
-
subscribeAttribute(cluster: ClusterId | string, attribute: string, listener: (newValue: any, oldValue: any, context: ActionContext) => void, log?: AnsiLogger):
|
|
99
|
+
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;
|
|
100
|
+
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;
|
|
101
|
+
subscribeAttribute(cluster: ClusterId | string, attribute: string, listener: (newValue: any, oldValue: any, context: ActionContext) => void, log?: AnsiLogger): MatterbridgeEndpoint;
|
|
102
102
|
setCluster<T extends Behavior.Type>(cluster: T, value: Behavior.StateOf<T>, log?: AnsiLogger): Promise<boolean>;
|
|
103
|
-
setCluster<T extends ClusterType>(cluster: T, value: ClusterAttributesOf<T
|
|
103
|
+
setCluster<T extends ClusterType>(cluster: T, value: Partial<ClusterAttributesOf<T>>, log?: AnsiLogger): Promise<boolean>;
|
|
104
104
|
setCluster(cluster: ClusterId | string, value: Record<string, boolean | number | bigint | string | object | undefined | null>, log?: AnsiLogger): Promise<boolean>;
|
|
105
105
|
getCluster<T extends Behavior.Type>(cluster: T, log?: AnsiLogger): Behavior.StateOf<T> | undefined;
|
|
106
106
|
getCluster<T extends ClusterType>(cluster: T, log?: AnsiLogger): ClusterAttributesOf<T> | undefined;
|
|
@@ -240,8 +240,8 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
240
240
|
async updateAttribute(cluster, attribute, value, log) {
|
|
241
241
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
242
242
|
}
|
|
243
|
-
|
|
244
|
-
return
|
|
243
|
+
subscribeAttribute(cluster, attribute, listener, log) {
|
|
244
|
+
return subscribeAttribute(this, cluster, attribute, listener, log);
|
|
245
245
|
}
|
|
246
246
|
async setCluster(cluster, value, log) {
|
|
247
247
|
return await setCluster(this, cluster, value, log);
|
|
@@ -821,28 +821,28 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
821
821
|
return this;
|
|
822
822
|
}
|
|
823
823
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
824
|
-
const position = this.getAttribute(WindowCovering
|
|
824
|
+
const position = this.getAttribute(WindowCovering, 'currentPositionLiftPercent100ths', this.log);
|
|
825
825
|
if (isValidNumber(position, 0, 10000)) {
|
|
826
|
-
await this.setAttribute(WindowCovering
|
|
827
|
-
await this.setAttribute(WindowCovering
|
|
826
|
+
await this.setAttribute(WindowCovering, 'targetPositionLiftPercent100ths', position, this.log);
|
|
827
|
+
await this.setAttribute(WindowCovering, 'operationalStatus', {
|
|
828
828
|
global: WindowCovering.MovementStatus.Stopped,
|
|
829
829
|
lift: WindowCovering.MovementStatus.Stopped,
|
|
830
830
|
tilt: WindowCovering.MovementStatus.Stopped,
|
|
831
831
|
}, this.log);
|
|
832
832
|
}
|
|
833
833
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
834
|
-
if (this.hasAttributeServer(WindowCovering
|
|
835
|
-
const position = this.getAttribute(WindowCovering
|
|
834
|
+
if (this.hasAttributeServer(WindowCovering, 'currentPositionTiltPercent100ths')) {
|
|
835
|
+
const position = this.getAttribute(WindowCovering, 'currentPositionTiltPercent100ths', this.log);
|
|
836
836
|
if (isValidNumber(position, 0, 10000)) {
|
|
837
|
-
await this.setAttribute(WindowCovering
|
|
837
|
+
await this.setAttribute(WindowCovering, 'targetPositionTiltPercent100ths', position, this.log);
|
|
838
838
|
}
|
|
839
839
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
840
840
|
}
|
|
841
841
|
}
|
|
842
842
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
843
|
-
await this.setAttribute(WindowCovering
|
|
844
|
-
await this.setAttribute(WindowCovering
|
|
845
|
-
await this.setAttribute(WindowCovering
|
|
843
|
+
await this.setAttribute(WindowCovering, 'currentPositionLiftPercent100ths', current, this.log);
|
|
844
|
+
await this.setAttribute(WindowCovering, 'targetPositionLiftPercent100ths', target, this.log);
|
|
845
|
+
await this.setAttribute(WindowCovering, 'operationalStatus', {
|
|
846
846
|
global: status,
|
|
847
847
|
lift: status,
|
|
848
848
|
tilt: status,
|
|
@@ -850,7 +850,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
850
850
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
851
851
|
}
|
|
852
852
|
async setWindowCoveringStatus(status) {
|
|
853
|
-
await this.setAttribute(WindowCovering
|
|
853
|
+
await this.setAttribute(WindowCovering, 'operationalStatus', {
|
|
854
854
|
global: status,
|
|
855
855
|
lift: status,
|
|
856
856
|
tilt: status,
|
|
@@ -858,19 +858,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
858
858
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
859
859
|
}
|
|
860
860
|
getWindowCoveringStatus() {
|
|
861
|
-
const status = this.getAttribute(WindowCovering
|
|
861
|
+
const status = this.getAttribute(WindowCovering, 'operationalStatus', this.log);
|
|
862
862
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
863
863
|
this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
|
|
864
864
|
return status.global;
|
|
865
865
|
}
|
|
866
866
|
}
|
|
867
867
|
async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
|
|
868
|
-
await this.setAttribute(WindowCovering
|
|
869
|
-
await this.setAttribute(WindowCovering
|
|
868
|
+
await this.setAttribute(WindowCovering, 'currentPositionLiftPercent100ths', liftPosition, this.log);
|
|
869
|
+
await this.setAttribute(WindowCovering, 'targetPositionLiftPercent100ths', liftPosition, this.log);
|
|
870
870
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${liftPosition} and targetPositionLiftPercent100ths: ${liftPosition}.`);
|
|
871
|
-
if (tiltPosition && this.hasAttributeServer(WindowCovering
|
|
872
|
-
await this.setAttribute(WindowCovering
|
|
873
|
-
await this.setAttribute(WindowCovering
|
|
871
|
+
if (tiltPosition && this.hasAttributeServer(WindowCovering, 'currentPositionTiltPercent100ths')) {
|
|
872
|
+
await this.setAttribute(WindowCovering, 'currentPositionTiltPercent100ths', tiltPosition, this.log);
|
|
873
|
+
await this.setAttribute(WindowCovering, 'targetPositionTiltPercent100ths', tiltPosition, this.log);
|
|
874
874
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
|
|
875
875
|
}
|
|
876
876
|
}
|
|
@@ -56,7 +56,7 @@ export declare function getAttributeId(endpoint: Endpoint, cluster: string, attr
|
|
|
56
56
|
export declare function getAttribute(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, attribute: string, log?: AnsiLogger): any;
|
|
57
57
|
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
58
|
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
|
-
export declare function subscribeAttribute(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, attribute: string, listener: (newValue: any, oldValue: any, context: ActionContext) => void, log?: AnsiLogger):
|
|
59
|
+
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;
|
|
60
60
|
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
61
|
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
62
|
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>;
|
|
@@ -719,25 +719,21 @@ export async function updateAttribute(endpoint, cluster, attribute, value, log)
|
|
|
719
719
|
`to ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
720
720
|
return true;
|
|
721
721
|
}
|
|
722
|
-
export
|
|
722
|
+
export function subscribeAttribute(endpoint, cluster, attribute, listener, log) {
|
|
723
723
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
724
724
|
if (!clusterName) {
|
|
725
725
|
endpoint.log.error(`subscribeAttribute ${hk}${attribute}${er} error: cluster not found on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
726
|
-
return
|
|
727
|
-
}
|
|
728
|
-
if (endpoint.construction.status !== Lifecycle.Status.Active) {
|
|
729
|
-
endpoint.log.debug(`subscribeAttribute ${hk}${clusterName}.${attribute}${db}: Endpoint ${or}${endpoint.maybeId}${db}:${or}${endpoint.maybeNumber}${db} is in the ${BLUE}${endpoint.construction.status}${db} state`);
|
|
730
|
-
await endpoint.construction.ready;
|
|
726
|
+
return endpoint;
|
|
731
727
|
}
|
|
732
728
|
const events = endpoint.events;
|
|
733
729
|
attribute = lowercaseFirstLetter(attribute) + '$Changed';
|
|
734
730
|
if (!(clusterName in events) || !(attribute in events[clusterName])) {
|
|
735
731
|
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}`);
|
|
736
|
-
return
|
|
732
|
+
return endpoint;
|
|
737
733
|
}
|
|
738
734
|
events[clusterName][attribute].on(listener);
|
|
739
|
-
log?.info(`${db}Subscribed endpoint ${or}${endpoint.
|
|
740
|
-
return
|
|
735
|
+
log?.info(`${db}Subscribed endpoint ${or}${endpoint.maybeId}${db}:${or}${endpoint.maybeNumber}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
|
|
736
|
+
return endpoint;
|
|
741
737
|
}
|
|
742
738
|
export async function setCluster(endpoint, cluster, value, log) {
|
|
743
739
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matterbridge/core",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.1-dev-20260607-08cd4da",
|
|
4
4
|
"description": "Matterbridge core library",
|
|
5
5
|
"author": "https://github.com/Luligu",
|
|
6
6
|
"homepage": "https://matterbridge.io/",
|
|
@@ -130,10 +130,10 @@
|
|
|
130
130
|
],
|
|
131
131
|
"dependencies": {
|
|
132
132
|
"@matter/main": "0.17.1",
|
|
133
|
-
"@matterbridge/dgram": "3.8.
|
|
134
|
-
"@matterbridge/thread": "3.8.
|
|
135
|
-
"@matterbridge/types": "3.8.
|
|
136
|
-
"@matterbridge/utils": "3.8.
|
|
133
|
+
"@matterbridge/dgram": "3.8.1-dev-20260607-08cd4da",
|
|
134
|
+
"@matterbridge/thread": "3.8.1-dev-20260607-08cd4da",
|
|
135
|
+
"@matterbridge/types": "3.8.1-dev-20260607-08cd4da",
|
|
136
|
+
"@matterbridge/utils": "3.8.1-dev-20260607-08cd4da",
|
|
137
137
|
"escape-html": "1.0.3",
|
|
138
138
|
"express": "5.2.1",
|
|
139
139
|
"express-rate-limit": "8.5.2",
|