matterbridge 3.1.5 → 3.1.6-dev-20250720-88d6141

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 (213) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cli.js +2 -91
  3. package/dist/cliEmitter.js +0 -30
  4. package/dist/clusters/export.js +0 -2
  5. package/dist/defaultConfigSchema.js +0 -24
  6. package/dist/deviceManager.js +1 -94
  7. package/dist/devices/batteryStorage.js +1 -48
  8. package/dist/devices/dishwasher.js +90 -0
  9. package/dist/devices/evse.js +10 -74
  10. package/dist/devices/export.js +2 -2
  11. package/dist/devices/extractorHood.js +35 -0
  12. package/dist/devices/heatPump.js +2 -50
  13. package/dist/devices/laundryDryer.js +6 -83
  14. package/dist/devices/laundryWasher.js +7 -91
  15. package/dist/devices/roboticVacuumCleaner.js +7 -93
  16. package/dist/devices/solarPower.js +0 -38
  17. package/dist/devices/waterHeater.js +2 -82
  18. package/dist/frontend.js +21 -429
  19. package/dist/globalMatterbridge.js +0 -47
  20. package/dist/helpers.js +0 -53
  21. package/dist/index.js +1 -30
  22. package/dist/logger/export.js +0 -1
  23. package/dist/matter/behaviors.js +0 -2
  24. package/dist/matter/clusters.js +0 -2
  25. package/dist/matter/devices.js +0 -2
  26. package/dist/matter/endpoints.js +0 -2
  27. package/dist/matter/export.js +0 -3
  28. package/dist/matter/types.js +0 -3
  29. package/dist/matterbridge.js +79 -802
  30. package/dist/matterbridgeAccessoryPlatform.js +0 -36
  31. package/dist/matterbridgeBehaviors.js +21 -61
  32. package/dist/matterbridgeDeviceTypes.js +15 -579
  33. package/dist/matterbridgeDynamicPlatform.js +0 -36
  34. package/dist/matterbridgeEndpoint.js +47 -1113
  35. package/dist/matterbridgeEndpointHelpers.js +12 -322
  36. package/dist/matterbridgePlatform.js +0 -233
  37. package/dist/matterbridgeTypes.js +0 -25
  38. package/dist/pluginManager.js +3 -249
  39. package/dist/shelly.js +7 -168
  40. package/dist/storage/export.js +0 -1
  41. package/dist/update.js +0 -54
  42. package/dist/utils/colorUtils.js +2 -263
  43. package/dist/utils/commandLine.js +0 -54
  44. package/dist/utils/copyDirectory.js +1 -38
  45. package/dist/utils/createDirectory.js +0 -33
  46. package/dist/utils/createZip.js +2 -47
  47. package/dist/utils/deepCopy.js +0 -39
  48. package/dist/utils/deepEqual.js +1 -72
  49. package/dist/utils/error.js +0 -41
  50. package/dist/utils/export.js +0 -1
  51. package/dist/utils/hex.js +0 -58
  52. package/dist/utils/isvalid.js +0 -101
  53. package/dist/utils/network.js +5 -81
  54. package/dist/utils/spawn.js +0 -40
  55. package/dist/utils/wait.js +9 -62
  56. package/npm-shrinkwrap.json +9 -9
  57. package/package.json +2 -3
  58. package/dist/cli.d.ts +0 -26
  59. package/dist/cli.d.ts.map +0 -1
  60. package/dist/cli.js.map +0 -1
  61. package/dist/cliEmitter.d.ts +0 -34
  62. package/dist/cliEmitter.d.ts.map +0 -1
  63. package/dist/cliEmitter.js.map +0 -1
  64. package/dist/clusters/export.d.ts +0 -2
  65. package/dist/clusters/export.d.ts.map +0 -1
  66. package/dist/clusters/export.js.map +0 -1
  67. package/dist/defaultConfigSchema.d.ts +0 -28
  68. package/dist/defaultConfigSchema.d.ts.map +0 -1
  69. package/dist/defaultConfigSchema.js.map +0 -1
  70. package/dist/deviceManager.d.ts +0 -112
  71. package/dist/deviceManager.d.ts.map +0 -1
  72. package/dist/deviceManager.js.map +0 -1
  73. package/dist/devices/batteryStorage.d.ts +0 -48
  74. package/dist/devices/batteryStorage.d.ts.map +0 -1
  75. package/dist/devices/batteryStorage.js.map +0 -1
  76. package/dist/devices/evse.d.ts +0 -75
  77. package/dist/devices/evse.d.ts.map +0 -1
  78. package/dist/devices/evse.js.map +0 -1
  79. package/dist/devices/export.d.ts +0 -9
  80. package/dist/devices/export.d.ts.map +0 -1
  81. package/dist/devices/export.js.map +0 -1
  82. package/dist/devices/heatPump.d.ts +0 -47
  83. package/dist/devices/heatPump.d.ts.map +0 -1
  84. package/dist/devices/heatPump.js.map +0 -1
  85. package/dist/devices/laundryDryer.d.ts +0 -87
  86. package/dist/devices/laundryDryer.d.ts.map +0 -1
  87. package/dist/devices/laundryDryer.js.map +0 -1
  88. package/dist/devices/laundryWasher.d.ts +0 -242
  89. package/dist/devices/laundryWasher.d.ts.map +0 -1
  90. package/dist/devices/laundryWasher.js.map +0 -1
  91. package/dist/devices/roboticVacuumCleaner.d.ts +0 -112
  92. package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
  93. package/dist/devices/roboticVacuumCleaner.js.map +0 -1
  94. package/dist/devices/solarPower.d.ts +0 -40
  95. package/dist/devices/solarPower.d.ts.map +0 -1
  96. package/dist/devices/solarPower.js.map +0 -1
  97. package/dist/devices/waterHeater.d.ts +0 -111
  98. package/dist/devices/waterHeater.d.ts.map +0 -1
  99. package/dist/devices/waterHeater.js.map +0 -1
  100. package/dist/frontend.d.ts +0 -304
  101. package/dist/frontend.d.ts.map +0 -1
  102. package/dist/frontend.js.map +0 -1
  103. package/dist/globalMatterbridge.d.ts +0 -59
  104. package/dist/globalMatterbridge.d.ts.map +0 -1
  105. package/dist/globalMatterbridge.js.map +0 -1
  106. package/dist/helpers.d.ts +0 -48
  107. package/dist/helpers.d.ts.map +0 -1
  108. package/dist/helpers.js.map +0 -1
  109. package/dist/index.d.ts +0 -33
  110. package/dist/index.d.ts.map +0 -1
  111. package/dist/index.js.map +0 -1
  112. package/dist/logger/export.d.ts +0 -2
  113. package/dist/logger/export.d.ts.map +0 -1
  114. package/dist/logger/export.js.map +0 -1
  115. package/dist/matter/behaviors.d.ts +0 -2
  116. package/dist/matter/behaviors.d.ts.map +0 -1
  117. package/dist/matter/behaviors.js.map +0 -1
  118. package/dist/matter/clusters.d.ts +0 -2
  119. package/dist/matter/clusters.d.ts.map +0 -1
  120. package/dist/matter/clusters.js.map +0 -1
  121. package/dist/matter/devices.d.ts +0 -2
  122. package/dist/matter/devices.d.ts.map +0 -1
  123. package/dist/matter/devices.js.map +0 -1
  124. package/dist/matter/endpoints.d.ts +0 -2
  125. package/dist/matter/endpoints.d.ts.map +0 -1
  126. package/dist/matter/endpoints.js.map +0 -1
  127. package/dist/matter/export.d.ts +0 -5
  128. package/dist/matter/export.d.ts.map +0 -1
  129. package/dist/matter/export.js.map +0 -1
  130. package/dist/matter/types.d.ts +0 -3
  131. package/dist/matter/types.d.ts.map +0 -1
  132. package/dist/matter/types.js.map +0 -1
  133. package/dist/matterbridge.d.ts +0 -447
  134. package/dist/matterbridge.d.ts.map +0 -1
  135. package/dist/matterbridge.js.map +0 -1
  136. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -42
  137. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  138. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  139. package/dist/matterbridgeBehaviors.d.ts +0 -1340
  140. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  141. package/dist/matterbridgeBehaviors.js.map +0 -1
  142. package/dist/matterbridgeDeviceTypes.d.ts +0 -709
  143. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  144. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  145. package/dist/matterbridgeDynamicPlatform.d.ts +0 -42
  146. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  147. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  148. package/dist/matterbridgeEndpoint.d.ts +0 -1250
  149. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  150. package/dist/matterbridgeEndpoint.js.map +0 -1
  151. package/dist/matterbridgeEndpointHelpers.d.ts +0 -3198
  152. package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
  153. package/dist/matterbridgeEndpointHelpers.js.map +0 -1
  154. package/dist/matterbridgePlatform.d.ts +0 -310
  155. package/dist/matterbridgePlatform.d.ts.map +0 -1
  156. package/dist/matterbridgePlatform.js.map +0 -1
  157. package/dist/matterbridgeTypes.d.ts +0 -195
  158. package/dist/matterbridgeTypes.d.ts.map +0 -1
  159. package/dist/matterbridgeTypes.js.map +0 -1
  160. package/dist/pluginManager.d.ts +0 -270
  161. package/dist/pluginManager.d.ts.map +0 -1
  162. package/dist/pluginManager.js.map +0 -1
  163. package/dist/shelly.d.ts +0 -174
  164. package/dist/shelly.d.ts.map +0 -1
  165. package/dist/shelly.js.map +0 -1
  166. package/dist/storage/export.d.ts +0 -2
  167. package/dist/storage/export.d.ts.map +0 -1
  168. package/dist/storage/export.js.map +0 -1
  169. package/dist/update.d.ts +0 -59
  170. package/dist/update.d.ts.map +0 -1
  171. package/dist/update.js.map +0 -1
  172. package/dist/utils/colorUtils.d.ts +0 -117
  173. package/dist/utils/colorUtils.d.ts.map +0 -1
  174. package/dist/utils/colorUtils.js.map +0 -1
  175. package/dist/utils/commandLine.d.ts +0 -59
  176. package/dist/utils/commandLine.d.ts.map +0 -1
  177. package/dist/utils/commandLine.js.map +0 -1
  178. package/dist/utils/copyDirectory.d.ts +0 -33
  179. package/dist/utils/copyDirectory.d.ts.map +0 -1
  180. package/dist/utils/copyDirectory.js.map +0 -1
  181. package/dist/utils/createDirectory.d.ts +0 -34
  182. package/dist/utils/createDirectory.d.ts.map +0 -1
  183. package/dist/utils/createDirectory.js.map +0 -1
  184. package/dist/utils/createZip.d.ts +0 -39
  185. package/dist/utils/createZip.d.ts.map +0 -1
  186. package/dist/utils/createZip.js.map +0 -1
  187. package/dist/utils/deepCopy.d.ts +0 -32
  188. package/dist/utils/deepCopy.d.ts.map +0 -1
  189. package/dist/utils/deepCopy.js.map +0 -1
  190. package/dist/utils/deepEqual.d.ts +0 -54
  191. package/dist/utils/deepEqual.d.ts.map +0 -1
  192. package/dist/utils/deepEqual.js.map +0 -1
  193. package/dist/utils/error.d.ts +0 -44
  194. package/dist/utils/error.d.ts.map +0 -1
  195. package/dist/utils/error.js.map +0 -1
  196. package/dist/utils/export.d.ts +0 -12
  197. package/dist/utils/export.d.ts.map +0 -1
  198. package/dist/utils/export.js.map +0 -1
  199. package/dist/utils/hex.d.ts +0 -49
  200. package/dist/utils/hex.d.ts.map +0 -1
  201. package/dist/utils/hex.js.map +0 -1
  202. package/dist/utils/isvalid.d.ts +0 -103
  203. package/dist/utils/isvalid.d.ts.map +0 -1
  204. package/dist/utils/isvalid.js.map +0 -1
  205. package/dist/utils/network.d.ts +0 -74
  206. package/dist/utils/network.d.ts.map +0 -1
  207. package/dist/utils/network.js.map +0 -1
  208. package/dist/utils/spawn.d.ts +0 -33
  209. package/dist/utils/spawn.d.ts.map +0 -1
  210. package/dist/utils/spawn.js.map +0 -1
  211. package/dist/utils/wait.d.ts +0 -56
  212. package/dist/utils/wait.d.ts.map +0 -1
  213. package/dist/utils/wait.js.map +0 -1
