matterbridge 1.6.5 → 1.6.6-dev.13

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.
Files changed (102) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README-DEV.md +3 -3
  3. package/README.md +4 -0
  4. package/dist/cli.js +0 -26
  5. package/dist/cluster/export.js +0 -2
  6. package/dist/defaultConfigSchema.js +0 -23
  7. package/dist/deviceManager.js +1 -26
  8. package/dist/index.js +0 -30
  9. package/dist/logger/export.js +0 -1
  10. package/dist/matter/export.js +0 -1
  11. package/dist/matterbridge.js +106 -706
  12. package/dist/matterbridgeAccessoryPlatform.js +0 -33
  13. package/dist/matterbridgeBehaviors.js +10 -29
  14. package/dist/matterbridgeDevice.js +58 -939
  15. package/dist/matterbridgeDeviceTypes.js +21 -42
  16. package/dist/matterbridgeDynamicPlatform.js +0 -33
  17. package/dist/matterbridgeEdge.js +0 -528
  18. package/dist/matterbridgeEndpoint.js +79 -1090
  19. package/dist/matterbridgePlatform.js +36 -76
  20. package/dist/matterbridgeTypes.js +0 -24
  21. package/dist/matterbridgeWebsocket.js +8 -45
  22. package/dist/pluginManager.js +3 -237
  23. package/dist/storage/export.js +0 -1
  24. package/dist/utils/colorUtils.js +33 -165
  25. package/dist/utils/export.js +0 -1
  26. package/dist/utils/utils.js +7 -252
  27. package/frontend/build/asset-manifest.json +3 -3
  28. package/frontend/build/index.html +1 -1
  29. package/frontend/build/static/js/{main.0ab89802.js → main.a742de4e.js} +9 -9
  30. package/frontend/build/static/js/{main.0ab89802.js.map → main.a742de4e.js.map} +1 -1
  31. package/npm-shrinkwrap.json +115 -104
  32. package/package.json +5 -5
  33. package/dist/cli.d.ts +0 -25
  34. package/dist/cli.d.ts.map +0 -1
  35. package/dist/cli.js.map +0 -1
  36. package/dist/cluster/export.d.ts +0 -2
  37. package/dist/cluster/export.d.ts.map +0 -1
  38. package/dist/cluster/export.js.map +0 -1
  39. package/dist/defaultConfigSchema.d.ts +0 -27
  40. package/dist/defaultConfigSchema.d.ts.map +0 -1
  41. package/dist/defaultConfigSchema.js.map +0 -1
  42. package/dist/deviceManager.d.ts +0 -46
  43. package/dist/deviceManager.d.ts.map +0 -1
  44. package/dist/deviceManager.js.map +0 -1
  45. package/dist/index.d.ts +0 -40
  46. package/dist/index.d.ts.map +0 -1
  47. package/dist/index.js.map +0 -1
  48. package/dist/logger/export.d.ts +0 -2
  49. package/dist/logger/export.d.ts.map +0 -1
  50. package/dist/logger/export.js.map +0 -1
  51. package/dist/matter/export.d.ts +0 -5
  52. package/dist/matter/export.d.ts.map +0 -1
  53. package/dist/matter/export.js.map +0 -1
  54. package/dist/matterbridge.d.ts +0 -466
  55. package/dist/matterbridge.d.ts.map +0 -1
  56. package/dist/matterbridge.js.map +0 -1
  57. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -39
  58. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  59. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  60. package/dist/matterbridgeBehaviors.d.ts +0 -934
  61. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  62. package/dist/matterbridgeBehaviors.js.map +0 -1
  63. package/dist/matterbridgeDevice.d.ts +0 -6504
  64. package/dist/matterbridgeDevice.d.ts.map +0 -1
  65. package/dist/matterbridgeDevice.js.map +0 -1
  66. package/dist/matterbridgeDeviceTypes.d.ts +0 -65
  67. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  68. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  69. package/dist/matterbridgeDynamicPlatform.d.ts +0 -39
  70. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  71. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  72. package/dist/matterbridgeEdge.d.ts +0 -89
  73. package/dist/matterbridgeEdge.d.ts.map +0 -1
  74. package/dist/matterbridgeEdge.js.map +0 -1
  75. package/dist/matterbridgeEndpoint.d.ts +0 -8529
  76. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  77. package/dist/matterbridgeEndpoint.js.map +0 -1
  78. package/dist/matterbridgePlatform.d.ts +0 -96
  79. package/dist/matterbridgePlatform.d.ts.map +0 -1
  80. package/dist/matterbridgePlatform.js.map +0 -1
  81. package/dist/matterbridgeTypes.d.ts +0 -147
  82. package/dist/matterbridgeTypes.d.ts.map +0 -1
  83. package/dist/matterbridgeTypes.js.map +0 -1
  84. package/dist/matterbridgeWebsocket.d.ts +0 -49
  85. package/dist/matterbridgeWebsocket.d.ts.map +0 -1
  86. package/dist/matterbridgeWebsocket.js.map +0 -1
  87. package/dist/pluginManager.d.ts +0 -238
  88. package/dist/pluginManager.d.ts.map +0 -1
  89. package/dist/pluginManager.js.map +0 -1
  90. package/dist/storage/export.d.ts +0 -2
  91. package/dist/storage/export.d.ts.map +0 -1
  92. package/dist/storage/export.js.map +0 -1
  93. package/dist/utils/colorUtils.d.ts +0 -61
  94. package/dist/utils/colorUtils.d.ts.map +0 -1
  95. package/dist/utils/colorUtils.js.map +0 -1
  96. package/dist/utils/export.d.ts +0 -3
  97. package/dist/utils/export.d.ts.map +0 -1
  98. package/dist/utils/export.js.map +0 -1
  99. package/dist/utils/utils.d.ts +0 -221
  100. package/dist/utils/utils.d.ts.map +0 -1
  101. package/dist/utils/utils.js.map +0 -1
  102. /package/frontend/build/static/js/{main.0ab89802.js.LICENSE.txt → main.a742de4e.js.LICENSE.txt} +0 -0
@@ -1,35 +1,8 @@
1
- /**
2
- * This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
3
- *
4
- * @file matterbridgeEndpoint.ts
5
- * @author Luca Liguori
6
- * @date 2024-10-01
7
- * @version 1.0.0
8
- *
9
- * Copyright 2024, 2025, 2026 Luca Liguori.
10
- *
11
- * Licensed under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License.
13
- * You may obtain a copy of the License at
14
- *
15
- * http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- * See the License for the specific language governing permissions and
21
- * limitations under the License. *
22
- */
23
- /* eslint-disable @typescript-eslint/no-unused-vars */
24
- // Node.js modules
25
1
  import { createHash } from 'crypto';
26
- // AnsiLogger module
27
2
  import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, rs, zb } from 'node-ansi-logger';
28
- // Matterbridge
29
3
  import { MatterbridgeBehavior, MatterbridgeBehaviorDevice, MatterbridgeBooleanStateConfigurationServer, MatterbridgeColorControlServer, MatterbridgeDoorLockServer, MatterbridgeFanControlServer, MatterbridgeIdentifyServer, MatterbridgeLevelControlServer, MatterbridgeOnOffServer, MatterbridgeThermostatServer, MatterbridgeWindowCoveringServer, } from './matterbridgeBehaviors.js';
30
4
  import { bridgedNode } from './matterbridgeDeviceTypes.js';
31
5
  import { deepCopy, isValidNumber } from './utils/utils.js';
32
- // @matter
33
6
  import { Endpoint, MutableEndpoint, SupportedBehaviors, NamedHandler, Lifecycle } from '@matter/main';
34
7
  import { EndpointNumber, VendorId } from '@matter/main';
35
8
  import { AirQuality, AirQualityCluster, BasicInformation, BasicInformationCluster, BooleanState, BooleanStateCluster, BooleanStateConfiguration, BooleanStateConfigurationCluster, BridgedDeviceBasicInformation, BridgedDeviceBasicInformationCluster, CarbonDioxideConcentrationMeasurement, CarbonDioxideConcentrationMeasurementCluster, CarbonMonoxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurementCluster, ColorControl, ColorControlCluster, ConcentrationMeasurement, Descriptor, DoorLock, DoorLockCluster, ElectricalEnergyMeasurement, ElectricalEnergyMeasurementCluster, ElectricalPowerMeasurement, ElectricalPowerMeasurementCluster, FanControl, FanControlCluster, FixedLabel, FixedLabelCluster, FlowMeasurement, FlowMeasurementCluster, FormaldehydeConcentrationMeasurement, FormaldehydeConcentrationMeasurementCluster, Groups, GroupsCluster, Identify, IdentifyCluster, IlluminanceMeasurement, IlluminanceMeasurementCluster, LevelControl, LevelControlCluster, ModeSelect, ModeSelectCluster, NitrogenDioxideConcentrationMeasurement, NitrogenDioxideConcentrationMeasurementCluster, OccupancySensing, OccupancySensingCluster, OnOff, OnOffCluster, OzoneConcentrationMeasurement, OzoneConcentrationMeasurementCluster, Pm10ConcentrationMeasurement, Pm10ConcentrationMeasurementCluster, Pm1ConcentrationMeasurement, Pm1ConcentrationMeasurementCluster, Pm25ConcentrationMeasurement, Pm25ConcentrationMeasurementCluster, PowerSource, PowerSourceCluster, PowerSourceConfigurationCluster, PowerTopology, PowerTopologyCluster, PressureMeasurement, PressureMeasurementCluster, RadonConcentrationMeasurement, RadonConcentrationMeasurementCluster, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, SmokeCoAlarm, SmokeCoAlarmCluster, Switch, SwitchCluster, TemperatureMeasurement, TemperatureMeasurementCluster, Thermostat, ThermostatCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster, UserLabel, UserLabelCluster, WindowCovering, WindowCoveringCluster, } from '@matter/main/clusters';
