matterbridge 1.5.9 → 1.6.0

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 (51) hide show
  1. package/CHANGELOG.md +36 -3
  2. package/README-DEV.md +10 -6
  3. package/README-PODMAN.md +2 -0
  4. package/README-SERVICE.md +44 -6
  5. package/README.md +53 -7
  6. package/dist/cluster/export.js +1 -1
  7. package/dist/cluster/export.js.map +1 -1
  8. package/dist/defaultConfigSchema.d.ts.map +1 -1
  9. package/dist/defaultConfigSchema.js +9 -1
  10. package/dist/defaultConfigSchema.js.map +1 -1
  11. package/dist/matterbridge.d.ts +72 -48
  12. package/dist/matterbridge.d.ts.map +1 -1
  13. package/dist/matterbridge.js +174 -173
  14. package/dist/matterbridge.js.map +1 -1
  15. package/dist/matterbridgeDevice.d.ts +140 -1042
  16. package/dist/matterbridgeDevice.d.ts.map +1 -1
  17. package/dist/matterbridgeDevice.js +57 -363
  18. package/dist/matterbridgeDevice.js.map +1 -1
  19. package/dist/matterbridgeEdge.d.ts +90 -0
  20. package/dist/matterbridgeEdge.d.ts.map +1 -0
  21. package/dist/matterbridgeEdge.js +555 -0
  22. package/dist/matterbridgeEdge.js.map +1 -0
  23. package/dist/matterbridgeEndpoint.d.ts +5195 -0
  24. package/dist/matterbridgeEndpoint.d.ts.map +1 -0
  25. package/dist/matterbridgeEndpoint.js +2196 -0
  26. package/dist/matterbridgeEndpoint.js.map +1 -0
  27. package/dist/matterbridgeTypes.d.ts +6 -5
  28. package/dist/matterbridgeTypes.d.ts.map +1 -1
  29. package/dist/matterbridgeTypes.js +1 -1
  30. package/dist/matterbridgeTypes.js.map +1 -1
  31. package/dist/matterbridgeWebsocket.d.ts +49 -0
  32. package/dist/matterbridgeWebsocket.d.ts.map +1 -0
  33. package/dist/matterbridgeWebsocket.js +145 -0
  34. package/dist/matterbridgeWebsocket.js.map +1 -0
  35. package/dist/pluginManager.d.ts +134 -1
  36. package/dist/pluginManager.d.ts.map +1 -1
  37. package/dist/pluginManager.js +167 -14
  38. package/dist/pluginManager.js.map +1 -1
  39. package/frontend/build/asset-manifest.json +3 -3
  40. package/frontend/build/index.html +1 -1
  41. package/frontend/build/static/js/{main.96d6324b.js → main.045d08f7.js} +3 -3
  42. package/frontend/build/static/js/main.045d08f7.js.map +1 -0
  43. package/npm-shrinkwrap.json +838 -6222
  44. package/package.json +3 -78
  45. package/CODEOWNERS +0 -1
  46. package/dist/history/export.d.ts +0 -2
  47. package/dist/history/export.d.ts.map +0 -1
  48. package/dist/history/export.js +0 -2
  49. package/dist/history/export.js.map +0 -1
  50. package/frontend/build/static/js/main.96d6324b.js.map +0 -1
  51. /package/frontend/build/static/js/{main.96d6324b.js.LICENSE.txt → main.045d08f7.js.LICENSE.txt} +0 -0
@@ -20,12 +20,11 @@
20
20
  * See the License for the specific language governing permissions and
21
21
  * limitations under the License. *
22
22
  */