@@ -1,30 +1,5 @@
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
- * @created 2024-10-01
7
- * @version 2.1.1
8
- * @license Apache-2.0
9
- *
10
- * Copyright 2024, 2025, 2026 Luca Liguori.
11
- *
12
- * Licensed under the Apache License, Version 2.0 (the "License");
13
- * you may not use this file except in compliance with the License.
14
- * You may obtain a copy of the License at
15
- *
16
- * http://www.apache.org/licenses/LICENSE-2.0
17
- *
18
- * Unless required by applicable law or agreed to in writing, software
19
- * distributed under the License is distributed on an "AS IS" BASIS,
20
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21
- * See the License for the specific language governing permissions and
22
- * limitations under the License.
23
- */
24
- // @matter
25
1
  import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, UINT16_MAX, UINT32_MAX, VendorId } from '@matter/main';
26
2
  import { getClusterNameById, MeasurementType } from '@matter/main/types';
27
- // @matter clusters
28
3
  import { Descriptor } from '@matter/main/clusters/descriptor';
29
4
  import { PowerSource } from '@matter/main/clusters/power-source';
30
5
  import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
@@ -51,7 +26,6 @@ import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/ther
51
26
  import { OperationalState } from '@matter/main/clusters/operational-state';
52
27
  import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
53
28
  import { DeviceEnergyManagementMode } from '@matter/main/clusters/device-energy-management-mode';
54
- // @matter behaviors
55
29
  import { DescriptorServer } from '@matter/main/behaviors/descriptor';
56
30
  import { PowerSourceServer } from '@matter/main/behaviors/power-source';
57
31
  import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
@@ -82,42 +56,19 @@ import { RadonConcentrationMeasurementServer } from '@matter/main/behaviors/rado
82
56
  import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/main/behaviors/total-volatile-organic-compounds-concentration-measurement';
83
57
  import { FanControlServer } from '@matter/main/behaviors/fan-control';
84
58
  import { ResourceMonitoring } from '@matter/main/clusters/resource-monitoring';
85
- import { HepaFilterMonitoringServer } from '@matter/main/behaviors/hepa-filter-monitoring';
86
- import { ActivatedCarbonFilterMonitoringServer } from '@matter/main/behaviors/activated-carbon-filter-monitoring';
87
59
  import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behaviors/thermostat-user-interface-configuration';
88
- // AnsiLogger module
89
60
  import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
90
- // Matterbridge
91
61
  import { bridgedNode } from './matterbridgeDeviceTypes.js';
92
62
  import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
93
- import { MatterbridgeServer, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, MatterbridgeDeviceEnergyManagementServer, } from './matterbridgeBehaviors.js';
63
+ import { MatterbridgeServer, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, MatterbridgeDeviceEnergyManagementServer, MatterbridgeActivatedCarbonFilterMonitoringServer, MatterbridgeHepaFilterMonitoringServer, } from './matterbridgeBehaviors.js';
94
64
  import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultOperationalStateClusterServer, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, invokeBehaviorCommand, triggerEvent, } from './matterbridgeEndpointHelpers.js';
