@matterbridge/core 3.8.0-dev-20260604-901f3fc → 3.8.0-dev-20260605-48352af

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.
@@ -167,6 +167,16 @@ export class MatterbridgeEndpoint extends Endpoint {
167
167
  descriptor: options.tagList ? { tagList: options.tagList, deviceTypeList } : { deviceTypeList },
168
168
  };
169
169
  super(endpointV8, optionsV8);
170
+ const typeBehaviors = this.type.behaviors;
171
+ const origInject = this.behaviors.inject.bind(this.behaviors);
172
+ Object.defineProperty(this.behaviors, 'inject', {
173
+ configurable: true,
174
+ writable: true,
175
+ value: (type, options, notify = true) => {
176
+ origInject(type, options, notify);
177
+ typeBehaviors[type.id] = type;
178
+ },
179
+ });
170
180
  Object.defineProperty(this, MATTERBRIDGE_ENDPOINT_BRAND, {
171
181
  value: true,
172
182
  writable: false,
@@ -26,7 +26,7 @@ export class CommandHandler {
26
26
  }
27
27
  removeHandler(command, handler) {
28
28
  this.handler = this.handler.filter(({ command: registeredCommand, handler: registeredHandler }) => {
29
- return registeredCommand !== command && registeredHandler !== handler;
29
+ return registeredCommand !== command || registeredHandler !== handler;
30
30
  });
31
31
  }
32
32
  }
@@ -39,7 +39,7 @@ export declare function defaultFor<T extends Behavior.Type>(type: T, options?: B
39
39
  export declare function getBehaviourTypesFromClusterServerIds(clusterServerList: ClusterId[]): Behavior.Type[];
40
40
  export declare function getBehaviourTypesFromClusterClientIds(clusterClientList: ClusterId[]): Behavior.Type[];
41
41
  export declare function getBehaviourTypeFromClusterServerId(clusterId: ClusterId): Behavior.Type;
42
- export declare function getBehaviourTypeFromClusterClientId(_clusterId: ClusterId): void;
42
+ export declare function getBehaviourTypeFromClusterClientId(clusterId: ClusterId): ClusterBehavior.Type | undefined;
43
43
  export declare function getBehavior(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string): Behavior.Type | undefined;
44
44
  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>;
45
45
  export declare function invokeSubscribeHandler(endpoint: MatterbridgeEndpoint, cluster: Behavior.Type | ClusterType | ClusterId | string, attribute: string, newValue: unknown, oldValue: unknown): Promise<boolean>;
@@ -9,30 +9,41 @@ import { BooleanStateServer } from '@matter/node/behaviors/boolean-state';
9
9
  import { BridgedDeviceBasicInformationServer } from '@matter/node/behaviors/bridged-device-basic-information';
10
10
  import { CarbonDioxideConcentrationMeasurementServer } from '@matter/node/behaviors/carbon-dioxide-concentration-measurement';
11
11
  import { CarbonMonoxideConcentrationMeasurementServer } from '@matter/node/behaviors/carbon-monoxide-concentration-measurement';
12
+ import { ColorControlClient } from '@matter/node/behaviors/color-control';
13
+ import { DoorLockClient } from '@matter/node/behaviors/door-lock';
12
14
  import { ElectricalEnergyMeasurementServer } from '@matter/node/behaviors/electrical-energy-measurement';
15
+ import { ElectricalGridConditionsClient } from '@matter/node/behaviors/electrical-grid-conditions';
13
16
  import { ElectricalPowerMeasurementServer } from '@matter/node/behaviors/electrical-power-measurement';
17
+ import { FanControlClient } from '@matter/node/behaviors/fan-control';
14
18
  import { FixedLabelServer } from '@matter/node/behaviors/fixed-label';
15
- import { FlowMeasurementServer } from '@matter/node/behaviors/flow-measurement';
19
+ import { FlowMeasurementClient, FlowMeasurementServer } from '@matter/node/behaviors/flow-measurement';
16
20
  import { FormaldehydeConcentrationMeasurementServer } from '@matter/node/behaviors/formaldehyde-concentration-measurement';
17
- import { GroupsServer } from '@matter/node/behaviors/groups';
18
- import { IlluminanceMeasurementServer } from '@matter/node/behaviors/illuminance-measurement';
21
+ import { GroupsClient, GroupsServer } from '@matter/node/behaviors/groups';
22
+ import { IdentifyClient } from '@matter/node/behaviors/identify';
23
+ import { IlluminanceMeasurementClient, IlluminanceMeasurementServer } from '@matter/node/behaviors/illuminance-measurement';
24
+ import { LevelControlClient } from '@matter/node/behaviors/level-control';
19
25
  import { NitrogenDioxideConcentrationMeasurementServer } from '@matter/node/behaviors/nitrogen-dioxide-concentration-measurement';
20
- import { OccupancySensingServer } from '@matter/node/behaviors/occupancy-sensing';
26
+ import { OccupancySensingClient, OccupancySensingServer } from '@matter/node/behaviors/occupancy-sensing';
27
+ import { OnOffClient } from '@matter/node/behaviors/on-off';
28
+ import { OtaSoftwareUpdateProviderClient } from '@matter/node/behaviors/ota-software-update-provider';
29
+ import { OtaSoftwareUpdateRequestorClient } from '@matter/node/behaviors/ota-software-update-requestor';
21
30
  import { OzoneConcentrationMeasurementServer } from '@matter/node/behaviors/ozone-concentration-measurement';
22
31
  import { Pm1ConcentrationMeasurementServer } from '@matter/node/behaviors/pm1-concentration-measurement';
23
32
  import { Pm10ConcentrationMeasurementServer } from '@matter/node/behaviors/pm10-concentration-measurement';
24
33
  import { Pm25ConcentrationMeasurementServer } from '@matter/node/behaviors/pm25-concentration-measurement';
25
34
  import { PowerSourceServer } from '@matter/node/behaviors/power-source';
26
35
  import { PowerTopologyServer } from '@matter/node/behaviors/power-topology';
27
- import { PressureMeasurementServer } from '@matter/node/behaviors/pressure-measurement';
28
- import { PumpConfigurationAndControlServer } from '@matter/node/behaviors/pump-configuration-and-control';
36
+ import { PressureMeasurementClient, PressureMeasurementServer } from '@matter/node/behaviors/pressure-measurement';
37
+ import { PumpConfigurationAndControlClient, PumpConfigurationAndControlServer } from '@matter/node/behaviors/pump-configuration-and-control';
29
38
  import { RadonConcentrationMeasurementServer } from '@matter/node/behaviors/radon-concentration-measurement';
30
- import { RelativeHumidityMeasurementServer } from '@matter/node/behaviors/relative-humidity-measurement';
31
- import { ScenesManagementServer } from '@matter/node/behaviors/scenes-management';
39
+ import { RelativeHumidityMeasurementClient, RelativeHumidityMeasurementServer } from '@matter/node/behaviors/relative-humidity-measurement';
40
+ import { ScenesManagementClient, ScenesManagementServer } from '@matter/node/behaviors/scenes-management';
32
41
  import { SwitchServer } from '@matter/node/behaviors/switch';
33
- import { TemperatureMeasurementServer } from '@matter/node/behaviors/temperature-measurement';
42
+ import { TemperatureMeasurementClient, TemperatureMeasurementServer } from '@matter/node/behaviors/temperature-measurement';
43
+ import { ThermostatClient } from '@matter/node/behaviors/thermostat';
34
44
  import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/node/behaviors/total-volatile-organic-compounds-concentration-measurement';
35
45
  import { UserLabelServer } from '@matter/node/behaviors/user-label';
46
+ import { WindowCoveringClient } from '@matter/node/behaviors/window-covering';
36
47
  import { getClusterNameById } from '@matter/types/cluster';
37
48
  import { AirQuality } from '@matter/types/clusters/air-quality';
38
49
  import { BasicInformation } from '@matter/types/clusters/basic-information';
@@ -46,6 +57,7 @@ import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-man
46
57
  import { DeviceEnergyManagementMode } from '@matter/types/clusters/device-energy-management-mode';
47
58
  import { DoorLock } from '@matter/types/clusters/door-lock';
48
59
  import { ElectricalEnergyMeasurement } from '@matter/types/clusters/electrical-energy-measurement';
60
+ import { ElectricalGridConditions } from '@matter/types/clusters/electrical-grid-conditions';
49
61
  import { ElectricalPowerMeasurement } from '@matter/types/clusters/electrical-power-measurement';
50
62
  import { FanControl } from '@matter/types/clusters/fan-control';
51
63
  import { FixedLabel } from '@matter/types/clusters/fixed-label';
@@ -60,6 +72,8 @@ import { NitrogenDioxideConcentrationMeasurement } from '@matter/types/clusters/
60
72
  import { OccupancySensing } from '@matter/types/clusters/occupancy-sensing';
61
73
  import { OnOff } from '@matter/types/clusters/on-off';
62
74
  import { OperationalState } from '@matter/types/clusters/operational-state';
75
+ import { OtaSoftwareUpdateProvider } from '@matter/types/clusters/ota-software-update-provider';
76
+ import { OtaSoftwareUpdateRequestor } from '@matter/types/clusters/ota-software-update-requestor';
63
77
  import { OzoneConcentrationMeasurement } from '@matter/types/clusters/ozone-concentration-measurement';
64
78
  import { Pm1ConcentrationMeasurement } from '@matter/types/clusters/pm1-concentration-measurement';
65
79
  import { Pm10ConcentrationMeasurement } from '@matter/types/clusters/pm10-concentration-measurement';
@@ -83,7 +97,7 @@ import { NodeId } from '@matter/types/datatype';
83
97
  import { MeasurementType } from '@matter/types/globals';
84
98
  import { deepEqual } from '@matterbridge/utils/deep-equal';
85
99
  import { isValidArray } from '@matterbridge/utils/validate';
86
- import { BLUE, CYAN, db, debugStringify, er, hk, or, YELLOW, zb } from 'node-ansi-logger';
100
+ import { BLUE, CYAN, db, debugStringify, er, hk, nf, or, wr, YELLOW, zb } from 'node-ansi-logger';
87
101
  import { MatterbridgeBindingServer } from './behaviors/bindingServer.js';
88
102
  import { MatterbridgeBooleanStateConfigurationServer } from './behaviors/booleanStateConfigurationServer.js';
89
103
  import { MatterbridgeColorControlServer } from './behaviors/colorControlServer.js';
@@ -218,7 +232,10 @@ export function getBehaviourTypesFromClusterServerIds(clusterServerList) {
218
232
  }
219
233
  export function getBehaviourTypesFromClusterClientIds(clusterClientList) {
220
234
  const behaviorTypes = [];
221
- clusterClientList.forEach((_clusterId) => {
235
+ clusterClientList.forEach((clusterId) => {
236
+ const behaviorType = getBehaviourTypeFromClusterClientId(clusterId);
237
+ if (behaviorType)
238
+ behaviorTypes.push(behaviorType);
222
239
  });
223
240
  return behaviorTypes;
224
241
  }
@@ -315,7 +332,48 @@ export function getBehaviourTypeFromClusterServerId(clusterId) {
315
332
  return MatterbridgeDeviceEnergyManagementModeServer;
316
333
  return MatterbridgeIdentifyServer;
317
334
  }
318
- export function getBehaviourTypeFromClusterClientId(_clusterId) {
335
+ export function getBehaviourTypeFromClusterClientId(clusterId) {
336
+ if (clusterId === Identify.id)
337
+ return IdentifyClient;
338
+ if (clusterId === Groups.id)
339
+ return GroupsClient;
340
+ if (clusterId === OnOff.id)
341
+ return OnOffClient;
342
+ if (clusterId === LevelControl.id)
343
+ return LevelControlClient;
344
+ if (clusterId === ColorControl.id)
345
+ return ColorControlClient;
346
+ if (clusterId === OccupancySensing.id)
347
+ return OccupancySensingClient;
348
+ if (clusterId === ScenesManagement.id)
349
+ return ScenesManagementClient;
350
+ if (clusterId === DoorLock.id)
351
+ return DoorLockClient;
352
+ if (clusterId === ElectricalGridConditions.id)
353
+ return ElectricalGridConditionsClient;
354
+ if (clusterId === FanControl.id)
355
+ return FanControlClient;
356
+ if (clusterId === FlowMeasurement.id)
357
+ return FlowMeasurementClient;
358
+ if (clusterId === IlluminanceMeasurement.id)
359
+ return IlluminanceMeasurementClient;
360
+ if (clusterId === OtaSoftwareUpdateProvider.id)
361
+ return OtaSoftwareUpdateProviderClient;
362
+ if (clusterId === OtaSoftwareUpdateRequestor.id)
363
+ return OtaSoftwareUpdateRequestorClient;
364
+ if (clusterId === PressureMeasurement.id)
365
+ return PressureMeasurementClient;
366
+ if (clusterId === PumpConfigurationAndControl.id)
367
+ return PumpConfigurationAndControlClient;
368
+ if (clusterId === RelativeHumidityMeasurement.id)
369
+ return RelativeHumidityMeasurementClient;
370
+ if (clusterId === TemperatureMeasurement.id)
371
+ return TemperatureMeasurementClient;
372
+ if (clusterId === Thermostat.id)
373
+ return ThermostatClient;
374
+ if (clusterId === WindowCovering.id)
375
+ return WindowCoveringClient;
376
+ return undefined;
319
377
  }
320
378
  export function getBehavior(endpoint, cluster) {
321
379
  let behavior;
@@ -497,10 +555,23 @@ export function addClusterClients(endpoint, clientList) {
497
555
  return;
498
556
  if (!endpoint.behaviors.has(MatterbridgeBindingServer)) {
499
557
  endpoint.behaviors.require(MatterbridgeBindingServer, { clientList });
500
- return;
501
558
  }
502
- const existing = endpoint.behaviors.optionsFor(MatterbridgeBindingServer)?.clientList ?? [];
503
- endpoint.behaviors.inject(MatterbridgeBindingServer, { clientList: [...new Set([...existing, ...clientList])] });
559
+ else {
560
+ const existing = endpoint.behaviors.optionsFor(MatterbridgeBindingServer)?.clientList ?? [];
561
+ endpoint.behaviors.inject(MatterbridgeBindingServer, { clientList: [...new Set([...existing, ...clientList])] });
562
+ }
563
+ const clientClusters = endpoint.type.clientClusters;
564
+ for (const clusterId of clientList) {
565
+ const key = lowercaseFirstLetter(getClusterNameById(clusterId));
566
+ const value = getBehaviourTypeFromClusterClientId(clusterId);
567
+ if (!value) {
568
+ endpoint.log.warn(`addClusterClients: no client behavior found for clusterId ${hk}0x${clusterId.toString(16).padStart(4, '0')}${wr}`);
569
+ }
570
+ if (!clientClusters[key] && value) {
571
+ clientClusters[key] = value;
572
+ endpoint.log.info(`addClusterClients: added client behavior for clusterId ${hk}0x${clusterId.toString(16).padStart(4, '0')}${nf}`);
573
+ }
574
+ }
504
575
  }
505
576
  export function addRequiredClusterClients(endpoint) {
506
577
  const requiredClientList = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matterbridge/core",
3
- "version": "3.8.0-dev-20260604-901f3fc",
3
+ "version": "3.8.0-dev-20260605-48352af",
4
4
  "description": "Matterbridge core library",
5
5
  "author": "https://github.com/Luligu",
6
6
  "homepage": "https://matterbridge.io/",
@@ -129,11 +129,11 @@
129
129
  "CHANGELOG.md"
130
130
  ],
131
131
  "dependencies": {
132
- "@matter/main": "0.17.0",
133
- "@matterbridge/dgram": "3.8.0-dev-20260604-901f3fc",
134
- "@matterbridge/thread": "3.8.0-dev-20260604-901f3fc",
135
- "@matterbridge/types": "3.8.0-dev-20260604-901f3fc",
136
- "@matterbridge/utils": "3.8.0-dev-20260604-901f3fc",
132
+ "@matter/main": "0.17.1",
133
+ "@matterbridge/dgram": "3.8.0-dev-20260605-48352af",
134
+ "@matterbridge/thread": "3.8.0-dev-20260605-48352af",
135
+ "@matterbridge/types": "3.8.0-dev-20260605-48352af",
136
+ "@matterbridge/utils": "3.8.0-dev-20260605-48352af",
137
137
  "escape-html": "1.0.3",
138
138
  "express": "5.2.1",
139
139
  "express-rate-limit": "8.5.2",