23
- import { AirQuality, AirQualityCluster, BasicInformationCluster, BooleanState, BooleanStateCluster, BooleanStateConfiguration, BooleanStateConfigurationCluster, BridgedDeviceBasicInformation, BridgedDeviceBasicInformationCluster, CarbonDioxideConcentrationMeasurement, CarbonDioxideConcentrationMeasurementCluster, CarbonMonoxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurementCluster, ClusterServer, ColorControl, ColorControlCluster, ConcentrationMeasurement, DeviceEnergyManagement, DeviceEnergyManagementCluster, DeviceEnergyManagementMode, DeviceEnergyManagementModeCluster, DoorLock, DoorLockCluster, ElectricalEnergyMeasurement, ElectricalEnergyMeasurementCluster, ElectricalPowerMeasurement, ElectricalPowerMeasurementCluster, FanControl, FanControlCluster, FixedLabelCluster, FlowMeasurement, FlowMeasurementCluster, FormaldehydeConcentrationMeasurement, FormaldehydeConcentrationMeasurementCluster, Groups, GroupsCluster, GroupsClusterHandler, Identify, IdentifyCluster, IlluminanceMeasurement, IlluminanceMeasurementCluster, LevelControl, LevelControlCluster, MeasurementType, 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, ThreadNetworkDiagnostics, ThreadNetworkDiagnosticsCluster, TimeSynchronization, TimeSynchronizationCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster, WindowCovering, WindowCoveringCluster, getClusterNameById, } from '@project-chip/matter-node.js/cluster';
23
+ import { ActionsCluster, AirQuality, AirQualityCluster, BasicInformationCluster, BooleanState, BooleanStateCluster, BooleanStateConfiguration, BooleanStateConfigurationCluster, BridgedDeviceBasicInformation, BridgedDeviceBasicInformationCluster, CarbonDioxideConcentrationMeasurement, CarbonDioxideConcentrationMeasurementCluster, CarbonMonoxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurementCluster, ClusterServer, ColorControl, ColorControlCluster, ConcentrationMeasurement, DeviceEnergyManagement, DeviceEnergyManagementCluster, DeviceEnergyManagementMode, DeviceEnergyManagementModeCluster, DoorLock, DoorLockCluster, ElectricalEnergyMeasurement, ElectricalEnergyMeasurementCluster, ElectricalPowerMeasurement, ElectricalPowerMeasurementCluster, FanControl, FanControlCluster, FixedLabelCluster, FlowMeasurement, FlowMeasurementCluster, FormaldehydeConcentrationMeasurement, FormaldehydeConcentrationMeasurementCluster, Groups, GroupsCluster, GroupsClusterHandler, Identify, IdentifyCluster, IlluminanceMeasurement, IlluminanceMeasurementCluster, LevelControl, LevelControlCluster, MeasurementType, 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, ThreadNetworkDiagnostics, ThreadNetworkDiagnosticsCluster, TimeSynchronization, TimeSynchronizationCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster, WindowCovering, WindowCoveringCluster, getClusterNameById, } from '@project-chip/matter-node.js/cluster';
24
24
  import { Specification } from '@project-chip/matter-node.js/model';
25
25
  import { EndpointNumber, VendorId } from '@project-chip/matter-node.js/datatype';
26
26
  import { Device, DeviceClasses, DeviceTypeDefinition, Endpoint } from '@project-chip/matter-node.js/device';
27
27
  import { extendPublicHandlerMethods } from '@project-chip/matter-node.js/util';
28
- import { EveHistory, MatterHistory } from 'matter-history';
29
28
  import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from 'node-ansi-logger';
30
29
  import { createHash } from 'crypto';
31
30
  // Matter 1.2 and 1.3 device types
@@ -98,6 +97,13 @@ export const deviceEnergyManagement = DeviceTypeDefinition({
98
97
  requiredServerClusters: [DeviceEnergyManagement.Cluster.id, DeviceEnergyManagementMode.Cluster.id],
99
98
  optionalServerClusters: [],
100
99
  });