95
65
  export class MatterbridgeEndpoint extends Endpoint {
96
- /** The bridge mode of Matterbridge */
97
66
  static bridgeMode = '';
98
- /** The default log level of the new MatterbridgeEndpoints */
99
- static logLevel = "info" /* LogLevel.INFO */;
100
- /**
101
- * Activates a special mode for this endpoint.
102
- * - 'server': it creates the device server node and add the device as Matter device that needs to be paired individually.
103
- * In this case the bridge mode is not relevant. The device is autonomous. The main use case is a workaround for the Apple Home rvc issue.
104
- *
105
- * - 'matter': it adds the device directly to the bridge server node as Matter device. In this case the implementation must respect
106
- * the 9.2.3. Disambiguation rule (i.e. use taglist if needed cause the device doesn't have nodeLabel).
107
- * Furthermore the device will be a part of the bridge (i.e. will have the same name and will be in the same room).
108
- * See 9.12.2.2. Native Matter functionality in Bridge.
109
- *
110
- * @remarks
111
- * Always use createDefaultBasicInformationClusterServer() to create the BasicInformation cluster server.
112
- */
67
+ static logLevel = "info";
113
68
  mode = undefined;
114
- /** The server node of the endpoint, if it is a single not bridged endpoint */
115
69
  serverNode;
116
- /** The logger instance for the MatterbridgeEndpoint */
117
70
  log;
118
- /** The plugin name this MatterbridgeEndpoint belongs to */
119
71
  plugin = undefined;
120
- /** The configuration URL of the device, if available */
121
72
  configUrl = undefined;
122
73
  deviceName = undefined;
123
74
  serialNumber = undefined;
@@ -131,28 +82,14 @@ export class MatterbridgeEndpoint extends Endpoint {
131
82
  hardwareVersion = undefined;
132
83
  hardwareVersionString = undefined;
133
84
  productUrl = 'https://www.npmjs.com/package/matterbridge';
134
- /** The name of the first device type of the endpoint (old api compatibility) */
135
85
  name = undefined;
136
- /** The code of the first device type of the endpoint (old api compatibility) */
137
86
  deviceType = undefined;
138
- /** The original id (with spaces and .) of the endpoint (old api compatibility) */
139
87
  uniqueStorageKey = undefined;
140
88
  tagList = undefined;
141
- /** Maps the DeviceTypeDefinitions with their code */
142
89
  deviceTypes = new Map();
143
- /** Command handler for the MatterbridgeEndpoint commands */
144
90
  commandHandler = new NamedHandler();
145
- /**
146
- * Represents a MatterbridgeEndpoint.
147
- *
148
- * @class MatterbridgeEndpoint
149
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
150
- * @param {MatterbridgeEndpointOptions} [options] - The options for the device.
151
- * @param {boolean} [debug] - Debug flag.
152
- */
153
91
  constructor(definition, options = {}, debug = false) {
154
92
  let deviceTypeList = [];
155
- // Get the first DeviceTypeDefinition
156
93
  let firstDefinition;
157
94
  if (Array.isArray(definition)) {
158
95
  firstDefinition = definition[0];
@@ -165,7 +102,6 @@ export class MatterbridgeEndpoint extends Endpoint {
165
102
  firstDefinition = definition;
166
103
  deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
167
104
  }
168
- // Convert the first DeviceTypeDefinition to an EndpointType.Options
169
105
  const deviceTypeDefinitionV8 = {
170
106
  name: firstDefinition.name.replace('-', '_'),
171
107
  deviceType: firstDefinition.code,
@@ -184,20 +120,17 @@ export class MatterbridgeEndpoint extends Endpoint {
184
120
  behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
185
121
  };
186
122
  const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
187
- // Check if the uniqueStorageKey is valid
188
123
  if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
189
124
  options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
190
125
  }
191
126
  if (options.id && checkNotLatinCharacters(options.id)) {
192
127
  options.id = generateUniqueId(options.id);
193
128
  }
194
- // Convert the options to an Endpoint.Options
195
129
  const optionsV8 = {
196
130
  id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
197
131
  number: options.endpointId,
198
132
  descriptor: options.tagList ? { tagList: options.tagList, deviceTypeList } : { deviceTypeList },
199
133
  };
200
- // Override the deprecated uniqueStorageKey && endpointId with id and number if provided
201
134
  if (options.id !== undefined) {
202
135
  optionsV8.id = options.id.replace(/[ .]/g, '');
203
136
  }
@@ -217,40 +150,16 @@ export class MatterbridgeEndpoint extends Endpoint {
217
150
  }
218
151
  else
219
152
  this.deviceTypes.set(firstDefinition.code, firstDefinition);
220
- // console.log('MatterbridgeEndpoint.option', options);
221
- // console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
222
- // console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
223
- // Create the logger
224
- this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
153
+ this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
225
154
  this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} mode: ${CYAN}${this.mode}${db} id: ${CYAN}${optionsV8.id}${db} number: ${CYAN}${optionsV8.number}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
226
- // Add MatterbridgeServer
227
155
  this.behaviors.require(MatterbridgeServer, { log: this.log, commandHandler: this.commandHandler });
228
156
  }
229
- /**
230
- * Loads an instance of the MatterbridgeEndpoint class.
231
- *
232
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
233
- * @param {MatterbridgeEndpointOptions} [options] - The options for the device.
234
- * @param {boolean} [debug] - Debug flag.
235
- * @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
236
- */
237
157
  static async loadInstance(definition, options = {}, debug = false) {
238
158
  return new MatterbridgeEndpoint(definition, options, debug);
239
159
  }
240
- /**
241
- * Get all the device types of this endpoint.
242
- *
243
- * @returns {DeviceTypeDefinition[]} The device types of this endpoint.
244
- */
245
160
  getDeviceTypes() {
246
161
  return Array.from(this.deviceTypes.values());
247
162
  }
248
- /**
249
- * Checks if the provided cluster server is supported by this endpoint.
250
- *
251
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
252
- * @returns {boolean} True if the cluster server is supported, false otherwise.
253
- */
254
163
  hasClusterServer(cluster) {
255
164
  const behavior = getBehavior(this, cluster);
256
165
  if (behavior)
@@ -258,13 +167,6 @@ export class MatterbridgeEndpoint extends Endpoint {
258
167
  else
259
168
  return false;
260
169
  }
261
- /**
262
- * Checks if the provided attribute server is supported for a given cluster of this endpoint.
263
- *
264
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
265
- * @param {string} attribute - The attribute name to check.
266
- * @returns {boolean} True if the attribute server is supported, false otherwise.
267
- */
268
170
  hasAttributeServer(cluster, attribute) {
269
171
  const behavior = getBehavior(this, cluster);
270
172
  if (!behavior || !this.behaviors.supported[behavior.id])
@@ -273,239 +175,82 @@ export class MatterbridgeEndpoint extends Endpoint {
273
175
  const defaults = this.behaviors.defaultsFor(behavior);
274
176
  return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
275
177
  }
276
- /**
277
- * Retrieves the initial options for the provided cluster server.
278
- *
279
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
280
- * @returns {Record<string, boolean | number | bigint | string | object | null> | undefined} The options for the provided cluster server, or undefined if the cluster is not supported.
281
- */
282
178
  getClusterServerOptions(cluster) {
283
179
  const behavior = getBehavior(this, cluster);
284
180
  if (!behavior)
285
181
  return undefined;
286
182
  return this.behaviors.optionsFor(behavior);
287
183
  }
288
- /**
289
- * Retrieves the value of the provided attribute from the given cluster.
290
- *
291
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
292
- * @param {string} attribute - The name of the attribute to retrieve.
293
- * @param {AnsiLogger} [log] - Optional logger for error and info messages.
294
- * @returns {any} The value of the attribute, or undefined if the attribute is not found.
295
- */
296
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
297
184
  getAttribute(cluster, attribute, log) {
298
185
  return getAttribute(this, cluster, attribute, log);
299
186
  }
300
- /**
301
- * Sets the value of an attribute on a cluster server.
302
- *
303
- * @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
304
- * @param {string} attribute - The name of the attribute.
305
- * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
306
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
307
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
308
- */
309
187
  async setAttribute(clusterId, attribute, value, log) {
310
188
  return await setAttribute(this, clusterId, attribute, value, log);
311
189
  }
312
- /**
313
- * Update the value of an attribute on a cluster server only if the value is different.
314
- *
315
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
316
- * @param {string} attribute - The name of the attribute.
317
- * @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
318
- * @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
319
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
320
- */
321
190
  async updateAttribute(cluster, attribute, value, log) {
322
191
  return await updateAttribute(this, cluster, attribute, value, log);
323
192
  }
324
- /**
325
- * Subscribes to the provided attribute on a cluster.
326
- *
327
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
328
- * @param {string} attribute - The name of the attribute to subscribe to.
329
- * @param {(newValue: any, oldValue: any, context: ActionContext) => void} listener - A callback function that will be called when the attribute value changes. When context.offline === true then the change is locally generated and not from the controller.
330
- * @param {AnsiLogger} [log] - Optional logger for logging errors and information.
331
- * @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
332
- *
333
- * @remarks The listener function (cannot be async) will receive three parameters:
334
- * - `newValue`: The new value of the attribute.
335
- * - `oldValue`: The old value of the attribute.
336
- * - `context`: The action context, which includes information about the action that triggered the change. When context.offline === true then the change is locally generated and not from the controller.
337
- */
338
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
339
193
  async subscribeAttribute(cluster, attribute, listener, log) {
340
194
  return await subscribeAttribute(this, cluster, attribute, listener, log);
341
195
  }
342
- /**
343
- * Triggers an event on the specified cluster.
344
- *
345
- * @param {ClusterId} cluster - The ID of the cluster.
346
- * @param {string} event - The name of the event to trigger.
347
- * @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
348
- * @param {AnsiLogger} [log] - Optional logger for logging information.
349
- * @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
350
- */
351
196
  async triggerEvent(cluster, event, payload, log) {
352
197
  return await triggerEvent(this, cluster, event, payload, log);
353
198
  }
354
- /**
355
- * Adds cluster servers from the provided server list.
356
- *
357
- * @param {ClusterId[]} serverList - The list of cluster IDs to add.
358
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
359
- */
360
199
  addClusterServers(serverList) {
361
200
  addClusterServers(this, serverList);
362
201
  return this;
363
202
  }
364
- /**
365
- * Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
366
- *
367
- * @param {string} label - The label to add.
368
- * @param {string} value - The value of the label.
369
- * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
370
- */
371
203
  async addFixedLabel(label, value) {
372
204
  await addFixedLabel(this, label, value);
373
205
  return this;
374
206
  }
375
- /**
376
- * Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
377
- *
378
- * @param {string} label - The label to add.
379
- * @param {string} value - The value of the label.
380
- * @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
381
- */
382
207
  async addUserLabel(label, value) {
383
208
  await addUserLabel(this, label, value);
384
209
  return this;
385
210
  }
386
- /**
387
- * Adds a command handler for the specified command.
388
- *
389
- * @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
390
- * @param {CommandHandlerFunction} handler - The handler function to execute when the command is received.
391
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
392
- *
393
- * @remarks
394
- * The handler function will receive an object with the following properties:
395
- * - `request`: The request object sent with the command.
396
- * - `cluster`: The id of the cluster that received the command (i.e. "onOff").
397
- * - `attributes`: The current attributes of the cluster that received the command (i.e. { onOff: true}).
398
- * - `endpoint`: The MatterbridgeEndpoint instance that received the command.
399
- */
400
211
  addCommandHandler(command, handler) {
401
212
  this.commandHandler.addHandler(command, handler);
402
213
  return this;
403
214
  }
404
- /**
405
- * Execute the command handler for the specified command. Used ONLY in Jest tests.
406
- *
407
- * @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
408
- * @param {Record<string, boolean | number | bigint | string | object | null>} [request] - The optional request to pass to the handler function.
409
- * @param {string} [cluster] - The optional cluster to pass to the handler function.
410
- * @param {Record<string, boolean | number | bigint | string | object | null>} [attributes] - The optional attributes to pass to the handler function.
411
- * @param {MatterbridgeEndpoint} [endpoint] - The optional MatterbridgeEndpoint instance to pass to the handler function
412
- *
413
- * @deprecated Used ONLY in Jest tests.
414
- */
415
215
  async executeCommandHandler(command, request, cluster, attributes, endpoint) {
416
216
  await this.commandHandler.executeHandler(command, { request, cluster, attributes, endpoint });
417
217
  }
418
- /**
419
- * Invokes a behavior command on the specified cluster. Used ONLY in Jest tests.
420
- *
421
- * @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
422
- * @param {string} command - The command to invoke.
423
- * @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The optional parameters to pass to the command.
424
- *
425
- * @deprecated Used ONLY in Jest tests.
426
- */
427
218
  async invokeBehaviorCommand(cluster, command, params) {
428
219
  await invokeBehaviorCommand(this, cluster, command, params);
429
220
  }
430
- /**
431
- * Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
432
- *
433
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
434
- */
435
221
  addRequiredClusterServers() {
436
222
  addRequiredClusterServers(this);
437
223
  return this;
438
224
  }
439
- /**
440
- * Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
441
- *
442
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
443
- */
444
225
  addOptionalClusterServers() {
445
226
  addOptionalClusterServers(this);
446
227
  return this;
447
228
  }
448
- /**
449
- * Retrieves all cluster servers.
450
- *
451
- * @returns {Behavior.Type[]} An array of all cluster servers.
452
- */
453
229
  getAllClusterServers() {
454
230
  return Object.values(this.behaviors.supported);
455
231
  }
456
- /**
457
- * Retrieves the names of all cluster servers.
458
- *
459
- * @returns {string[]} An array of all cluster server names.
460
- */
461
232
  getAllClusterServerNames() {
462
233
  return Object.keys(this.behaviors.supported);
463
234
  }
464
- /**
465
- * Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
466
- *
467
- * @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
468
- */
469
235
  forEachAttribute(callback) {
470
236
  if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
471
237
  return;
472
238
  for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
473
- // Skip if the key / cluster name is a number, cause they are double indexed.
474
239
  if (!isNaN(Number(clusterName)))
475
240
  continue;
476
241
  for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
477
- // Skip if the behavior has no associated cluster (i.e. matterbridge server)
478
242
  const clusterId = getClusterId(this, clusterName);
479
243
  if (clusterId === undefined) {
480
- // this.log.debug(`***forEachAttribute: cluster ${clusterName} not found`);
481
244
  continue;
482
245
  }
483
- // Skip if the attribute is not present in the ClusterBehavior.Type. Also skip if the attribute it is an internal state.
484
246
  const attributeId = getAttributeId(this, clusterName, attributeName);
485
247
  if (attributeId === undefined) {
486
- // this.log.debug(`***forEachAttribute: attribute ${clusterName}.${attributeName} not found`);
487
248
  continue;
488
249
  }
489
250
  callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
490
251
  }
491
252
  }
492
253
  }
493
- /**
494
- * Adds a child endpoint with the specified device types and options.
495
- * If the child endpoint is not already present, it will be created and added.
496
- * If the child endpoint is already present, the existing child endpoint will be returned.
497
- *
498
- * @param {string} endpointName - The name of the new endpoint to add.
499
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
500
- * @param {MatterbridgeEndpointOptions} [options] - The options for the endpoint.
501
- * @param {boolean} [debug] - Whether to enable debug logging.
502
- * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
503
- *
504
- * @example
505
- * ```typescript
506
- * const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
507
- * ```
508
- */
509
254
  addChildDeviceType(endpointName, definition, options = {}, debug = false) {
510
255
  this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
511
256
  let alreadyAdded = false;
@@ -545,23 +290,6 @@ export class MatterbridgeEndpoint extends Endpoint {
545
290
  }
546
291
  return child;
547
292
  }
548
- /**
549
- * Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
550
- * If the child endpoint is not already present in the childEndpoints, it will be added.
551
- * If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
552
- *
553
- * @param {string} endpointName - The name of the new enpoint to add.
554
- * @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
555
- * @param {ClusterId[]} [serverList] - The list of cluster IDs to include.
556
- * @param {MatterbridgeEndpointOptions} [options] - The options for the device.
557
- * @param {boolean} [debug] - Whether to enable debug logging.
558
- * @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
559
- *
560
- * @example
561
- * ```typescript
562
- * const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
563
- * ```
564
- */
565
293
  addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
566
294
  this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
567
295
  let alreadyAdded = false;
@@ -624,39 +352,15 @@ export class MatterbridgeEndpoint extends Endpoint {
624
352
  }
625
353
  return child;
626
354
  }
627
- /**
628
- * Retrieves a child endpoint by its name.
629
- *
630
- * @param {string} endpointName - The name of the endpoint to retrieve.
631
- * @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
632
- */
633
355
  getChildEndpointByName(endpointName) {
634
356
  return this.parts.find((part) => part.id === endpointName);
635
357
  }
636
- /**
637
- * Retrieves a child endpoint by its EndpointNumber.
638
- *
639
- * @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
640
- * @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
641
- */
642
358
  getChildEndpoint(endpointNumber) {
643
359
  return this.parts.find((part) => part.number === endpointNumber);
644
360
  }
645
- /**
646
- * Get all the child endpoints of this endpoint.
647
- *
648
- * @returns {MatterbridgeEndpoint[]} The child endpoints.
649
- */
650
361
  getChildEndpoints() {
651
362
  return Array.from(this.parts);
652
363
  }
653
- /**
654
- * Serializes the Matterbridge device into a serialized object.
655
- *
656
- * @param {MatterbridgeEndpoint} device - The Matterbridge device to serialize.
657
- *
658
- * @returns {SerializedMatterbridgeEndpoint | undefined} The serialized Matterbridge device object.
659
- */
660
364
  static serialize(device) {
661
365
  if (!device.serialNumber || !device.deviceName || !device.uniqueId)
662
366
  return;
@@ -679,16 +383,9 @@ export class MatterbridgeEndpoint extends Endpoint {
679
383
  serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
680
384
  if (behaviorName === 'powerSource')
681
385
  serialized.clusterServersId.push(PowerSource.Cluster.id);
682
- // serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
683
386
  });
684
387
  return serialized;
685
388
  }
