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