100
+ export const bridge = DeviceTypeDefinition({
101
+ name: 'MA-aggregator',
102
+ code: 0x000e,
103
+ deviceClass: DeviceClasses.Dynamic,
104
+ revision: 1,
105
+ optionalServerClusters: [ActionsCluster.id],
106
+ });
101
107
  export const powerSource = DeviceTypeDefinition({
102
108
  name: 'MA-powerSource',
103
109
  code: 0x0011,
@@ -230,73 +236,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
230
236
  static async loadInstance(definition, options = {}, debug = false) {
231
237
  return new MatterbridgeDevice(definition, options, debug);
232
238
  }
233
- /**
234
- * Create asyncronously a device with one or more device types and with the required cluster servers and the specified cluster servers.
235
- *
236
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
237
- * @param {EndpointOptions} [options={}] - The options for the device.
238
- * @param {ClusterId[]} clusterServerList - The list of cluster IDs to include.
239
- * @param {boolean} [debug=false] - The debug level for the device.
240
- * @returns {Promise<MatterbridgeDevice>} The MatterbridgeDevice instance.
241
- *
242
- static async createWithClusterServer(definition: DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>, options: EndpointOptions = {}, clusterServerList: ClusterId[] = [], debug = false): Promise<MatterbridgeDevice> {
243
- const device = new MatterbridgeDevice(definition, options, debug);
244
- if (Array.isArray(definition)) {
245
- definition.forEach((deviceType) => {
246
- deviceType.requiredServerClusters.forEach((clusterId) => {
247
- if (!clusterServerList.includes(clusterId)) clusterServerList.push(clusterId);
248
- });
249
- });
250
- } else {
251
- definition.requiredServerClusters.forEach((clusterId) => {
252
- if (!clusterServerList.includes(clusterId)) clusterServerList.push(clusterId);
253
- });
254
- }
255
- device.log.debug(`createWithClusterServer:`);
256
- const deviceTypes = device.getDeviceTypes();
257
- deviceTypes.forEach((deviceType) => {
258
- device.log.debug(`- with deviceType: ${zb}${deviceType.code}${db}-${zb}${deviceType.name}${db}`);
259
- });
260
- clusterServerList.forEach((clusterId) => {
261
- device.log.debug(`- with cluster: ${hk}${clusterId}${db}-${hk}${getClusterNameById(clusterId)}${db}`);
262
- });
263
- device.addClusterServerFromList(device, clusterServerList);
264
- // TODO must by typed and tested
265
- Object.entries(options).forEach(([key, value]) => {
266
- if (key === 'basicInformation') {
267
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
268
- const basicInformation = value as any;
269
- device.createDefaultBasicInformationClusterServer(
270
- basicInformation.deviceName,
271
- basicInformation.serialNumber,
272
- basicInformation.vendorId,
273
- basicInformation.vendorName,
274
- basicInformation.productId,
275
- basicInformation.productName,
276
- basicInformation.softwareVersion,
277
- basicInformation.softwareVersionString,
278
- basicInformation.hardwareVersion,
279
- basicInformation.hardwareVersionString,
280
- );
281
- } else if (key === 'bridgedDeviceBasicInformation') {
282
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
283
- const bridgedDeviceBasicInformation = value as any;
284
- device.createDefaultBridgedDeviceBasicInformationClusterServer(
285
- bridgedDeviceBasicInformation.deviceName,
286
- bridgedDeviceBasicInformation.serialNumber,
287
- bridgedDeviceBasicInformation.vendorId,
288
- bridgedDeviceBasicInformation.vendorName,
289
- bridgedDeviceBasicInformation.productName,
290
- bridgedDeviceBasicInformation.softwareVersion,
291
- bridgedDeviceBasicInformation.softwareVersionString,
292
- bridgedDeviceBasicInformation.hardwareVersion,
293
- bridgedDeviceBasicInformation.hardwareVersionString,
294
- );
295
- }
296
- });
297
- return device;
298
- }
299
- */
300
239
  /**
301
240
  * Adds a device type to the list of device types of the MatterbridgeDevice endpoint.
302
241
  * If the device type is not already present in the list, it will be added.
@@ -351,7 +290,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
351
290
  let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
352
291
  if (!child) {
353
292
  child = new Endpoint(deviceTypes, { uniqueStorageKey: endpointName });
354
- child.addFixedLabel('endpointName', endpointName.slice(0, 16));
355
293
  this.addChildEndpoint(child);
356
294
  }
357
295
  deviceTypes.forEach((deviceType) => {
@@ -385,7 +323,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
385
323
  endpoint.getDeviceTypes().forEach((deviceType) => {
386
324
  this.log.debug(`- for deviceType: ${zb}${deviceType.code}${db}-${zb}${deviceType.name}${db}`);
387
325
  deviceType.requiredServerClusters.forEach((clusterId) => {
388
- if (!requiredServerList.includes(clusterId) && !endpoint.getClusterClientById(clusterId))
326
+ if (!requiredServerList.includes(clusterId) && !endpoint.getClusterServerById(clusterId))
389
327
  requiredServerList.push(clusterId);
390
328
  });
391
329
  });
@@ -407,7 +345,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
407
345
  endpoint.getDeviceTypes().forEach((deviceType) => {
408
346
  this.log.debug(`- for deviceType: ${zb}${deviceType.code}${db}-${zb}${deviceType.name}${db}`);
409
347
  deviceType.optionalServerClusters.forEach((clusterId) => {
410
- if (!optionalServerList.includes(clusterId) && !endpoint.getClusterClientById(clusterId))
348
+ if (!optionalServerList.includes(clusterId) && !endpoint.getClusterServerById(clusterId))
411
349
  optionalServerList.push(clusterId);
412
350
  });
413
351
  });
@@ -435,7 +373,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
435
373
  if (includeServerList.includes(LevelControl.Cluster.id))
436
374
  endpoint.addClusterServer(this.getDefaultLevelControlClusterServer());
437
375
  if (includeServerList.includes(ColorControl.Cluster.id))
438
- endpoint.addClusterServer(this.getDefaultCompleteColorControlClusterServer());
376
+ endpoint.addClusterServer(this.getDefaultColorControlClusterServer());
439
377
  if (includeServerList.includes(Switch.Cluster.id))
440
378
  endpoint.addClusterServer(this.getDefaultSwitchClusterServer());
441
379
  if (includeServerList.includes(DoorLock.Cluster.id))
@@ -446,6 +384,8 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
446
384
  endpoint.addClusterServer(this.getDefaultTimeSyncClusterServer());
447
385
  if (includeServerList.includes(WindowCovering.Cluster.id))
448
386
  endpoint.addClusterServer(this.getDefaultWindowCoveringClusterServer());
387
+ if (includeServerList.includes(FanControl.Cluster.id))
388
+ endpoint.addClusterServer(this.getDefaultFanControlClusterServer());
449
389
  if (includeServerList.includes(TemperatureMeasurement.Cluster.id))
450
390
  endpoint.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer());
451
391
  if (includeServerList.includes(RelativeHumidityMeasurement.Cluster.id))
@@ -464,8 +404,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
464
404
  endpoint.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer());
465
405
  if (includeServerList.includes(PowerSource.Cluster.id))
466
406
  endpoint.addClusterServer(this.getDefaultPowerSourceWiredClusterServer());
467
- if (includeServerList.includes(EveHistory.Cluster.id))
468
- endpoint.addClusterServer(MatterHistory.getEveHistoryClusterServer());
469
407
  if (includeServerList.includes(PowerTopology.Cluster.id))
470
408
  endpoint.addClusterServer(this.getDefaultPowerTopologyClusterServer());
471
409
  if (includeServerList.includes(ElectricalPowerMeasurement.Cluster.id))
@@ -496,8 +434,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
496
434
  endpoint.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer());
497
435
  if (includeServerList.includes(TotalVolatileOrganicCompoundsConcentrationMeasurement.Cluster.id))
498
436
  endpoint.addClusterServer(this.getDefaultTvocMeasurementClusterServer());
499
- if (includeServerList.includes(FanControl.Cluster.id))
500
- endpoint.addClusterServer(this.getDefaultFanControlClusterServer());
501
437
  if (includeServerList.includes(DeviceEnergyManagement.Cluster.id))
502
438
  endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementClusterServer());
503
439
  if (includeServerList.includes(DeviceEnergyManagementMode.Cluster.id))
@@ -513,74 +449,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
513
449
  getChildEndpointByName(endpointName) {
514
450
  return this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
515
451
  }
516
- /**
517
- * Retrieves a child endpoint name.
518
- *
519
- * @param {Endpoint} child - The child endpoint to retrieve the name.
520
- * @returns {string | undefined} The child endpoint name, or undefined if not found.
521
- *
522
- * @deprecated This method is deprecated and will be removed in a future version. Use endpoint.uniqueStorageKey instead.
523
- */
524
- getChildEndpointName(child) {
525
- // Find the endpoint name (l1...)
526
- const labelList = child.getClusterServer(FixedLabelCluster)?.getLabelListAttribute();
527
- if (!labelList)
528
- return undefined;
529
- const endpointNameLabel = labelList.find((entry) => entry.label === 'endpointName');
530
- if (endpointNameLabel)
531
- return endpointNameLabel.value;
532
- }
533
- /**
534
- * Sets the endpoint name for a child endpoint.
535
- *
536
- * @param {Endpoint} child - The child endpoint.
537
- * @param {string} endpointName - The name of the endpoint.
538
- *
539
- * @deprecated This method is deprecated and will be removed in a future version.
540
- */
541
- setChildEndpointName(child, endpointName) {
542
- child.addFixedLabel('endpointName', endpointName);
543
- }
544
- /**
545
- * Retrieves the label associated with the specified endpoint number.
546
- * @param {EndpointNumber | undefined} endpointNumber - The number of the endpoint.
547
- * @returns {string | undefined} The label associated with the endpoint number, or undefined if not found.
548
- *
549
- * @deprecated This method is deprecated and will be removed in a future version.
550
- */
551
- getEndpointLabel(endpointNumber) {
552
- if (!endpointNumber)
553
- return undefined;
554
- const labelList = this.getChildEndpoint(endpointNumber)?.getClusterServer(FixedLabelCluster)?.getLabelListAttribute();
555
- if (!labelList)
556
- return undefined;
557
- for (const entry of labelList) {
558
- if (entry.label === 'endpointName')
559
- return entry.value;
560
- }
561
- }
562
- /**
563
- * Retrieves the child endpoint with the specified label.
564
- *
565
- * @param {string} label - The label of the child endpoint to retrieve.
566
- * @returns {Endpoint | undefined} The child endpoint with the specified label, or undefined if not found.
567
- *
568
- * @deprecated This method is deprecated and will be removed in a future version. Use getChildEndpointByName instead.
569
- */
570
- getChildEndpointWithLabel(label) {
571
- for (const endpoint of this.getChildEndpoints()) {
572
- const labelList = endpoint.getClusterServer(FixedLabelCluster)?.getLabelListAttribute();
573
- if (!labelList)
574
- return undefined;
575
- let endpointName = '';
576
- for (const entry of labelList) {
577
- if (entry.label === 'endpointName')
578
- endpointName = entry.value;
579
- }
580
- if (endpointName === label)
581
- return endpoint;
582
- }
583
- }
584
452
  /**
585
453
  * Retrieves the value of the specified attribute from the given endpoint and cluster.
586
454
  *
@@ -708,14 +576,14 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
708
576
  * @param pluginName - The name of the plugin.
709
577
  * @returns The serialized Matterbridge device object.
710
578
  */
711
- serialize(pluginName) {
579
+ serialize() {
712
580
  if (!this.serialNumber || !this.deviceName || !this.uniqueId)
713
581
  return;
714
582
  const cluster = this.getClusterServer(BasicInformationCluster) ?? this.getClusterServer(BridgedDeviceBasicInformationCluster);
715
583
  if (!cluster)
716
584
  return;
717
585
  const serialized = {
718
- pluginName,
586
+ pluginName: this.plugin ?? 'Unknown',
719
587
  serialNumber: this.serialNumber,
720
588
  deviceName: this.deviceName,
721
589
  uniqueId: this.uniqueId,
@@ -979,6 +847,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
979
847
  maxMeasuredValue: Number.MAX_SAFE_INTEGER,
980
848
  accuracyRanges: [{ rangeMin: Number.MIN_SAFE_INTEGER, rangeMax: Number.MAX_SAFE_INTEGER, fixedMax: 1 }],
981
849
  },
850
+ cumulativeEnergyReset: null,
982
851
  cumulativeEnergyImported: energy ? { energy } : null,
983
852
  cumulativeEnergyExported: null,
984
853
  }, {}, {
@@ -1153,167 +1022,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1153
1022
  }
1154
1023
  /**
1155
1024
  * Get a default color control cluster server.
1156
- * @deprecated This method is deprecated and will be removed in a future version. Use getDefaultCompleteColorControlClusterServer.
1157
- *
1158
- * @param currentHue - The current hue value.
1159
- * @param currentSaturation - The current saturation value.
1160
- * @param colorTemperatureMireds - The color temperature in mireds.
1161
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1162
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1163
- */
1164
- getDefaultColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1165
- return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
1166
- colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
1167
- options: {
1168
- executeIfOff: false,
1169
- },
1170
- numberOfPrimaries: null,
1171
- enhancedColorMode: ColorControl.EnhancedColorMode.CurrentHueAndCurrentSaturation,
1172
- colorCapabilities: { xy: false, hueSaturation: true, colorLoop: false, enhancedHue: false, colorTemperature: true },
1173
- currentHue,
1174
- currentSaturation,
1175
- colorTemperatureMireds,
1176
- colorTempPhysicalMinMireds,
1177
- colorTempPhysicalMaxMireds,
1178
- }, {
1179
- moveToHue: async ({ request, attributes, endpoint }) => {
1180
- this.log.debug('Matter command: moveToHue request:', request, 'attributes.currentHue:', attributes.currentHue.getLocal());
1181
- // attributes.currentHue.setLocal(request.hue);
1182
- this.commandHandler.executeHandler('moveToHue', { request, attributes, endpoint });
1183
- },
1184
- moveHue: async () => {
1185
- this.log.error('Matter command: moveHue not implemented');
1186
- },
1187
- stepHue: async () => {
1188
- this.log.error('Matter command: stepHue not implemented');
1189
- },
1190
- moveToSaturation: async ({ request, attributes, endpoint }) => {
1191
- this.log.debug('Matter command: moveToSaturation request:', request, 'attributes.currentSaturation:', attributes.currentSaturation.getLocal());
1192
- // attributes.currentSaturation.setLocal(request.saturation);
1193
- this.commandHandler.executeHandler('moveToSaturation', { request, attributes, endpoint });
1194
- },
1195
- moveSaturation: async () => {
1196
- this.log.error('Matter command: moveSaturation not implemented');
1197
- },
1198
- stepSaturation: async () => {
1199
- this.log.error('Matter command: stepSaturation not implemented');
1200
- },
1201
- moveToHueAndSaturation: async ({ request, attributes, endpoint }) => {
1202
- this.log.debug('Matter command: moveToHueAndSaturation request:', request, 'attributes.currentHue:', attributes.currentHue.getLocal(), 'attributes.currentSaturation:', attributes.currentSaturation.getLocal());
1203
- // attributes.currentHue.setLocal(request.hue);
1204
- // attributes.currentSaturation.setLocal(request.saturation);
1205
- this.commandHandler.executeHandler('moveToHueAndSaturation', { request, attributes, endpoint });
1206
- },
1207
- stopMoveStep: async () => {
1208
- this.log.error('Matter command: stopMoveStep not implemented');
1209
- },
1210
- moveToColorTemperature: async ({ request, attributes, endpoint }) => {
1211
- this.log.debug('Matter command: moveToColorTemperature request:', request, 'attributes.colorTemperatureMireds:', attributes.colorTemperatureMireds.getLocal());
1212
- // attributes.colorTemperatureMireds.setLocal(request.colorTemperatureMireds);
1213
- this.commandHandler.executeHandler('moveToColorTemperature', { request, attributes, endpoint });
1214
- },
1215
- moveColorTemperature: async () => {
1216
- this.log.error('Matter command: moveColorTemperature not implemented');
1217
- },
1218
- stepColorTemperature: async () => {
1219
- this.log.error('Matter command: stepColorTemperature not implemented');
1220
- },
1221
- }, {});
1222
- }
1223
- /**
1224
- * Creates a default color control cluster server.
1225
- * @deprecated This method is deprecated and will be removed in a future version. Use createDefaultCompleteColorControlClusterServer.
1226
- *
1227
- * @param currentHue - The current hue value.
1228
- * @param currentSaturation - The current saturation value.
1229
- * @param colorTemperatureMireds - The color temperature in mireds.
1230
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1231
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1232
- */
1233
- createDefaultColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1234
- this.addClusterServer(this.getDefaultColorControlClusterServer(currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
1235
- }
1236
- /**
1237
- * Get a default color control cluster server.
1238
- * @deprecated This method is deprecated and will be removed in a future version. Use getDefaultCompleteColorControlClusterServer.
1239
- *
1240
- * @param currentX - The current X value.
1241
- * @param currentY - The current Y value.
1242
- * @param currentHue - The current hue value.
1243
- * @param currentSaturation - The current saturation value.
1244
- * @param colorTemperatureMireds - The color temperature in mireds.
1245
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1246
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1247
- */
1248
- getDefaultXYColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1249
- return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
1250
- colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
1251
- options: {
1252
- executeIfOff: false,
1253
- },
1254
- numberOfPrimaries: null,
1255
- enhancedColorMode: ColorControl.EnhancedColorMode.CurrentHueAndCurrentSaturation,
1256
- colorCapabilities: { xy: true, hueSaturation: true, colorLoop: false, enhancedHue: false, colorTemperature: true },
1257
- currentHue: 0,
1258
- currentSaturation: 0,
1259
- currentX,
1260
- currentY,
1261
- colorTemperatureMireds,
1262
- colorTempPhysicalMinMireds,
1263
- colorTempPhysicalMaxMireds,
1264
- }, {
1265
- moveToColor: async (data) => {
1266
- this.log.debug('Matter command: moveToColor request:', data.request, 'attributes.currentHue:', data.attributes.currentX.getLocal(), data.attributes.currentY.getLocal());
1267
- this.commandHandler.executeHandler('moveToColor', data);
1268
- },
1269
- moveColor: async () => {
1270
- this.log.error('Matter command: moveColor not implemented');
1271
- },
1272
- stepColor: async () => {
1273
- this.log.error('Matter command: stepColor not implemented');
1274
- },
1275
- moveToHue: async ({ request, attributes, endpoint }) => {
1276
- this.log.debug('Matter command: moveToHue request:', request, 'attributes.currentHue:', attributes.currentHue.getLocal());
1277
- this.commandHandler.executeHandler('moveToHue', { request, attributes, endpoint });
1278
- },
1279
- moveHue: async () => {
1280
- this.log.error('Matter command: moveHue not implemented');
1281
- },
1282
- stepHue: async () => {
1283
- this.log.error('Matter command: stepHue not implemented');
1284
- },
1285
- moveToSaturation: async ({ request, attributes, endpoint }) => {
1286
- this.log.debug('Matter command: moveToSaturation request:', request, 'attributes.currentSaturation:', attributes.currentSaturation.getLocal());
1287
- this.commandHandler.executeHandler('moveToSaturation', { request, attributes, endpoint });
1288
- },
1289
- moveSaturation: async () => {
1290
- this.log.error('Matter command: moveSaturation not implemented');
1291
- },
1292
- stepSaturation: async () => {
1293
- this.log.error('Matter command: stepSaturation not implemented');
1294
- },
1295
- moveToHueAndSaturation: async ({ request, attributes, endpoint }) => {
1296
- this.log.debug('Matter command: moveToHueAndSaturation request:', request, 'attributes.currentHue:', attributes.currentHue.getLocal(), 'attributes.currentSaturation:', attributes.currentSaturation.getLocal());
1297
- this.commandHandler.executeHandler('moveToHueAndSaturation', { request, attributes, endpoint });
1298
- },
1299
- stopMoveStep: async () => {
1300
- this.log.error('Matter command: stopMoveStep not implemented');
1301
- },
1302
- moveToColorTemperature: async ({ request, attributes, endpoint }) => {
1303
- this.log.debug('Matter command: moveToColorTemperature request:', request, 'attributes.colorTemperatureMireds:', attributes.colorTemperatureMireds.getLocal());
1304
- this.commandHandler.executeHandler('moveToColorTemperature', { request, attributes, endpoint });
1305
- },
1306
- moveColorTemperature: async () => {
1307
- this.log.error('Matter command: moveColorTemperature not implemented');
1308
- },
1309
- stepColorTemperature: async () => {
1310
- this.log.error('Matter command: stepColorTemperature not implemented');
1311
- },
1312
- }, {});
1313
- }
1314
- /**
1315
- * Creates a default color control cluster server.
1316
- * @deprecated This method is deprecated and will be removed in a future version. Use createDefaultCompleteColorControlClusterServer.
1317
1025
  *
1318
1026
  * @param currentX - The current X value.
1319
1027
  * @param currentY - The current Y value.
@@ -1323,21 +1031,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1323
1031
  * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1324
1032
  * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1325
1033
  */