686
- /**
687
- * Deserializes the device into a serialized object.
688
- *
689
- * @param {SerializedMatterbridgeEndpoint} serializedDevice - The serialized Matterbridge device object.
690
- * @returns {MatterbridgeEndpoint | undefined} The deserialized Matterbridge device.
691
- */
692
389
  static deserialize(serializedDevice) {
693
390
  const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
694
391
  device.plugin = serializedDevice.pluginName;
@@ -704,122 +401,55 @@ export class MatterbridgeEndpoint extends Endpoint {
704
401
  device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
705
402
  else if (clusterId === PowerSource.Cluster.id)
706
403
  device.createDefaultPowerSourceWiredClusterServer();
707
- // else addClusterServerFromList(device, [clusterId]);
708
404
  }
709
405
  return device;
710
406
  }
711
- /**
712
- * Creates a default power source wired cluster server.
713
- *
714
- * @param {PowerSource.WiredCurrentType} wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
715
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
716
- *
717
- * @remarks
718
- * - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
719
- * - description: The description of the power source is a fixed attribute that describes the power source type.
720
- * - wiredCurrentType: The type of wired current is a fixed attribute that indicates the type of wired current used by the power source (AC or DC).
721
- */
722
407
  createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
723
408
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
724
- // Base attributes
725
409
  status: PowerSource.PowerSourceStatus.Active,
726
410
  order: 0,
727
411
  description: wiredCurrentType === PowerSource.WiredCurrentType.Ac ? 'AC Power' : 'DC Power',
728
412
  endpointList: [],
729
- // Wired feature attributes
730
413
  wiredCurrentType,
731
414
  });
732
415
  return this;
733
416
  }
734
- /**
735
- * Creates a default power source replaceable battery cluster server.
736
- *
737
- * @param {number} batPercentRemaining - The remaining battery percentage (default: 100).
738
- * @param {PowerSource.BatChargeLevel} batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
739
- * @param {number} batVoltage - The battery voltage (default: 1500).
740
- * @param {string} batReplacementDescription - The description of the battery replacement (default: 'Battery type').
741
- * @param {number} batQuantity - The quantity of the battery (default: 1).
742
- * @param {PowerSource.BatReplaceability} batReplaceability - The replaceability of the battery (default: PowerSource.BatReplaceability.Unspecified).
743
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
744
- *
745
- * @remarks
746
- * - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
747
- * - description: The description of the power source is a fixed attribute that describes the power source type.
748
- * - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
749
- * - batReplacementDescription: The description of the battery replacement is a fixed attribute that describes the battery type.
750
- * - batQuantity: The quantity of the battery is a fixed attribute that indicates how many batteries are present in the device.
751
- */
752
417
  createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1, batReplaceability = PowerSource.BatReplaceability.UserReplaceable) {
753
418
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
754
- // Base attributes
755
419
  status: PowerSource.PowerSourceStatus.Active,
756
420
  order: 0,
757
421
  description: 'Primary battery',
758
422
  endpointList: [],
759
- // Battery feature attributes
760
423
  batVoltage,
761
424
  batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
762
425
  batChargeLevel,
763
426
  batReplacementNeeded: false,
764
427
  batReplaceability,
765
428
  activeBatFaults: undefined,
766
- // Replaceable feature attributes
767
429
  batReplacementDescription,
768
430
  batQuantity,
769
431
  });
770
432
  return this;
771
433
  }
772
- /**
773
- * Creates a default power source rechargeable battery cluster server.
774
- *
775
- * @param {number} [batPercentRemaining] - The remaining battery percentage (default: 100).
776
- * @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
777
- * @param {number} [batVoltage] - The battery voltage in mV (default: 1500).
778
- * @param {PowerSource.BatReplaceability} [batReplaceability] - The replaceability of the battery (default: PowerSource.BatReplaceability.Unspecified).
779
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
780
- *
781
- * @remarks
782
- * - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
783
- * - description: The description of the power source is a fixed attribute that describes the power source type.
784
- * - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
785
- */
786
434
  createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplaceability = PowerSource.BatReplaceability.Unspecified) {
787
435
  this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
788
- // Base attributes
789
436
  status: PowerSource.PowerSourceStatus.Active,
790
437
  order: 0,
791
438
  description: 'Primary battery',
792
439
  endpointList: [],
793
- // Battery feature attributes
794
440
  batVoltage,
795
441
  batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
796
- batTimeRemaining: null, // Indicates the estimated time in seconds before the battery will no longer be able to provide power to the Node
442
+ batTimeRemaining: null,
797
443
  batChargeLevel,
798
444
  batReplacementNeeded: false,
799
445
  batReplaceability,
800
446
  batPresent: true,
801
447
  activeBatFaults: [],
802
- // Rechargeable feature attributes
803
448
  batChargeState: PowerSource.BatChargeState.IsNotCharging,
804
449
  batFunctionalWhileCharging: true,
805
450
  });
806
451
  return this;
807
452
  }
808
- /**
809
- * Setup the default Basic Information Cluster Server attributes for the server node.
810
- *
811
- * @param {string} deviceName - The name of the device.
812
- * @param {string} serialNumber - The serial number of the device.
813
- * @param {number} [vendorId] - The vendor ID of the device. Default is 0xfff1 (Matter Test VendorId).
814
- * @param {string} [vendorName] - The name of the vendor. Default is 'Matterbridge'.
815
- * @param {number} [productId] - The product ID of the device. Default is 0x8000 (Matter Test ProductId).
816
- * @param {string} [productName] - The name of the product. Default is 'Matterbridge device'.
817
- * @param {number} [softwareVersion] - The software version of the device. Default is 1.
818
- * @param {string} [softwareVersionString] - The software version string of the device. Default is '1.0.0'.
819
- * @param {number} [hardwareVersion] - The hardware version of the device. Default is 1.
820
- * @param {string} [hardwareVersionString] - The hardware version string of the device. Default is '1.0.0'.
821
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
822
- */
823
453
  createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productId = 0x8000, productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
824
454
  this.log.logName = deviceName;
825
455
  this.deviceName = deviceName;
@@ -843,22 +473,6 @@ export class MatterbridgeEndpoint extends Endpoint {
843
473
  }
844
474
  return this;
845
475
  }
846
- /**
847
- * Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
848
- *
849
- * @param {string} deviceName - The name of the device.
850
- * @param {string} serialNumber - The serial number of the device.
851
- * @param {number} [vendorId] - The vendor ID of the device. Default is 0xfff1 (Matter Test VendorId).
852
- * @param {string} [vendorName] - The name of the vendor. Default is 'Matterbridge'.
853
- * @param {string} [productName] - The name of the product. Default is 'Matterbridge device'.
854
- * @param {number} [softwareVersion] - The software version of the device. Default is 1.
855
- * @param {string} [softwareVersionString] - The software version string of the device. Default is '1.0.0'.
856
- * @param {number} [hardwareVersion] - The hardware version of the device. Default is 1.
857
- * @param {string} [hardwareVersionString] - The hardware version string of the device. Default is '1.0.0'.
858
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
859
- *
860
- * @remarks The bridgedNode device type must be added to the deviceTypeList of the Descriptor cluster.
861
- */
862
476
  createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
863
477
  this.log.logName = deviceName;
864
478
  this.deviceName = deviceName;
@@ -891,13 +505,6 @@ export class MatterbridgeEndpoint extends Endpoint {
891
505
  });
892
506
  return this;
893
507
  }
894
- /**
895
- * Creates a default identify cluster server with the specified identify time and type.
896
- *
897
- * @param {number} [identifyTime] - The time to identify the server. Defaults to 0.
898
- * @param {Identify.IdentifyType} [identifyType] - The type of identification. Defaults to Identify.IdentifyType.None.
899
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
900
- */
901
508
  createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
902
509
  this.behaviors.require(MatterbridgeIdentifyServer, {
903
510
  identifyTime,
@@ -905,36 +512,14 @@ export class MatterbridgeEndpoint extends Endpoint {
905
512
  });
906
513
  return this;
907
514
  }
908
- /**
909
- * Creates a default groups cluster server.
910
- *
911
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
912
- */
913
515
  createDefaultGroupsClusterServer() {
914
516
  this.behaviors.require(GroupsServer);
915
517
  return this;
916
518
  }
917
- /**
918
- * Creates a default scenes management cluster server.
919
- *
920
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
921
- *
922
- * @remarks The scenes management cluster server is still provisional and so not yet implemented.
923
- */
924
519
  createDefaultScenesClusterServer() {
925
520
  this.behaviors.require(ScenesManagementServer);
926
521
  return this;
927
522
  }