@@ -50,9 +23,10 @@ import { AirQualityServer, BasicInformationServer, CarbonDioxideConcentrationMea
50
23
  import { ClusterServer, GroupsClusterHandler } from '@project-chip/matter.js/cluster';
51
24
  export class MatterbridgeEndpoint extends Endpoint {
52
25
  static bridgeMode = '';
53
- static logLevel = "info" /* LogLevel.INFO */;
26
+ static logLevel = "info";
54
27
  log;
55
28
  plugin = undefined;
29
+ configUrl = undefined;
56
30
  deviceName = undefined;
57
31
  serialNumber = undefined;
58
32
  uniqueId = undefined;
@@ -68,20 +42,13 @@ export class MatterbridgeEndpoint extends Endpoint {
68
42
  deviceType;
69
43
  uniqueStorageKey = undefined;
70
44
  tagList = undefined;
71
- // Maps matter deviceTypes and endpoints
45
+ subType = '';
72
46
  deviceTypes = new Map();
73
47
  clusterServers = new Map();
74
48
  clusterClients = new Map();
75
49
  commandHandler = new NamedHandler();
76
- /**
77
- * Represents a MatterbridgeEndpoint.
78
- * @constructor
79
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
80
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
81
- */
82
50
  constructor(definition, options = {}, debug = false) {
83
51
  let deviceTypeList = [];
84
- // Get the first DeviceTypeDefinition
85
52
  let firstDefinition;
86
53
  if (Array.isArray(definition)) {
87
54
  firstDefinition = definition[0];
@@ -94,7 +61,6 @@ export class MatterbridgeEndpoint extends Endpoint {
94
61
  firstDefinition = definition;
95
62
  deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
96
63
  }
97
- // Convert the first DeviceTypeDefinition to an EndpointType.Options
98
64
  const deviceTypeDefinitionV8 = {
99
65
  name: firstDefinition.name.replace('-', '_'),
100
66
  deviceType: firstDefinition.code,
@@ -113,7 +79,6 @@ export class MatterbridgeEndpoint extends Endpoint {
113
79
  behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
114
80
  };
115
81
  const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
116
- // Convert the options to an Endpoint.Options
117
82
  const optionsV8 = {
118
83
  id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
119
84
  number: options.endpointId,
@@ -131,27 +96,15 @@ export class MatterbridgeEndpoint extends Endpoint {
131
96
  }
132
97
  else
133
98
  this.deviceTypes.set(firstDefinition.code, firstDefinition);
134
- // console.log('MatterbridgeEndpoint.option', options);
135
- // console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
136
- // console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
137
- // Create the logger
138
- this.log = new AnsiLogger({ logName: 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
99
+ this.log = new AnsiLogger({ logName: 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
139
100
  this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
140
101
  `id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
141
- // Add MatterbridgeBehavior with MatterbridgeBehaviorDevice
142
102
  this.behaviors.require(MatterbridgeBehavior, { deviceCommand: new MatterbridgeBehaviorDevice(this.log, this.commandHandler, undefined) });
143
103
  }
144
- /**
145
- * Loads an instance of the MatterbridgeDevice class.
146
- *
147
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
148
- * @returns MatterbridgeDevice instance.
149
- */
150
104
  static async loadInstance(definition, options = {}, debug = false) {
151
105
  return new MatterbridgeEndpoint(definition, options, debug);
152
106
  }
153
107
  static getBehaviourTypesFromClusterServerIds(clusterServerList) {
154
- // Map Server ClusterId to Behavior.Type
155
108
  const behaviorTypes = [];
156
109
  clusterServerList.forEach((clusterId) => {
157
110
  behaviorTypes.push(MatterbridgeEndpoint.getBehaviourTypeFromClusterServerId(clusterId));
@@ -159,15 +112,12 @@ export class MatterbridgeEndpoint extends Endpoint {
159
112
  return behaviorTypes;
160
113
  }
161
114
  static getBehaviourTypesFromClusterClientIds(clusterClientList) {
162
- // Map Client ClusterId to Behavior.Type
163
115
  const behaviorTypes = [];
164
116
  clusterClientList.forEach((clusterId) => {
165
- // behaviorTypes.push(MatterbridgeEndpoint.getBehaviourTypeFromClusterClientId(clusterId));
166
117
  });
167
118
  return behaviorTypes;
168
119
  }
169
- static getBehaviourTypeFromClusterServerId(clusterId, type) {
170
- // Map ClusterId to Behavior.Type
120
+ static getBehaviourTypeFromClusterServerId(clusterId, subType) {
171
121
  if (clusterId === Identify.Cluster.id)
172
122
  return MatterbridgeIdentifyServer;
173
123
  if (clusterId === Groups.Cluster.id)
@@ -175,24 +125,36 @@ export class MatterbridgeEndpoint extends Endpoint {
175
125
  if (clusterId === OnOff.Cluster.id)
176
126
  return MatterbridgeOnOffServer.with('Lighting');
177
127
  if (clusterId === LevelControl.Cluster.id)
178
- return MatterbridgeLevelControlServer;
179
- if (clusterId === ColorControl.Cluster.id)
128
+ return MatterbridgeLevelControlServer.with('OnOff', 'Lighting');
129
+ if (clusterId === ColorControl.Cluster.id && subType === undefined)
180
130
  return MatterbridgeColorControlServer;
131
+ if (clusterId === ColorControl.Cluster.id && subType === 'CompleteColorControl')
132
+ return MatterbridgeColorControlServer;
133
+ if (clusterId === ColorControl.Cluster.id && subType === 'XyColorControl')
134
+ return MatterbridgeColorControlServer.with('Xy');
135
+ if (clusterId === ColorControl.Cluster.id && subType === 'HueSaturationColorControl')
136
+ return MatterbridgeColorControlServer.with('HueSaturation');
137
+ if (clusterId === ColorControl.Cluster.id && subType === 'ColorTemperatureColorControl')
138
+ return MatterbridgeColorControlServer.with('ColorTemperature');
181
139
  if (clusterId === DoorLock.Cluster.id)
182
140
  return MatterbridgeDoorLockServer;
183
- if (clusterId === Thermostat.Cluster.id && type === 'AutoModeThermostat')
141
+ if (clusterId === Thermostat.Cluster.id && subType === undefined)
142
+ return MatterbridgeThermostatServer.with('AutoMode', 'Heating', 'Cooling');
143
+ if (clusterId === Thermostat.Cluster.id && subType === 'AutoModeThermostat')
184
144
  return MatterbridgeThermostatServer.with('AutoMode', 'Heating', 'Cooling');
185
- if (clusterId === Thermostat.Cluster.id && type === 'HeatingThermostat')
145
+ if (clusterId === Thermostat.Cluster.id && subType === 'HeatingThermostat')
186
146
  return MatterbridgeThermostatServer.with('Heating');
187
- if (clusterId === Thermostat.Cluster.id && type === 'CoolingThermostat')
147
+ if (clusterId === Thermostat.Cluster.id && subType === 'CoolingThermostat')
188
148
  return MatterbridgeThermostatServer.with('Cooling');
189
149
  if (clusterId === WindowCovering.Cluster.id)
190
150
  return MatterbridgeWindowCoveringServer;
191
151
  if (clusterId === FanControl.Cluster.id)
192
152
  return MatterbridgeFanControlServer;
193
- if (clusterId === Switch.Cluster.id && type === 'MomentarySwitch')
153
+ if (clusterId === Switch.Cluster.id && subType === undefined)
194
154
  return SwitchServer.with('MomentarySwitch', 'MomentarySwitchRelease', 'MomentarySwitchLongPress', 'MomentarySwitchMultiPress');
195
- if (clusterId === Switch.Cluster.id && type === 'LatchingSwitch')
155
+ if (clusterId === Switch.Cluster.id && subType === 'MomentarySwitch')
156
+ return SwitchServer.with('MomentarySwitch', 'MomentarySwitchRelease', 'MomentarySwitchLongPress', 'MomentarySwitchMultiPress');
157
+ if (clusterId === Switch.Cluster.id && subType === 'LatchingSwitch')
196
158
  return SwitchServer.with('LatchingSwitch');
197
159
  if (clusterId === TemperatureMeasurement.Cluster.id)
198
160
  return TemperatureMeasurementServer;
@@ -246,11 +208,13 @@ export class MatterbridgeEndpoint extends Endpoint {
246
208
  return ElectricalPowerMeasurementServer.with('AlternatingCurrent');
247
209
  if (clusterId === ElectricalEnergyMeasurement.Cluster.id)
248
210
  return ElectricalEnergyMeasurementServer.with('ImportedEnergy', 'ExportedEnergy', 'CumulativeEnergy');
249
- if (clusterId === PowerSource.Cluster.id && type === 'WiredPowerSource')
211
+ if (clusterId === PowerSource.Cluster.id && subType === undefined)
212
+ return PowerSourceServer;
213
+ if (clusterId === PowerSource.Cluster.id && subType === 'WiredPowerSource')
250
214
  return PowerSourceServer.with(PowerSource.Feature.Wired);
251
- if (clusterId === PowerSource.Cluster.id && type === 'BatteryReplaceablePowerSource')
215
+ if (clusterId === PowerSource.Cluster.id && subType === 'BatteryReplaceablePowerSource')
252
216
  return PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable);
253
- if (clusterId === PowerSource.Cluster.id && type === 'BatteryRechargeablePowerSource')
217
+ if (clusterId === PowerSource.Cluster.id && subType === 'BatteryRechargeablePowerSource')
254
218
  return PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable);
255
219
  if (clusterId === BasicInformation.Cluster.id)
256
220
  return BasicInformationServer;
@@ -259,21 +223,12 @@ export class MatterbridgeEndpoint extends Endpoint {
259
223
  return MatterbridgeIdentifyServer;
260
224
  }
261
225
  static getBehaviourTypeFromClusterClientId(clusterId) {
262
- // Map ClusterId to Behavior.Type
263
226
  return IdentifyBehavior;
264
227
  }
265
- /**
266
- * Adds a device type to the list of device types.
267
- * If the device type is not already present in the list, it will be added.
268
- *
269
- * @param {DeviceTypeDefinition} deviceType - The device type to add.
270
- */
271
228
  addDeviceType(deviceType) {
272
229
  if (!this.deviceTypes.has(deviceType.code)) {
273
- // Keep the Matterbridge internal map
274
230
  this.log.debug(`addDeviceType: ${zb}${'0x' + deviceType.code.toString(16).padStart(4, '0')}${db}-${zb}${deviceType.name}${db}`);
275
231
  this.deviceTypes.set(deviceType.code, deviceType);
276
- // Add the device types to the descriptor server
277
232
  const deviceTypeList = Array.from(this.deviceTypes.values()).map((dt) => ({
278
233
  deviceType: dt.code,
279
234
  revision: dt.revision,
@@ -291,12 +246,6 @@ export class MatterbridgeEndpoint extends Endpoint {
291
246
  }
292
247
  }
293
248
  }
294
- /**
295
- * Adds one or more device types with the required cluster servers and the specified cluster servers.
296
- *
297
- * @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
298
- * @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
299
- */
300
249
  addDeviceTypeWithClusterServer(deviceTypes, includeServerList) {
301
250
  this.log.debug('addDeviceTypeWithClusterServer:');
302
251
  deviceTypes.forEach((deviceType) => {
@@ -319,12 +268,6 @@ export class MatterbridgeEndpoint extends Endpoint {
319
268
  });
320
269
  this.addClusterServerFromList(this, includeServerList);
321
270
  }
322
- /**
323
- * Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
324
- *
325
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the required cluster servers to.
326
- * @returns {MatterbridgeEndpoint} The updated endpoint with the required cluster servers added.
327
- */
328
271
  addRequiredClusterServers(endpoint) {
329
272
  const requiredServerList = [];
330
273
  this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.id}${db}`);
@@ -341,12 +284,6 @@ export class MatterbridgeEndpoint extends Endpoint {
341
284
  this.addClusterServerFromList(endpoint, requiredServerList);
342
285
  return endpoint;
343
286
  }
344
- /**
345
- * Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
346
- *
347
- * @param {MatterbridgeEndpoint} endpoint - The endpoint to add the required cluster servers to.
348
- * @returns {MatterbridgeEndpoint} The updated endpoint with the required cluster servers added.
349
- */
350
287
  addOptionalClusterServers(endpoint) {
351
288
  const optionalServerList = [];
352
289
  this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.id}${db}`);
@@ -363,17 +300,6 @@ export class MatterbridgeEndpoint extends Endpoint {
363
300
  this.addClusterServerFromList(endpoint, optionalServerList);
364
301
  return endpoint;
365
302
  }
366
- /**
367
- * Adds a child endpoint with the specified device types and options.
368
- * If the child endpoint is not already present, it will be created and added.
369
- * If the child endpoint is already present, the device types will be added to the existing child endpoint.
370
- *
371
- * @param {string} endpointName - The name of the new endpoint to add.
372
- * @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
373
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
374
- * @param {boolean} [debug=false] - Whether to enable debug logging.
375
- * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
376
- */
377
303
  addChildDeviceType(endpointName, deviceTypes, options = {}, debug = false) {
378
304
  this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
379
305
  let child = this.getChildEndpointByName(endpointName);
@@ -404,18 +330,6 @@ export class MatterbridgeEndpoint extends Endpoint {
404
330
  }
405
331
  return child;
406
332
  }
407
- /**
408
- * Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
409
- * If the child endpoint is not already present in the childEndpoints, it will be added.
410
- * If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
411
- *
412
- * @param {string} endpointName - The name of the new enpoint to add.
413
- * @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
414
- * @param {ClusterId[]} [includeServerList=[]] - The list of cluster IDs to include.
415
- * @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
416
- * @param {boolean} [debug=false] - Whether to enable debug logging.
417
- * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
418
- */
419
333
  addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
420
334
  this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
421
335
  let child = this.getChildEndpointByName(endpointName);
@@ -459,12 +373,6 @@ export class MatterbridgeEndpoint extends Endpoint {
459
373
  }
460
374
  return child;
461
375
  }
462
- /**
463
- * Retrieves a child endpoint by its name.
464
- *
465
- * @param {string} endpointName - The name of the endpoint to retrieve.
466
- * @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
467
- */
468
376
  getChildEndpointByName(endpointName) {
469
377
  return this.parts.find((part) => part.id === endpointName);
470
378
  }
@@ -483,8 +391,6 @@ export class MatterbridgeEndpoint extends Endpoint {
483
391
  });
484
392
  }
485
393
  async setBridgedDeviceReachability(reachable) {
486
- // await this.setAttribute(BridgedDeviceBasicInformationCluster.id, 'reachable', reachable, this.log);
487
- // await this.triggerEvent(BridgedDeviceBasicInformationCluster.id, 'reachableChanged', { reachableNewValue: reachable }, this.log);
488
394
  }
489
395
  hasClusterServer(cluster) {
490
396
  return this.clusterServers.has(cluster.id);
@@ -502,16 +408,11 @@ export class MatterbridgeEndpoint extends Endpoint {
502
408
  return this.clusterServers.get(clusterId);
503
409
  }
504
410
  addTagList(endpoint, mfgCode, namespaceId, tag, label) {
505
- // Do nothing here only for old api compatibility
506
411
  }
507
412
  addClusterServer(cluster) {
508
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
509
413
  const options = {};
510
414
  for (const attribute of Object.values(cluster.attributes)) {
511
- // console.error('Attribute:', (attribute as any).id, (attribute as any).name, (attribute as any).value);
512
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
513
415
  if (attribute.id < 0xfff0) {
514
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
515
416
  options[attribute.name] = attribute.value;
516
417
  }
517
418
  }
@@ -519,44 +420,37 @@ export class MatterbridgeEndpoint extends Endpoint {
519
420
  if (this.clusterServers.has(cluster.id)) {
520
421
  this.log.debug(`****cluster ${hk}${'0x' + cluster.id.toString(16).padStart(4, '0')}${db}-${hk}${getClusterNameById(cluster.id)}${db} already added`);
521
422
  }
522
- let type = undefined;
423
+ this.subType = '';
424
+ if (cluster.id === ColorControl.Cluster.id && cluster.isAttributeSupportedByName('currentX') && !cluster.isAttributeSupportedByName('currentHue') && !cluster.isAttributeSupportedByName('colorTemperatureMireds'))
425
+ this.subType = 'XyColorControl';
426
+ else if (cluster.id === ColorControl.Cluster.id && cluster.isAttributeSupportedByName('currentHue') && !cluster.isAttributeSupportedByName('currentX') && !cluster.isAttributeSupportedByName('colorTemperatureMireds'))
427
+ this.subType = 'HueSaturationColorControl';
428
+ else if (cluster.id === ColorControl.Cluster.id && cluster.isAttributeSupportedByName('colorTemperatureMireds') && !cluster.isAttributeSupportedByName('currentHue') && !cluster.isAttributeSupportedByName('currentX'))
429
+ this.subType = 'ColorTemperatureColorControl';
430
+ else
431
+ this.subType = 'CompleteColorControl';
523
432
  if (cluster.id === SwitchCluster.id && cluster.isEventSupportedByName('multiPressComplete'))
524
- type = 'MomentarySwitch';
433
+ this.subType = 'MomentarySwitch';
525
434
  if (cluster.id === SwitchCluster.id && cluster.isEventSupportedByName('switchLatched'))
526
- type = 'LatchingSwitch';
435
+ this.subType = 'LatchingSwitch';
527
436
  if (cluster.id === PowerSourceCluster.id && cluster.isAttributeSupportedByName('wiredCurrentType'))
528
- type = 'WiredPowerSource';
437
+ this.subType = 'WiredPowerSource';
529
438
  if (cluster.id === PowerSourceCluster.id && cluster.isAttributeSupportedByName('batReplacementDescription'))
530
- type = 'BatteryReplaceablePowerSource';
439
+ this.subType = 'BatteryReplaceablePowerSource';
531
440
  if (cluster.id === PowerSourceCluster.id && cluster.isAttributeSupportedByName('batChargeState'))
532
- type = 'BatteryRechargeablePowerSource';
441
+ this.subType = 'BatteryRechargeablePowerSource';
533
442
  if (cluster.id === ThermostatCluster.id && cluster.isAttributeSupportedByName('occupiedCoolingSetpoint'))
534
- type = 'CoolingThermostat';
443
+ this.subType = 'CoolingThermostat';
535
444
  if (cluster.id === ThermostatCluster.id && cluster.isAttributeSupportedByName('occupiedHeatingSetpoint'))
536
- type = 'HeatingThermostat';
445
+ this.subType = 'HeatingThermostat';
537
446
  if (cluster.id === ThermostatCluster.id && cluster.isAttributeSupportedByName('minSetpointDeadBand'))
538
- type = 'AutoModeThermostat';
539
- const behavior = MatterbridgeEndpoint.getBehaviourTypeFromClusterServerId(cluster.id, type);
540
- if (cluster.id === PowerTopologyCluster.id && this.clusterServers.has(cluster.id))
541
- return; // TODO remove this workaround
542
- if (cluster.id === ElectricalPowerMeasurementCluster.id && this.clusterServers.has(cluster.id))
543
- return; // TODO remove this workaround
544
- if (cluster.id === ElectricalEnergyMeasurementCluster.id && this.clusterServers.has(cluster.id))
545
- return; // TODO remove this workaround
546
- if (cluster.id === ThermostatCluster.id && this.clusterServers.has(cluster.id))
547
- return; // TODO remove this workaround
447
+ this.subType = 'AutoModeThermostat';
448
+ const behavior = MatterbridgeEndpoint.getBehaviourTypeFromClusterServerId(cluster.id, this.subType);
548
449
  this.clusterServers.set(cluster.id, cluster);
549
450
  if (cluster.id === BasicInformationCluster.id)
550
- return; // Not used in Matterbridge edge for devices. Only on server node.
451
+ return;
551
452
  this.behaviors.require(behavior, options);
552
453
  }
553
- /**
554
- * Adds cluster servers to the specified endpoint based on the provided server list.
555
- *
556
- * @param {Endpoint} endpoint - The endpoint to add cluster servers to.
557
- * @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
558
- * @returns void
559
- */
560
454
  addClusterServerFromList(endpoint, includeServerList) {
561
455
  if (includeServerList.includes(Identify.Cluster.id))
562
456
  endpoint.addClusterServer(this.getDefaultIdentifyClusterServer());
@@ -626,8 +520,6 @@ export class MatterbridgeEndpoint extends Endpoint {
626
520
  endpoint.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer());
627
521
  if (includeServerList.includes(TotalVolatileOrganicCompoundsConcentrationMeasurement.Cluster.id))
628
522
  endpoint.addClusterServer(this.getDefaultTvocMeasurementClusterServer());
629
- // if (includeServerList.includes(DeviceEnergyManagement.Cluster.id)) endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementClusterServer());
630
- // if (includeServerList.includes(DeviceEnergyManagementMode.Cluster.id)) endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementModeClusterServer());
631
523
  }
632
524
  async addFixedLabel(label, value) {
633
525
  if (!this.clusterServers.get(FixedLabelCluster.id)) {
@@ -638,7 +530,6 @@ export class MatterbridgeEndpoint extends Endpoint {
638
530
  return;
639
531
  }
640
532
  this.log.debug(`addFixedLabel: add label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
641
- // if (this.construction.status !== Lifecycle.Status.Active) await this.construction.ready;
642
533
  const labelList = (this.getAttribute(FixedLabelCluster.id, 'labelList', this.log) ?? []).filter((entryLabel) => entryLabel.label !== label);
643
534
  labelList.push({ label, value });
644
535
  await this.setAttribute(FixedLabelCluster.id, 'labelList', labelList, this.log);
@@ -652,7 +543,6 @@ export class MatterbridgeEndpoint extends Endpoint {
652
543
  return;
653
544
  }
654
545
  this.log.debug(`addUserLabel: add label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
655
- // if (this.construction.status !== Lifecycle.Status.Active) await this.construction.ready;
656
546
  const labelList = (this.getAttribute(UserLabelCluster.id, 'labelList', this.log) ?? []).filter((entryLabel) => entryLabel.label !== label);
657
547
  labelList.push({ label, value });
658
548
  await this.setAttribute(UserLabelCluster.id, 'labelList', labelList, this.log);
@@ -667,16 +557,6 @@ export class MatterbridgeEndpoint extends Endpoint {
667
557
  return name;
668
558
  return name.charAt(0).toLowerCase() + name.slice(1);
669
559
  }
670
- /**
671
- * Retrieves the value of the specified attribute from the given endpoint and cluster.
672
- *
673
- * @param {ClusterId} clusterId - The ID of the cluster to retrieve the attribute from.
674
- * @param {string} attribute - The name of the attribute to retrieve.
675
- * @param {AnsiLogger} [log] - Optional logger for error and info messages.
676
- * @param {MatterbridgeEndpoint} [endpoint] - Optional the child endpoint to retrieve the attribute from.
677
- * @returns {any} The value of the attribute, or undefined if the attribute is not found.
678
- */
679
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
680
560
  getAttribute(clusterId, attribute, log, endpoint) {
681
561
  if (!endpoint)
682
562
  endpoint = this;
@@ -685,7 +565,6 @@ export class MatterbridgeEndpoint extends Endpoint {
685
565
  this.log.error(`getAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
686
566
  return undefined;
687
567
  }
688
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
689
568
  const state = endpoint.state;
690
569
  if (!(clusterName in state)) {
691
570
  this.log.error(`getAttribute error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
@@ -700,27 +579,14 @@ export class MatterbridgeEndpoint extends Endpoint {
700
579
  log?.info(`${db}Get endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${this.capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db} value ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
701
580
  return value;
702
581
  }
703
- /**
704
- * Sets the value of an attribute on a cluster server endpoint.
705
- *
706
- * @param {ClusterId} clusterId - The ID of the cluster.
707
- * @param {string} attribute - The name of the attribute.
708
- * @param {any} value - The value to set for the attribute.
709
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
710
- * @param {MatterbridgeEndpoint} [endpoint] - (Optional) The endpoint to set the attribute on. If not provided, the attribute will be set on the current endpoint.
711
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
712
- */
713
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
714
582
  async setAttribute(clusterId, attribute, value, log, endpoint) {
715
583
  if (!endpoint)
716
584
  endpoint = this;
717
585
  const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
718
586
  if (endpoint.construction.status !== Lifecycle.Status.Active) {
719
587
  this.log.error(`setAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
720
- // await endpoint.construction.ready;
721
588
  return false;
722
589
  }
723
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
724
590
  const state = endpoint.state;
725
591
  if (!(clusterName in state)) {
726
592
  this.log.error(`setAttribute ${hk}${attribute}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
@@ -735,32 +601,18 @@ export class MatterbridgeEndpoint extends Endpoint {
735
601
  if (typeof oldValue === 'object')
736
602
  oldValue = deepCopy(oldValue);
737
603
  await endpoint.setStateOf(endpoint.behaviors.supported[clusterName], { [attribute]: value });
738
- // await endpoint.set({ [clusterName]: { [attribute]: value } });
739
604
  log?.info(`${db}Set endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${this.capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db} ` +
740
605
  `from ${YELLOW}${typeof oldValue === 'object' ? debugStringify(oldValue) : oldValue}${db} ` +
741
606
  `to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
742
607
  return true;
743
608
  }
744
- /**
745
- * Subscribes to an attribute on a cluster.
746
- *
747
- * @param {ClusterId} clusterId - The ID of the cluster.
748
- * @param {string} attribute - The name of the attribute to subscribe to.
749
- * @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
750
- * @param {AnsiLogger} [log] - Optional logger for logging errors and information.
751
- * @param {MatterbridgeEndpoint} [endpoint] - Optional endpoint to subscribe the attribute on. Defaults to the current endpoint.
752
- * @returns {boolean} - A boolean indicating whether the subscription was successful.
753
- */
754
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
755
609
  async subscribeAttribute(clusterId, attribute, listener, log, endpoint) {
756
610
  if (!endpoint)
757
611
  endpoint = this;
758
612
  const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
759
613
  if (endpoint.construction.status !== Lifecycle.Status.Active) {
760
- // this.log.error(`subscribeAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
761
614
  await endpoint.construction.ready;
762
615
  }
763
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
764
616
  const events = endpoint.events;
765
617
  if (!(clusterName in events)) {
766
618
  this.log.error(`subscribeAttribute ${hk}${attribute}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
@@ -775,120 +627,31 @@ export class MatterbridgeEndpoint extends Endpoint {
775
627
  log?.info(`${db}Subscribe endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${this.capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
776
628
  return true;
777
629
  }
778
- /**
779
- * Triggers an event on the specified cluster.
780
- *
781
- * @param {ClusterId} clusterId - The ID of the cluster.
782
- * @param {string} event - The name of the event to trigger.
783
- * @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
784
- * @param {AnsiLogger} [log] - Optional logger for logging information.
785
- * @param {MatterbridgeEndpoint} [endpoint] - Optional endpoint to trigger the event on. Defaults to the current endpoint.
786
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
787
- */
788
630
  async triggerEvent(clusterId, event, payload, log, endpoint) {
789
631
  if (!endpoint)
790
632
  endpoint = this;
791
633
  const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
792
634
  if (endpoint.construction.status !== Lifecycle.Status.Active) {
793
- // this.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
794
635
  await endpoint.construction.ready;
795
- // return false;
796
636
  }
797
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
798
637
  const events = endpoint.events;
799
638
  if (!(clusterName in events) || !(event in events[clusterName])) {
800
639
  this.log.error(`triggerEvent ${hk}${event}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
801
640
  return false;
802
641
  }
803
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
804
- // @ts-ignore
805
642
  await endpoint.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
806
643
  log?.info(`${db}Trigger event ${hk}${this.capitalizeFirstLetter(clusterName)}${db}.${hk}${event}${db} with ${debugStringify(payload)}${db} on endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} `);
807
644
  return true;
808
645
  }
809
- /**
810
- * Adds a command handler for the specified command.
811
- *
812
- * @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
813
- * @param {(data: any) => void} handler - The handler function to execute when the command is received.
814
- * @returns {void}
815
- */
816
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
817
646
  addCommandHandler(command, handler) {
818
647
  this.commandHandler.addHandler(command, handler);
819
648
  }
820
- /**
821
- * Serializes the Matterbridge device into a serialized object.
822
- *
823
- * @param pluginName - The name of the plugin.
824
- * @returns The serialized Matterbridge device object.
825
- */
826
649
  serialize() {
827
650
  return undefined;
828
- /*
829
- if (!this.serialNumber || !this.deviceName || !this.uniqueId) return;
830
- const cluster = this.getClusterServer(BasicInformationCluster) ?? this.getClusterServer(BridgedDeviceBasicInformationCluster);
831
- if (!cluster) return;
832
- const serialized: SerializedMatterbridgeDevice = {
833
- pluginName: this.plugin ?? 'Unknown',
834
- serialNumber: this.serialNumber,
835
- deviceName: this.deviceName,
836
- uniqueId: this.uniqueId,
837
- productName: cluster.attributes.productName?.getLocal(),
838
- vendorId: cluster.attributes.vendorId?.getLocal(),
839
- vendorName: cluster.attributes.vendorName?.getLocal(),
840
- deviceTypes: Array.from(this.deviceTypes.values()),
841
- endpoint: this.number,
842
- endpointName: this.id,
843
- clusterServersId: [],
844
- };
845
- this.getAllClusterServers().forEach((clusterServer) => {
846
- serialized.clusterServersId.push(clusterServer.id);
847
- });
848
- return serialized;
849
- */
850
- }
851
- /**
852
- * Deserializes the device into a serialized object.
853
- *
854
- * @returns The deserialized MatterbridgeDevice.
855
- */
651
+ }
856
652
  static deserialize(serializedDevice) {
857
653
  return undefined;
858
- /*
859
- const device = new MatterbridgeDevice(serializedDevice.deviceTypes);
860
- device.serialNumber = serializedDevice.serialNumber;
861
- device.deviceName = serializedDevice.deviceName;
862
- device.uniqueId = serializedDevice.uniqueId;
863
- for (const clusterId of serializedDevice.clusterServersId) {
864
- if (clusterId === BasicInformationCluster.id)
865
- device.createDefaultBasicInformationClusterServer(
866
- serializedDevice.deviceName,
867
- serializedDevice.serialNumber,
868
- serializedDevice.vendorId ?? 0xfff1,
869
- serializedDevice.vendorName ?? 'Matterbridge',
870
- serializedDevice.productId ?? 0x8000,
871
- serializedDevice.productName ?? 'Matterbridge device',
872
- );
873
- else if (clusterId === BridgedDeviceBasicInformationCluster.id)
874
- device.createDefaultBridgedDeviceBasicInformationClusterServer(
875
- serializedDevice.deviceName,
876
- serializedDevice.serialNumber,
877
- serializedDevice.vendorId ?? 0xfff1,
878
- serializedDevice.vendorName ?? 'Matterbridge',
879
- serializedDevice.productName ?? 'Matterbridge device',
880
- );
881
- else device.addClusterServerFromList(device, [clusterId]);
882
- }
883
- return device;
884
- */
885
- }
886
- /**
887
- * From here copy paste from MatterbridgeDevice
888
- */
889
- /**
890
- * Get a default IdentifyCluster server.
891
- */
654
+ }
892
655
  getDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
893
656
  return ClusterServer(IdentifyCluster, {
894
657
  identifyTime,
@@ -904,88 +667,28 @@ export class MatterbridgeEndpoint extends Endpoint {
904
667
  },
905
668
  });
906
669
  }
907
- /**
908
- * Creates a default IdentifyCluster server.
909
- */
910
670
  createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
911
671
  this.addClusterServer(this.getDefaultIdentifyClusterServer(identifyTime, identifyType));
912
672
  }
913
- /**
914
- * Get a default IdentifyCluster server.
915
- */
916
673
  getDefaultGroupsClusterServer() {
917
674
  return ClusterServer(GroupsCluster, {
918
675
  nameSupport: {
919
676
  nameSupport: true,
920
677
  },
921
678
  }, GroupsClusterHandler());
922
- // return createDefaultGroupsClusterServer();
923
679
  }
924
- /**
925
- * Creates a default groups cluster server and adds it to the device.
926
- */
927
680
  createDefaultGroupsClusterServer() {
928
681
  this.addClusterServer(this.getDefaultGroupsClusterServer());
929
682
  }
930
- /**
931
- * Get a default scenes cluster server and adds it to the current instance.
932
- * @deprecated This method is deprecated.
933
- *
934
- */
935
683
  getDefaultScenesClusterServer() {
936
- /*
937
- return ClusterServer(
938
- ScenesCluster,
939
- {
940
- sceneCount: 0,
941
- currentScene: 0,
942
- currentGroup: GroupId(0),
943
- sceneValid: false,
944
- nameSupport: {
945
- nameSupport: true,
946
- },
947
- lastConfiguredBy: null,
948
- },
949
- {},
950
- );
951
- */
952
- }
953
- /**
954
- * Creates a default scenes cluster server and adds it to the current instance.
955
- * @deprecated This method is deprecated.
956
- */
684
+ }
957
685
  createDefaultScenesClusterServer() {
958
- /*
959
- this.addClusterServer(this.getDefaultScenesClusterServer());
960
- */
961
- }
962
- /**
963
- * Creates a unique identifier based on the provided parameters.
964
- * @param param1 - The first parameter.
965
- * @param param2 - The second parameter.
966
- * @param param3 - The third parameter.
967
- * @param param4 - The fourth parameter.
968
- * @returns A unique identifier generated using the MD5 hash algorithm.
969
- */
686
+ }
970
687
  createUniqueId(param1, param2, param3, param4) {
971
688
  const hash = createHash('md5');
972
689
  hash.update(param1 + param2 + param3 + param4);
973
690
  return hash.digest('hex');
974
691
  }
975
- /**
976
- * Get a default Basic Information Cluster Server.
977
- *
978
- * @param deviceName - The name of the device.
979
- * @param serialNumber - The serial number of the device.
980
- * @param vendorId - The vendor ID of the device.
981
- * @param vendorName - The vendor name of the device.
982
- * @param productId - The product ID of the device.
983
- * @param productName - The product name of the device.
984
- * @param softwareVersion - The software version of the device. Default is 1.
985
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
986
- * @param hardwareVersion - The hardware version of the device. Default is 1.
987
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
988
- */
989
692
  getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
990
693
  this.log.logName = deviceName;
991
694
  this.deviceName = deviceName;
@@ -1006,6 +709,7 @@ export class MatterbridgeEndpoint extends Endpoint {
1006
709
  vendorName: vendorName.slice(0, 32),
1007
710
  productId: productId,
1008
711
  productName: productName.slice(0, 32),
712
+ productUrl: 'https://www.npmjs.com/package/matterbridge',
1009
713
  productLabel: deviceName.slice(0, 64),
1010
714
  nodeLabel: deviceName.slice(0, 32),
1011
715
  serialNumber: serialNumber.slice(0, 32),
@@ -1025,20 +729,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1025
729
  reachableChanged: true,
1026
730
  });
1027
731
  }
1028
- /**
1029
- * Creates a default Basic Information Cluster Server.
1030
- *
1031
- * @param deviceName - The name of the device.
1032
- * @param serialNumber - The serial number of the device.
1033
- * @param vendorId - The vendor ID of the device.
1034
- * @param vendorName - The vendor name of the device.
1035
- * @param productId - The product ID of the device.
1036
- * @param productName - The product name of the device.
1037
- * @param softwareVersion - The software version of the device. Default is 1.
1038
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
1039
- * @param hardwareVersion - The hardware version of the device. Default is 1.
1040
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
1041
- */
1042
732
  createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
1043
733
  if (MatterbridgeEndpoint.bridgeMode === 'bridge') {
1044
734
  this.addDeviceType(bridgedNode);
@@ -1047,19 +737,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1047
737
  }
1048
738
  this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
1049
739
  }
1050
- /**
1051
- * Get a default BridgedDeviceBasicInformationClusterServer.
1052
- *
1053
- * @param deviceName - The name of the device.
1054
- * @param serialNumber - The serial number of the device.
1055
- * @param vendorId - The vendor ID of the device.
1056
- * @param vendorName - The name of the vendor.
1057
- * @param productName - The name of the product.
1058
- * @param softwareVersion - The software version of the device. Default is 1.
1059
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
1060
- * @param hardwareVersion - The hardware version of the device. Default is 1.
1061
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
1062
- */
1063
740
  getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
1064
741
  this.log.logName = deviceName;
1065
742
  this.deviceName = deviceName;
@@ -1074,9 +751,10 @@ export class MatterbridgeEndpoint extends Endpoint {
1074
751
  this.hardwareVersion = hardwareVersion;
1075
752
  this.hardwareVersionString = hardwareVersionString;
1076
753
  return ClusterServer(BridgedDeviceBasicInformationCluster, {
1077
- vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
754
+ vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
1078
755
  vendorName: vendorName.slice(0, 32),
1079
756
  productName: productName.slice(0, 32),
757
+ productUrl: 'https://www.npmjs.com/package/matterbridge',
1080
758
  productLabel: deviceName.slice(0, 64),
1081
759
  nodeLabel: deviceName.slice(0, 32),
1082
760
  serialNumber: serialNumber.slice(0, 32),
@@ -1093,36 +771,12 @@ export class MatterbridgeEndpoint extends Endpoint {
1093
771
  reachableChanged: true,
1094
772
  });
1095
773
  }
1096
- /**
1097
- * Creates a default BridgedDeviceBasicInformationClusterServer.
1098
- *
1099
- * @param deviceName - The name of the device.
1100
- * @param serialNumber - The serial number of the device.
1101
- * @param vendorId - The vendor ID of the device.
1102
- * @param vendorName - The name of the vendor.
1103
- * @param productName - The name of the product.
1104
- * @param softwareVersion - The software version of the device. Default is 1.
1105
- * @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
1106
- * @param hardwareVersion - The hardware version of the device. Default is 1.
1107
- * @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
1108
- */
1109
774
  createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
1110
775
  this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
1111
776
  }
1112
- /**
1113
- * Get a default Power Topology Cluster Server. Only needed for an electricalSensor device type.
1114
- *
1115
- * @returns {ClusterServer} - The configured Power Topology Cluster Server.
1116
- */
1117
777
  getDefaultPowerTopologyClusterServer() {
1118
778
  return ClusterServer(PowerTopologyCluster.with(PowerTopology.Feature.TreeTopology), {}, {}, {});
1119
779
  }
1120
- /**
1121
- * Get a default Electrical Energy Measurement Cluster Server.
1122
- *
1123
- * @param {number} energy - The total consumption value in mW/h.
1124
- * @returns {ClusterServer} - The configured Electrical Energy Measurement Cluster Server.
1125
- */
1126
780
  getDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
1127
781
  return ClusterServer(ElectricalEnergyMeasurementCluster.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
1128
782
  accuracy: {
@@ -1139,15 +793,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1139
793
  cumulativeEnergyMeasured: true,
1140
794
  });
1141
795
  }
1142
- /**
1143
- * Get a default Electrical Power Measurement Cluster Server.
1144
- *
1145
- * @param {number} voltage - The voltage value in millivolts.
1146
- * @param {number} current - The current value in milliamperes.
1147
- * @param {number} power - The power value in milliwatts.
1148
- * @param {number} frequency - The frequency value in millihertz.
1149
- * @returns {ClusterServer} - The configured Electrical Power Measurement Cluster Server.
1150
- */
1151
796
  getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
1152
797
  return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
1153
798
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -1188,16 +833,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1188
833
  frequency: frequency,
1189
834
  }, {}, {});
1190
835
  }
1191
- /**
1192
- * Get a default OnOff cluster server.
1193
- *
1194
- * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1195
- * @param {boolean} [globalSceneControl=false] - The global scene control state.
1196
- * @param {number} [onTime=0] - The on time value.
1197
- * @param {number} [offWaitTime=0] - The off wait time value.
1198
- * @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
1199
- * @returns {ClusterServer} - The configured OnOff cluster server.
1200
- */
1201
836
  getDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
1202
837
  return ClusterServer(OnOffCluster.with(OnOff.Feature.Lighting), {
1203
838
  onOff,
@@ -1207,107 +842,56 @@ export class MatterbridgeEndpoint extends Endpoint {
1207
842
  startUpOnOff,
1208
843
  }, {
1209
844
  on: async (data) => {
1210
- // Never called in edge
1211
845
  },
1212
846
  off: async (data) => {
1213
- // Never called in edge
1214
847
  },
1215
848
  toggle: async (data) => {
1216
- // Never called in edge
1217
849
  },
1218
850
  offWithEffect: async () => {
1219
- // Never called in edge
1220
851
  },
1221
852
  onWithRecallGlobalScene: async () => {
1222
- // Never called in edge
1223
853
  },
1224
854
  onWithTimedOff: async () => {
1225
- // Never called in edge
1226
855
  },
1227
856
  }, {});
1228
857
  }
1229
- /**
1230
- * Creates a default OnOff cluster server.
1231
- *
1232
- * @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
1233
- * @param {boolean} [globalSceneControl=false] - The global scene control state.
1234
- * @param {number} [onTime=0] - The on time value.
1235
- * @param {number} [offWaitTime=0] - The off wait time value.
1236
- * @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
1237
- * @returns {void}
1238
- */
1239
858
  createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
1240
859
  this.addClusterServer(this.getDefaultOnOffClusterServer(onOff, globalSceneControl, onTime, offWaitTime, startUpOnOff));
1241
860
  }
1242
- /**
1243
- * Get a default level control cluster server.
1244
- *
1245
- * @param currentLevel - The current level (default: 254).
1246
- * @param minLevel - The minimum level (default: 0).
1247
- * @param maxLevel - The maximum level (default: 254).
1248
- * @param onLevel - The on level (default: null).
1249
- */
1250
- getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 0, maxLevel = 254, onLevel = 254) {
1251
- return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff), {
861
+ getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
862
+ return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
1252
863
  currentLevel,
1253
864
  minLevel,
1254
865
  maxLevel,
1255
866
  onLevel,
867
+ remainingTime: 0,
868
+ startUpCurrentLevel,
1256
869
  options: {
1257
870
  executeIfOff: false,
1258
871
  coupleColorTempToLevel: false,
1259
872
  },
1260
873
  }, {
1261
874
  moveToLevel: async (data) => {
1262
- this.log.debug('Matter command: moveToLevel request:', data.request, 'attributes.currentLevel:', data.attributes.currentLevel.getLocal());
1263
- await this.commandHandler.executeHandler('moveToLevel', data);
1264
875
  },
1265
876
  move: async () => {
1266
- this.log.error('Matter command: move not implemented');
1267
877
  },
1268
878
  step: async () => {
1269
- this.log.error('Matter command: step not implemented');
1270
879
  },
1271
880
  stop: async () => {
1272
- this.log.error('Matter command: stop not implemented');
1273
881
  },
1274
882
  moveToLevelWithOnOff: async (data) => {
1275
- this.log.debug('Matter command: moveToLevelWithOnOff request:', data.request, 'attributes.currentLevel:', data.attributes.currentLevel.getLocal());
1276
- await this.commandHandler.executeHandler('moveToLevelWithOnOff', data);
1277
883
  },
1278
884
  moveWithOnOff: async () => {
1279
- this.log.error('Matter command: moveWithOnOff not implemented');
1280
885
  },
1281
886
  stepWithOnOff: async () => {
1282
- this.log.error('Matter command: stepWithOnOff not implemented');
1283
887
  },
1284
888
  stopWithOnOff: async () => {
1285
- this.log.error('Matter command: stopWithOnOff not implemented');
1286
889
  },
1287
890
  });
1288
891
  }
1289
- /**
1290
- * Creates a default level control cluster server.
1291
- *
1292
- * @param currentLevel - The current level (default: 254).
1293
- * @param minLevel - The minimum level (default: 0).
1294
- * @param maxLevel - The maximum level (default: 254).
1295
- * @param onLevel - The on level (default: null).
1296
- */
1297
- createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 0, maxLevel = 254, onLevel = 254) {
1298
- this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel));
1299
- }
1300
- /**
1301
- * Get a default color control cluster server.
1302
- *
1303
- * @param currentX - The current X value.
1304
- * @param currentY - The current Y value.
1305
- * @param currentHue - The current hue value.
1306
- * @param currentSaturation - The current saturation value.
1307
- * @param colorTemperatureMireds - The color temperature in mireds.
1308
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1309
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1310
- */
892
+ createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
893
+ this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel, startUpCurrentLevel));
894
+ }
1311
895
  getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1312
896
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
1313
897
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -1325,77 +909,42 @@ export class MatterbridgeEndpoint extends Endpoint {
1325
909
  colorTempPhysicalMinMireds,
1326
910
  colorTempPhysicalMaxMireds,
1327
911
  coupleColorTempToLevelMinMireds: colorTempPhysicalMinMireds,
912
+ remainingTime: 0,
1328
913
  startUpColorTemperatureMireds: null,
1329
914
  }, {
1330
915
  moveToColor: async (data) => {
1331
- this.log.debug('Matter command: moveToColor request:', data.request, 'attributes.currentX:', data.attributes.currentX.getLocal(), 'attributes.currentY:', data.attributes.currentY.getLocal());
1332
- this.commandHandler.executeHandler('moveToColor', data);
1333
916
  },
1334
917
  moveColor: async () => {
1335
- this.log.error('Matter command: moveColor not implemented');
1336
918
  },
1337
919
  stepColor: async () => {
1338
- this.log.error('Matter command: stepColor not implemented');
1339
920
  },
1340
921
  moveToHue: async (data) => {
1341
- this.log.debug('Matter command: moveToHue request:', data.request, 'attributes.currentHue:', data.attributes.currentHue.getLocal());
1342
- this.commandHandler.executeHandler('moveToHue', data);
1343
922
  },
1344
923
  moveHue: async () => {
1345
- this.log.error('Matter command: moveHue not implemented');
1346
924
  },
1347
925
  stepHue: async () => {
1348
- this.log.error('Matter command: stepHue not implemented');
1349
926
  },
1350
927
  moveToSaturation: async (data) => {
1351
- this.log.debug('Matter command: moveToSaturation request:', data.request, 'attributes.currentSaturation:', data.attributes.currentSaturation.getLocal());
1352
- this.commandHandler.executeHandler('moveToSaturation', data);
1353
928
  },
1354
929
  moveSaturation: async () => {
1355
- this.log.error('Matter command: moveSaturation not implemented');
1356
930
  },
1357
931
  stepSaturation: async () => {
1358
- this.log.error('Matter command: stepSaturation not implemented');
1359
932
  },
1360
933
  moveToHueAndSaturation: async (data) => {
1361
- this.log.debug('Matter command: moveToHueAndSaturation request:', data.request, 'attributes.currentHue:', data.attributes.currentHue.getLocal(), 'attributes.currentSaturation:', data.attributes.currentSaturation.getLocal());
1362
- this.commandHandler.executeHandler('moveToHueAndSaturation', data);
1363
934
  },
1364
935
  stopMoveStep: async () => {
1365
- this.log.error('Matter command: stopMoveStep not implemented');
1366
936
  },
1367
937
  moveToColorTemperature: async (data) => {
1368
- this.log.debug('Matter command: moveToColorTemperature request:', data.request, 'attributes.colorTemperatureMireds:', data.attributes.colorTemperatureMireds.getLocal());
1369
- this.commandHandler.executeHandler('moveToColorTemperature', data);
1370
938
  },
1371
939
  moveColorTemperature: async () => {
1372
- this.log.error('Matter command: moveColorTemperature not implemented');
1373
940
  },
1374
941
  stepColorTemperature: async () => {
1375
- this.log.error('Matter command: stepColorTemperature not implemented');
1376
942
  },
1377
943
  }, {});
1378
944
  }
1379
- /**
1380
- * Creates a default color control cluster server.
1381
- *
1382
- * @param currentX - The current X value.
1383
- * @param currentY - The current Y value.
1384
- * @param currentHue - The current hue value.
1385
- * @param currentSaturation - The current saturation value.
1386
- * @param colorTemperatureMireds - The color temperature in mireds.
1387
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1388
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1389
- */
1390
945
  createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1391
946
  this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
1392
947
  }
1393
- /**
1394
- * Get a Xy color control cluster server.
1395
- *
1396
- * @param currentX - The current X value.
1397
- * @param currentY - The current Y value.
1398
- */
1399
948
  getXyColorControlClusterServer(currentX = 0, currentY = 0) {
1400
949
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy), {
1401
950
  colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
@@ -1407,36 +956,21 @@ export class MatterbridgeEndpoint extends Endpoint {
1407
956
  numberOfPrimaries: null,
1408
957
  currentX,
1409
958
  currentY,
959
+ remainingTime: 0,
1410
960
  }, {
1411
961
  moveToColor: async () => {
1412
- // Never called in edge
1413
962
  },
1414
963
  moveColor: async () => {
1415
- // Never called in edge
1416
964
  },
1417
965
  stepColor: async () => {
1418
- // Never called in edge
1419
966
  },
1420
967
  stopMoveStep: async () => {
1421
- // Never called in edge
1422
968
  },
1423
969
  }, {});
1424
970
  }
1425
- /**
1426
- * Creates a Xy color control cluster server.
1427
- *
1428
- * @param currentX - The current X value.
1429
- * @param currentY - The current Y value.
1430
- */
1431
- createXyControlClusterServer(currentX = 0, currentY = 0) {
971
+ createXyColorControlClusterServer(currentX = 0, currentY = 0) {
1432
972
  this.addClusterServer(this.getXyColorControlClusterServer(currentX, currentY));
1433
973
  }
1434
- /**
1435
- * Get a default hue and saturation control cluster server.
1436
- *
1437
- * @param currentHue - The current hue value.
1438
- * @param currentSaturation - The current saturation value.
1439
- */
1440
974
  getHsColorControlClusterServer(currentHue = 0, currentSaturation = 0) {
1441
975
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation), {
1442
976
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -1448,49 +982,29 @@ export class MatterbridgeEndpoint extends Endpoint {
1448
982
  numberOfPrimaries: null,
1449
983
  currentHue,
1450
984
  currentSaturation,
985
+ remainingTime: 0,
1451
986
  }, {
1452
987
  moveToHue: async ({ request, attributes, endpoint }) => {
1453
- // Never called in edge
1454
988
  },
1455
989
  moveHue: async () => {
1456
- // Never called in edge
1457
990
  },
1458
991
  stepHue: async () => {
1459
- // Never called in edge
1460
992
  },
1461
993
  moveToSaturation: async ({ request, attributes, endpoint }) => {
1462
- // Never called in edge
1463
994
  },
1464
995
  moveSaturation: async () => {
1465
- // Never called in edge
1466
996
  },
1467
997
  stepSaturation: async () => {
1468
- // Never called in edge
1469
998
  },
1470
999
  moveToHueAndSaturation: async ({ request, attributes, endpoint }) => {
1471
- // Never called in edge
1472
1000
  },
1473
1001
  stopMoveStep: async () => {
1474
- // Never called in edge
1475
1002
  },
1476
1003
  }, {});
1477
1004
  }
1478
- /**
1479
- * Creates a hue and saturation color control cluster server.
1480
- *
1481
- * @param currentHue - The current hue value.
1482
- * @param currentSaturation - The current saturation value.
1483
- */
1484
1005
  createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0) {
1485
1006
  this.addClusterServer(this.getHsColorControlClusterServer(currentHue, currentSaturation));
1486
1007
  }
1487
- /**
1488
- * Get a color temperature color control cluster server.
1489
- *
1490
- * @param colorTemperatureMireds - The color temperature in mireds.
1491
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1492
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1493
- */
1494
1008
  getCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1495
1009
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.ColorTemperature), {
1496
1010
  colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
@@ -1503,44 +1017,24 @@ export class MatterbridgeEndpoint extends Endpoint {
1503
1017
  colorTemperatureMireds,
1504
1018
  colorTempPhysicalMinMireds,
1505
1019
  colorTempPhysicalMaxMireds,
1020
+ coupleColorTempToLevelMinMireds: colorTempPhysicalMinMireds,
1021
+ remainingTime: 0,
1022
+ startUpColorTemperatureMireds: null,
1506
1023
  }, {
1507
1024
  stopMoveStep: async () => {
1508
- // Never called in edge
1509
1025
  },
1510
1026
  moveToColorTemperature: async ({ request, attributes, endpoint }) => {
1511
- // Never called in edge
1512
1027
  },
1513
1028
  moveColorTemperature: async () => {
1514
- // Never called in edge
1515
1029
  },
1516
1030
  stepColorTemperature: async () => {
1517
- // Never called in edge
1518
1031
  },
1519
1032
  }, {});
1520
1033
  }
1521
- /**
1522
- * Creates a color temperature color control cluster server.
1523
- *
1524
- * @param colorTemperatureMireds - The color temperature in mireds.
1525
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1526
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1527
- */
1528
1034
  createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1529
1035
  this.addClusterServer(this.getCtColorControlClusterServer(colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
1530
1036
  }
1531
1037
  isColorControlConfigured = false;
1532
- /**
1533
- * Configures the color control cluster for a device.
1534
- *
1535
- * @remark This method must be called only after creating the cluster with getDefaultColorControlClusterServer or createDefaultColorControlClusterServer
1536
- * and before starting the matter node.
1537
- *
1538
- * @param {boolean} hueSaturation - A boolean indicating whether the device supports hue and saturation control.
1539
- * @param {boolean} xy - A boolean indicating whether the device supports XY control.
1540
- * @param {boolean} colorTemperature - A boolean indicating whether the device supports color temperature control.
1541
- * @param {ColorControl.ColorMode} colorMode - An optional parameter specifying the color mode of the device.
1542
- * @param {Endpoint} endpoint - An optional parameter specifying the endpoint to configure. If not provided, the device endpoint will be used.
1543
- */
1544
1038
  async configureColorControlCluster(hueSaturation, xy, colorTemperature, colorMode, endpoint) {
1545
1039
  if (!endpoint)
1546
1040
  endpoint = this;
@@ -1563,12 +1057,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1563
1057
  }
1564
1058
  this.isColorControlConfigured = true;
1565
1059
  }
1566
- /**
1567
- * Configures the color control mode for the device.
1568
- *
1569
- * @param {ColorControl.ColorMode} colorMode - The color mode to set.
1570
- * @param {Endpoint} endpoint - The optional endpoint to configure. If not provided, the method will configure the current endpoint.
1571
- */
1572
1060
  async configureColorControlMode(colorMode, endpoint) {
1573
1061
  if (!endpoint)
1574
1062
  endpoint = this;
@@ -1577,11 +1065,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1577
1065
  await endpoint.setAttribute(ColorControlCluster.id, 'enhancedColorMode', colorMode, this.log, endpoint);
1578
1066
  }
1579
1067
  }
1580
- /**
1581
- * Get a default window covering cluster server.
1582
- *
1583
- * @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1584
- */
1585
1068
  getDefaultWindowCoveringClusterServer(positionPercent100ths) {
1586
1069
  return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
1587
1070
  type: WindowCovering.WindowCoveringType.Rollershade,
@@ -1597,44 +1080,26 @@ export class MatterbridgeEndpoint extends Endpoint {
1597
1080
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
1598
1081
  endProductType: WindowCovering.EndProductType.RollerShade,
1599
1082
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
1600
- targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1601
- currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1083
+ targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
1084
+ currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
1602
1085
  }, {
1603
1086
  upOrOpen: async (data) => {
1604
- this.log.debug('Matter command: upOrOpen');
1605
- await this.commandHandler.executeHandler('upOrOpen', data);
1606
1087
  },
1607
1088
  downOrClose: async (data) => {
1608
- this.log.debug('Matter command: downOrClose');
1609
- await this.commandHandler.executeHandler('downOrClose', data);
1610
1089
  },
1611
1090
  stopMotion: async (data) => {
1612
- this.log.debug('Matter command: stopMotion');
1613
- await this.commandHandler.executeHandler('stopMotion', data);
1614
1091
  },
1615
1092
  goToLiftPercentage: async (data) => {
1616
- this.log.debug(`Matter command: goToLiftPercentage: ${data.request.liftPercent100thsValue} current: ${data.attributes.currentPositionLiftPercent100ths?.getLocal()} ` +
1617
- `target: ${data.attributes.targetPositionLiftPercent100ths?.getLocal()} status: ${data.attributes.operationalStatus.getLocal().lift}`);
1618
- await this.commandHandler.executeHandler('goToLiftPercentage', data);
1619
1093
  },
1620
1094
  }, {});
1621
1095
  }
1622
- /**
1623
- * Creates a default window covering cluster server.
1624
- *
1625
- * @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1626
- */
1627
1096
  createDefaultWindowCoveringClusterServer(positionPercent100ths) {
1628
1097
  this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
1629
1098
  }
1630
- /**
1631
- * Sets the window covering target position as the current position and stops the movement.
1632
- * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1633
- */
1634
1099
  async setWindowCoveringTargetAsCurrentAndStopped(endpoint) {
1635
1100
  if (!endpoint)
1636
1101
  endpoint = this;
1637
- const position = endpoint.getAttribute(WindowCoveringCluster.id, 'currentPositionLiftPercent100ths', this.log, endpoint); // windowCoveringCluster.getCurrentPositionLiftPercent100thsAttribute();
1102
+ const position = endpoint.getAttribute(WindowCoveringCluster.id, 'currentPositionLiftPercent100ths', this.log, endpoint);
1638
1103
  if (position !== null) {
1639
1104
  await endpoint.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', position, this.log, endpoint);
1640
1105
  await endpoint.setAttribute(WindowCoveringCluster.id, 'operationalStatus', {
@@ -1645,13 +1110,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1645
1110
  }
1646
1111
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
1647
1112
  }
1648
- /**
1649
- * Sets the current and target status of a window covering.
1650
- * @param {number} current - The current position of the window covering.
1651
- * @param {number} target - The target position of the window covering.
1652
- * @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
1653
- * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1654
- */
1655
1113
  async setWindowCoveringCurrentTargetStatus(current, target, status, endpoint) {
1656
1114
  if (!endpoint)
1657
1115
  endpoint = this;
@@ -1664,11 +1122,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1664
1122
  }, this.log, endpoint);
1665
1123
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
1666
1124
  }
1667
- /**
1668
- * Sets the status of the window covering.
1669
- * @param {WindowCovering.MovementStatus} status - The movement status to set.
1670
- * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1671
- */
1672
1125
  async setWindowCoveringStatus(status, endpoint) {
1673
1126
  if (!endpoint)
1674
1127
  endpoint = this;
@@ -1679,12 +1132,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1679
1132
  }, this.log, endpoint);
1680
1133
  this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
1681
1134
  }
1682
- /**
1683
- * Retrieves the status of the window covering.
1684
- * @param {Endpoint} endpoint - The endpoint on which to get the window covering (default the device endpoint).
1685
- *
1686
- * @returns The global operational status of the window covering.
1687
- */
1688
1135
  getWindowCoveringStatus(endpoint) {
1689
1136
  if (!endpoint)
1690
1137
  endpoint = this;
@@ -1692,12 +1139,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1692
1139
  this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
1693
1140
  return status.global;
1694
1141
  }
1695
- /**
1696
- * Sets the target and current position of the window covering.
1697
- *
1698
- * @param position - The position to set, specified as a number.
1699
- * @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
1700
- */
1701
1142
  async setWindowCoveringTargetAndCurrentPosition(position, endpoint) {
1702
1143
  if (!endpoint)
1703
1144
  endpoint = this;
@@ -1705,13 +1146,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1705
1146
  await endpoint.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', position, this.log, endpoint);
1706
1147
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
1707
1148
  }
1708
- /**
1709
- * Get a default door lock cluster server.
1710
- *
1711
- * @remarks
1712
- * This method adds a cluster server for a door lock cluster with default settings.
1713
- *
1714
- */
1715
1149
  getDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1716
1150
  return ClusterServer(DoorLockCluster, {
1717
1151
  operatingMode: DoorLock.OperatingMode.Normal,
@@ -1721,12 +1155,8 @@ export class MatterbridgeEndpoint extends Endpoint {
1721
1155
  supportedOperatingModes: { normal: true, vacation: false, privacy: false, noRemoteLockUnlock: false, passage: false },
1722
1156
  }, {
1723
1157
  lockDoor: async (data) => {
1724
- this.log.debug('Matter command: lockDoor', data.request);
1725
- await this.commandHandler.executeHandler('lockDoor', data);
1726
1158
  },
1727
1159
  unlockDoor: async (data) => {
1728
- this.log.debug('Matter command: unlockDoor', data.request);
1729
- await this.commandHandler.executeHandler('unlockDoor', data);
1730
1160
  },
1731
1161
  }, {
1732
1162
  doorLockAlarm: true,
@@ -1734,22 +1164,9 @@ export class MatterbridgeEndpoint extends Endpoint {
1734
1164
  lockOperationError: true,
1735
1165
  });
1736
1166
  }
1737
- /**
1738
- * Creates a default door lock cluster server.
1739
- *
1740
- * @remarks
1741
- * This method adds a cluster server for a door lock cluster with default settings.
1742
- *
1743
- */
1744
1167
  createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1745
1168
  this.addClusterServer(this.getDefaultDoorLockClusterServer(lockState, lockType));
1746
1169
  }
1747
- /**
1748
- * Get a default momentary switch cluster server.
1749
- *
1750
- * @remarks
1751
- * This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
1752
- */
1753
1170
  getDefaultSwitchClusterServer() {
1754
1171
  return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
1755
1172
  numberOfPositions: 2,
@@ -1764,21 +1181,9 @@ export class MatterbridgeEndpoint extends Endpoint {
1764
1181
  multiPressComplete: true,
1765
1182
  });
1766
1183
  }
1767
- /**
1768
- * Creates a default momentary switch cluster server.
1769
- *
1770
- * @remarks
1771
- * This method adds a cluster server with default momentary switch features and configurations.
1772
- */
1773
1184
  createDefaultSwitchClusterServer() {
1774
1185
  this.addClusterServer(this.getDefaultSwitchClusterServer());
1775
1186
  }
1776
- /**
1777
- * Get a default latching switch cluster server.
1778
- *
1779
- * @remarks
1780
- * This method adds a cluster server with default latching switch features and configuration.
1781
- */
1782
1187
  getDefaultLatchingSwitchClusterServer() {
1783
1188
  return ClusterServer(SwitchCluster.with(Switch.Feature.LatchingSwitch), {
1784
1189
  numberOfPositions: 2,
@@ -1787,22 +1192,9 @@ export class MatterbridgeEndpoint extends Endpoint {
1787
1192
  switchLatched: true,
1788
1193
  });
1789
1194
  }
1790
- /**
1791
- * Creates a default latching switch cluster server.
1792
- *
1793
- * @remarks
1794
- * This method adds a cluster server with default latching switch features and configuration.
1795
- */
1796
1195
  createDefaultLatchingSwitchClusterServer() {
1797
1196
  this.addClusterServer(this.getDefaultLatchingSwitchClusterServer());
1798
1197
  }
1799
- /**
1800
- * Triggers a switch event on the specified endpoint.
1801
- *
1802
- * @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
1803
- * @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
1804
- * @returns {void}
1805
- */
1806
1198
  async triggerSwitchEvent(event, log, endpoint) {
1807
1199
  if (!endpoint)
1808
1200
  endpoint = this;
@@ -1870,15 +1262,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1870
1262
  }
1871
1263
  return true;
1872
1264
  }
1873
- /**
1874
- * Retrieves the default mode select cluster server.
1875
- *
1876
- * @param description - The description of the cluster server.
1877
- * @param supportedModes - The supported modes for the cluster server.
1878
- * @param currentMode - The current mode of the cluster server. Defaults to 0.
1879
- * @param startUpMode - The startup mode of the cluster server. Defaults to 0.
1880
- * @returns The default mode select cluster server.
1881
- */
1882
1265
  getDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
1883
1266
  return ClusterServer(ModeSelectCluster, {
1884
1267
  description: description,
@@ -1888,31 +1271,14 @@ export class MatterbridgeEndpoint extends Endpoint {
1888
1271
  startUpMode: startUpMode,
1889
1272
  }, {
1890
1273
  changeToMode: async (data) => {
1891
- this.log.debug('Matter command: ModeSelectCluster.changeToMode', data.request);
1892
- await this.commandHandler.executeHandler('changeToMode', data);
1893
1274
  },
1894
1275
  });
1895
1276
  }
1896
- /**
1897
- * Creates a default mode select cluster server.
1898
- *
1899
- * @param description - The description of the cluster server.
1900
- * @param supportedModes - The supported modes for the cluster server.
1901
- * @param currentMode - The current mode of the cluster server. Defaults to 0.
1902
- * @param startUpMode - The startup mode of the cluster server. Defaults to 0.
1903
- * @param endpoint - The endpoint to add the cluster server to. Defaults to `this` if not provided.
1904
- *
1905
- */
1906
1277
  createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
1907
1278
  if (!endpoint)
1908
1279
  endpoint = this;
1909
1280
  endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
1910
1281
  }
1911
- /**
1912
- * Get a default occupancy sensing cluster server.
1913
- *
1914
- * @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
1915
- */
1916
1282
  getDefaultOccupancySensingClusterServer(occupied = false) {
1917
1283
  return ClusterServer(OccupancySensingCluster, {
1918
1284
  occupancy: { occupied },
@@ -1921,19 +1287,9 @@ export class MatterbridgeEndpoint extends Endpoint {
1921
1287
  pirOccupiedToUnoccupiedDelay: 30,
1922
1288
  }, {});
1923
1289
  }
1924
- /**
1925
- * Creates a default occupancy sensing cluster server.
1926
- *
1927
- * @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
1928
- */
1929
1290
  createDefaultOccupancySensingClusterServer(occupied = false) {
1930
1291
  this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
1931
1292
  }
1932
- /**
1933
- * Get a default Illuminance Measurement Cluster Server.
1934
- *
1935
- * @param measuredValue - The measured value of illuminance.
1936
- */
1937
1293
  getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
1938
1294
  return ClusterServer(IlluminanceMeasurementCluster, {
1939
1295
  measuredValue,
@@ -1942,19 +1298,9 @@ export class MatterbridgeEndpoint extends Endpoint {
1942
1298
  tolerance: 0,
1943
1299
  }, {}, {});
1944
1300
  }
1945
- /**
1946
- * Creates a default Illuminance Measurement Cluster Server.
1947
- *
1948
- * @param measuredValue - The measured value of illuminance.
1949
- */
1950
1301
  createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
1951
1302
  this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
1952
1303
  }
1953
- /**
1954
- * Get a default flow measurement cluster server.
1955
- *
1956
- * @param measuredValue - The measured value of the flow in 10 x m/h.
1957
- */
1958
1304
  getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
1959
1305
  return ClusterServer(FlowMeasurementCluster, {
1960
1306
  measuredValue,
@@ -1963,19 +1309,9 @@ export class MatterbridgeEndpoint extends Endpoint {
1963
1309
  tolerance: 0,
1964
1310
  }, {}, {});
1965
1311
  }
1966
- /**
1967
- * Creates a default flow measurement cluster server.
1968
- *
1969
- * @param measuredValue - The measured value of the flow in 10 x m/h.
1970
- */
1971
1312
  createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
1972
1313
  this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
1973
1314
  }
1974
- /**
1975
- * Get a default temperature measurement cluster server.
1976
- *
1977
- * @param measuredValue - The measured value of the temperature x 100.
1978
- */
1979
1315
  getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
1980
1316
  return ClusterServer(TemperatureMeasurementCluster, {
1981
1317
  measuredValue,
@@ -1984,19 +1320,9 @@ export class MatterbridgeEndpoint extends Endpoint {
1984
1320
  tolerance: 0,
1985
1321
  }, {}, {});
1986
1322
  }
1987
- /**
1988
- * Creates a default temperature measurement cluster server.
1989
- *
1990
- * @param measuredValue - The measured value of the temperature x 100.
1991
- */
1992
1323
  createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
1993
1324
  this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
1994
1325
  }
1995
- /**
1996
- * Get a default RelativeHumidityMeasurementCluster server.
1997
- *
1998
- * @param measuredValue - The measured value of the relative humidity x 100.
1999
- */
2000
1326
  getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
2001
1327
  return ClusterServer(RelativeHumidityMeasurementCluster, {
2002
1328
  measuredValue,
@@ -2005,19 +1331,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2005
1331
  tolerance: 0,
2006
1332
  }, {}, {});
2007
1333
  }
2008
- /**
2009
- * Creates a default RelativeHumidityMeasurementCluster server.
2010
- *
2011
- * @param measuredValue - The measured value of the relative humidity x 100.
2012
- */
2013
1334
  createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
2014
1335
  this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
2015
1336
  }
2016
- /**
2017
- * Get a default Pressure Measurement Cluster Server.
2018
- *
2019
- * @param measuredValue - The measured value for the pressure.
2020
- */
2021
1337
  getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
2022
1338
  return ClusterServer(PressureMeasurementCluster, {
2023
1339
  measuredValue,
@@ -2026,39 +1342,19 @@ export class MatterbridgeEndpoint extends Endpoint {
2026
1342
  tolerance: 0,
2027
1343
  }, {}, {});
2028
1344
  }
2029
- /**
2030
- * Creates a default Pressure Measurement Cluster Server.
2031
- *
2032
- * @param measuredValue - The measured value for the pressure.
2033
- */
2034
1345
  createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
2035
1346
  this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
2036
1347
  }
2037
- /**
2038
- * Get a default boolean state cluster server.
2039
- *
2040
- * @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
2041
- */
2042
1348
  getDefaultBooleanStateClusterServer(contact) {
2043
1349
  return ClusterServer(BooleanStateCluster, {
2044
- stateValue: contact ?? true, // true=contact false=no_contact
1350
+ stateValue: contact ?? true,
2045
1351
  }, {}, {
2046
1352
  stateChange: true,
2047
1353
  });
2048
1354
  }
2049
- /**
2050
- * Creates a default boolean state configuration cluster server.
2051
- *
2052
- * @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
2053
- */
2054
1355
  createDefaultBooleanStateClusterServer(contact) {
2055
1356
  this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
2056
1357
  }
2057
- /**
2058
- * Get a default boolean state configuration cluster server.
2059
- *
2060
- * @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
2061
- */
2062
1358
  getDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
2063
1359
  return ClusterServer(BooleanStateConfigurationCluster.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel), {
2064
1360
  currentSensitivityLevel: 0,
@@ -2067,35 +1363,18 @@ export class MatterbridgeEndpoint extends Endpoint {
2067
1363
  alarmsActive: { visual: false, audible: false },
2068
1364
  alarmsEnabled: { visual: false, audible: false },
2069
1365
  alarmsSupported: { visual: true, audible: true },
2070
- // alarmsSuppressed: { visual: false, audible: false },
2071
1366
  sensorFault: { generalFault: sensorFault },
2072
1367
  }, {
2073
1368
  enableDisableAlarm: async (data) => {
2074
- this.log.debug('Matter command: enableDisableAlarm', data.request);
2075
- await this.commandHandler.executeHandler('enableDisableAlarm', data);
2076
1369
  },
2077
1370
  }, {
2078
1371
  alarmsStateChanged: true,
2079
1372
  sensorFault: true,
2080
1373
  });
2081
1374
  }
2082
- /**
2083
- * Creates a default boolean state configuration cluster server.
2084
- *
2085
- * @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
2086
- */
2087
1375
  createDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
2088
1376
  this.addClusterServer(this.getDefaultBooleanStateConfigurationClusterServer(sensorFault));
2089
1377
  }
2090
- /**
2091
- * Get a default power source replaceable battery cluster server.
2092
- *
2093
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
2094
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
2095
- * @param batVoltage - The battery voltage (default: 1500).
2096
- * @param batReplacementDescription - The battery replacement description (default: 'Battery type').
2097
- * @param batQuantity - The battery quantity (default: 1).
2098
- */
2099
1378
  getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
2100
1379
  return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
2101
1380
  status: PowerSource.PowerSourceStatus.Active,
@@ -2112,25 +1391,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2112
1391
  endpointList: [],
2113
1392
  }, {}, {});
2114
1393
  }
2115
- /**
2116
- * Creates a default power source replaceable battery cluster server.
2117
- *
2118
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
2119
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
2120
- * @param batVoltage - The battery voltage (default: 1500).
2121
- * @param batReplacementDescription - The battery replacement description (default: 'Battery type').
2122
- * @param batQuantity - The battery quantity (default: 1).
2123
- */
2124
1394
  createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
2125
1395
  this.addClusterServer(this.getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity));
2126
1396
  }
2127
- /**
2128
- * Get a default power source rechargeable battery cluster server.
2129
- *
2130
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
2131
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
2132
- * @param batVoltage - The battery voltage (default: 1500).
2133
- */
2134
1397
  getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
2135
1398
  return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
2136
1399
  status: PowerSource.PowerSourceStatus.Active,
@@ -2148,21 +1411,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2148
1411
  endpointList: [],
2149
1412
  }, {}, {});
2150
1413
  }
2151
- /**
2152
- * Creates a default power source rechargeable battery cluster server.
2153
- *
2154
- * @param batPercentRemaining - The remaining battery percentage (default: 100).
2155
- * @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
2156
- * @param batVoltage - The battery voltage (default: 1500).
2157
- */
2158
1414
  createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
2159
1415
  this.addClusterServer(this.getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage));
2160
1416
  }
2161
- /**
2162
- * Get a default power source wired cluster server.
2163
- *
2164
- * @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
2165
- */
2166
1417
  getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
2167
1418
  return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Wired), {
2168
1419
  wiredCurrentType,
@@ -2172,45 +1423,22 @@ export class MatterbridgeEndpoint extends Endpoint {
2172
1423
  endpointList: [],
2173
1424
  }, {}, {});
2174
1425
  }
2175
- /**
2176
- * Creates a default power source wired cluster server.
2177
- *
2178
- * @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
2179
- */
2180
1426
  createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
2181
1427
  this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
2182
1428
  }
2183
- /**
2184
- * @deprecated This function is deprecated by Matter 1.3 spec and will be removed in a future version.
2185
- */
2186
1429
  createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
2187
1430
  this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
2188
1431
  sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
2189
1432
  }, {}, {}));
2190
1433
  }
2191
- /**
2192
- * Get a default air quality cluster server.
2193
- *
2194
- * @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
2195
- */
2196
1434
  getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
2197
1435
  return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
2198
1436
  airQuality,
2199
1437
  }, {}, {});
2200
1438
  }
2201
- /**
2202
- * Creates a default air quality cluster server.
2203
- *
2204
- * @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
2205
- */
2206
1439
  createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
2207
1440
  this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
2208
1441
  }
2209
- /**
2210
- * Get a default TVOC measurement cluster server.
2211
- *
2212
- * @param measuredValue - The measured value for TVOC.
2213
- */
2214
1442
  getDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2215
1443
  return ClusterServer(TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.with('NumericMeasurement'), {
2216
1444
  measuredValue,
@@ -2221,28 +1449,14 @@ export class MatterbridgeEndpoint extends Endpoint {
2221
1449
  measurementMedium,
2222
1450
  }, {}, {});
2223
1451
  }
2224
- /**
2225
- * Creates a default TVOC measurement cluster server.
2226
- *
2227
- * @param measuredValue - The measured value for TVOC.
2228
- */
2229
1452
  createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2230
1453
  this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2231
1454
  }
2232
- /**
2233
- * Get a default heating thermostat cluster server with the specified parameters.
2234
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
2235
- * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
2236
- * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
2237
- * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
2238
- * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
2239
- */
2240
1455
  getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
2241
1456
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
2242
1457
  localTemperature: localTemperature * 100,
2243
1458
  systemMode: Thermostat.SystemMode.Heat,
2244
1459
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
2245
- // Thermostat.Feature.Heating
2246
1460
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
2247
1461
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
2248
1462
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
@@ -2250,36 +1464,17 @@ export class MatterbridgeEndpoint extends Endpoint {
2250
1464
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
2251
1465
  }, {
2252
1466
  setpointRaiseLower: async (data) => {
2253
- this.log.debug('Matter command: setpointRaiseLower', data.request);
2254
- await this.commandHandler.executeHandler('setpointRaiseLower', data);
2255
1467
  },
2256
1468
  }, {});
2257
1469
  }
2258
- /**
2259
- * Creates and adds a default heating thermostat cluster server to the device.
2260
- *
2261
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
2262
- * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
2263
- * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
2264
- * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
2265
- */
2266
1470
  createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
2267
1471
  this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
2268
1472
  }
2269
- /**
2270
- * Get a default cooling thermostat cluster server with the specified parameters.
2271
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
2272
- * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
2273
- * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
2274
- * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
2275
- * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
2276
- */
2277
1473
  getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
2278
1474
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
2279
1475
  localTemperature: localTemperature * 100,
2280
1476
  systemMode: Thermostat.SystemMode.Cool,
2281
1477
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
2282
- // Thermostat.Feature.Cooling
2283
1478
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
2284
1479
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
2285
1480
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
@@ -2287,84 +1482,37 @@ export class MatterbridgeEndpoint extends Endpoint {
2287
1482
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
2288
1483
  }, {
2289
1484
  setpointRaiseLower: async (data) => {
2290
- this.log.debug('Matter command: setpointRaiseLower', data.request);
2291
- await this.commandHandler.executeHandler('setpointRaiseLower', data);
2292
1485
  },
2293
1486
  }, {});
2294
1487
  }
2295
- /**
2296
- * Creates and adds a default cooling thermostat cluster server to the device.
2297
- *
2298
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
2299
- * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
2300
- * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
2301
- * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
2302
- */
2303
1488
  createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
2304
1489
  this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
2305
1490
  }
2306
- /**
2307
- * Get a default thermostat cluster server with the specified parameters.
2308
- *
2309
- * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
2310
- * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
2311
- * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
2312
- * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
2313
- * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
2314
- * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
2315
- * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
2316
- * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
2317
- * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
2318
- */
2319
1491
  getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
2320
1492
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
2321
1493
  localTemperature: localTemperature * 100,
2322
1494
  systemMode: Thermostat.SystemMode.Auto,
2323
1495
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
2324
- // Thermostat.Feature.Heating
2325
1496
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
2326
1497
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
2327
1498
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
2328
1499
  absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
2329
1500
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
2330
- // Thermostat.Feature.Cooling
2331
1501
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
2332
1502
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
2333
1503
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
2334
1504
  absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
2335
1505
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
2336
- // Thermostat.Feature.AutoMode
2337
1506
  minSetpointDeadBand: minSetpointDeadBand * 100,
2338
1507
  thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
2339
1508
  }, {
2340
1509
  setpointRaiseLower: async (data) => {
2341
- this.log.debug('Matter command: setpointRaiseLower', data.request);
2342
- await this.commandHandler.executeHandler('setpointRaiseLower', data);
2343
1510
  },
2344
1511
  }, {});
2345
1512
  }
2346
- /**
2347
- * Creates and adds a default thermostat cluster server to the device.
2348
- *
2349
- * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
2350
- * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
2351
- * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
2352
- * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
2353
- * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
2354
- * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
2355
- * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
2356
- * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
2357
- */
2358
1513
  createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
2359
1514
  this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
2360
1515
  }
2361
- /**
2362
- * Returns the default SmokeCOAlarm Cluster Server.
2363
- *
2364
- * @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2365
- * @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2366
- * @returns The default SmokeCOAlarmClusterServer.
2367
- */
2368
1516
  getDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
2369
1517
  return ClusterServer(SmokeCoAlarmCluster.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm), {
2370
1518
  smokeState,
@@ -2379,8 +1527,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2379
1527
  interconnectCoAlarm: SmokeCoAlarm.AlarmState.Normal,
2380
1528
  }, {
2381
1529
  selfTestRequest: async (data) => {
2382
- this.log.debug('Matter command: selfTestRequest');
2383
- await this.commandHandler.executeHandler('selfTestRequest', data);
2384
1530
  },
2385
1531
  }, {
2386
1532
  smokeAlarm: true,
@@ -2396,24 +1542,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2396
1542
  allClear: true,
2397
1543
  });
2398
1544
  }
2399
- /**
2400
- * Create the default SmokeCOAlarm Cluster Server.
2401
- *
2402
- * @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2403
- * @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
2404
- * @returns The default SmokeCOAlarmClusterServer.
2405
- */
2406
1545
  createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
2407
1546
  this.addClusterServer(this.getDefaultSmokeCOAlarmClusterServer(smokeState, coState));
2408
1547
  }
2409
- /**
2410
- * Returns the default Carbon Monoxide Concentration Measurement Cluster Server.
2411
- *
2412
- * @param {number} measuredValue - The measured value of the concentration.
2413
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2414
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2415
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2416
- */
2417
1548
  getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2418
1549
  return ClusterServer(CarbonMonoxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
2419
1550
  measuredValue,
@@ -2424,24 +1555,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2424
1555
  measurementMedium,
2425
1556
  }, {}, {});
2426
1557
  }
2427
- /**
2428
- * Create the default Carbon Monoxide Concentration Measurement Cluster Server.
2429
- *
2430
- * @param {number} measuredValue - The measured value of the concentration.
2431
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2432
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2433
- */
2434
1558
  createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2435
1559
  this.addClusterServer(this.getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2436
1560
  }
2437
- /**
2438
- * Returns the default Carbon Dioxide Concentration Measurement Cluster Server.
2439
- *
2440
- * @param {number} measuredValue - The measured value of the concentration.
2441
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2442
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2443
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2444
- */
2445
1561
  getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2446
1562
  return ClusterServer(CarbonDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
2447
1563
  measuredValue,
@@ -2452,24 +1568,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2452
1568
  measurementMedium,
2453
1569
  }, {}, {});
2454
1570
  }
2455
- /**
2456
- * Create the default Carbon Dioxide Concentration Measurement Cluster Server.
2457
- *
2458
- * @param {number} measuredValue - The measured value of the concentration.
2459
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2460
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2461
- */
2462
1571
  createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2463
1572
  this.addClusterServer(this.getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2464
1573
  }
2465
- /**
2466
- * Returns the default Formaldehyde Concentration Measurement Cluster Server.
2467
- *
2468
- * @param {number} measuredValue - The measured value of the concentration.
2469
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2470
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2471
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2472
- */
2473
1574
  getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2474
1575
  return ClusterServer(FormaldehydeConcentrationMeasurementCluster.with('NumericMeasurement'), {
2475
1576
  measuredValue,
@@ -2480,24 +1581,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2480
1581
  measurementMedium,
2481
1582
  }, {}, {});
2482
1583
  }
2483
- /**
2484
- * Create the default Formaldehyde Concentration Measurement Cluster Server.
2485
- *
2486
- * @param {number} measuredValue - The measured value of the concentration.
2487
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2488
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2489
- */
2490
1584
  createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2491
1585
  this.addClusterServer(this.getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2492
1586
  }
2493
- /**
2494
- * Returns the default Pm1 Concentration Measurement Cluster Server.
2495
- *
2496
- * @param {number} measuredValue - The measured value of the concentration.
2497
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2498
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2499
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2500
- */
2501
1587
  getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2502
1588
  return ClusterServer(Pm1ConcentrationMeasurementCluster.with('NumericMeasurement'), {
2503
1589
  measuredValue,
@@ -2508,24 +1594,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2508
1594
  measurementMedium,
2509
1595
  }, {}, {});
2510
1596
  }
2511
- /**
2512
- * Create the default Pm1 Concentration Measurement Cluster Server.
2513
- *
2514
- * @param {number} measuredValue - The measured value of the concentration.
2515
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2516
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2517
- */
2518
- createDefaulPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1597
+ createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2519
1598
  this.addClusterServer(this.getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2520
1599
  }
2521
- /**
2522
- * Returns the default Pm25 Concentration Measurement Cluster Server.
2523
- *
2524
- * @param {number} measuredValue - The measured value of the concentration.
2525
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2526
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2527
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2528
- */
2529
1600
  getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2530
1601
  return ClusterServer(Pm25ConcentrationMeasurementCluster.with('NumericMeasurement'), {
2531
1602
  measuredValue,
@@ -2536,24 +1607,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2536
1607
  measurementMedium,
2537
1608
  }, {}, {});
2538
1609
  }
2539
- /**
2540
- * Create the default Pm25 Concentration Measurement Cluster Server.
2541
- *
2542
- * @param {number} measuredValue - The measured value of the concentration.
2543
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2544
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2545
- */
2546
- createDefaulPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1610
+ createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2547
1611
  this.addClusterServer(this.getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2548
1612
  }
2549
- /**
2550
- * Returns the default Pm10 Concentration Measurement Cluster Server.
2551
- *
2552
- * @param {number} measuredValue - The measured value of the concentration.
2553
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2554
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2555
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2556
- */
2557
1613
  getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2558
1614
  return ClusterServer(Pm10ConcentrationMeasurementCluster.with('NumericMeasurement'), {
2559
1615
  measuredValue,
@@ -2564,24 +1620,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2564
1620
  measurementMedium,
2565
1621
  }, {}, {});
2566
1622
  }
2567
- /**
2568
- * Create the default Pm10 Concentration Measurement Cluster Server.
2569
- *
2570
- * @param {number} measuredValue - The measured value of the concentration.
2571
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2572
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2573
- */
2574
- createDefaulPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1623
+ createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2575
1624
  this.addClusterServer(this.getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2576
1625
  }
2577
- /**
2578
- * Returns the default Ozone Concentration Measurement Cluster Server.
2579
- *
2580
- * @param {number} measuredValue - The measured value of the concentration.
2581
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2582
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2583
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2584
- */
2585
1626
  getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2586
1627
  return ClusterServer(OzoneConcentrationMeasurementCluster.with('NumericMeasurement'), {
2587
1628
  measuredValue,
@@ -2592,24 +1633,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2592
1633
  measurementMedium,
2593
1634
  }, {}, {});
2594
1635
  }
2595
- /**
2596
- * Create the default Ozone Concentration Measurement Cluster Server.
2597
- *
2598
- * @param {number} measuredValue - The measured value of the concentration.
2599
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2600
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2601
- */
2602
- createDefaulOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1636
+ createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2603
1637
  this.addClusterServer(this.getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2604
1638
  }
2605
- /**
2606
- * Returns the default Radon Concentration Measurement Cluster Server.
2607
- *
2608
- * @param {number} measuredValue - The measured value of the concentration.
2609
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2610
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2611
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2612
- */
2613
1639
  getDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2614
1640
  return ClusterServer(RadonConcentrationMeasurementCluster.with('NumericMeasurement'), {
2615
1641
  measuredValue,
@@ -2620,24 +1646,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2620
1646
  measurementMedium,
2621
1647
  }, {}, {});
2622
1648
  }
2623
- /**
2624
- * Create the default Radon Concentration Measurement Cluster Server.
2625
- *
2626
- * @param {number} measuredValue - The measured value of the concentration.
2627
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2628
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2629
- */
2630
- createDefaulRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1649
+ createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2631
1650
  this.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2632
1651
  }
2633
- /**
2634
- * Returns the default Nitrogen Dioxide Concentration Measurement Cluster Server.
2635
- *
2636
- * @param {number} measuredValue - The measured value of the concentration.
2637
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2638
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2639
- * @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
2640
- */
2641
1652
  getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2642
1653
  return ClusterServer(NitrogenDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
2643
1654
  measuredValue,
@@ -2648,22 +1659,9 @@ export class MatterbridgeEndpoint extends Endpoint {
2648
1659
  measurementMedium,
2649
1660
  }, {}, {});
2650
1661
  }
2651
- /**
2652
- * Create the default Nitrogen Dioxide Concentration Measurement Cluster Server.
2653
- *
2654
- * @param {number} measuredValue - The measured value of the concentration.
2655
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
2656
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
2657
- */
2658
- createDefaulNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
1662
+ createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2659
1663
  this.addClusterServer(this.getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
2660
1664
  }
2661
- /**
2662
- * Returns the default fan control cluster server rev 2.
2663
- *
2664
- * @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
2665
- * @returns The default fan control cluster server.
2666
- */
2667
1665
  getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
2668
1666
  return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
2669
1667
  fanMode,
@@ -2675,19 +1673,10 @@ export class MatterbridgeEndpoint extends Endpoint {
2675
1673
  speedCurrent: 0,
2676
1674
  }, {
2677
1675
  step: async (data) => {
2678
- this.log.debug('Matter command: step', data.request);
2679
- await this.commandHandler.executeHandler('step', data);
2680
1676
  },
2681
1677
  }, {});
2682
1678
  }
2683
- /**
2684
- * Create the default fan control cluster server rev 2.
2685
- *
2686
- * @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
2687
- * @returns The default fan control cluster server.
2688
- */
2689
1679
  createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
2690
1680
  this.addClusterServer(this.getDefaultFanControlClusterServer(fanMode));
2691
1681
  }
2692
1682
  }
2693
- //# sourceMappingURL=matterbridgeEndpoint.js.map