1326
- createDefaultXYColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1327
- this.addClusterServer(this.getDefaultXYColorControlClusterServer(currentX, currentY, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
1328
- }
1329
- /**
1330
- * Get a default color control cluster server.
1331
- *
1332
- * @param currentX - The current X value.
1333
- * @param currentY - The current Y value.
1334
- * @param currentHue - The current hue value.
1335
- * @param currentSaturation - The current saturation value.
1336
- * @param colorTemperatureMireds - The color temperature in mireds.
1337
- * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1338
- * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1339
- */
1340
- getDefaultCompleteColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1034
+ getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1341
1035
  return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
1342
1036
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
1343
1037
  enhancedColorMode: ColorControl.EnhancedColorMode.CurrentHueAndCurrentSaturation,
@@ -1414,8 +1108,8 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1414
1108
  * @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
1415
1109
  * @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
1416
1110
  */
1417
- createDefaultCompleteColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1418
- this.addClusterServer(this.getDefaultCompleteColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
1111
+ createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1112
+ this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
1419
1113
  }
1420
1114
  /**
1421
1115
  * Configures the color control cluster for a device.
@@ -1434,7 +1128,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1434
1128
  endpoint = this;
1435
1129
  endpoint.getClusterServer(ColorControlCluster)?.setFeatureMapAttribute({ hueSaturation, enhancedHue: false, colorLoop: false, xy, colorTemperature });
1436
1130
  endpoint.getClusterServer(ColorControlCluster)?.setColorCapabilitiesAttribute({ hueSaturation, enhancedHue: false, colorLoop: false, xy, colorTemperature });
1437
- if (colorMode !== undefined && colorMode >= 0 && colorMode <= 2) {
1131
+ if (colorMode !== undefined && colorMode >= ColorControl.ColorMode.CurrentHueAndCurrentSaturation && colorMode <= ColorControl.ColorMode.ColorTemperatureMireds) {
1438
1132
  endpoint.getClusterServer(ColorControlCluster)?.setColorModeAttribute(colorMode);
1439
1133
  endpoint.getClusterServer(ColorControlCluster)?.setEnhancedColorModeAttribute(colorMode);
1440
1134
  }
@@ -1766,8 +1460,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1766
1460
  /**
1767
1461
  * Retrieves the default mode select cluster server.
1768
1462
  *
1769
- * @deprecated This method is currently under development and should not be used.
1770
- *
1771
1463
  * @param description - The description of the cluster server.
1772
1464
  * @param supportedModes - The supported modes for the cluster server.
1773
1465
  * @param currentMode - The current mode of the cluster server. Defaults to 0.
@@ -1794,17 +1486,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
1794
1486
  * @remarks
1795
1487
  * This method adds a cluster server for a mode select cluster with default settings.
1796
1488
  *
1797
- * @deprecated This method is currently under development and should not be used.
1798
- *
1799
1489
  * @param endpoint - The endpoint to add the cluster server to. Defaults to `this` if not provided.
1800
1490
  */
1801
- createDefaultModeSelectClusterServer(endpoint) {
1491
+ createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
1802
1492
  if (!endpoint)
1803
1493
  endpoint = this;
1804
- endpoint.addClusterServer(this.getDefaultModeSelectClusterServer('Mode select', [
1805
- { label: 'Mode 0', mode: 0, semanticTags: [{ mfgCode: VendorId(0xfff1), value: 0 }] },
1806
- { label: 'Mode 1', mode: 1, semanticTags: [{ mfgCode: VendorId(0xfff1), value: 1 }] },
1807
- ]));
1494
+ endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
1808
1495
  }
1809
1496
  /**
1810
1497
  * Get a default occupancy sensing cluster server.
@@ -2130,25 +1817,30 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2130
1817
  /**
2131
1818
  * Get a default thermostat cluster server with the specified parameters.
2132
1819
  *
2133
- * @param localTemperature - The local temperature value in degrees Celsius. Defaults to 23.
2134
- * @param occupiedHeatingSetpoint - The occupied heating setpoint value in degrees Celsius. Defaults to 21.
2135
- * @param occupiedCoolingSetpoint - The occupied cooling setpoint value in degrees Celsius. Defaults to 25.
2136
- * @param minSetpointDeadBand - The minimum setpoint dead band value.
2137
- */
2138
- getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1) {
1820
+ * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
1821
+ * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1822
+ * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1823
+ * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
1824
+ * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
1825
+ * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
1826
+ * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
1827
+ * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
1828
+ * @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
1829
+ */
1830
+ getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
2139
1831
  return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
2140
1832
  localTemperature: localTemperature * 100,
2141
1833
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
2142
1834
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
2143
- minHeatSetpointLimit: 0,
2144
- maxHeatSetpointLimit: 5000,
2145
- absMinHeatSetpointLimit: 0,
2146
- absMaxHeatSetpointLimit: 5000,
2147
- minCoolSetpointLimit: 0,
2148
- maxCoolSetpointLimit: 5000,
2149
- absMinCoolSetpointLimit: 0,
2150
- absMaxCoolSetpointLimit: 5000,
2151
- minSetpointDeadBand,
1835
+ minHeatSetpointLimit: minHeatSetpointLimit * 100,
1836
+ maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1837
+ absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
1838
+ absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1839
+ minCoolSetpointLimit: minCoolSetpointLimit * 100,
1840
+ maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1841
+ absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
1842
+ absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1843
+ minSetpointDeadBand: minSetpointDeadBand * 100,
2152
1844
  systemMode: Thermostat.SystemMode.Off,
2153
1845
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
2154
1846
  thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
@@ -2162,13 +1854,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2162
1854
  /**
2163
1855
  * Creates and adds a default thermostat cluster server to the device.
2164
1856
  *
2165
- * @param localTemperature - The local temperature value.
2166
- * @param occupiedHeatingSetpoint - The occupied heating setpoint value.
2167
- * @param occupiedCoolingSetpoint - The occupied cooling setpoint value.
2168
- * @param minSetpointDeadBand - The minimum setpoint dead band value.
1857
+ * @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
1858
+ * @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1859
+ * @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1860
+ * @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
1861
+ * @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
1862
+ * @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
1863
+ * @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
1864
+ * @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
2169
1865
  */
2170
- createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1) {
2171
- this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand));
1866
+ createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1867
+ this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
2172
1868
  }
2173
1869
  /**
2174
1870
  * Get a default dummy time sync cluster server. Only needed to create a thermostat.
@@ -2517,7 +2213,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2517
2213
  * @returns The default fan control cluster server.
2518
2214
  */
2519
2215
  getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
2520
- return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto /* , FanControl.Feature.Step*/), {
2216
+ return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
2521
2217
  fanMode,
2522
2218
  fanModeSequence: FanControl.FanModeSequence.OffLowMedHighAuto,
2523
2219
  percentSetting: 0,
@@ -2526,12 +2222,10 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
2526
2222
  speedSetting: 0,
2527
2223
  speedCurrent: 0,
2528
2224
  }, {
2529
- /*
2530
- step: async ({ request, attributes }) => {
2531
- this.log.debug('Matter command: step', request);
2532
- await this.commandHandler.executeHandler('step', { request, attributes });
2533
- },
2534
- */
2225
+ step: async (data) => {
2226
+ this.log.debug('Matter command: step', data.request);
2227
+ await this.commandHandler.executeHandler('step', data);
2228
+ },
2535
2229
  }, {});
2536
2230
  }
2537
2231
  /**