928
- /**
929
- * Creates a default OnOff cluster server for light devices with feature Lighting.
930
- *
931
- * @param {boolean} [onOff] - The initial state of the OnOff cluster.
932
- * @param {boolean} [globalSceneControl] - The global scene control state.
933
- * @param {number} [onTime] - The on time value.
934
- * @param {number} [offWaitTime] - The off wait time value.
935
- * @param {OnOff.StartUpOnOff | null} [startUpOnOff] - The start-up OnOff state. Null means previous state.
936
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
937
- */
938
523
  createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
939
524
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
940
525
  onOff,
@@ -945,52 +530,24 @@ export class MatterbridgeEndpoint extends Endpoint {
945
530
  });
946
531
  return this;
947
532
  }
948
- /**
949
- * Creates an OnOff cluster server without features.
950
- *
951
- * @param {boolean} [onOff] - The initial state of the OnOff cluster.
952
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
953
- */
954
533
  createOnOffClusterServer(onOff = false) {
955
534
  this.behaviors.require(MatterbridgeOnOffServer, {
956
535
  onOff,
957
536
  });
958
537
  return this;
959
538
  }
960
- /**
961
- * Creates a DeadFront OnOff cluster server with feature DeadFrontBehavior.
962
- *
963
- * @param {boolean} [onOff] - The initial state of the OnOff cluster.
964
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
965
- */
966
539
  createDeadFrontOnOffClusterServer(onOff = false) {
967
540
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
968
541
  onOff,
969
542
  });
970
543
  return this;
971
544
  }
972
- /**
973
- * Creates an OffOnly OnOff cluster server with feature OffOnly.
974
- *
975
- * @param {boolean} [onOff] - The initial state of the OnOff cluster.
976
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
977
- */
978
545
  createOffOnlyOnOffClusterServer(onOff = false) {
979
546
  this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
980
547
  onOff,
981
548
  });
982
549
  return this;
983
550
  }
984
- /**
985
- * Creates a default level control cluster server for light devices with feature OnOff and Lighting.
986
- *
987
- * @param {number} [currentLevel] - The current level (default: 254).
988
- * @param {number} [minLevel] - The minimum level (default: 1).
989
- * @param {number} [maxLevel] - The maximum level (default: 254).
990
- * @param {number | null} [onLevel] - The on level (default: null).
991
- * @param {number | null} [startUpCurrentLevel] - The startUp on level (default: null).
992
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
993
- */
994
551
  createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
995
552
  this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
996
553
  currentLevel,
@@ -1006,13 +563,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1006
563
  });
1007
564
  return this;
1008
565
  }
1009
- /**
1010
- * Creates a level control cluster server without features.
1011
- *
1012
- * @param {number} [currentLevel] - The current level (default: 254).
1013
- * @param {number | null} [onLevel] - The on level (default: null).
1014
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1015
- */
1016
566
  createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
1017
567
  this.behaviors.require(MatterbridgeLevelControlServer, {
1018
568
  currentLevel,
@@ -1024,25 +574,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1024
574
  });
1025
575
  return this;
1026
576
  }
1027
- /**
1028
- * Creates a default color control cluster server with features Xy, HueSaturation and ColorTemperature.
1029
- *
1030
- * @param {number} currentX - The current X value (range 0-65279).
1031
- * @param {number} currentY - The current Y value (range 0-65279).
1032
- * @param {number} currentHue - The current hue value (range: 0-254).
1033
- * @param {number} currentSaturation - The current saturation value (range: 0-254).
1034
- * @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
1035
- * @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
1036
- * @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
1037
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1038
- *
1039
- * @remarks colorMode and enhancedColorMode persist across restarts.
1040
- * @remarks currentHue and currentSaturation persist across restarts.
1041
- * @remarks currentX and currentY persist across restarts.
1042
- * @remarks colorTemperatureMireds persists across restarts.
1043
- * @remarks startUpColorTemperatureMireds persists across restarts.
1044
- * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1045
- */
1046
577
  createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1047
578
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
1048
579
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -1065,25 +596,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1065
596
  });
1066
597
  return this;
1067
598
  }
1068
- /**
1069
- * Creates a Xy color control cluster server with feature Xy and ColorTemperature.
1070
- *
1071
- * @param {number} currentX - The current X value (range 0-65279).
1072
- * @param {number} currentY - The current Y value (range 0-65279).
1073
- * @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
1074
- * @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
1075
- * @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
1076
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1077
- *
1078
- * @remarks
1079
- * From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
1080
- *
1081
- * @remarks colorMode and enhancedColorMode persist across restarts.
1082
- * @remarks currentX and currentY persist across restarts.
1083
- * @remarks colorTemperatureMireds persists across restarts.
1084
- * @remarks startUpColorTemperatureMireds persists across restarts.
1085
- * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1086
- */
1087
599
  createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1088
600
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
1089
601
  colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
@@ -1104,22 +616,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1104
616
  });
1105
617
  return this;
1106
618
  }
1107
- /**
1108
- * Creates a default hue and saturation control cluster server with feature HueSaturation and ColorTemperature.
1109
- *
1110
- * @param {number} currentHue - The current hue value (range: 0-254).
1111
- * @param {number} currentSaturation - The current saturation value (range: 0-254).
1112
- * @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
1113
- * @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
1114
- * @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
1115
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1116
- *
1117
- * @remarks colorMode and enhancedColorMode persist across restarts.
1118
- * @remarks currentHue and currentSaturation persist across restarts.
1119
- * @remarks colorTemperatureMireds persists across restarts.
1120
- * @remarks startUpColorTemperatureMireds persists across restarts.
1121
- * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1122
- */
1123
619
  createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1124
620
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
1125
621
  colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
@@ -1140,20 +636,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1140
636
  });
1141
637
  return this;
1142
638
  }
1143
- /**
1144
- * Creates a color temperature color control cluster server with feature ColorTemperature.
1145
- * This cluster server is used for devices that only support color temperature control.
1146
- *
1147
- * @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
1148
- * @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
1149
- * @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
1150
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1151
- *
1152
- * @remarks colorMode and enhancedColorMode persist across restarts.
1153
- * @remarks colorTemperatureMireds persists across restarts.
1154
- * @remarks startUpColorTemperatureMireds persists across restarts.
1155
- * @remarks coupleColorTempToLevelMinMireds persists across restarts.
1156
- */
1157
639
  createCtColorControlClusterServer(colorTemperatureMireds = 250, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
1158
640
  this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
1159
641
  colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
@@ -1172,34 +654,15 @@ export class MatterbridgeEndpoint extends Endpoint {
1172
654
  });
1173
655
  return this;
1174
656
  }
1175
- /**
1176
- * Configures the color control mode for the device.
1177
- *
1178
- * @param {ColorControl.ColorMode} colorMode - The color mode to set.
1179
- *
1180
- * @remarks colorMode and enhancedColorMode persist across restarts.
1181
- */
1182
657
  async configureColorControlMode(colorMode) {
1183
658
  if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
1184
659
  await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
1185
660
  await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
1186
661
  }
1187
662
  }
1188
- /**
1189
- * Creates a default window covering cluster server with feature Lift and PositionAwareLift.
1190
- *
1191
- * @param {number} positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1192
- * @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.Rollershade). Must support feature Lift.
1193
- * @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.RollerShade). Must support feature Lift.
1194
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1195
- *
1196
- * @remarks mode attributes is writable and persists across restarts.
1197
- * currentPositionLiftPercent100ths persists across restarts.
1198
- * configStatus attributes persists across restarts.
1199
- */
1200
663
  createDefaultWindowCoveringClusterServer(positionPercent100ths, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade) {
1201
664
  this.behaviors.require(MatterbridgeLiftWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
1202
- type, // Must support feature Lift
665
+ type,
1203
666
  numberOfActuationsLift: 0,
1204
667
  configStatus: {
1205
668
  operational: true,
@@ -1207,33 +670,20 @@ export class MatterbridgeEndpoint extends Endpoint {
1207
670
  liftMovementReversed: false,
1208
671
  liftPositionAware: true,
1209
672
  tiltPositionAware: false,
1210
- liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
1211
- tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
673
+ liftEncoderControlled: false,
674
+ tiltEncoderControlled: false,
1212
675
  },
1213
676
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
1214
- endProductType, // Must support feature Lift
677
+ endProductType,
1215
678
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
1216
- targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1217
- currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
679
+ targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
680
+ currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
1218
681
  });
1219
682
  return this;
1220
683
  }
1221
- /**
1222
- * Creates a default window covering cluster server with features Lift, PositionAwareLift, Tilt, PositionAwareTilt.
1223
- *
1224
- * @param {number} positionLiftPercent100ths - The lift position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1225
- * @param {number} positionTiltPercent100ths - The tilt position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
1226
- * @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.TiltBlindLift). Must support features Lift and Tilt.
1227
- * @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.InteriorBlind). Must support features Lift and Tilt.
1228
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1229
- *
1230
- * @remarks mode attributes is writable and persists across restarts.
1231
- * currentPositionTiltPercent100ths persists across restarts.
1232
- * configStatus attributes persists across restarts.
1233
- */
1234
684
  createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind) {
1235
685
  this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt), {
1236
- type, // Must support features Lift and Tilt
686
+ type,
1237
687
  numberOfActuationsLift: 0,
1238
688
  numberOfActuationsTilt: 0,
1239
689
  configStatus: {
@@ -1242,23 +692,19 @@ export class MatterbridgeEndpoint extends Endpoint {
1242
692
  liftMovementReversed: false,
1243
693
  liftPositionAware: true,
1244
694
  tiltPositionAware: true,
1245
- liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
1246
- tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
695
+ liftEncoderControlled: false,
696
+ tiltEncoderControlled: false,
1247
697
  },
1248
698
  operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
1249
- endProductType, // Must support features Lift and Tilt
699
+ endProductType,
1250
700
  mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
1251
- targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1252
- currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1253
- targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
1254
- currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
701
+ targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
702
+ currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
703
+ targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
704
+ currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
1255
705
  });
1256
706
  return this;
1257
707
  }
1258
- /**
1259
- * Sets the window covering lift target position as the current position and stops the movement.
1260
- *
1261
- */
1262
708
  async setWindowCoveringTargetAsCurrentAndStopped() {
1263
709
  const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
1264
710
  if (isValidNumber(position, 0, 10000)) {
@@ -1278,13 +724,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1278
724
  this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
1279
725
  }
1280
726
  }
