matterbridge 1.6.8-dev.1 → 1.6.8-dev.2
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 +3 -1
- package/README-SERVICE.md +12 -3
- package/README.md +2 -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.map +1 -0
- package/dist/cluster/export.js +2 -0
- package/dist/cluster/export.js.map +1 -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.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -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.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 +661 -62
- package/dist/matterbridge.js.map +1 -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 +116 -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 +1142 -0
- package/dist/matterbridgeDevice.d.ts.map +1 -0
- package/dist/matterbridgeDevice.js +1009 -8
- package/dist/matterbridgeDevice.js.map +1 -0
- package/dist/matterbridgeDeviceTypes.d.ts +109 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +82 -11
- package/dist/matterbridgeDeviceTypes.js.map +1 -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 +90 -0
- package/dist/matterbridgeEdge.d.ts.map +1 -0
- package/dist/matterbridgeEdge.js +529 -0
- package/dist/matterbridgeEdge.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +1134 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +1134 -11
- package/dist/matterbridgeEndpoint.js.map +1 -0
- package/dist/matterbridgePlatform.d.ts +114 -0
- package/dist/matterbridgePlatform.d.ts.map +1 -0
- package/dist/matterbridgePlatform.js +91 -3
- package/dist/matterbridgePlatform.js.map +1 -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.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 +238 -3
- package/dist/pluginManager.js.map +1 -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.map +1 -0
- package/dist/utils/colorUtils.js +205 -2
- package/dist/utils/colorUtils.js.map +1 -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 +2 -2
- package/package.json +1 -1
|
@@ -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, PumpConfigurationAndControl, PumpConfigurationAndControlCluster, RadonConcentrationMeasurement, RadonConcentrationMeasurementCluster, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, SmokeCoAlarm, SmokeCoAlarmCluster, Switch, SwitchCluster, TemperatureMeasurement, TemperatureMeasurementCluster, Thermostat, ThermostatCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster, UserLabel, UserLabelCluster, ValveConfigurationAndControl, ValveConfigurationAndControlCluster, 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
|
configUrl = undefined;
|
|
@@ -43,12 +70,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
43
70
|
uniqueStorageKey = undefined;
|
|
44
71
|
tagList = undefined;
|
|
45
72
|
subType = '';
|
|
73
|
+
// Maps matter deviceTypes and endpoints
|
|
46
74
|
deviceTypes = new Map();
|
|
47
75
|
clusterServers = new Map();
|
|
48
76
|
clusterClients = new Map();
|
|
49
77
|
commandHandler = new NamedHandler();
|
|
78
|
+
/**
|
|
79
|
+
* Represents a MatterbridgeEndpoint.
|
|
80
|
+
* @constructor
|
|
81
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
|
|
82
|
+
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
83
|
+
*/
|
|
50
84
|
constructor(definition, options = {}, debug = false) {
|
|
51
85
|
let deviceTypeList = [];
|
|
86
|
+
// Get the first DeviceTypeDefinition
|
|
52
87
|
let firstDefinition;
|
|
53
88
|
if (Array.isArray(definition)) {
|
|
54
89
|
firstDefinition = definition[0];
|
|
@@ -61,6 +96,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
61
96
|
firstDefinition = definition;
|
|
62
97
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
63
98
|
}
|
|
99
|
+
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
64
100
|
const deviceTypeDefinitionV8 = {
|
|
65
101
|
name: firstDefinition.name.replace('-', '_'),
|
|
66
102
|
deviceType: firstDefinition.code,
|
|
@@ -79,6 +115,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
79
115
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
80
116
|
};
|
|
81
117
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
118
|
+
// Convert the options to an Endpoint.Options
|
|
82
119
|
const optionsV8 = {
|
|
83
120
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
84
121
|
number: options.endpointId,
|
|
@@ -96,15 +133,27 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
96
133
|
}
|
|
97
134
|
else
|
|
98
135
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
99
|
-
|
|
136
|
+
// console.log('MatterbridgeEndpoint.option', options);
|
|
137
|
+
// console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
|
|
138
|
+
// console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
|
|
139
|
+
// Create the logger
|
|
140
|
+
this.log = new AnsiLogger({ logName: 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
|
|
100
141
|
this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
|
|
101
142
|
`id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
|
|
143
|
+
// Add MatterbridgeBehavior with MatterbridgeBehaviorDevice
|
|
102
144
|
this.behaviors.require(MatterbridgeBehavior, { deviceCommand: new MatterbridgeBehaviorDevice(this.log, this.commandHandler, undefined) });
|
|
103
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* Loads an instance of the MatterbridgeDevice class.
|
|
148
|
+
*
|
|
149
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
|
|
150
|
+
* @returns MatterbridgeDevice instance.
|
|
151
|
+
*/
|
|
104
152
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
105
153
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
106
154
|
}
|
|
107
155
|
static getBehaviourTypesFromClusterServerIds(clusterServerList) {
|
|
156
|
+
// Map Server ClusterId to Behavior.Type
|
|
108
157
|
const behaviorTypes = [];
|
|
109
158
|
clusterServerList.forEach((clusterId) => {
|
|
110
159
|
behaviorTypes.push(MatterbridgeEndpoint.getBehaviourTypeFromClusterServerId(clusterId));
|
|
@@ -112,12 +161,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
112
161
|
return behaviorTypes;
|
|
113
162
|
}
|
|
114
163
|
static getBehaviourTypesFromClusterClientIds(clusterClientList) {
|
|
164
|
+
// Map Client ClusterId to Behavior.Type
|
|
115
165
|
const behaviorTypes = [];
|
|
116
166
|
clusterClientList.forEach((clusterId) => {
|
|
167
|
+
// behaviorTypes.push(MatterbridgeEndpoint.getBehaviourTypeFromClusterClientId(clusterId));
|
|
117
168
|
});
|
|
118
169
|
return behaviorTypes;
|
|
119
170
|
}
|
|
120
171
|
static getBehaviourTypeFromClusterServerId(clusterId, subType) {
|
|
172
|
+
// Map ClusterId to Behavior.Type
|
|
121
173
|
if (clusterId === Identify.Cluster.id)
|
|
122
174
|
return MatterbridgeIdentifyServer;
|
|
123
175
|
if (clusterId === Groups.Cluster.id)
|
|
@@ -229,12 +281,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
229
281
|
return MatterbridgeIdentifyServer;
|
|
230
282
|
}
|
|
231
283
|
static getBehaviourTypeFromClusterClientId(clusterId) {
|
|
284
|
+
// Map ClusterId to Behavior.Type
|
|
232
285
|
return IdentifyBehavior;
|
|
233
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Adds a device type to the list of device types.
|
|
289
|
+
* If the device type is not already present in the list, it will be added.
|
|
290
|
+
*
|
|
291
|
+
* @param {DeviceTypeDefinition} deviceType - The device type to add.
|
|
292
|
+
*/
|
|
234
293
|
addDeviceType(deviceType) {
|
|
235
294
|
if (!this.deviceTypes.has(deviceType.code)) {
|
|
295
|
+
// Keep the Matterbridge internal map
|
|
236
296
|
this.log.debug(`addDeviceType: ${zb}${'0x' + deviceType.code.toString(16).padStart(4, '0')}${db}-${zb}${deviceType.name}${db}`);
|
|
237
297
|
this.deviceTypes.set(deviceType.code, deviceType);
|
|
298
|
+
// Add the device types to the descriptor server
|
|
238
299
|
const deviceTypeList = Array.from(this.deviceTypes.values()).map((dt) => ({
|
|
239
300
|
deviceType: dt.code,
|
|
240
301
|
revision: dt.revision,
|
|
@@ -252,6 +313,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
252
313
|
}
|
|
253
314
|
}
|
|
254
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Adds one or more device types with the required cluster servers and the specified cluster servers.
|
|
318
|
+
*
|
|
319
|
+
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
320
|
+
* @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
|
|
321
|
+
*/
|
|
255
322
|
addDeviceTypeWithClusterServer(deviceTypes, includeServerList) {
|
|
256
323
|
this.log.debug('addDeviceTypeWithClusterServer:');
|
|
257
324
|
deviceTypes.forEach((deviceType) => {
|
|
@@ -274,6 +341,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
274
341
|
});
|
|
275
342
|
this.addClusterServerFromList(this, includeServerList);
|
|
276
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Adds the required 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
|
+
*/
|
|
277
350
|
addRequiredClusterServers(endpoint) {
|
|
278
351
|
const requiredServerList = [];
|
|
279
352
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.id}${db}`);
|
|
@@ -290,6 +363,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
290
363
|
this.addClusterServerFromList(endpoint, requiredServerList);
|
|
291
364
|
return endpoint;
|
|
292
365
|
}
|
|
366
|
+
/**
|
|
367
|
+
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
368
|
+
*
|
|
369
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
370
|
+
* @returns {MatterbridgeEndpoint} The updated endpoint with the required cluster servers added.
|
|
371
|
+
*/
|
|
293
372
|
addOptionalClusterServers(endpoint) {
|
|
294
373
|
const optionalServerList = [];
|
|
295
374
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.id}${db}`);
|
|
@@ -306,6 +385,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
306
385
|
this.addClusterServerFromList(endpoint, optionalServerList);
|
|
307
386
|
return endpoint;
|
|
308
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* Adds a child endpoint with the specified device types and options.
|
|
390
|
+
* If the child endpoint is not already present, it will be created and added.
|
|
391
|
+
* If the child endpoint is already present, the device types will be added to the existing child endpoint.
|
|
392
|
+
*
|
|
393
|
+
* @param {string} endpointName - The name of the new endpoint to add.
|
|
394
|
+
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
395
|
+
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
|
|
396
|
+
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
397
|
+
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```typescript
|
|
401
|
+
* const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
402
|
+
* ```
|
|
403
|
+
*/
|
|
309
404
|
addChildDeviceType(endpointName, deviceTypes, options = {}, debug = false) {
|
|
310
405
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
311
406
|
let child = this.getChildEndpointByName(endpointName);
|
|
@@ -336,6 +431,23 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
336
431
|
}
|
|
337
432
|
return child;
|
|
338
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
436
|
+
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
437
|
+
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
438
|
+
*
|
|
439
|
+
* @param {string} endpointName - The name of the new enpoint to add.
|
|
440
|
+
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
441
|
+
* @param {ClusterId[]} [includeServerList=[]] - The list of cluster IDs to include.
|
|
442
|
+
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
443
|
+
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
444
|
+
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
445
|
+
*
|
|
446
|
+
* @example
|
|
447
|
+
* ```typescript
|
|
448
|
+
* const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
449
|
+
* ```
|
|
450
|
+
*/
|
|
339
451
|
addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
|
|
340
452
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
341
453
|
let child = this.getChildEndpointByName(endpointName);
|
|
@@ -379,6 +491,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
379
491
|
}
|
|
380
492
|
return child;
|
|
381
493
|
}
|
|
494
|
+
/**
|
|
495
|
+
* Retrieves a child endpoint by its name.
|
|
496
|
+
*
|
|
497
|
+
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
498
|
+
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
499
|
+
*/
|
|
382
500
|
getChildEndpointByName(endpointName) {
|
|
383
501
|
return this.parts.find((part) => part.id === endpointName);
|
|
384
502
|
}
|
|
@@ -397,6 +515,8 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
397
515
|
});
|
|
398
516
|
}
|
|
399
517
|
async setBridgedDeviceReachability(reachable) {
|
|
518
|
+
// await this.setAttribute(BridgedDeviceBasicInformationCluster.id, 'reachable', reachable, this.log);
|
|
519
|
+
// await this.triggerEvent(BridgedDeviceBasicInformationCluster.id, 'reachableChanged', { reachableNewValue: reachable }, this.log);
|
|
400
520
|
}
|
|
401
521
|
hasClusterServer(cluster) {
|
|
402
522
|
return this.clusterServers.has(cluster.id);
|
|
@@ -414,15 +534,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
414
534
|
return this.clusterServers.get(clusterId);
|
|
415
535
|
}
|
|
416
536
|
addTagList(endpoint, mfgCode, namespaceId, tag, label) {
|
|
537
|
+
// Do nothing here only for old api compatibility
|
|
417
538
|
}
|
|
418
539
|
addClusterServer(cluster) {
|
|
540
|
+
// console.log('addClusterServer:', cluster.id, cluster.name, cluster.attributes, cluster.events, cluster.commands);
|
|
419
541
|
let features = {};
|
|
542
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
420
543
|
const options = {};
|
|
421
544
|
for (const attribute of Object.values(cluster.attributes)) {
|
|
545
|
+
// console.error('Attribute:', (attribute as any).id, (attribute as any).name, (attribute as any).value);
|
|
546
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
422
547
|
if (attribute.name === 'featureMap') {
|
|
548
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
423
549
|
features = attribute.value;
|
|
550
|
+
// console.log('Cluster', cluster.name, 'FeatureMap:', features);
|
|
551
|
+
// options[(attribute as any).name] = (attribute as any).value;
|
|
424
552
|
}
|
|
553
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
425
554
|
if (attribute.id < 0xfff0) {
|
|
555
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
426
556
|
options[attribute.name] = attribute.value;
|
|
427
557
|
}
|
|
428
558
|
}
|
|
@@ -462,9 +592,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
462
592
|
const behavior = MatterbridgeEndpoint.getBehaviourTypeFromClusterServerId(cluster.id, this.subType);
|
|
463
593
|
this.clusterServers.set(cluster.id, cluster);
|
|
464
594
|
if (cluster.id === BasicInformationCluster.id)
|
|
465
|
-
return;
|
|
595
|
+
return; // Not used in Matterbridge edge for devices. Only on server node.
|
|
466
596
|
this.behaviors.require(behavior, options);
|
|
467
597
|
}
|
|
598
|
+
/**
|
|
599
|
+
* Adds cluster servers to the specified endpoint based on the provided server list.
|
|
600
|
+
*
|
|
601
|
+
* @param {Endpoint} endpoint - The endpoint to add cluster servers to.
|
|
602
|
+
* @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
|
|
603
|
+
* @returns void
|
|
604
|
+
*/
|
|
468
605
|
addClusterServerFromList(endpoint, includeServerList) {
|
|
469
606
|
if (includeServerList.includes(Identify.Cluster.id))
|
|
470
607
|
endpoint.addClusterServer(this.getDefaultIdentifyClusterServer());
|
|
@@ -534,6 +671,8 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
534
671
|
endpoint.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer());
|
|
535
672
|
if (includeServerList.includes(TotalVolatileOrganicCompoundsConcentrationMeasurement.Cluster.id))
|
|
536
673
|
endpoint.addClusterServer(this.getDefaultTvocMeasurementClusterServer());
|
|
674
|
+
// if (includeServerList.includes(DeviceEnergyManagement.Cluster.id)) endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementClusterServer());
|
|
675
|
+
// if (includeServerList.includes(DeviceEnergyManagementMode.Cluster.id)) endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementModeClusterServer());
|
|
537
676
|
}
|
|
538
677
|
async addFixedLabel(label, value) {
|
|
539
678
|
if (!this.clusterServers.get(FixedLabelCluster.id)) {
|
|
@@ -571,6 +710,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
571
710
|
return name;
|
|
572
711
|
return name.charAt(0).toLowerCase() + name.slice(1);
|
|
573
712
|
}
|
|
713
|
+
/**
|
|
714
|
+
* Retrieves the value of the specified attribute from the given endpoint and cluster.
|
|
715
|
+
*
|
|
716
|
+
* @param {ClusterId} clusterId - The ID of the cluster to retrieve the attribute from.
|
|
717
|
+
* @param {string} attribute - The name of the attribute to retrieve.
|
|
718
|
+
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
719
|
+
* @param {MatterbridgeEndpoint} [endpoint] - Optional the child endpoint to retrieve the attribute from.
|
|
720
|
+
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
721
|
+
*/
|
|
722
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
574
723
|
getAttribute(clusterId, attribute, log, endpoint) {
|
|
575
724
|
if (!endpoint)
|
|
576
725
|
endpoint = this;
|
|
@@ -579,6 +728,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
579
728
|
this.log.error(`getAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
580
729
|
return undefined;
|
|
581
730
|
}
|
|
731
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
582
732
|
const state = endpoint.state;
|
|
583
733
|
if (!(clusterName in state)) {
|
|
584
734
|
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}`);
|
|
@@ -593,6 +743,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
593
743
|
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}`);
|
|
594
744
|
return value;
|
|
595
745
|
}
|
|
746
|
+
/**
|
|
747
|
+
* Sets the value of an attribute on a cluster server endpoint.
|
|
748
|
+
*
|
|
749
|
+
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
750
|
+
* @param {string} attribute - The name of the attribute.
|
|
751
|
+
* @param {any} value - The value to set for the attribute.
|
|
752
|
+
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
753
|
+
* @param {MatterbridgeEndpoint} [endpoint] - (Optional) The endpoint to set the attribute on. If not provided, the attribute will be set on the current endpoint.
|
|
754
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
755
|
+
*/
|
|
756
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
596
757
|
async setAttribute(clusterId, attribute, value, log, endpoint) {
|
|
597
758
|
if (!endpoint)
|
|
598
759
|
endpoint = this;
|
|
@@ -601,6 +762,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
601
762
|
this.log.error(`setAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
602
763
|
return false;
|
|
603
764
|
}
|
|
765
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
604
766
|
const state = endpoint.state;
|
|
605
767
|
if (!(clusterName in state)) {
|
|
606
768
|
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}`);
|
|
@@ -620,13 +782,26 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
620
782
|
`to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
621
783
|
return true;
|
|
622
784
|
}
|
|
785
|
+
/**
|
|
786
|
+
* Subscribes to an attribute on a cluster.
|
|
787
|
+
*
|
|
788
|
+
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
789
|
+
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
790
|
+
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
791
|
+
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
792
|
+
* @param {MatterbridgeEndpoint} [endpoint] - Optional endpoint to subscribe the attribute on. Defaults to the current endpoint.
|
|
793
|
+
* @returns {boolean} - A boolean indicating whether the subscription was successful.
|
|
794
|
+
*/
|
|
795
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
623
796
|
async subscribeAttribute(clusterId, attribute, listener, log, endpoint) {
|
|
624
797
|
if (!endpoint)
|
|
625
798
|
endpoint = this;
|
|
626
799
|
const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
627
800
|
if (endpoint.construction.status !== Lifecycle.Status.Active) {
|
|
801
|
+
// this.log.error(`subscribeAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
628
802
|
await endpoint.construction.ready;
|
|
629
803
|
}
|
|
804
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
630
805
|
const events = endpoint.events;
|
|
631
806
|
if (!(clusterName in events)) {
|
|
632
807
|
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}`);
|
|
@@ -641,65 +816,218 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
641
816
|
log?.info(`${db}Subscribe endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${this.capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
|
|
642
817
|
return true;
|
|
643
818
|
}
|
|
819
|
+
/**
|
|
820
|
+
* Triggers an event on the specified cluster.
|
|
821
|
+
*
|
|
822
|
+
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
823
|
+
* @param {string} event - The name of the event to trigger.
|
|
824
|
+
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
825
|
+
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
826
|
+
* @param {MatterbridgeEndpoint} [endpoint] - Optional endpoint to trigger the event on. Defaults to the current endpoint.
|
|
827
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
828
|
+
*/
|
|
644
829
|
async triggerEvent(clusterId, event, payload, log, endpoint) {
|
|
645
830
|
if (!endpoint)
|
|
646
831
|
endpoint = this;
|
|
647
832
|
const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
648
833
|
if (endpoint.construction.status !== Lifecycle.Status.Active) {
|
|
834
|
+
// this.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
649
835
|
await endpoint.construction.ready;
|
|
836
|
+
// return false;
|
|
650
837
|
}
|
|
838
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
651
839
|
const events = endpoint.events;
|
|
652
840
|
if (!(clusterName in events) || !(event in events[clusterName])) {
|
|
653
841
|
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}`);
|
|
654
842
|
return false;
|
|
655
843
|
}
|
|
844
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
845
|
+
// @ts-ignore
|
|
656
846
|
await endpoint.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
|
|
657
847
|
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} `);
|
|
658
848
|
return true;
|
|
659
849
|
}
|
|
850
|
+
/**
|
|
851
|
+
* Adds a command handler for the specified command.
|
|
852
|
+
*
|
|
853
|
+
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
854
|
+
* @param {(data: any) => void} handler - The handler function to execute when the command is received.
|
|
855
|
+
* @returns {void}
|
|
856
|
+
*/
|
|
857
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
660
858
|
addCommandHandler(command, handler) {
|
|
661
859
|
this.commandHandler.addHandler(command, handler);
|
|
662
860
|
}
|
|
861
|
+
/**
|
|
862
|
+
* Serializes the Matterbridge device into a serialized object.
|
|
863
|
+
*
|
|
864
|
+
* @param pluginName - The name of the plugin.
|
|
865
|
+
* @returns The serialized Matterbridge device object.
|
|
866
|
+
*/
|
|
663
867
|
serialize() {
|
|
664
868
|
return undefined;
|
|
665
|
-
|
|
869
|
+
/*
|
|
870
|
+
if (!this.serialNumber || !this.deviceName || !this.uniqueId) return;
|
|
871
|
+
const cluster = this.getClusterServer(BasicInformationCluster) ?? this.getClusterServer(BridgedDeviceBasicInformationCluster);
|
|
872
|
+
if (!cluster) return;
|
|
873
|
+
const serialized: SerializedMatterbridgeDevice = {
|
|
874
|
+
pluginName: this.plugin ?? 'Unknown',
|
|
875
|
+
serialNumber: this.serialNumber,
|
|
876
|
+
deviceName: this.deviceName,
|
|
877
|
+
uniqueId: this.uniqueId,
|
|
878
|
+
productName: cluster.attributes.productName?.getLocal(),
|
|
879
|
+
vendorId: cluster.attributes.vendorId?.getLocal(),
|
|
880
|
+
vendorName: cluster.attributes.vendorName?.getLocal(),
|
|
881
|
+
deviceTypes: Array.from(this.deviceTypes.values()),
|
|
882
|
+
endpoint: this.number,
|
|
883
|
+
endpointName: this.id,
|
|
884
|
+
clusterServersId: [],
|
|
885
|
+
};
|
|
886
|
+
this.getAllClusterServers().forEach((clusterServer) => {
|
|
887
|
+
serialized.clusterServersId.push(clusterServer.id);
|
|
888
|
+
});
|
|
889
|
+
return serialized;
|
|
890
|
+
*/
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* Deserializes the device into a serialized object.
|
|
894
|
+
*
|
|
895
|
+
* @returns The deserialized MatterbridgeDevice.
|
|
896
|
+
*/
|
|
666
897
|
static deserialize(serializedDevice) {
|
|
667
898
|
return undefined;
|
|
668
|
-
|
|
899
|
+
/*
|
|
900
|
+
const device = new MatterbridgeDevice(serializedDevice.deviceTypes);
|
|
901
|
+
device.serialNumber = serializedDevice.serialNumber;
|
|
902
|
+
device.deviceName = serializedDevice.deviceName;
|
|
903
|
+
device.uniqueId = serializedDevice.uniqueId;
|
|
904
|
+
for (const clusterId of serializedDevice.clusterServersId) {
|
|
905
|
+
if (clusterId === BasicInformationCluster.id)
|
|
906
|
+
device.createDefaultBasicInformationClusterServer(
|
|
907
|
+
serializedDevice.deviceName,
|
|
908
|
+
serializedDevice.serialNumber,
|
|
909
|
+
serializedDevice.vendorId ?? 0xfff1,
|
|
910
|
+
serializedDevice.vendorName ?? 'Matterbridge',
|
|
911
|
+
serializedDevice.productId ?? 0x8000,
|
|
912
|
+
serializedDevice.productName ?? 'Matterbridge device',
|
|
913
|
+
);
|
|
914
|
+
else if (clusterId === BridgedDeviceBasicInformationCluster.id)
|
|
915
|
+
device.createDefaultBridgedDeviceBasicInformationClusterServer(
|
|
916
|
+
serializedDevice.deviceName,
|
|
917
|
+
serializedDevice.serialNumber,
|
|
918
|
+
serializedDevice.vendorId ?? 0xfff1,
|
|
919
|
+
serializedDevice.vendorName ?? 'Matterbridge',
|
|
920
|
+
serializedDevice.productName ?? 'Matterbridge device',
|
|
921
|
+
);
|
|
922
|
+
else device.addClusterServerFromList(device, [clusterId]);
|
|
923
|
+
}
|
|
924
|
+
return device;
|
|
925
|
+
*/
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* From here copy paste from MatterbridgeDevice
|
|
929
|
+
*/
|
|
930
|
+
/**
|
|
931
|
+
* Get a default IdentifyCluster server.
|
|
932
|
+
*/
|
|
669
933
|
getDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
670
934
|
return ClusterServer(IdentifyCluster, {
|
|
671
935
|
identifyTime,
|
|
672
936
|
identifyType,
|
|
673
937
|
}, {
|
|
674
938
|
identify: async (data) => {
|
|
939
|
+
// Never called in edge
|
|
675
940
|
},
|
|
676
941
|
triggerEffect: async (data) => {
|
|
942
|
+
// Never called in edge
|
|
677
943
|
},
|
|
678
944
|
});
|
|
679
945
|
}
|
|
946
|
+
/**
|
|
947
|
+
* Creates a default IdentifyCluster server.
|
|
948
|
+
*/
|
|
680
949
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
681
950
|
this.addClusterServer(this.getDefaultIdentifyClusterServer(identifyTime, identifyType));
|
|
682
951
|
return this;
|
|
683
952
|
}
|
|
953
|
+
/**
|
|
954
|
+
* Get a default IdentifyCluster server.
|
|
955
|
+
*/
|
|
684
956
|
getDefaultGroupsClusterServer() {
|
|
685
957
|
return ClusterServer(GroupsCluster, {
|
|
686
958
|
nameSupport: {
|
|
687
959
|
nameSupport: true,
|
|
688
960
|
},
|
|
689
961
|
}, GroupsClusterHandler());
|
|
962
|
+
// return createDefaultGroupsClusterServer();
|
|
690
963
|
}
|
|
964
|
+
/**
|
|
965
|
+
* Creates a default groups cluster server and adds it to the device.
|
|
966
|
+
*/
|
|
691
967
|
createDefaultGroupsClusterServer() {
|
|
692
968
|
this.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
969
|
+
return this;
|
|
693
970
|
}
|
|
971
|
+
/**
|
|
972
|
+
* Get a default scenes cluster server and adds it to the current instance.
|
|
973
|
+
* @deprecated This method is deprecated.
|
|
974
|
+
*
|
|
975
|
+
*/
|
|
694
976
|
getDefaultScenesClusterServer() {
|
|
695
|
-
|
|
977
|
+
/*
|
|
978
|
+
return ClusterServer(
|
|
979
|
+
ScenesCluster,
|
|
980
|
+
{
|
|
981
|
+
sceneCount: 0,
|
|
982
|
+
currentScene: 0,
|
|
983
|
+
currentGroup: GroupId(0),
|
|
984
|
+
sceneValid: false,
|
|
985
|
+
nameSupport: {
|
|
986
|
+
nameSupport: true,
|
|
987
|
+
},
|
|
988
|
+
lastConfiguredBy: null,
|
|
989
|
+
},
|
|
990
|
+
{},
|
|
991
|
+
);
|
|
992
|
+
*/
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Creates a default scenes cluster server and adds it to the current instance.
|
|
996
|
+
* @deprecated This method is deprecated.
|
|
997
|
+
*/
|
|
696
998
|
createDefaultScenesClusterServer() {
|
|
999
|
+
/*
|
|
1000
|
+
this.addClusterServer(this.getDefaultScenesClusterServer());
|
|
1001
|
+
*/
|
|
1002
|
+
return this;
|
|
697
1003
|
}
|
|
1004
|
+
/**
|
|
1005
|
+
* Creates a unique identifier based on the provided parameters.
|
|
1006
|
+
* @param param1 - The first parameter.
|
|
1007
|
+
* @param param2 - The second parameter.
|
|
1008
|
+
* @param param3 - The third parameter.
|
|
1009
|
+
* @param param4 - The fourth parameter.
|
|
1010
|
+
* @returns A unique identifier generated using the MD5 hash algorithm.
|
|
1011
|
+
*/
|
|
698
1012
|
createUniqueId(param1, param2, param3, param4) {
|
|
699
1013
|
const hash = createHash('md5');
|
|
700
1014
|
hash.update(param1 + param2 + param3 + param4);
|
|
701
1015
|
return hash.digest('hex');
|
|
702
1016
|
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Get a default Basic Information Cluster Server.
|
|
1019
|
+
*
|
|
1020
|
+
* @param deviceName - The name of the device.
|
|
1021
|
+
* @param serialNumber - The serial number of the device.
|
|
1022
|
+
* @param vendorId - The vendor ID of the device.
|
|
1023
|
+
* @param vendorName - The vendor name of the device.
|
|
1024
|
+
* @param productId - The product ID of the device.
|
|
1025
|
+
* @param productName - The product name of the device.
|
|
1026
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
1027
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
1028
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
1029
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
1030
|
+
*/
|
|
703
1031
|
getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
704
1032
|
this.log.logName = deviceName;
|
|
705
1033
|
this.deviceName = deviceName;
|
|
@@ -740,6 +1068,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
740
1068
|
reachableChanged: true,
|
|
741
1069
|
});
|
|
742
1070
|
}
|
|
1071
|
+
/**
|
|
1072
|
+
* Creates a default Basic Information Cluster Server.
|
|
1073
|
+
*
|
|
1074
|
+
* @param deviceName - The name of the device.
|
|
1075
|
+
* @param serialNumber - The serial number of the device.
|
|
1076
|
+
* @param vendorId - The vendor ID of the device.
|
|
1077
|
+
* @param vendorName - The vendor name of the device.
|
|
1078
|
+
* @param productId - The product ID of the device.
|
|
1079
|
+
* @param productName - The product name of the device.
|
|
1080
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
1081
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
1082
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
1083
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
1084
|
+
*/
|
|
743
1085
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
744
1086
|
if (MatterbridgeEndpoint.bridgeMode === 'bridge') {
|
|
745
1087
|
this.addDeviceType(bridgedNode);
|
|
@@ -747,7 +1089,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
747
1089
|
return;
|
|
748
1090
|
}
|
|
749
1091
|
this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
1092
|
+
return this;
|
|
750
1093
|
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Get a default BridgedDeviceBasicInformationClusterServer.
|
|
1096
|
+
*
|
|
1097
|
+
* @param deviceName - The name of the device.
|
|
1098
|
+
* @param serialNumber - The serial number of the device.
|
|
1099
|
+
* @param vendorId - The vendor ID of the device.
|
|
1100
|
+
* @param vendorName - The name of the vendor.
|
|
1101
|
+
* @param productName - The name of the product.
|
|
1102
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
1103
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
1104
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
1105
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
1106
|
+
*/
|
|
751
1107
|
getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
752
1108
|
this.log.logName = deviceName;
|
|
753
1109
|
this.deviceName = deviceName;
|
|
@@ -762,7 +1118,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
762
1118
|
this.hardwareVersion = hardwareVersion;
|
|
763
1119
|
this.hardwareVersionString = hardwareVersionString;
|
|
764
1120
|
return ClusterServer(BridgedDeviceBasicInformationCluster, {
|
|
765
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
1121
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
|
|
766
1122
|
vendorName: vendorName.slice(0, 32),
|
|
767
1123
|
productName: productName.slice(0, 32),
|
|
768
1124
|
productUrl: 'https://www.npmjs.com/package/matterbridge',
|
|
@@ -782,12 +1138,37 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
782
1138
|
reachableChanged: true,
|
|
783
1139
|
});
|
|
784
1140
|
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Creates a default BridgedDeviceBasicInformationClusterServer.
|
|
1143
|
+
*
|
|
1144
|
+
* @param deviceName - The name of the device.
|
|
1145
|
+
* @param serialNumber - The serial number of the device.
|
|
1146
|
+
* @param vendorId - The vendor ID of the device.
|
|
1147
|
+
* @param vendorName - The name of the vendor.
|
|
1148
|
+
* @param productName - The name of the product.
|
|
1149
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
1150
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
1151
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
1152
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
1153
|
+
*/
|
|
785
1154
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
786
1155
|
this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
1156
|
+
return this;
|
|
787
1157
|
}
|
|
1158
|
+
/**
|
|
1159
|
+
* Get a default Power Topology Cluster Server. Only needed for an electricalSensor device type.
|
|
1160
|
+
*
|
|
1161
|
+
* @returns {ClusterServer} - The configured Power Topology Cluster Server.
|
|
1162
|
+
*/
|
|
788
1163
|
getDefaultPowerTopologyClusterServer() {
|
|
789
1164
|
return ClusterServer(PowerTopologyCluster.with(PowerTopology.Feature.TreeTopology), {}, {}, {});
|
|
790
1165
|
}
|
|
1166
|
+
/**
|
|
1167
|
+
* Get a default Electrical Energy Measurement Cluster Server.
|
|
1168
|
+
*
|
|
1169
|
+
* @param {number} energy - The total consumption value in mW/h.
|
|
1170
|
+
* @returns {ClusterServer} - The configured Electrical Energy Measurement Cluster Server.
|
|
1171
|
+
*/
|
|
791
1172
|
getDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
792
1173
|
return ClusterServer(ElectricalEnergyMeasurementCluster.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
793
1174
|
accuracy: {
|
|
@@ -804,6 +1185,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
804
1185
|
cumulativeEnergyMeasured: true,
|
|
805
1186
|
});
|
|
806
1187
|
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Get a default Electrical Power Measurement Cluster Server.
|
|
1190
|
+
*
|
|
1191
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
1192
|
+
* @param {number} current - The current value in milliamperes.
|
|
1193
|
+
* @param {number} power - The power value in milliwatts.
|
|
1194
|
+
* @param {number} frequency - The frequency value in millihertz.
|
|
1195
|
+
* @returns {ClusterServer} - The configured Electrical Power Measurement Cluster Server.
|
|
1196
|
+
*/
|
|
807
1197
|
getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
808
1198
|
return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
809
1199
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -844,6 +1234,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
844
1234
|
frequency: frequency,
|
|
845
1235
|
}, {}, {});
|
|
846
1236
|
}
|
|
1237
|
+
/**
|
|
1238
|
+
* Get a default OnOff cluster server for light devices.
|
|
1239
|
+
*
|
|
1240
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1241
|
+
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
1242
|
+
* @param {number} [onTime=0] - The on time value.
|
|
1243
|
+
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
1244
|
+
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
1245
|
+
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
1246
|
+
*/
|
|
847
1247
|
getDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
848
1248
|
return ClusterServer(OnOffCluster.with(OnOff.Feature.Lighting), {
|
|
849
1249
|
onOff,
|
|
@@ -853,52 +1253,110 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
853
1253
|
startUpOnOff,
|
|
854
1254
|
}, {
|
|
855
1255
|
on: async (data) => {
|
|
1256
|
+
// Never called in edge
|
|
856
1257
|
},
|
|
857
1258
|
off: async (data) => {
|
|
1259
|
+
// Never called in edge
|
|
858
1260
|
},
|
|
859
1261
|
toggle: async (data) => {
|
|
1262
|
+
// Never called in edge
|
|
860
1263
|
},
|
|
861
1264
|
offWithEffect: async () => {
|
|
1265
|
+
// Never called in edge
|
|
862
1266
|
},
|
|
863
1267
|
onWithRecallGlobalScene: async () => {
|
|
1268
|
+
// Never called in edge
|
|
864
1269
|
},
|
|
865
1270
|
onWithTimedOff: async () => {
|
|
1271
|
+
// Never called in edge
|
|
866
1272
|
},
|
|
867
1273
|
}, {});
|
|
868
1274
|
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Creates a default OnOff cluster server for light devices.
|
|
1277
|
+
*
|
|
1278
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1279
|
+
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
1280
|
+
* @param {number} [onTime=0] - The on time value.
|
|
1281
|
+
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
1282
|
+
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
1283
|
+
* @returns {void}
|
|
1284
|
+
*/
|
|
869
1285
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
870
1286
|
this.addClusterServer(this.getDefaultOnOffClusterServer(onOff, globalSceneControl, onTime, offWaitTime, startUpOnOff));
|
|
1287
|
+
return this;
|
|
871
1288
|
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Get an OnOff cluster server without features.
|
|
1291
|
+
*
|
|
1292
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1293
|
+
*
|
|
1294
|
+
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
1295
|
+
*/
|
|
872
1296
|
getOnOffClusterServer(onOff = false) {
|
|
873
1297
|
return ClusterServer(OnOffCluster, {
|
|
874
1298
|
onOff,
|
|
875
1299
|
}, {
|
|
876
1300
|
on: async (data) => {
|
|
1301
|
+
// Never called in edge
|
|
877
1302
|
},
|
|
878
1303
|
off: async (data) => {
|
|
1304
|
+
// Never called in edge
|
|
879
1305
|
},
|
|
880
1306
|
toggle: async (data) => {
|
|
1307
|
+
// Never called in edge
|
|
881
1308
|
},
|
|
882
1309
|
}, {});
|
|
883
1310
|
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Creates an OnOff cluster server without features.
|
|
1313
|
+
*
|
|
1314
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1315
|
+
*/
|
|
884
1316
|
createOnOffClusterServer(onOff = false) {
|
|
885
1317
|
this.addClusterServer(this.getOnOffClusterServer(onOff));
|
|
1318
|
+
return this;
|
|
886
1319
|
}
|
|
1320
|
+
/**
|
|
1321
|
+
* Get a DeadFront OnOff cluster server.
|
|
1322
|
+
*
|
|
1323
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1324
|
+
*
|
|
1325
|
+
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
1326
|
+
*/
|
|
887
1327
|
getDeadFrontOnOffClusterServer(onOff = false) {
|
|
888
1328
|
return ClusterServer(OnOffCluster.with(OnOff.Feature.DeadFrontBehavior), {
|
|
889
1329
|
onOff,
|
|
890
1330
|
}, {
|
|
891
1331
|
on: async (data) => {
|
|
1332
|
+
// Never called in edge
|
|
892
1333
|
},
|
|
893
1334
|
off: async (data) => {
|
|
1335
|
+
// Never called in edge
|
|
894
1336
|
},
|
|
895
1337
|
toggle: async (data) => {
|
|
1338
|
+
// Never called in edge
|
|
896
1339
|
},
|
|
897
1340
|
}, {});
|
|
898
1341
|
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Creates a DeadFront OnOff cluster server.
|
|
1344
|
+
*
|
|
1345
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1346
|
+
*/
|
|
899
1347
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
900
1348
|
this.addClusterServer(this.getDeadFrontOnOffClusterServer(onOff));
|
|
1349
|
+
return this;
|
|
901
1350
|
}
|
|
1351
|
+
/**
|
|
1352
|
+
* Get a default level control cluster server.
|
|
1353
|
+
*
|
|
1354
|
+
* @param currentLevel - The current level (default: 254).
|
|
1355
|
+
* @param minLevel - The minimum level (default: 1).
|
|
1356
|
+
* @param maxLevel - The maximum level (default: 254).
|
|
1357
|
+
* @param onLevel - The on level (default: null).
|
|
1358
|
+
* @param startUpCurrentLevel - The startUp on level (default: null).
|
|
1359
|
+
*/
|
|
902
1360
|
getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
903
1361
|
return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
904
1362
|
currentLevel,
|
|
@@ -913,26 +1371,55 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
913
1371
|
},
|
|
914
1372
|
}, {
|
|
915
1373
|
moveToLevel: async (data) => {
|
|
1374
|
+
// Never called in edge
|
|
916
1375
|
},
|
|
917
1376
|
move: async () => {
|
|
1377
|
+
// Never called in edge
|
|
918
1378
|
},
|
|
919
1379
|
step: async () => {
|
|
1380
|
+
// Never called in edge
|
|
920
1381
|
},
|
|
921
1382
|
stop: async () => {
|
|
1383
|
+
// Never called in edge
|
|
922
1384
|
},
|
|
923
1385
|
moveToLevelWithOnOff: async (data) => {
|
|
1386
|
+
// Never called in edge
|
|
924
1387
|
},
|
|
925
1388
|
moveWithOnOff: async () => {
|
|
1389
|
+
// Never called in edge
|
|
926
1390
|
},
|
|
927
1391
|
stepWithOnOff: async () => {
|
|
1392
|
+
// Never called in edge
|
|
928
1393
|
},
|
|
929
1394
|
stopWithOnOff: async () => {
|
|
1395
|
+
// Never called in edge
|
|
930
1396
|
},
|
|
931
1397
|
});
|
|
932
1398
|
}
|
|
1399
|
+
/**
|
|
1400
|
+
* Creates a default level control cluster server.
|
|
1401
|
+
*
|
|
1402
|
+
* @param currentLevel - The current level (default: 254).
|
|
1403
|
+
* @param minLevel - The minimum level (default: 1).
|
|
1404
|
+
* @param maxLevel - The maximum level (default: 254).
|
|
1405
|
+
* @param onLevel - The on level (default: null).
|
|
1406
|
+
* @param startUpCurrentLevel - The startUp on level (default: null).
|
|
1407
|
+
*/
|
|
933
1408
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
934
1409
|
this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel, startUpCurrentLevel));
|
|
1410
|
+
return this;
|
|
935
1411
|
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Get a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
1414
|
+
*
|
|
1415
|
+
* @param currentX - The current X value.
|
|
1416
|
+
* @param currentY - The current Y value.
|
|
1417
|
+
* @param currentHue - The current hue value.
|
|
1418
|
+
* @param currentSaturation - The current saturation value.
|
|
1419
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1420
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1421
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1422
|
+
*/
|
|
936
1423
|
getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
937
1424
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
938
1425
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -954,38 +1441,73 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
954
1441
|
startUpColorTemperatureMireds: null,
|
|
955
1442
|
}, {
|
|
956
1443
|
moveToColor: async (data) => {
|
|
1444
|
+
// Never called in edge
|
|
957
1445
|
},
|
|
958
1446
|
moveColor: async () => {
|
|
1447
|
+
// Never called in edge
|
|
959
1448
|
},
|
|
960
1449
|
stepColor: async () => {
|
|
1450
|
+
// Never called in edge
|
|
961
1451
|
},
|
|
962
1452
|
moveToHue: async (data) => {
|
|
1453
|
+
// Never called in edge
|
|
963
1454
|
},
|
|
964
1455
|
moveHue: async () => {
|
|
1456
|
+
// Never called in edge
|
|
965
1457
|
},
|
|
966
1458
|
stepHue: async () => {
|
|
1459
|
+
// Never called in edge
|
|
967
1460
|
},
|
|
968
1461
|
moveToSaturation: async (data) => {
|
|
1462
|
+
// Never called in edge
|
|
969
1463
|
},
|
|
970
1464
|
moveSaturation: async () => {
|
|
1465
|
+
// Never called in edge
|
|
971
1466
|
},
|
|
972
1467
|
stepSaturation: async () => {
|
|
1468
|
+
// Never called in edge
|
|
973
1469
|
},
|
|
974
1470
|
moveToHueAndSaturation: async (data) => {
|
|
1471
|
+
// Never called in edge
|
|
975
1472
|
},
|
|
976
1473
|
stopMoveStep: async () => {
|
|
1474
|
+
// Never called in edge
|
|
977
1475
|
},
|
|
978
1476
|
moveToColorTemperature: async (data) => {
|
|
1477
|
+
// Never called in edge
|
|
979
1478
|
},
|
|
980
1479
|
moveColorTemperature: async () => {
|
|
1480
|
+
// Never called in edge
|
|
981
1481
|
},
|
|
982
1482
|
stepColorTemperature: async () => {
|
|
1483
|
+
// Never called in edge
|
|
983
1484
|
},
|
|
984
1485
|
}, {});
|
|
985
1486
|
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
1489
|
+
*
|
|
1490
|
+
* @param currentX - The current X value.
|
|
1491
|
+
* @param currentY - The current Y value.
|
|
1492
|
+
* @param currentHue - The current hue value.
|
|
1493
|
+
* @param currentSaturation - The current saturation value.
|
|
1494
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1495
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1496
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1497
|
+
*/
|
|
986
1498
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
987
1499
|
this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1500
|
+
return this;
|
|
988
1501
|
}
|
|
1502
|
+
/**
|
|
1503
|
+
* Get a Xy color control cluster server with Xy and ColorTemperature.
|
|
1504
|
+
*
|
|
1505
|
+
* @param currentX - The current X value.
|
|
1506
|
+
* @param currentY - The current Y value.
|
|
1507
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1508
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1509
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1510
|
+
*/
|
|
989
1511
|
getXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
990
1512
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
991
1513
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -1005,24 +1527,50 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1005
1527
|
remainingTime: 0,
|
|
1006
1528
|
}, {
|
|
1007
1529
|
moveToColor: async () => {
|
|
1530
|
+
// Never called in edge
|
|
1008
1531
|
},
|
|
1009
1532
|
moveColor: async () => {
|
|
1533
|
+
// Never called in edge
|
|
1010
1534
|
},
|
|
1011
1535
|
stepColor: async () => {
|
|
1536
|
+
// Never called in edge
|
|
1012
1537
|
},
|
|
1013
1538
|
stopMoveStep: async () => {
|
|
1539
|
+
// Never called in edge
|
|
1014
1540
|
},
|
|
1015
1541
|
moveToColorTemperature: async () => {
|
|
1542
|
+
// Never called in edge
|
|
1016
1543
|
},
|
|
1017
1544
|
moveColorTemperature: async () => {
|
|
1545
|
+
// Never called in edge
|
|
1018
1546
|
},
|
|
1019
1547
|
stepColorTemperature: async () => {
|
|
1548
|
+
// Never called in edge
|
|
1020
1549
|
},
|
|
1021
1550
|
}, {});
|
|
1022
1551
|
}
|
|
1552
|
+
/**
|
|
1553
|
+
* Creates a Xy color control cluster server with Xy and ColorTemperature.
|
|
1554
|
+
*
|
|
1555
|
+
* @param currentX - The current X value.
|
|
1556
|
+
* @param currentY - The current Y value.
|
|
1557
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1558
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1559
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1560
|
+
*/
|
|
1023
1561
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1024
1562
|
this.addClusterServer(this.getXyColorControlClusterServer(currentX, currentY, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1563
|
+
return this;
|
|
1025
1564
|
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Get a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
|
|
1567
|
+
*
|
|
1568
|
+
* @param currentHue - The current hue value.
|
|
1569
|
+
* @param currentSaturation - The current saturation value.
|
|
1570
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1571
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1572
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1573
|
+
*/
|
|
1026
1574
|
getHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1027
1575
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1028
1576
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1042,32 +1590,60 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1042
1590
|
remainingTime: 0,
|
|
1043
1591
|
}, {
|
|
1044
1592
|
moveToHue: async () => {
|
|
1593
|
+
// Never called in edge
|
|
1045
1594
|
},
|
|
1046
1595
|
moveHue: async () => {
|
|
1596
|
+
// Never called in edge
|
|
1047
1597
|
},
|
|
1048
1598
|
stepHue: async () => {
|
|
1599
|
+
// Never called in edge
|
|
1049
1600
|
},
|
|
1050
1601
|
moveToSaturation: async () => {
|
|
1602
|
+
// Never called in edge
|
|
1051
1603
|
},
|
|
1052
1604
|
moveSaturation: async () => {
|
|
1605
|
+
// Never called in edge
|
|
1053
1606
|
},
|
|
1054
1607
|
stepSaturation: async () => {
|
|
1608
|
+
// Never called in edge
|
|
1055
1609
|
},
|
|
1056
1610
|
moveToHueAndSaturation: async () => {
|
|
1611
|
+
// Never called in edge
|
|
1057
1612
|
},
|
|
1058
1613
|
stopMoveStep: async () => {
|
|
1614
|
+
// Never called in edge
|
|
1059
1615
|
},
|
|
1060
1616
|
moveToColorTemperature: async () => {
|
|
1617
|
+
// Never called in edge
|
|
1061
1618
|
},
|
|
1062
1619
|
moveColorTemperature: async () => {
|
|
1620
|
+
// Never called in edge
|
|
1063
1621
|
},
|
|
1064
1622
|
stepColorTemperature: async () => {
|
|
1623
|
+
// Never called in edge
|
|
1065
1624
|
},
|
|
1066
1625
|
}, {});
|
|
1067
1626
|
}
|
|
1627
|
+
/**
|
|
1628
|
+
* Creates a hue and saturation color control cluster server with HueSaturation and ColorTemperature.
|
|
1629
|
+
*
|
|
1630
|
+
* @param currentHue - The current hue value.
|
|
1631
|
+
* @param currentSaturation - The current saturation value.
|
|
1632
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1633
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1634
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1635
|
+
*/
|
|
1068
1636
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1069
1637
|
this.addClusterServer(this.getHsColorControlClusterServer(currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1638
|
+
return this;
|
|
1070
1639
|
}
|
|
1640
|
+
/**
|
|
1641
|
+
* Get a color temperature color control cluster server.
|
|
1642
|
+
*
|
|
1643
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1644
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1645
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1646
|
+
*/
|
|
1071
1647
|
getCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1072
1648
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.ColorTemperature), {
|
|
1073
1649
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1085,19 +1661,45 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1085
1661
|
startUpColorTemperatureMireds: null,
|
|
1086
1662
|
}, {
|
|
1087
1663
|
stopMoveStep: async () => {
|
|
1664
|
+
// Never called in edge
|
|
1088
1665
|
},
|
|
1089
1666
|
moveToColorTemperature: async () => {
|
|
1667
|
+
// Never called in edge
|
|
1090
1668
|
},
|
|
1091
1669
|
moveColorTemperature: async () => {
|
|
1670
|
+
// Never called in edge
|
|
1092
1671
|
},
|
|
1093
1672
|
stepColorTemperature: async () => {
|
|
1673
|
+
// Never called in edge
|
|
1094
1674
|
},
|
|
1095
1675
|
}, {});
|
|
1096
1676
|
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Creates a color temperature color control cluster server.
|
|
1679
|
+
*
|
|
1680
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1681
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1682
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1683
|
+
*/
|
|
1097
1684
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1098
1685
|
this.addClusterServer(this.getCtColorControlClusterServer(colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1686
|
+
return this;
|
|
1099
1687
|
}
|
|
1100
1688
|
isColorControlConfigured = false;
|
|
1689
|
+
/**
|
|
1690
|
+
* Configures the color control cluster for a device.
|
|
1691
|
+
*
|
|
1692
|
+
* @remark This method must be called only after creating the cluster with getDefaultColorControlClusterServer or createDefaultColorControlClusterServer
|
|
1693
|
+
* and before starting the matter node.
|
|
1694
|
+
*
|
|
1695
|
+
* @deprecated Use configureColorControlMode instead.
|
|
1696
|
+
*
|
|
1697
|
+
* @param {boolean} hueSaturation - A boolean indicating whether the device supports hue and saturation control.
|
|
1698
|
+
* @param {boolean} xy - A boolean indicating whether the device supports XY control.
|
|
1699
|
+
* @param {boolean} colorTemperature - A boolean indicating whether the device supports color temperature control.
|
|
1700
|
+
* @param {ColorControl.ColorMode} colorMode - An optional parameter specifying the color mode of the device.
|
|
1701
|
+
* @param {Endpoint} endpoint - An optional parameter specifying the endpoint to configure. If not provided, the device endpoint will be used.
|
|
1702
|
+
*/
|
|
1101
1703
|
async configureColorControlCluster(hueSaturation, xy, colorTemperature, colorMode, endpoint) {
|
|
1102
1704
|
if (!endpoint)
|
|
1103
1705
|
endpoint = this;
|
|
@@ -1119,7 +1721,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1119
1721
|
await endpoint.setAttribute(ColorControlCluster.id, 'enhancedColorMode', colorMode, this.log, endpoint);
|
|
1120
1722
|
}
|
|
1121
1723
|
this.isColorControlConfigured = true;
|
|
1724
|
+
return this;
|
|
1122
1725
|
}
|
|
1726
|
+
/**
|
|
1727
|
+
* Configures the color control mode for the device.
|
|
1728
|
+
*
|
|
1729
|
+
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1730
|
+
* @param {Endpoint} endpoint - The optional endpoint to configure. If not provided, the method will configure the current endpoint.
|
|
1731
|
+
*/
|
|
1123
1732
|
async configureColorControlMode(colorMode, endpoint) {
|
|
1124
1733
|
if (!endpoint)
|
|
1125
1734
|
endpoint = this;
|
|
@@ -1127,7 +1736,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1127
1736
|
await endpoint.setAttribute(ColorControlCluster.id, 'colorMode', colorMode, this.log, endpoint);
|
|
1128
1737
|
await endpoint.setAttribute(ColorControlCluster.id, 'enhancedColorMode', colorMode, this.log, endpoint);
|
|
1129
1738
|
}
|
|
1739
|
+
return this;
|
|
1130
1740
|
}
|
|
1741
|
+
/**
|
|
1742
|
+
* Get a default window covering cluster server.
|
|
1743
|
+
*
|
|
1744
|
+
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1745
|
+
*/
|
|
1131
1746
|
getDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1132
1747
|
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1133
1748
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
@@ -1143,26 +1758,39 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1143
1758
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1144
1759
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
1145
1760
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1146
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1147
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1761
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1762
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1148
1763
|
}, {
|
|
1149
1764
|
upOrOpen: async (data) => {
|
|
1765
|
+
// Never called in edge
|
|
1150
1766
|
},
|
|
1151
1767
|
downOrClose: async (data) => {
|
|
1768
|
+
// Never called in edge
|
|
1152
1769
|
},
|
|
1153
1770
|
stopMotion: async (data) => {
|
|
1771
|
+
// Never called in edge
|
|
1154
1772
|
},
|
|
1155
1773
|
goToLiftPercentage: async (data) => {
|
|
1774
|
+
// Never called in edge
|
|
1156
1775
|
},
|
|
1157
1776
|
}, {});
|
|
1158
1777
|
}
|
|
1778
|
+
/**
|
|
1779
|
+
* Creates a default window covering cluster server.
|
|
1780
|
+
*
|
|
1781
|
+
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1782
|
+
*/
|
|
1159
1783
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1160
1784
|
this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
|
|
1161
1785
|
}
|
|
1786
|
+
/**
|
|
1787
|
+
* Sets the window covering target position as the current position and stops the movement.
|
|
1788
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1789
|
+
*/
|
|
1162
1790
|
async setWindowCoveringTargetAsCurrentAndStopped(endpoint) {
|
|
1163
1791
|
if (!endpoint)
|
|
1164
1792
|
endpoint = this;
|
|
1165
|
-
const position = endpoint.getAttribute(WindowCoveringCluster.id, 'currentPositionLiftPercent100ths', this.log, endpoint);
|
|
1793
|
+
const position = endpoint.getAttribute(WindowCoveringCluster.id, 'currentPositionLiftPercent100ths', this.log, endpoint); // windowCoveringCluster.getCurrentPositionLiftPercent100thsAttribute();
|
|
1166
1794
|
if (position !== null) {
|
|
1167
1795
|
await endpoint.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', position, this.log, endpoint);
|
|
1168
1796
|
await endpoint.setAttribute(WindowCoveringCluster.id, 'operationalStatus', {
|
|
@@ -1173,6 +1801,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1173
1801
|
}
|
|
1174
1802
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1175
1803
|
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Sets the current and target status of a window covering.
|
|
1806
|
+
* @param {number} current - The current position of the window covering.
|
|
1807
|
+
* @param {number} target - The target position of the window covering.
|
|
1808
|
+
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1809
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1810
|
+
*/
|
|
1176
1811
|
async setWindowCoveringCurrentTargetStatus(current, target, status, endpoint) {
|
|
1177
1812
|
if (!endpoint)
|
|
1178
1813
|
endpoint = this;
|
|
@@ -1185,6 +1820,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1185
1820
|
}, this.log, endpoint);
|
|
1186
1821
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1187
1822
|
}
|
|
1823
|
+
/**
|
|
1824
|
+
* Sets the status of the window covering.
|
|
1825
|
+
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1826
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1827
|
+
*/
|
|
1188
1828
|
async setWindowCoveringStatus(status, endpoint) {
|
|
1189
1829
|
if (!endpoint)
|
|
1190
1830
|
endpoint = this;
|
|
@@ -1195,6 +1835,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1195
1835
|
}, this.log, endpoint);
|
|
1196
1836
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1197
1837
|
}
|
|
1838
|
+
/**
|
|
1839
|
+
* Retrieves the status of the window covering.
|
|
1840
|
+
* @param {Endpoint} endpoint - The endpoint on which to get the window covering (default the device endpoint).
|
|
1841
|
+
*
|
|
1842
|
+
* @returns The global operational status of the window covering.
|
|
1843
|
+
*/
|
|
1198
1844
|
getWindowCoveringStatus(endpoint) {
|
|
1199
1845
|
if (!endpoint)
|
|
1200
1846
|
endpoint = this;
|
|
@@ -1202,6 +1848,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1202
1848
|
this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
|
|
1203
1849
|
return status.global;
|
|
1204
1850
|
}
|
|
1851
|
+
/**
|
|
1852
|
+
* Sets the target and current position of the window covering.
|
|
1853
|
+
*
|
|
1854
|
+
* @param position - The position to set, specified as a number.
|
|
1855
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1856
|
+
*/
|
|
1205
1857
|
async setWindowCoveringTargetAndCurrentPosition(position, endpoint) {
|
|
1206
1858
|
if (!endpoint)
|
|
1207
1859
|
endpoint = this;
|
|
@@ -1209,6 +1861,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1209
1861
|
await endpoint.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', position, this.log, endpoint);
|
|
1210
1862
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
1211
1863
|
}
|
|
1864
|
+
/**
|
|
1865
|
+
* Get a default door lock cluster server.
|
|
1866
|
+
*
|
|
1867
|
+
* @remarks
|
|
1868
|
+
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1869
|
+
*
|
|
1870
|
+
*/
|
|
1212
1871
|
getDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1213
1872
|
return ClusterServer(DoorLockCluster, {
|
|
1214
1873
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
@@ -1218,8 +1877,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1218
1877
|
supportedOperatingModes: { normal: true, vacation: false, privacy: false, noRemoteLockUnlock: false, passage: false },
|
|
1219
1878
|
}, {
|
|
1220
1879
|
lockDoor: async (data) => {
|
|
1880
|
+
// Never called in edge
|
|
1221
1881
|
},
|
|
1222
1882
|
unlockDoor: async (data) => {
|
|
1883
|
+
// Never called in edge
|
|
1223
1884
|
},
|
|
1224
1885
|
}, {
|
|
1225
1886
|
doorLockAlarm: true,
|
|
@@ -1227,9 +1888,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1227
1888
|
lockOperationError: true,
|
|
1228
1889
|
});
|
|
1229
1890
|
}
|
|
1891
|
+
/**
|
|
1892
|
+
* Creates a default door lock cluster server.
|
|
1893
|
+
*
|
|
1894
|
+
* @remarks
|
|
1895
|
+
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1896
|
+
*
|
|
1897
|
+
*/
|
|
1230
1898
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1231
1899
|
this.addClusterServer(this.getDefaultDoorLockClusterServer(lockState, lockType));
|
|
1232
1900
|
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Get a default momentary switch cluster server.
|
|
1903
|
+
*
|
|
1904
|
+
* @remarks
|
|
1905
|
+
* This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
|
|
1906
|
+
*/
|
|
1233
1907
|
getDefaultSwitchClusterServer() {
|
|
1234
1908
|
return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
|
|
1235
1909
|
numberOfPositions: 2,
|
|
@@ -1244,9 +1918,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1244
1918
|
multiPressComplete: true,
|
|
1245
1919
|
});
|
|
1246
1920
|
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Creates a default momentary switch cluster server.
|
|
1923
|
+
*
|
|
1924
|
+
* @remarks
|
|
1925
|
+
* This method adds a cluster server with default momentary switch features and configurations.
|
|
1926
|
+
*/
|
|
1247
1927
|
createDefaultSwitchClusterServer() {
|
|
1248
1928
|
this.addClusterServer(this.getDefaultSwitchClusterServer());
|
|
1249
1929
|
}
|
|
1930
|
+
/**
|
|
1931
|
+
* Get a default latching switch cluster server.
|
|
1932
|
+
*
|
|
1933
|
+
* @remarks
|
|
1934
|
+
* This method adds a cluster server with default latching switch features and configuration.
|
|
1935
|
+
*/
|
|
1250
1936
|
getDefaultLatchingSwitchClusterServer() {
|
|
1251
1937
|
return ClusterServer(SwitchCluster.with(Switch.Feature.LatchingSwitch), {
|
|
1252
1938
|
numberOfPositions: 2,
|
|
@@ -1255,9 +1941,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1255
1941
|
switchLatched: true,
|
|
1256
1942
|
});
|
|
1257
1943
|
}
|
|
1944
|
+
/**
|
|
1945
|
+
* Creates a default latching switch cluster server.
|
|
1946
|
+
*
|
|
1947
|
+
* @remarks
|
|
1948
|
+
* This method adds a cluster server with default latching switch features and configuration.
|
|
1949
|
+
*/
|
|
1258
1950
|
createDefaultLatchingSwitchClusterServer() {
|
|
1259
1951
|
this.addClusterServer(this.getDefaultLatchingSwitchClusterServer());
|
|
1260
1952
|
}
|
|
1953
|
+
/**
|
|
1954
|
+
* Triggers a switch event on the specified endpoint.
|
|
1955
|
+
*
|
|
1956
|
+
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1957
|
+
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1958
|
+
* @returns {void}
|
|
1959
|
+
*/
|
|
1261
1960
|
async triggerSwitchEvent(event, log, endpoint) {
|
|
1262
1961
|
if (!endpoint)
|
|
1263
1962
|
endpoint = this;
|
|
@@ -1325,6 +2024,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1325
2024
|
}
|
|
1326
2025
|
return true;
|
|
1327
2026
|
}
|
|
2027
|
+
/**
|
|
2028
|
+
* Retrieves the default mode select cluster server.
|
|
2029
|
+
*
|
|
2030
|
+
* @param description - The description of the cluster server.
|
|
2031
|
+
* @param supportedModes - The supported modes for the cluster server.
|
|
2032
|
+
* @param currentMode - The current mode of the cluster server. Defaults to 0.
|
|
2033
|
+
* @param startUpMode - The startup mode of the cluster server. Defaults to 0.
|
|
2034
|
+
* @returns The default mode select cluster server.
|
|
2035
|
+
*/
|
|
1328
2036
|
getDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1329
2037
|
return ClusterServer(ModeSelectCluster, {
|
|
1330
2038
|
description: description,
|
|
@@ -1334,14 +2042,30 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1334
2042
|
startUpMode: startUpMode,
|
|
1335
2043
|
}, {
|
|
1336
2044
|
changeToMode: async (data) => {
|
|
2045
|
+
// Never called in edge
|
|
1337
2046
|
},
|
|
1338
2047
|
});
|
|
1339
2048
|
}
|
|
2049
|
+
/**
|
|
2050
|
+
* Creates a default mode select cluster server.
|
|
2051
|
+
*
|
|
2052
|
+
* @param description - The description of the cluster server.
|
|
2053
|
+
* @param supportedModes - The supported modes for the cluster server.
|
|
2054
|
+
* @param currentMode - The current mode of the cluster server. Defaults to 0.
|
|
2055
|
+
* @param startUpMode - The startup mode of the cluster server. Defaults to 0.
|
|
2056
|
+
* @param endpoint - The endpoint to add the cluster server to. Defaults to `this` if not provided.
|
|
2057
|
+
*
|
|
2058
|
+
*/
|
|
1340
2059
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
|
|
1341
2060
|
if (!endpoint)
|
|
1342
2061
|
endpoint = this;
|
|
1343
2062
|
endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
|
|
1344
2063
|
}
|
|
2064
|
+
/**
|
|
2065
|
+
* Get a default occupancy sensing cluster server.
|
|
2066
|
+
*
|
|
2067
|
+
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
2068
|
+
*/
|
|
1345
2069
|
getDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1346
2070
|
return ClusterServer(OccupancySensingCluster, {
|
|
1347
2071
|
occupancy: { occupied },
|
|
@@ -1350,9 +2074,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1350
2074
|
pirOccupiedToUnoccupiedDelay: 30,
|
|
1351
2075
|
}, {});
|
|
1352
2076
|
}
|
|
2077
|
+
/**
|
|
2078
|
+
* Creates a default occupancy sensing cluster server.
|
|
2079
|
+
*
|
|
2080
|
+
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
2081
|
+
*/
|
|
1353
2082
|
createDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1354
2083
|
this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
|
|
1355
2084
|
}
|
|
2085
|
+
/**
|
|
2086
|
+
* Get a default Illuminance Measurement Cluster Server.
|
|
2087
|
+
*
|
|
2088
|
+
* @param measuredValue - The measured value of illuminance.
|
|
2089
|
+
*/
|
|
1356
2090
|
getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1357
2091
|
return ClusterServer(IlluminanceMeasurementCluster, {
|
|
1358
2092
|
measuredValue,
|
|
@@ -1361,9 +2095,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1361
2095
|
tolerance: 0,
|
|
1362
2096
|
}, {}, {});
|
|
1363
2097
|
}
|
|
2098
|
+
/**
|
|
2099
|
+
* Creates a default Illuminance Measurement Cluster Server.
|
|
2100
|
+
*
|
|
2101
|
+
* @param measuredValue - The measured value of illuminance.
|
|
2102
|
+
*/
|
|
1364
2103
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1365
2104
|
this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
|
|
1366
2105
|
}
|
|
2106
|
+
/**
|
|
2107
|
+
* Get a default flow measurement cluster server.
|
|
2108
|
+
*
|
|
2109
|
+
* @param measuredValue - The measured value of the flow in 10 x m/h.
|
|
2110
|
+
*/
|
|
1367
2111
|
getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1368
2112
|
return ClusterServer(FlowMeasurementCluster, {
|
|
1369
2113
|
measuredValue,
|
|
@@ -1372,9 +2116,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1372
2116
|
tolerance: 0,
|
|
1373
2117
|
}, {}, {});
|
|
1374
2118
|
}
|
|
2119
|
+
/**
|
|
2120
|
+
* Creates a default flow measurement cluster server.
|
|
2121
|
+
*
|
|
2122
|
+
* @param measuredValue - The measured value of the flow in 10 x m/h.
|
|
2123
|
+
*/
|
|
1375
2124
|
createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1376
2125
|
this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
|
|
1377
2126
|
}
|
|
2127
|
+
/**
|
|
2128
|
+
* Get a default temperature measurement cluster server.
|
|
2129
|
+
*
|
|
2130
|
+
* @param measuredValue - The measured value of the temperature x 100.
|
|
2131
|
+
*/
|
|
1378
2132
|
getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1379
2133
|
return ClusterServer(TemperatureMeasurementCluster, {
|
|
1380
2134
|
measuredValue,
|
|
@@ -1383,9 +2137,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1383
2137
|
tolerance: 0,
|
|
1384
2138
|
}, {}, {});
|
|
1385
2139
|
}
|
|
2140
|
+
/**
|
|
2141
|
+
* Creates a default temperature measurement cluster server.
|
|
2142
|
+
*
|
|
2143
|
+
* @param measuredValue - The measured value of the temperature x 100.
|
|
2144
|
+
*/
|
|
1386
2145
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1387
2146
|
this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
|
|
1388
2147
|
}
|
|
2148
|
+
/**
|
|
2149
|
+
* Get a default RelativeHumidityMeasurementCluster server.
|
|
2150
|
+
*
|
|
2151
|
+
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
2152
|
+
*/
|
|
1389
2153
|
getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1390
2154
|
return ClusterServer(RelativeHumidityMeasurementCluster, {
|
|
1391
2155
|
measuredValue,
|
|
@@ -1394,9 +2158,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1394
2158
|
tolerance: 0,
|
|
1395
2159
|
}, {}, {});
|
|
1396
2160
|
}
|
|
2161
|
+
/**
|
|
2162
|
+
* Creates a default RelativeHumidityMeasurementCluster server.
|
|
2163
|
+
*
|
|
2164
|
+
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
2165
|
+
*/
|
|
1397
2166
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1398
2167
|
this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
|
|
1399
2168
|
}
|
|
2169
|
+
/**
|
|
2170
|
+
* Get a default Pressure Measurement Cluster Server.
|
|
2171
|
+
*
|
|
2172
|
+
* @param measuredValue - The measured value for the pressure.
|
|
2173
|
+
*/
|
|
1400
2174
|
getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1401
2175
|
return ClusterServer(PressureMeasurementCluster, {
|
|
1402
2176
|
measuredValue,
|
|
@@ -1405,19 +2179,39 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1405
2179
|
tolerance: 0,
|
|
1406
2180
|
}, {}, {});
|
|
1407
2181
|
}
|
|
2182
|
+
/**
|
|
2183
|
+
* Creates a default Pressure Measurement Cluster Server.
|
|
2184
|
+
*
|
|
2185
|
+
* @param measuredValue - The measured value for the pressure.
|
|
2186
|
+
*/
|
|
1408
2187
|
createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1409
2188
|
this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
|
|
1410
2189
|
}
|
|
2190
|
+
/**
|
|
2191
|
+
* Get a default boolean state cluster server.
|
|
2192
|
+
*
|
|
2193
|
+
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
2194
|
+
*/
|
|
1411
2195
|
getDefaultBooleanStateClusterServer(contact) {
|
|
1412
2196
|
return ClusterServer(BooleanStateCluster, {
|
|
1413
|
-
stateValue: contact ?? true,
|
|
2197
|
+
stateValue: contact ?? true, // true=contact false=no_contact
|
|
1414
2198
|
}, {}, {
|
|
1415
2199
|
stateChange: true,
|
|
1416
2200
|
});
|
|
1417
2201
|
}
|
|
2202
|
+
/**
|
|
2203
|
+
* Creates a default boolean state configuration cluster server.
|
|
2204
|
+
*
|
|
2205
|
+
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
2206
|
+
*/
|
|
1418
2207
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1419
2208
|
this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
|
|
1420
2209
|
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Get a default boolean state configuration cluster server.
|
|
2212
|
+
*
|
|
2213
|
+
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
2214
|
+
*/
|
|
1421
2215
|
getDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
1422
2216
|
return ClusterServer(BooleanStateConfigurationCluster.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel), {
|
|
1423
2217
|
currentSensitivityLevel: 0,
|
|
@@ -1426,18 +2220,34 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1426
2220
|
alarmsActive: { visual: false, audible: false },
|
|
1427
2221
|
alarmsEnabled: { visual: false, audible: false },
|
|
1428
2222
|
alarmsSupported: { visual: true, audible: true },
|
|
2223
|
+
// alarmsSuppressed: { visual: false, audible: false },
|
|
1429
2224
|
sensorFault: { generalFault: sensorFault },
|
|
1430
2225
|
}, {
|
|
1431
2226
|
enableDisableAlarm: async (data) => {
|
|
2227
|
+
// Never called in edge
|
|
1432
2228
|
},
|
|
1433
2229
|
}, {
|
|
1434
2230
|
alarmsStateChanged: true,
|
|
1435
2231
|
sensorFault: true,
|
|
1436
2232
|
});
|
|
1437
2233
|
}
|
|
2234
|
+
/**
|
|
2235
|
+
* Creates a default boolean state configuration cluster server.
|
|
2236
|
+
*
|
|
2237
|
+
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
2238
|
+
*/
|
|
1438
2239
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
1439
2240
|
this.addClusterServer(this.getDefaultBooleanStateConfigurationClusterServer(sensorFault));
|
|
1440
2241
|
}
|
|
2242
|
+
/**
|
|
2243
|
+
* Get a default power source replaceable battery cluster server.
|
|
2244
|
+
*
|
|
2245
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2246
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2247
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
2248
|
+
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
2249
|
+
* @param batQuantity - The battery quantity (default: 1).
|
|
2250
|
+
*/
|
|
1441
2251
|
getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
1442
2252
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
1443
2253
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -1454,9 +2264,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1454
2264
|
endpointList: [],
|
|
1455
2265
|
}, {}, {});
|
|
1456
2266
|
}
|
|
2267
|
+
/**
|
|
2268
|
+
* Creates a default power source replaceable battery cluster server.
|
|
2269
|
+
*
|
|
2270
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2271
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2272
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
2273
|
+
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
2274
|
+
* @param batQuantity - The battery quantity (default: 1).
|
|
2275
|
+
*/
|
|
1457
2276
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
1458
2277
|
this.addClusterServer(this.getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity));
|
|
1459
2278
|
}
|
|
2279
|
+
/**
|
|
2280
|
+
* Get a default power source rechargeable battery cluster server.
|
|
2281
|
+
*
|
|
2282
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2283
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2284
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
2285
|
+
*/
|
|
1460
2286
|
getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
1461
2287
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
1462
2288
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -1474,9 +2300,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1474
2300
|
endpointList: [],
|
|
1475
2301
|
}, {}, {});
|
|
1476
2302
|
}
|
|
2303
|
+
/**
|
|
2304
|
+
* Creates a default power source rechargeable battery cluster server.
|
|
2305
|
+
*
|
|
2306
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2307
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2308
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
2309
|
+
*/
|
|
1477
2310
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
1478
2311
|
this.addClusterServer(this.getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage));
|
|
1479
2312
|
}
|
|
2313
|
+
/**
|
|
2314
|
+
* Get a default power source wired cluster server.
|
|
2315
|
+
*
|
|
2316
|
+
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
2317
|
+
*/
|
|
1480
2318
|
getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
1481
2319
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Wired), {
|
|
1482
2320
|
wiredCurrentType,
|
|
@@ -1486,22 +2324,45 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1486
2324
|
endpointList: [],
|
|
1487
2325
|
}, {}, {});
|
|
1488
2326
|
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Creates a default power source wired cluster server.
|
|
2329
|
+
*
|
|
2330
|
+
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
2331
|
+
*/
|
|
1489
2332
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
1490
2333
|
this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
|
|
1491
2334
|
}
|
|
2335
|
+
/**
|
|
2336
|
+
* @deprecated This function is deprecated by Matter 1.3 spec and will be removed in a future version.
|
|
2337
|
+
*/
|
|
1492
2338
|
createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
|
|
1493
2339
|
this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
|
|
1494
2340
|
sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
|
|
1495
2341
|
}, {}, {}));
|
|
1496
2342
|
}
|
|
2343
|
+
/**
|
|
2344
|
+
* Get a default air quality cluster server.
|
|
2345
|
+
*
|
|
2346
|
+
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2347
|
+
*/
|
|
1497
2348
|
getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1498
2349
|
return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1499
2350
|
airQuality,
|
|
1500
2351
|
}, {}, {});
|
|
1501
2352
|
}
|
|
2353
|
+
/**
|
|
2354
|
+
* Creates a default air quality cluster server.
|
|
2355
|
+
*
|
|
2356
|
+
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2357
|
+
*/
|
|
1502
2358
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1503
2359
|
this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
|
|
1504
2360
|
}
|
|
2361
|
+
/**
|
|
2362
|
+
* Get a default TVOC measurement cluster server.
|
|
2363
|
+
*
|
|
2364
|
+
* @param measuredValue - The measured value for TVOC.
|
|
2365
|
+
*/
|
|
1505
2366
|
getDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1506
2367
|
return ClusterServer(TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1507
2368
|
measuredValue,
|
|
@@ -1512,14 +2373,28 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1512
2373
|
measurementMedium,
|
|
1513
2374
|
}, {}, {});
|
|
1514
2375
|
}
|
|
2376
|
+
/**
|
|
2377
|
+
* Creates a default TVOC measurement cluster server.
|
|
2378
|
+
*
|
|
2379
|
+
* @param measuredValue - The measured value for TVOC.
|
|
2380
|
+
*/
|
|
1515
2381
|
createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1516
2382
|
this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1517
2383
|
}
|
|
2384
|
+
/**
|
|
2385
|
+
* Get a default heating thermostat cluster server with the specified parameters.
|
|
2386
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2387
|
+
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2388
|
+
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2389
|
+
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2390
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2391
|
+
*/
|
|
1518
2392
|
getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1519
2393
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
|
|
1520
2394
|
localTemperature: localTemperature * 100,
|
|
1521
2395
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1522
2396
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
2397
|
+
// Thermostat.Feature.Heating
|
|
1523
2398
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1524
2399
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1525
2400
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1527,17 +2402,35 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1527
2402
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1528
2403
|
}, {
|
|
1529
2404
|
setpointRaiseLower: async (data) => {
|
|
2405
|
+
// Never called in edge
|
|
1530
2406
|
},
|
|
1531
2407
|
}, {});
|
|
1532
2408
|
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Creates and adds a default heating thermostat cluster server to the device.
|
|
2411
|
+
*
|
|
2412
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2413
|
+
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2414
|
+
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2415
|
+
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2416
|
+
*/
|
|
1533
2417
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1534
2418
|
this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
|
|
1535
2419
|
}
|
|
2420
|
+
/**
|
|
2421
|
+
* Get a default cooling thermostat cluster server with the specified parameters.
|
|
2422
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2423
|
+
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2424
|
+
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2425
|
+
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2426
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2427
|
+
*/
|
|
1536
2428
|
getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1537
2429
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
|
|
1538
2430
|
localTemperature: localTemperature * 100,
|
|
1539
2431
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1540
2432
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
2433
|
+
// Thermostat.Feature.Cooling
|
|
1541
2434
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1542
2435
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1543
2436
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -1545,37 +2438,82 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1545
2438
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1546
2439
|
}, {
|
|
1547
2440
|
setpointRaiseLower: async (data) => {
|
|
2441
|
+
// Never called in edge
|
|
1548
2442
|
},
|
|
1549
2443
|
}, {});
|
|
1550
2444
|
}
|
|
2445
|
+
/**
|
|
2446
|
+
* Creates and adds a default cooling thermostat cluster server to the device.
|
|
2447
|
+
*
|
|
2448
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2449
|
+
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2450
|
+
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2451
|
+
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2452
|
+
*/
|
|
1551
2453
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1552
2454
|
this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
1553
2455
|
}
|
|
2456
|
+
/**
|
|
2457
|
+
* Get a default thermostat cluster server with the specified parameters.
|
|
2458
|
+
*
|
|
2459
|
+
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2460
|
+
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2461
|
+
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2462
|
+
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2463
|
+
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2464
|
+
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2465
|
+
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2466
|
+
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2467
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2468
|
+
*/
|
|
1554
2469
|
getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1555
2470
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1556
2471
|
localTemperature: localTemperature * 100,
|
|
1557
2472
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1558
2473
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
2474
|
+
// Thermostat.Feature.Heating
|
|
1559
2475
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1560
2476
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1561
2477
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1562
2478
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1563
2479
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2480
|
+
// Thermostat.Feature.Cooling
|
|
1564
2481
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1565
2482
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1566
2483
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1567
2484
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1568
2485
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2486
|
+
// Thermostat.Feature.AutoMode
|
|
1569
2487
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1570
2488
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1571
2489
|
}, {
|
|
1572
2490
|
setpointRaiseLower: async (data) => {
|
|
2491
|
+
// Never called in edge
|
|
1573
2492
|
},
|
|
1574
2493
|
}, {});
|
|
1575
2494
|
}
|
|
2495
|
+
/**
|
|
2496
|
+
* Creates and adds a default thermostat cluster server to the device.
|
|
2497
|
+
*
|
|
2498
|
+
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2499
|
+
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2500
|
+
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2501
|
+
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2502
|
+
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2503
|
+
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2504
|
+
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2505
|
+
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2506
|
+
*/
|
|
1576
2507
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1577
2508
|
this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
1578
2509
|
}
|
|
2510
|
+
/**
|
|
2511
|
+
* Returns the default SmokeCOAlarm Cluster Server.
|
|
2512
|
+
*
|
|
2513
|
+
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2514
|
+
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2515
|
+
* @returns The default SmokeCOAlarmClusterServer.
|
|
2516
|
+
*/
|
|
1579
2517
|
getDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1580
2518
|
return ClusterServer(SmokeCoAlarmCluster.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm), {
|
|
1581
2519
|
smokeState,
|
|
@@ -1590,6 +2528,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1590
2528
|
interconnectCoAlarm: SmokeCoAlarm.AlarmState.Normal,
|
|
1591
2529
|
}, {
|
|
1592
2530
|
selfTestRequest: async (data) => {
|
|
2531
|
+
// Never called in edge
|
|
1593
2532
|
},
|
|
1594
2533
|
}, {
|
|
1595
2534
|
smokeAlarm: true,
|
|
@@ -1605,9 +2544,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1605
2544
|
allClear: true,
|
|
1606
2545
|
});
|
|
1607
2546
|
}
|
|
2547
|
+
/**
|
|
2548
|
+
* Create the default SmokeCOAlarm Cluster Server.
|
|
2549
|
+
*
|
|
2550
|
+
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2551
|
+
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2552
|
+
* @returns The default SmokeCOAlarmClusterServer.
|
|
2553
|
+
*/
|
|
1608
2554
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1609
2555
|
this.addClusterServer(this.getDefaultSmokeCOAlarmClusterServer(smokeState, coState));
|
|
1610
2556
|
}
|
|
2557
|
+
/**
|
|
2558
|
+
* Returns the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2559
|
+
*
|
|
2560
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2561
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2562
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2563
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2564
|
+
*/
|
|
1611
2565
|
getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1612
2566
|
return ClusterServer(CarbonMonoxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1613
2567
|
measuredValue,
|
|
@@ -1618,9 +2572,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1618
2572
|
measurementMedium,
|
|
1619
2573
|
}, {}, {});
|
|
1620
2574
|
}
|
|
2575
|
+
/**
|
|
2576
|
+
* Create the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2577
|
+
*
|
|
2578
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2579
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2580
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2581
|
+
*/
|
|
1621
2582
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1622
2583
|
this.addClusterServer(this.getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1623
2584
|
}
|
|
2585
|
+
/**
|
|
2586
|
+
* Returns the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2587
|
+
*
|
|
2588
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2589
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2590
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2591
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2592
|
+
*/
|
|
1624
2593
|
getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1625
2594
|
return ClusterServer(CarbonDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1626
2595
|
measuredValue,
|
|
@@ -1631,9 +2600,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1631
2600
|
measurementMedium,
|
|
1632
2601
|
}, {}, {});
|
|
1633
2602
|
}
|
|
2603
|
+
/**
|
|
2604
|
+
* Create the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2605
|
+
*
|
|
2606
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2607
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2608
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2609
|
+
*/
|
|
1634
2610
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1635
2611
|
this.addClusterServer(this.getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1636
2612
|
}
|
|
2613
|
+
/**
|
|
2614
|
+
* Returns the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2615
|
+
*
|
|
2616
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2617
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2618
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2619
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2620
|
+
*/
|
|
1637
2621
|
getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1638
2622
|
return ClusterServer(FormaldehydeConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1639
2623
|
measuredValue,
|
|
@@ -1644,9 +2628,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1644
2628
|
measurementMedium,
|
|
1645
2629
|
}, {}, {});
|
|
1646
2630
|
}
|
|
2631
|
+
/**
|
|
2632
|
+
* Create the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2633
|
+
*
|
|
2634
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2635
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2636
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2637
|
+
*/
|
|
1647
2638
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1648
2639
|
this.addClusterServer(this.getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1649
2640
|
}
|
|
2641
|
+
/**
|
|
2642
|
+
* Returns the default Pm1 Concentration Measurement Cluster Server.
|
|
2643
|
+
*
|
|
2644
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2645
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2646
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2647
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2648
|
+
*/
|
|
1650
2649
|
getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1651
2650
|
return ClusterServer(Pm1ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1652
2651
|
measuredValue,
|
|
@@ -1657,9 +2656,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1657
2656
|
measurementMedium,
|
|
1658
2657
|
}, {}, {});
|
|
1659
2658
|
}
|
|
2659
|
+
/**
|
|
2660
|
+
* Create the default Pm1 Concentration Measurement Cluster Server.
|
|
2661
|
+
*
|
|
2662
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2663
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2664
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2665
|
+
*/
|
|
1660
2666
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1661
2667
|
this.addClusterServer(this.getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1662
2668
|
}
|
|
2669
|
+
/**
|
|
2670
|
+
* Returns the default Pm25 Concentration Measurement Cluster Server.
|
|
2671
|
+
*
|
|
2672
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2673
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2674
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2675
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2676
|
+
*/
|
|
1663
2677
|
getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1664
2678
|
return ClusterServer(Pm25ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1665
2679
|
measuredValue,
|
|
@@ -1670,9 +2684,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1670
2684
|
measurementMedium,
|
|
1671
2685
|
}, {}, {});
|
|
1672
2686
|
}
|
|
2687
|
+
/**
|
|
2688
|
+
* Create the default Pm25 Concentration Measurement Cluster Server.
|
|
2689
|
+
*
|
|
2690
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2691
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2692
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2693
|
+
*/
|
|
1673
2694
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1674
2695
|
this.addClusterServer(this.getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1675
2696
|
}
|
|
2697
|
+
/**
|
|
2698
|
+
* Returns the default Pm10 Concentration Measurement Cluster Server.
|
|
2699
|
+
*
|
|
2700
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2701
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2702
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2703
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2704
|
+
*/
|
|
1676
2705
|
getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1677
2706
|
return ClusterServer(Pm10ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1678
2707
|
measuredValue,
|
|
@@ -1683,9 +2712,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1683
2712
|
measurementMedium,
|
|
1684
2713
|
}, {}, {});
|
|
1685
2714
|
}
|
|
2715
|
+
/**
|
|
2716
|
+
* Create the default Pm10 Concentration Measurement Cluster Server.
|
|
2717
|
+
*
|
|
2718
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2719
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2720
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2721
|
+
*/
|
|
1686
2722
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1687
2723
|
this.addClusterServer(this.getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1688
2724
|
}
|
|
2725
|
+
/**
|
|
2726
|
+
* Returns the default Ozone Concentration Measurement Cluster Server.
|
|
2727
|
+
*
|
|
2728
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2729
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2730
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2731
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2732
|
+
*/
|
|
1689
2733
|
getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1690
2734
|
return ClusterServer(OzoneConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1691
2735
|
measuredValue,
|
|
@@ -1696,9 +2740,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1696
2740
|
measurementMedium,
|
|
1697
2741
|
}, {}, {});
|
|
1698
2742
|
}
|
|
2743
|
+
/**
|
|
2744
|
+
* Create the default Ozone Concentration Measurement Cluster Server.
|
|
2745
|
+
*
|
|
2746
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2747
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2748
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2749
|
+
*/
|
|
1699
2750
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1700
2751
|
this.addClusterServer(this.getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1701
2752
|
}
|
|
2753
|
+
/**
|
|
2754
|
+
* Returns the default Radon Concentration Measurement Cluster Server.
|
|
2755
|
+
*
|
|
2756
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2757
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2758
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2759
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2760
|
+
*/
|
|
1702
2761
|
getDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1703
2762
|
return ClusterServer(RadonConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1704
2763
|
measuredValue,
|
|
@@ -1709,9 +2768,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1709
2768
|
measurementMedium,
|
|
1710
2769
|
}, {}, {});
|
|
1711
2770
|
}
|
|
2771
|
+
/**
|
|
2772
|
+
* Create the default Radon Concentration Measurement Cluster Server.
|
|
2773
|
+
*
|
|
2774
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2775
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2776
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2777
|
+
*/
|
|
1712
2778
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1713
2779
|
this.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1714
2780
|
}
|
|
2781
|
+
/**
|
|
2782
|
+
* Returns the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2783
|
+
*
|
|
2784
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2785
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2786
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2787
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2788
|
+
*/
|
|
1715
2789
|
getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1716
2790
|
return ClusterServer(NitrogenDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1717
2791
|
measuredValue,
|
|
@@ -1722,9 +2796,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1722
2796
|
measurementMedium,
|
|
1723
2797
|
}, {}, {});
|
|
1724
2798
|
}
|
|
2799
|
+
/**
|
|
2800
|
+
* Create the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2801
|
+
*
|
|
2802
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2803
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2804
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2805
|
+
*/
|
|
1725
2806
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1726
2807
|
this.addClusterServer(this.getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1727
2808
|
}
|
|
2809
|
+
/**
|
|
2810
|
+
* Returns the default fan control cluster server rev 2.
|
|
2811
|
+
*
|
|
2812
|
+
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2813
|
+
* @returns The default fan control cluster server.
|
|
2814
|
+
*/
|
|
1728
2815
|
getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1729
2816
|
return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1730
2817
|
fanMode,
|
|
@@ -1736,12 +2823,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1736
2823
|
speedCurrent: 0,
|
|
1737
2824
|
}, {
|
|
1738
2825
|
step: async (data) => {
|
|
2826
|
+
// Never called in edge
|
|
1739
2827
|
},
|
|
1740
2828
|
}, {});
|
|
1741
2829
|
}
|
|
2830
|
+
/**
|
|
2831
|
+
* Create the default fan control cluster server rev 2.
|
|
2832
|
+
*
|
|
2833
|
+
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2834
|
+
* @returns The default fan control cluster server.
|
|
2835
|
+
*/
|
|
1742
2836
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1743
2837
|
this.addClusterServer(this.getDefaultFanControlClusterServer(fanMode));
|
|
1744
2838
|
}
|
|
2839
|
+
/**
|
|
2840
|
+
* Returns the default Pump Configuration And Control cluster server.
|
|
2841
|
+
*
|
|
2842
|
+
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
2843
|
+
* @returns {ClusterServer} - The default Pump Configuration And Control cluster server.
|
|
2844
|
+
*/
|
|
1745
2845
|
getDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1746
2846
|
return ClusterServer(PumpConfigurationAndControlCluster.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
1747
2847
|
minConstSpeed: null,
|
|
@@ -1755,9 +2855,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1755
2855
|
operationMode: pumpMode,
|
|
1756
2856
|
}, {}, {});
|
|
1757
2857
|
}
|
|
2858
|
+
/**
|
|
2859
|
+
* Creates the default Pump Configuration And Control cluster server.
|
|
2860
|
+
*
|
|
2861
|
+
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
2862
|
+
* @returns {void}
|
|
2863
|
+
*/
|
|
1758
2864
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1759
2865
|
this.addClusterServer(this.getDefaultPumpConfigurationAndControlClusterServer(pumpMode));
|
|
1760
2866
|
}
|
|
2867
|
+
/**
|
|
2868
|
+
* Returns the default Valve Configuration And Control cluster server rev 2.
|
|
2869
|
+
*
|
|
2870
|
+
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
2871
|
+
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
2872
|
+
* @returns {ClusterServer} - The default Valve Configuration And Control cluster server.
|
|
2873
|
+
*/
|
|
1761
2874
|
getDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
1762
2875
|
return ClusterServer(ValveConfigurationAndControlCluster.with(ValveConfigurationAndControl.Feature.Level), {
|
|
1763
2876
|
currentState: valveState,
|
|
@@ -1769,12 +2882,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1769
2882
|
remainingDuration: null,
|
|
1770
2883
|
}, {
|
|
1771
2884
|
open: async (data) => {
|
|
2885
|
+
// Never called in edge
|
|
1772
2886
|
},
|
|
1773
2887
|
close: async (data) => {
|
|
2888
|
+
// Never called in edge
|
|
1774
2889
|
},
|
|
1775
2890
|
}, {});
|
|
1776
2891
|
}
|
|
2892
|
+
/**
|
|
2893
|
+
* Create the default Valve Configuration And Control cluster server rev 2.
|
|
2894
|
+
*
|
|
2895
|
+
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
2896
|
+
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
2897
|
+
* @returns {void}
|
|
2898
|
+
*/
|
|
1777
2899
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
1778
2900
|
this.addClusterServer(this.getDefaultValveConfigurationAndControlClusterServer(valveState, valveLevel));
|
|
1779
2901
|
}
|
|
1780
2902
|
}
|
|
2903
|
+
//# sourceMappingURL=matterbridgeEndpoint.js.map
|