1281
- /**
1282
- * Sets the lift current and target position and the status of a window covering.
1283
- *
1284
- * @param {number} current - The current position of the window covering.
1285
- * @param {number} target - The target position of the window covering.
1286
- * @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
1287
- */
1288
727
  async setWindowCoveringCurrentTargetStatus(current, target, status) {
1289
728
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
1290
729
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
@@ -1295,11 +734,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1295
734
  }, this.log);
1296
735
  this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
1297
736
  }
1298
- /**
1299
- * Sets the status of the window covering.
1300
- *
1301
- * @param {WindowCovering.MovementStatus} status - The movement status to set.
1302
- */
1303
737
  async setWindowCoveringStatus(status) {
1304
738
  await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
1305
739
  global: status,
@@ -1308,11 +742,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1308
742
  }, this.log);
1309
743
  this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
1310
744
  }
1311
- /**
1312
- * Retrieves the status of the window covering.
1313
- *
1314
- * @returns {WindowCovering.MovementStatus | undefined} The movement status of the window covering, or undefined if not available.
1315
- */
1316
745
  getWindowCoveringStatus() {
1317
746
  const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
1318
747
  if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
@@ -1320,12 +749,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1320
749
  return status.global;
1321
750
  }
1322
751
  }
1323
- /**
1324
- * Sets the lift target and current position of the window covering.
1325
- *
1326
- * @param {number} liftPosition - The position to set, specified as a number.
1327
- * @param {number} [tiltPosition] - The tilt position to set, specified as a number.
1328
- */
1329
752
  async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
1330
753
  await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', liftPosition, this.log);
1331
754
  await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', liftPosition, this.log);
@@ -1336,57 +759,31 @@ export class MatterbridgeEndpoint extends Endpoint {
1336
759
  this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
1337
760
  }
1338
761
  }
1339
- /**
1340
- * Creates a default thermostat cluster server with features Heating, Cooling and AutoMode.
1341
- *
1342
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1343
- * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1344
- * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1345
- * @param {number} [minSetpointDeadBand] - The minimum setpoint dead band value. Defaults to 1°.
1346
- * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
1347
- * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
1348
- * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
1349
- * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
1350
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1351
- */
1352
762
  createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1353
763
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
1354
764
  localTemperature: localTemperature * 100,
1355
765
  systemMode: Thermostat.SystemMode.Auto,
1356
766
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
1357
- // Thermostat.Feature.Heating
1358
767
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1359
768
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1360
769
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1361
770
  absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
1362
771
  absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
1363
- // Thermostat.Feature.Cooling
1364
772
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1365
773
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1366
774
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1367
775
  absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
1368
776
  absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
1369
- // Thermostat.Feature.AutoMode
1370
777
  minSetpointDeadBand: minSetpointDeadBand * 100,
1371
778
  thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
1372
779
  });
1373
780
  return this;
1374
781
  }
1375
- /**
1376
- * Creates a default heating thermostat cluster server with feature Heating.
1377
- *
1378
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1379
- * @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
1380
- * @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
1381
- * @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
1382
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1383
- */
1384
782
  createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
1385
783
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
1386
784
  localTemperature: localTemperature * 100,
1387
785
  systemMode: Thermostat.SystemMode.Heat,
1388
786
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
1389
- // Thermostat.Feature.Heating
1390
787
  occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
1391
788
  minHeatSetpointLimit: minHeatSetpointLimit * 100,
1392
789
  maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
@@ -1395,21 +792,11 @@ export class MatterbridgeEndpoint extends Endpoint {
1395
792
  });
1396
793
  return this;
1397
794
  }
1398
- /**
1399
- * Creates a default cooling thermostat cluster server with feature Cooling.
1400
- *
1401
- * @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
1402
- * @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
1403
- * @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
1404
- * @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
1405
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1406
- */
1407
795
  createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
1408
796
  this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
1409
797
  localTemperature: localTemperature * 100,
1410
798
  systemMode: Thermostat.SystemMode.Cool,
1411
799
  controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
1412
- // Thermostat.Feature.Cooling
1413
800
  occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
1414
801
  minCoolSetpointLimit: minCoolSetpointLimit * 100,
1415
802
  maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
@@ -1418,16 +805,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1418
805
  });
1419
806
  return this;
1420
807
  }
1421
- /**
1422
- * Creates a default thermostat user interface configuration cluster server.
1423
- *
1424
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1425
- * @remarks
1426
- * The default values are:
1427
- * - temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius (writeble).
1428
- * - keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout (writeble).
1429
- * - scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted (writeble).
1430
- */
1431
808
  createDefaultThermostatUserInterfaceConfigurationClusterServer() {
1432
809
  this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
1433
810
  temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
@@ -1436,159 +813,69 @@ export class MatterbridgeEndpoint extends Endpoint {
1436
813
  });
1437
814
  return this;
1438
815
  }
1439
- /**
1440
- * Creates a default fan control cluster server with features Auto, and Step.
1441
- *
1442
- * @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1443
- * @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
1444
- * @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
1445
- * @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
1446
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1447
- *
1448
- * @remarks
1449
- * - fanmode is writable and persists across reboots.
1450
- * - fanModeSequence is fixed.
1451
- * - percentSetting is writable.
1452
- */
1453
816
  createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0) {
1454
817
  this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.Auto, FanControl.Feature.Step), {
1455
- fanMode, // Writable and persistent attribute
1456
- fanModeSequence, // Fixed attribute
1457
- percentSetting, // Writable attribute
818
+ fanMode,
819
+ fanModeSequence,
820
+ percentSetting,
1458
821
  percentCurrent,
1459
822
  });
1460
823
  return this;
1461
824
  }
1462
- /**
1463
- * Creates a fan control cluster server with features MultiSpeed, Auto, and Step.
1464
- *
1465
- * @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1466
- * @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
1467
- * @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
1468
- * @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
1469
- * @param {number} [speedMax] - The maximum speed setting. Defaults to 10.
1470
- * @param {number} [speedSetting] - The initial speed setting. Defaults to 0.
1471
- * @param {number} [speedCurrent] - The initial speed current. Defaults to 0.
1472
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1473
- *
1474
- * @remarks
1475
- * - fanmode is writable and persists across reboots.
1476
- * - fanModeSequence is fixed.
1477
- * - percentSetting is writable.
1478
- * - speedMax is fixed.
1479
- * - speedSetting is writable.
1480
- */
1481
825
  createMultiSpeedFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0, speedMax = 10, speedSetting = 0, speedCurrent = 0) {
1482
826
  this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
1483
- fanMode, // Writable and persistent attribute
1484
- fanModeSequence, // Fixed attribute
1485
- percentSetting, // Writable attribute
827
+ fanMode,
828
+ fanModeSequence,
829
+ percentSetting,
1486
830
  percentCurrent,
1487
- // MultiSpeed feature
1488
- speedMax, // Fixed attribute
1489
- speedSetting, // Writable attribute
831
+ speedMax,
832
+ speedSetting,
1490
833
  speedCurrent,
1491
834
  });
1492
835
  return this;
1493
836
  }
1494
- /**
1495
- * Creates a base fan control cluster server without features.
1496
- *
1497
- * @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
1498
- * @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHigh`.
1499
- * @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
1500
- * @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
1501
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1502
- *
1503
- * @remarks
1504
- * fanmode is writable and persists across reboots.
1505
- * fanModeSequence is fixed.
1506
- * percentSetting is writable.
1507
- */
1508
837
  createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHigh, percentSetting = 0, percentCurrent = 0) {
1509
838
  this.behaviors.require(FanControlServer, {
1510
- fanMode, // Writable and persistent attribute
1511
- fanModeSequence, // Fixed attribute
1512
- percentSetting, // Writable attribute
839
+ fanMode,
840
+ fanModeSequence,
841
+ percentSetting,
1513
842
  percentCurrent,
1514
843
  });
1515
844
  return this;
1516
845
  }
1517
- /**
1518
- * Creates a default HEPA Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
1519
- * It supports ResourceMonitoring.Feature.Condition and ResourceMonitoring.Feature.ReplacementProductList.
1520
- *
1521
- * @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
1522
- * @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
1523
- * @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
1524
- *
1525
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1526
- */
1527
- createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
1528
- this.behaviors.require(HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
1529
- condition: 100, // Feature.Condition
1530
- degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
846
+ createDefaultHepaFilterMonitoringClusterServer(condition = 100, changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = true, lastChangedTime = null, replacementProductList = []) {
847
+ this.behaviors.require(MatterbridgeHepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, ResourceMonitoring.Feature.ReplacementProductList), {
848
+ condition,
849
+ degradationDirection: ResourceMonitoring.DegradationDirection.Down,
850
+ replacementProductList,
1531
851
  changeIndication,
1532
852
  inPlaceIndicator,
1533
853
  lastChangedTime,
1534
- replacementProductList: [], // Feature.ReplacementProductList
1535
854
  });
1536
855
  return this;
1537
856
  }
1538
- /**
1539
- * Creates a default Activated Carbon Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
1540
- *
1541
- * @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
1542
- * @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
1543
- * @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
1544
- *
1545
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1546
- */
1547
- createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
1548
- this.behaviors.require(ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
1549
- condition: 100, // Feature.Condition
1550
- degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
857
+ createDefaultActivatedCarbonFilterMonitoringClusterServer(condition = 100, changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = true, lastChangedTime = null, replacementProductList = []) {
858
+ this.behaviors.require(MatterbridgeActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, ResourceMonitoring.Feature.ReplacementProductList), {
859
+ condition,
860
+ degradationDirection: ResourceMonitoring.DegradationDirection.Down,
861
+ replacementProductList,
1551
862
  changeIndication,
1552
863
  inPlaceIndicator,
1553
864
  lastChangedTime,
1554
- replacementProductList: [], // Feature.ReplacementProductList
1555
865
  });
1556
866
  return this;
1557
867
  }
1558
- /**
1559
- * Creates a default door lock cluster server.
1560
- *
1561
- * @param {DoorLock.LockState} [lockState] - The initial state of the lock (default: Locked).
1562
- * @param {DoorLock.LockType} [lockType] - The type of the lock (default: DeadBolt).
1563
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1564
- *
1565
- * @remarks
1566
- * All operating modes NOT supported by a lock SHALL be set to one. The value of the OperatingMode enumeration defines the related bit to be set.
1567
- */
1568
868
  createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
1569
869
  this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
1570
870
  lockState,
1571
871
  lockType,
1572
872
  actuatorEnabled: false,
1573
873
  operatingMode: DoorLock.OperatingMode.Normal,
1574
- // Special case of inverted bitmap: add also alwaysSet = 2047
1575
874
  supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
1576
875
  alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
1577
876
  });
1578
877
  return this;
1579
878
  }
1580
- /**
1581
- * Creates a default Mode Select cluster server.
1582
- *
1583
- * @param {string} description - The description of the mode select cluster.
1584
- * @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
1585
- * @param {number} [currentMode] - The current mode (default: 0).
1586
- * @param {number} [startUpMode] - The startup mode (default: 0).
1587
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1588
- *
1589
- * @remarks
1590
- * endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
1591
- */
1592
879
  createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
1593
880
  this.behaviors.require(MatterbridgeModeSelectServer, {
1594
881
  description: description,
@@ -1599,35 +886,21 @@ export class MatterbridgeEndpoint extends Endpoint {
1599
886
  });
1600
887
  return this;
1601
888
  }
1602
- /**
1603
- * Creates the default Valve Configuration And Control cluster server with features Level.
1604
- *
1605
- * @param {ValveConfigurationAndControl.ValveState} [valveState] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
1606
- * @param {number} [valveLevel] - The valve level to set. Defaults to 0.
1607
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1608
- */
1609
889
  createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
1610
890
  this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
1611
891
  currentState: valveState,
1612
892
  targetState: valveState,
1613
893
  openDuration: null,
1614
- defaultOpenDuration: null, // Writable and persistent across restarts
894
+ defaultOpenDuration: null,
1615
895
  remainingDuration: null,
1616
896
  valveFault: { generalFault: false, blocked: false, leaking: false, notConnected: false, shortCircuit: false, currentExceeded: false },
1617
- // Feature.Level
1618
897
  currentLevel: valveLevel,
1619
898
  targetLevel: valveLevel,
1620
- defaultOpenLevel: 100, // Writable and persistent across restarts
1621
- levelStep: 1, // Fixed
899
+ defaultOpenLevel: 100,
900
+ levelStep: 1,
1622
901
  });
1623
902
  return this;
1624
903
  }
1625
- /**
1626
- * Creates the default PumpConfigurationAndControl cluster server with features ConstantSpeed.
1627
- *
1628
- * @param {PumpConfigurationAndControl.OperationMode} [pumpMode] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
1629
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1630
- */
1631
904
  createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
1632
905
  this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
1633
906
  minConstSpeed: null,
@@ -1642,13 +915,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1642
915
  });
1643
916
  return this;
1644
917
  }
1645
- /**
1646
- * Creates the default SmokeCOAlarm Cluster Server with features SmokeAlarm and CoAlarm.
1647
- *
1648
- * @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1649
- * @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1650
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1651
- */
1652
918
  createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
1653
919
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
1654
920
  events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -1664,12 +930,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1664
930
  });
1665
931
  return this;
1666
932
  }
1667
- /**
1668
- * Creates a smoke only SmokeCOAlarm Cluster Server with features SmokeAlarm.
1669
- *
1670
- * @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1671
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1672
- */
1673
933
  createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
1674
934
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
1675
935
  events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -1684,12 +944,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1684
944
  });
1685
945
  return this;
1686
946
  }
1687
- /**
1688
- * Creates a co only SmokeCOAlarm Cluster Server with features CoAlarm.
1689
- *
1690
- * @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
1691
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1692
- */
1693
947
  createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
1694
948
  this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
1695
949
  events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
@@ -1704,15 +958,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1704
958
  });
1705
959
  return this;
1706
960
  }
1707
- /**
1708
- * Creates a default momentary switch cluster server with features MomentarySwitch, MomentarySwitchRelease, MomentarySwitchLongPress and MomentarySwitchMultiPress
1709
- * and events initialPress, longPress, shortRelease, longRelease, multiPressOngoing, multiPressComplete.
1710
- *
1711
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1712
- *
1713
- * @remarks
1714
- * This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
1715
- */
1716
961
  createDefaultSwitchClusterServer() {
1717
962
  this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
1718
963
  events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
@@ -1723,14 +968,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1723
968
  });
1724
969
  return this;
1725
970
  }
1726
- /**
1727
- * Creates a default momentary switch cluster server with feature MomentarySwitch and event initialPress.
1728
- *
1729
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1730
- *
1731
- * @remarks
1732
- * This method adds a cluster server with default momentary switch features and configuration suitable for Single press automations.
1733
- */
1734
971
  createDefaultMomentarySwitchClusterServer() {
1735
972
  this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch).enable({
1736
973
  events: { initialPress: true },
@@ -1740,14 +977,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1740
977
  });
1741
978
  return this;
1742
979
  }
1743
- /**
1744
- * Creates a default latching switch cluster server with features LatchingSwitch.
1745
- *
1746
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1747
- *
1748
- * @remarks
1749
- * This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
1750
- */
1751
980
  createDefaultLatchingSwitchClusterServer() {
1752
981
  this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
1753
982
  events: { switchLatched: true },
@@ -1757,13 +986,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1757
986
  });
1758
987
  return this;
1759
988
  }
1760
- /**
1761
- * Triggers a switch event on the specified endpoint.
1762
- *
1763
- * @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
1764
- * @param {AnsiLogger} log - Optional logger to log the event.
1765
- * @returns {boolean} - A boolean indicating whether the event was successfully triggered.
1766
- */
1767
989
  async triggerSwitchEvent(event, log) {
1768
990
  if (this.maybeNumber === undefined) {
1769
991
  this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
@@ -1823,30 +1045,10 @@ export class MatterbridgeEndpoint extends Endpoint {
1823
1045
  }
1824
1046
  return true;
1825
1047
  }
1826
- /**
1827
- * Creates a default OperationalState Cluster Server.
1828
- *
1829
- * @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state.
1830
- *
1831
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1832
- */
1833
1048
  createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
1834
1049
  this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
1835
1050
  return this;
1836
1051
  }
1837
- /**
1838
- * Creates a default boolean state cluster server.
1839
- * The stateChange event is enabled.
1840
- *
1841
- * @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
1842
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1843
- *
1844
- * @remarks
1845
- * Water Leak Detector: true = leak, false = no leak
1846
- * Water Freeze Detector: true = freeze, false = no freeze
1847
- * Rain Sensor: true = rain, false = no rain
1848
- * Contact Sensor: true = closed or contact, false = open or no contact
1849
- */
1850
1052
  createDefaultBooleanStateClusterServer(contact) {
1851
1053
  this.behaviors.require(BooleanStateServer.enable({
1852
1054
  events: { stateChange: true },
@@ -1855,22 +1057,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1855
1057
  });
1856
1058
  return this;
1857
1059
  }
1858
- /**
1859
- * Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
1860
- *
1861
- * Features:
1862
- * - Visual
1863
- * - Audible
1864
- * - SensitivityLevel
1865
- *
1866
- * @remarks Supports the enableDisableAlarm command.
1867
- *
1868
- * @param {boolean} [sensorFault] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
1869
- * @param {number} [currentSensitivityLevel] - The current sensitivity level. Defaults to `0` if not provided.
1870
- * @param {number} [supportedSensitivityLevels] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
1871
- * @param {number} [defaultSensitivityLevel] - The default sensitivity level. Defaults to `0` if not provided.
1872
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1873
- */
1874
1060
  createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
1875
1061
  this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
1876
1062
  events: { alarmsStateChanged: true, sensorFault: true },
@@ -1885,51 +1071,18 @@ export class MatterbridgeEndpoint extends Endpoint {
1885
1071
  });
1886
1072
  return this;
1887
1073
  }
1888
- /**
1889
- * Creates a default Device Energy Management Cluster Server with feature PowerForecastReporting and with the specified ESA type, ESA canGenerate, ESA state, and power limits.
1890
- *
1891
- * @param {DeviceEnergyManagement.EsaType} [esaType] - The ESA type. Defaults to `DeviceEnergyManagement.EsaType.Other`.
1892
- * @param {boolean} [esaCanGenerate] - Indicates if the ESA can generate energy. Defaults to `false`.
1893
- * @param {DeviceEnergyManagement.EsaState} [esaState] - The ESA state. Defaults to `DeviceEnergyManagement.EsaState.Online`.
1894
- * @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
1895
- * @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
1896
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1897
- *
1898
- * @remarks
1899
- * - The forecast attribute is set to null, indicating that there is no forecast currently available.
1900
- * - The ESA type and canGenerate attributes are fixed and cannot be changed after creation.
1901
- * - The ESA state is set to Online by default.
1902
- * - The absolute minimum and maximum power attributes are set to 0 by default.
1903
- * - For example, a battery storage inverter that can charge its battery at a maximum power of 2000W and can
1904
- * discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
1905
- */
1906
1074
  createDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
1907
1075
  this.behaviors.require(MatterbridgeDeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.PowerAdjustment), {
1908
- forecast: null, // A null value indicates that there is no forecast currently available
1909
- powerAdjustmentCapability: null, // A null value indicates that no power adjustment is currently possible, and nor is any adjustment currently active
1910
- esaType, // Fixed attribute
1911
- esaCanGenerate, // Fixed attribute
1076
+ forecast: null,
1077
+ powerAdjustmentCapability: null,
1078
+ esaType,
1079
+ esaCanGenerate,
1912
1080
  esaState,
1913
1081
  absMinPower,
1914
1082
  absMaxPower,
1915
1083
  });
1916
1084
  return this;
1917
1085
  }
1918
- /**
1919
- * Creates a default EnergyManagementMode Cluster Server.
1920
- *
1921
- * @param {number} [currentMode] - The current mode of the EnergyManagementMode cluster. Defaults to mode 1 (DeviceEnergyManagementMode.ModeTag.NoOptimization).
1922
- * @param {EnergyManagementMode.ModeOption[]} [supportedModes] - The supported modes for the DeviceEnergyManagementMode cluster. The attribute is fixed and defaults to a predefined set of cluster modes.
1923
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1924
- *
1925
- * @remarks
1926
- * A few examples of Device Energy Management modes and their mode tags are provided below.
1927
- * - For the "No Energy Management (Forecast reporting only)" mode, tags: 0x4000 (NoOptimization).
1928
- * - For the "Device Energy Management" mode, tags: 0x4001 (DeviceOptimization).
1929
- * - For the "Home Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization).
1930
- * - For the "Grid Energy Management" mode, tags: 0x4003 (GridOptimization).
1931
- * - For the "Full Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization), 0x4003 (GridOptimization).
1932
- */
1933
1086
  createDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
1934
1087
  this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, {
1935
1088
  supportedModes: supportedModes ?? [
@@ -1950,27 +1103,15 @@ export class MatterbridgeEndpoint extends Endpoint {
1950
1103
  mode: 5,
1951
1104
  modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.DeviceOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }, { value: DeviceEnergyManagementMode.ModeTag.GridOptimization }],
1952
1105
  },
1953
- ], // Fixed attribute
1106
+ ],
1954
1107
  currentMode: currentMode ?? 1,
1955
1108
  });
1956
1109
  return this;
1957
1110
  }
1958
- /**
1959
- * Creates a default Power Topology Cluster Server with feature TreeTopology (the endpoint provides or consumes power to/from itself and its child endpoints). Only needed for an electricalSensor device type.
1960
- *
1961
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1962
- */
1963
1111
  createDefaultPowerTopologyClusterServer() {
1964
1112
  this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
1965
1113
  return this;
1966
1114
  }
1967
- /**
1968
- * Creates a default Electrical Energy Measurement Cluster Server with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
1969
- *
1970
- * @param {number} energyImported - The total consumption value in mW/h.
1971
- * @param {number} energyExported - The total production value in mW/h.
1972
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1973
- */
1974
1115
  createDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
1975
1116
  this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
1976
1117
  accuracy: {
@@ -1986,15 +1127,6 @@ export class MatterbridgeEndpoint extends Endpoint {
1986
1127
  });
1987
1128
  return this;
1988
1129
  }
1989
- /**
1990
- * Creates a default Electrical Power Measurement Cluster Server with features AlternatingCurrent.
1991
- *
1992
- * @param {number} voltage - The voltage value in millivolts.
1993
- * @param {number} current - The current value in milliamperes.
1994
- * @param {number} power - The power value in milliwatts.
1995
- * @param {number} frequency - The frequency value in millihertz.
1996
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
1997
- */
1998
1130
  createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
1999
1131
  this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
2000
1132
  powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
@@ -2036,124 +1168,36 @@ export class MatterbridgeEndpoint extends Endpoint {
2036
1168
  });
2037
1169
  return this;
2038
1170
  }
2039
- /**
2040
- * Creates a default TemperatureMeasurement cluster server.
2041
- *
2042
- * @param {number | null} measuredValue - The measured value of the temperature x 100.
2043
- * @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
2044
- * @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
2045
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2046
- */
2047
1171
  createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
2048
1172
  this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
2049
1173
  return this;
2050
1174
  }
2051
- /**
2052
- * Creates a default RelativeHumidityMeasurement cluster server.
2053
- *
2054
- * @param {number | null} measuredValue - The measured value of the relative humidity x 100.
2055
- * @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
2056
- * @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
2057
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2058
- */
2059
1175
  createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
2060
1176
  this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
2061
1177
  return this;
2062
1178
  }
2063
- /**
2064
- * Creates a default PressureMeasurement cluster server.
2065
- *
2066
- * @param {number | null} measuredValue - The measured value for the pressure in kPa x 10.
2067
- * @param {number | null} minMeasuredValue - The minimum measured value for the pressure in kPa x 10.
2068
- * @param {number | null} maxMeasuredValue - The maximum measured value for the pressure in kPa x 10.
2069
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2070
- *
2071
- * @remarks
2072
- * - MeasuredValue = 10 x Pressure in kPa
2073
- * - MeasuredValue = 1 x Pressure in hPa
2074
- * - MeasuredValue = 33.8639 x Pressure in inHg
2075
- *
2076
- * Conversion:
2077
- * - 1 kPa = 10 hPa
2078
- * - 1 inHg = 33.8639 hPa
2079
- */
2080
1179
  createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
2081
1180
  this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
2082
1181
  return this;
2083
1182
  }
2084
- /**
2085
- * Creates a default IlluminanceMeasurement cluster server.
2086
- *
2087
- * @param {number | null} measuredValue - The measured value of illuminance.
2088
- * @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
2089
- * @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
2090
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2091
- *
2092
- * @remarks The default value for the illuminance measurement is null.
2093
- * This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
2094
- * • MeasuredValue = 10,000 x log10(illuminance) + 1,
2095
- * where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
2096
- * • 0 indicates a value of illuminance that is too low to be measured
2097
- * • null indicates that the illuminance measurement is invalid.
2098
- *
2099
- * - Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
2100
- * - Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
2101
- */
2102
1183
  createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
2103
1184
  this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
2104
1185
  return this;
2105
1186
  }
2106
- /**
2107
- * Creates a default FlowMeasurement cluster server.
2108
- *
2109
- * @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
2110
- * @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
2111
- * @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
2112
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2113
- */
2114
1187
  createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
2115
1188
  this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
2116
1189
  return this;
2117
1190
  }
2118
- /**
2119
- * Creates a default OccupancySensing cluster server with feature PassiveInfrared.
2120
- *
2121
- * @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
2122
- * @param {number} holdTime - The hold time in seconds. Default is 30.
2123
- * @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
2124
- * @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
2125
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2126
- *
2127
- * @remarks The default value for the occupancy sensor type is PIR.
2128
- */
2129
1191
  createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
2130
1192
  this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
2131
1193
  return this;
2132
1194
  }
2133
- /**
2134
- * Creates a default AirQuality cluster server.
2135
- *
2136
- * @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
2137
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2138
- */
2139
1195
  createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
2140
1196
  this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
2141
1197
  airQuality,
2142
1198
  });
2143
1199
  return this;
2144
1200
  }
2145
- /**
2146
- * Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature NumericMeasurement.
2147
- *
2148
- * @param {number | null} measuredValue - The measured value of the concentration.
2149
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2150
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2151
- * @param {number} [uncertainty] - The uncertainty value (optional).
2152
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2153
- *
2154
- * @remarks
2155
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2156
- */
2157
1201
  createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
2158
1202
  this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2159
1203
  measuredValue,
@@ -2165,16 +1209,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2165
1209
  });
2166
1210
  return this;
2167
1211
  }
2168
- /**
2169
- * Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature LevelIndication.
2170
-
2171
- * @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
2172
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
2173
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2174
- *
2175
- * @remarks
2176
- * The measurementMedium attribute is fixed and cannot be changed after creation.
2177
- */
2178
1212
  createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2179
1213
  this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
2180
1214
  levelValue,
@@ -2182,17 +1216,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2182
1216
  });
2183
1217
  return this;
2184
1218
  }
2185
- /**
2186
- * Create a default CarbonMonoxideConcentrationMeasurement cluster server with feature NumericMeasurement.
2187
- *
2188
- * @param {number | null} measuredValue - The measured value of the concentration.
2189
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2190
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2191
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2192
- *
2193
- * @remarks
2194
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2195
- */
2196
1219
  createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2197
1220
  this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2198
1221
  measuredValue,
@@ -2204,17 +1227,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2204
1227
  });
2205
1228
  return this;
2206
1229
  }
2207
- /**
2208
- * Create a default CarbonDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
2209
- *
2210
- * @param {number | null} measuredValue - The measured value of the concentration.
2211
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2212
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2213
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2214
- *
2215
- * @remarks
2216
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2217
- */
2218
1230
  createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2219
1231
  this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2220
1232
  measuredValue,
@@ -2226,17 +1238,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2226
1238
  });
2227
1239
  return this;
2228
1240
  }
2229
- /**
2230
- * Create a default FormaldehydeConcentrationMeasurement cluster server with feature NumericMeasurement.
2231
- *
2232
- * @param {number | null} measuredValue - The measured value of the concentration.
2233
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2234
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2235
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2236
- *
2237
- * @remarks
2238
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2239
- */
2240
1241
  createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2241
1242
  this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2242
1243
  measuredValue,
@@ -2248,17 +1249,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2248
1249
  });
2249
1250
  return this;
2250
1251
  }
2251
- /**
2252
- * Create a default Pm1ConcentrationMeasurement cluster server with feature NumericMeasurement.
2253
- *
2254
- * @param {number | null} measuredValue - The measured value of the concentration.
2255
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2256
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2257
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2258
- *
2259
- * @remarks
2260
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2261
- */
2262
1252
  createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2263
1253
  this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2264
1254
  measuredValue,
@@ -2270,17 +1260,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2270
1260
  });
2271
1261
  return this;
2272
1262
  }
2273
- /**
2274
- * Create a default Pm25ConcentrationMeasurement cluster server with feature NumericMeasurement.
2275
- *
2276
- * @param {number | null} measuredValue - The measured value of the concentration.
2277
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2278
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2279
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2280
- *
2281
- * @remarks
2282
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2283
- */
2284
1263
  createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2285
1264
  this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2286
1265
  measuredValue,
@@ -2292,17 +1271,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2292
1271
  });
2293
1272
  return this;
2294
1273
  }
2295
- /**
2296
- * Create a default Pm10ConcentrationMeasurement cluster server with feature NumericMeasurement.
2297
- *
2298
- * @param {number | null} measuredValue - The measured value of the concentration.
2299
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2300
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2301
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2302
- *
2303
- * @remarks
2304
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2305
- */
2306
1274
  createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2307
1275
  this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2308
1276
  measuredValue,
@@ -2314,17 +1282,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2314
1282
  });
2315
1283
  return this;
2316
1284
  }
2317
- /**
2318
- * Create a default OzoneConcentrationMeasurement cluster server with feature NumericMeasurement.
2319
- *
2320
- * @param {number | null} measuredValue - The measured value of the concentration.
2321
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
2322
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2323
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2324
- *
2325
- * @remarks
2326
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2327
- */
2328
1285
  createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2329
1286
  this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2330
1287
  measuredValue,
@@ -2336,17 +1293,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2336
1293
  });
2337
1294
  return this;
2338
1295
  }
2339
- /**
2340
- * Create a default RadonConcentrationMeasurement cluster server with feature NumericMeasurement.
2341
- *
2342
- * @param {number | null} measuredValue - The measured value of the concentration.
2343
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
2344
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2345
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2346
- *
2347
- * @remarks
2348
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2349
- */
2350
1296
  createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2351
1297
  this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2352
1298
  measuredValue,
@@ -2358,17 +1304,6 @@ export class MatterbridgeEndpoint extends Endpoint {
2358
1304
  });
2359
1305
  return this;
2360
1306
  }
2361
- /**
2362
- * Create a default NitrogenDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
2363
- *
2364
- * @param {number | null} measuredValue - The measured value of the concentration.
2365
- * @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
2366
- * @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
2367
- * @returns {this} The current MatterbridgeEndpoint instance for chaining.
2368
- *
2369
- * @remarks
2370
- * The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
2371
- */
2372
1307
  createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
2373
1308
  this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
2374
1309
  measuredValue,
@@ -2381,4 +1316,3 @@ export class MatterbridgeEndpoint extends Endpoint {
2381
1316
  return this;
2382
1317
  }
2383
1318
  }
2384
- //# sourceMappingURL=matterbridgeEndpoint.js.map