matterbridge 1.6.8-dev.6 → 1.6.8-dev.8
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 +2 -2
- package/dist/cli.js +0 -26
- package/dist/cluster/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -23
- package/dist/deviceManager.js +1 -26
- package/dist/index.js +0 -30
- package/dist/logger/export.js +0 -1
- package/dist/matter/export.js +0 -1
- package/dist/matterbridge.js +189 -812
- package/dist/matterbridgeAccessoryPlatform.js +0 -33
- package/dist/matterbridgeBehaviors.js +1 -29
- package/dist/matterbridgeDevice.js +10 -997
- package/dist/matterbridgeDeviceTypes.js +11 -82
- package/dist/matterbridgeDynamicPlatform.js +0 -33
- package/dist/matterbridgeEdge.js +0 -529
- package/dist/matterbridgeEndpoint.js +12 -1121
- package/dist/matterbridgePlatform.js +3 -99
- package/dist/matterbridgeTypes.js +0 -24
- package/dist/matterbridgeWebsocket.js +0 -45
- package/dist/pluginManager.js +3 -238
- package/dist/storage/export.js +0 -1
- package/dist/utils/colorUtils.js +2 -205
- package/dist/utils/export.js +0 -1
- package/dist/utils/utils.js +8 -253
- package/npm-shrinkwrap.json +8 -8
- package/package.json +1 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cluster/export.d.ts.map +0 -1
- package/dist/cluster/export.js.map +0 -1
- package/dist/defaultConfigSchema.d.ts.map +0 -1
- package/dist/defaultConfigSchema.js.map +0 -1
- package/dist/deviceManager.d.ts +0 -46
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -473
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -116
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDevice.d.ts +0 -1142
- package/dist/matterbridgeDevice.d.ts.map +0 -1
- package/dist/matterbridgeDevice.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -109
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEdge.d.ts +0 -90
- package/dist/matterbridgeEdge.d.ts.map +0 -1
- package/dist/matterbridgeEdge.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -1134
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -123
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/matterbridgeWebsocket.d.ts.map +0 -1
- package/dist/matterbridgeWebsocket.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -238
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/utils.d.ts +0 -221
- package/dist/utils/utils.d.ts.map +0 -1
- package/dist/utils/utils.js.map +0 -1
|
@@ -1,35 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
|
|
3
|
-
*
|
|
4
|
-
* @file matterbridgeEndpoint.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2024-10-01
|
|
7
|
-
* @version 1.0.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2024, 2025, 2026 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License. *
|
|
22
|
-
*/
|
|
23
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
24
|
-
// Node.js modules
|
|
25
1
|
import { createHash } from 'crypto';
|
|
26
|
-
|
|
27
|
-
import { AnsiLogger, BLUE, CYAN, LogLevel, TimestampFormat, YELLOW, db, debugStringify, er, hk, or, rs, zb } from 'node-ansi-logger';
|
|
28
|
-
// Matterbridge
|
|
2
|
+
import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, rs, zb } from 'node-ansi-logger';
|
|
29
3
|
import { MatterbridgeBehavior, MatterbridgeBehaviorDevice, MatterbridgeBooleanStateConfigurationServer, MatterbridgeColorControlServer, MatterbridgeDoorLockServer, MatterbridgeFanControlServer, MatterbridgeIdentifyServer, MatterbridgeLevelControlServer, MatterbridgeOnOffServer, MatterbridgeThermostatServer, MatterbridgeWindowCoveringServer, } from './matterbridgeBehaviors.js';
|
|
30
4
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
31
5
|
import { deepCopy, isValidNumber } from './utils/utils.js';
|
|
32
|
-
// @matter
|
|
33
6
|
import { Endpoint, MutableEndpoint, SupportedBehaviors, NamedHandler, Lifecycle } from '@matter/main';
|
|
34
7
|
import { EndpointNumber, VendorId } from '@matter/main';
|
|
35
8
|
import { AirQuality, AirQualityCluster, BasicInformation, BasicInformationCluster, BooleanState, BooleanStateCluster, BooleanStateConfiguration, BooleanStateConfigurationCluster, BridgedDeviceBasicInformation, BridgedDeviceBasicInformationCluster, CarbonDioxideConcentrationMeasurement, CarbonDioxideConcentrationMeasurementCluster, CarbonMonoxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurementCluster, ColorControl, ColorControlCluster, ConcentrationMeasurement, Descriptor, DoorLock, DoorLockCluster, ElectricalEnergyMeasurement, ElectricalEnergyMeasurementCluster, ElectricalPowerMeasurement, ElectricalPowerMeasurementCluster, FanControl, FanControlCluster, FixedLabel, FixedLabelCluster, FlowMeasurement, FlowMeasurementCluster, FormaldehydeConcentrationMeasurement, FormaldehydeConcentrationMeasurementCluster, Groups, GroupsCluster, Identify, IdentifyCluster, IlluminanceMeasurement, IlluminanceMeasurementCluster, LevelControl, LevelControlCluster, ModeSelect, ModeSelectCluster, NitrogenDioxideConcentrationMeasurement, NitrogenDioxideConcentrationMeasurementCluster, OccupancySensing, OccupancySensingCluster, OnOff, OnOffCluster, OzoneConcentrationMeasurement, OzoneConcentrationMeasurementCluster, Pm10ConcentrationMeasurement, Pm10ConcentrationMeasurementCluster, Pm1ConcentrationMeasurement, Pm1ConcentrationMeasurementCluster, Pm25ConcentrationMeasurement, Pm25ConcentrationMeasurementCluster, PowerSource, PowerSourceCluster, PowerSourceConfigurationCluster, PowerTopology, PowerTopologyCluster, PressureMeasurement, PressureMeasurementCluster, 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';
|
|
@@ -50,7 +23,7 @@ import { AirQualityServer, BasicInformationServer, CarbonDioxideConcentrationMea
|
|
|
50
23
|
import { ClusterServer, GroupsClusterHandler } from '@project-chip/matter.js/cluster';
|
|
51
24
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
52
25
|
static bridgeMode = '';
|
|
53
|
-
static logLevel =
|
|
26
|
+
static logLevel = "info";
|
|
54
27
|
log;
|
|
55
28
|
plugin = undefined;
|
|
56
29
|
configUrl = undefined;
|
|
@@ -70,20 +43,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
70
43
|
uniqueStorageKey = undefined;
|
|
71
44
|
tagList = undefined;
|
|
72
45
|
subType = '';
|
|
73
|
-
// Maps matter deviceTypes and endpoints
|
|
74
46
|
deviceTypes = new Map();
|
|
75
47
|
clusterServers = new Map();
|
|
76
48
|
clusterClients = new Map();
|
|
77
49
|
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
|
-
*/
|
|
84
50
|
constructor(definition, options = {}, debug = false) {
|
|
85
51
|
let deviceTypeList = [];
|
|
86
|
-
// Get the first DeviceTypeDefinition
|
|
87
52
|
let firstDefinition;
|
|
88
53
|
if (Array.isArray(definition)) {
|
|
89
54
|
firstDefinition = definition[0];
|
|
@@ -96,7 +61,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
96
61
|
firstDefinition = definition;
|
|
97
62
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
98
63
|
}
|
|
99
|
-
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
100
64
|
const deviceTypeDefinitionV8 = {
|
|
101
65
|
name: firstDefinition.name.replace('-', '_'),
|
|
102
66
|
deviceType: firstDefinition.code,
|
|
@@ -115,7 +79,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
115
79
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
116
80
|
};
|
|
117
81
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
118
|
-
// Convert the options to an Endpoint.Options
|
|
119
82
|
const optionsV8 = {
|
|
120
83
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
121
84
|
number: options.endpointId,
|
|
@@ -133,27 +96,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
133
96
|
}
|
|
134
97
|
else
|
|
135
98
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
136
|
-
|
|
137
|
-
// console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
|
|
138
|
-
// console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
|
|
139
|
-
// Create the logger
|
|
140
|
-
this.log = new AnsiLogger({ logName: 'MatterbridgeEndpoint', logTimestampFormat: TimestampFormat.TIME_MILLIS, logLevel: debug === true ? LogLevel.DEBUG : MatterbridgeEndpoint.logLevel });
|
|
99
|
+
this.log = new AnsiLogger({ logName: 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
|
|
141
100
|
this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
|
|
142
101
|
`id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
|
|
143
|
-
// Add MatterbridgeBehavior with MatterbridgeBehaviorDevice
|
|
144
102
|
this.behaviors.require(MatterbridgeBehavior, { deviceCommand: new MatterbridgeBehaviorDevice(this.log, this.commandHandler, undefined) });
|
|
145
103
|
}
|
|
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
|
-
*/
|
|
152
104
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
153
105
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
154
106
|
}
|
|
155
107
|
static getBehaviourTypesFromClusterServerIds(clusterServerList) {
|
|
156
|
-
// Map Server ClusterId to Behavior.Type
|
|
157
108
|
const behaviorTypes = [];
|
|
158
109
|
clusterServerList.forEach((clusterId) => {
|
|
159
110
|
behaviorTypes.push(MatterbridgeEndpoint.getBehaviourTypeFromClusterServerId(clusterId));
|
|
@@ -161,15 +112,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
161
112
|
return behaviorTypes;
|
|
162
113
|
}
|
|
163
114
|
static getBehaviourTypesFromClusterClientIds(clusterClientList) {
|
|
164
|
-
// Map Client ClusterId to Behavior.Type
|
|
165
115
|
const behaviorTypes = [];
|
|
166
116
|
clusterClientList.forEach((clusterId) => {
|
|
167
|
-
// behaviorTypes.push(MatterbridgeEndpoint.getBehaviourTypeFromClusterClientId(clusterId));
|
|
168
117
|
});
|
|
169
118
|
return behaviorTypes;
|
|
170
119
|
}
|
|
171
120
|
static getBehaviourTypeFromClusterServerId(clusterId, subType) {
|
|
172
|
-
// Map ClusterId to Behavior.Type
|
|
173
121
|
if (clusterId === Identify.Cluster.id)
|
|
174
122
|
return MatterbridgeIdentifyServer;
|
|
175
123
|
if (clusterId === Groups.Cluster.id)
|
|
@@ -281,21 +229,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
281
229
|
return MatterbridgeIdentifyServer;
|
|
282
230
|
}
|
|
283
231
|
static getBehaviourTypeFromClusterClientId(clusterId) {
|
|
284
|
-
// Map ClusterId to Behavior.Type
|
|
285
232
|
return IdentifyBehavior;
|
|
286
233
|
}
|
|
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
|
-
*/
|
|
293
234
|
addDeviceType(deviceType) {
|
|
294
235
|
if (!this.deviceTypes.has(deviceType.code)) {
|
|
295
|
-
// Keep the Matterbridge internal map
|
|
296
236
|
this.log.debug(`addDeviceType: ${zb}${'0x' + deviceType.code.toString(16).padStart(4, '0')}${db}-${zb}${deviceType.name}${db}`);
|
|
297
237
|
this.deviceTypes.set(deviceType.code, deviceType);
|
|
298
|
-
// Add the device types to the descriptor server
|
|
299
238
|
const deviceTypeList = Array.from(this.deviceTypes.values()).map((dt) => ({
|
|
300
239
|
deviceType: dt.code,
|
|
301
240
|
revision: dt.revision,
|
|
@@ -313,12 +252,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
313
252
|
}
|
|
314
253
|
}
|
|
315
254
|
}
|
|
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
|
-
*/
|
|
322
255
|
addDeviceTypeWithClusterServer(deviceTypes, includeServerList) {
|
|
323
256
|
this.log.debug('addDeviceTypeWithClusterServer:');
|
|
324
257
|
deviceTypes.forEach((deviceType) => {
|
|
@@ -341,12 +274,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
341
274
|
});
|
|
342
275
|
this.addClusterServerFromList(this, includeServerList);
|
|
343
276
|
}
|
|
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
|
-
*/
|
|
350
277
|
addRequiredClusterServers(endpoint) {
|
|
351
278
|
const requiredServerList = [];
|
|
352
279
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.id}${db}`);
|
|
@@ -363,12 +290,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
363
290
|
this.addClusterServerFromList(endpoint, requiredServerList);
|
|
364
291
|
return endpoint;
|
|
365
292
|
}
|
|
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
|
-
*/
|
|
372
293
|
addOptionalClusterServers(endpoint) {
|
|
373
294
|
const optionalServerList = [];
|
|
374
295
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.id}${db}`);
|
|
@@ -385,22 +306,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
385
306
|
this.addClusterServerFromList(endpoint, optionalServerList);
|
|
386
307
|
return endpoint;
|
|
387
308
|
}
|
|
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
|
-
*/
|
|
404
309
|
addChildDeviceType(endpointName, deviceTypes, options = {}, debug = false) {
|
|
405
310
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
406
311
|
let child = this.getChildEndpointByName(endpointName);
|
|
@@ -431,23 +336,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
431
336
|
}
|
|
432
337
|
return child;
|
|
433
338
|
}
|
|
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
|
-
*/
|
|
451
339
|
addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
|
|
452
340
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
453
341
|
let child = this.getChildEndpointByName(endpointName);
|
|
@@ -491,12 +379,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
491
379
|
}
|
|
492
380
|
return child;
|
|
493
381
|
}
|
|
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
|
-
*/
|
|
500
382
|
getChildEndpointByName(endpointName) {
|
|
501
383
|
return this.parts.find((part) => part.id === endpointName);
|
|
502
384
|
}
|
|
@@ -515,8 +397,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
515
397
|
});
|
|
516
398
|
}
|
|
517
399
|
async setBridgedDeviceReachability(reachable) {
|
|
518
|
-
// await this.setAttribute(BridgedDeviceBasicInformationCluster.id, 'reachable', reachable, this.log);
|
|
519
|
-
// await this.triggerEvent(BridgedDeviceBasicInformationCluster.id, 'reachableChanged', { reachableNewValue: reachable }, this.log);
|
|
520
400
|
}
|
|
521
401
|
hasClusterServer(cluster) {
|
|
522
402
|
return this.clusterServers.has(cluster.id);
|
|
@@ -534,25 +414,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
534
414
|
return this.clusterServers.get(clusterId);
|
|
535
415
|
}
|
|
536
416
|
addTagList(endpoint, mfgCode, namespaceId, tag, label) {
|
|
537
|
-
// Do nothing here only for old api compatibility
|
|
538
417
|
}
|
|
539
418
|
addClusterServer(cluster) {
|
|
540
|
-
// console.log('addClusterServer:', cluster.id, cluster.name, cluster.attributes, cluster.events, cluster.commands);
|
|
541
419
|
let features = {};
|
|
542
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
543
420
|
const options = {};
|
|
544
421
|
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
|
|
547
422
|
if (attribute.name === 'featureMap') {
|
|
548
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
549
423
|
features = attribute.value;
|
|
550
|
-
// console.log('Cluster', cluster.name, 'FeatureMap:', features);
|
|
551
|
-
// options[(attribute as any).name] = (attribute as any).value;
|
|
552
424
|
}
|
|
553
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
554
425
|
if (attribute.id < 0xfff0) {
|
|
555
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
556
426
|
options[attribute.name] = attribute.value;
|
|
557
427
|
}
|
|
558
428
|
}
|
|
@@ -592,16 +462,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
592
462
|
const behavior = MatterbridgeEndpoint.getBehaviourTypeFromClusterServerId(cluster.id, this.subType);
|
|
593
463
|
this.clusterServers.set(cluster.id, cluster);
|
|
594
464
|
if (cluster.id === BasicInformationCluster.id)
|
|
595
|
-
return;
|
|
465
|
+
return;
|
|
596
466
|
this.behaviors.require(behavior, options);
|
|
597
467
|
}
|
|
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
|
-
*/
|
|
605
468
|
addClusterServerFromList(endpoint, includeServerList) {
|
|
606
469
|
if (includeServerList.includes(Identify.Cluster.id))
|
|
607
470
|
endpoint.addClusterServer(this.getDefaultIdentifyClusterServer());
|
|
@@ -671,8 +534,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
671
534
|
endpoint.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer());
|
|
672
535
|
if (includeServerList.includes(TotalVolatileOrganicCompoundsConcentrationMeasurement.Cluster.id))
|
|
673
536
|
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());
|
|
676
537
|
}
|
|
677
538
|
async addFixedLabel(label, value) {
|
|
678
539
|
if (!this.clusterServers.get(FixedLabelCluster.id)) {
|
|
@@ -710,16 +571,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
710
571
|
return name;
|
|
711
572
|
return name.charAt(0).toLowerCase() + name.slice(1);
|
|
712
573
|
}
|
|
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
|
|
723
574
|
getAttribute(clusterId, attribute, log, endpoint) {
|
|
724
575
|
if (!endpoint)
|
|
725
576
|
endpoint = this;
|
|
@@ -728,7 +579,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
728
579
|
this.log.error(`getAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
729
580
|
return undefined;
|
|
730
581
|
}
|
|
731
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
732
582
|
const state = endpoint.state;
|
|
733
583
|
if (!(clusterName in state)) {
|
|
734
584
|
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}`);
|
|
@@ -743,17 +593,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
743
593
|
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}`);
|
|
744
594
|
return value;
|
|
745
595
|
}
|
|
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
|
|
757
596
|
async setAttribute(clusterId, attribute, value, log, endpoint) {
|
|
758
597
|
if (!endpoint)
|
|
759
598
|
endpoint = this;
|
|
@@ -762,7 +601,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
762
601
|
this.log.error(`setAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
763
602
|
return false;
|
|
764
603
|
}
|
|
765
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
766
604
|
const state = endpoint.state;
|
|
767
605
|
if (!(clusterName in state)) {
|
|
768
606
|
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}`);
|
|
@@ -782,26 +620,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
782
620
|
`to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
783
621
|
return true;
|
|
784
622
|
}
|
|
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
|
|
796
623
|
async subscribeAttribute(clusterId, attribute, listener, log, endpoint) {
|
|
797
624
|
if (!endpoint)
|
|
798
625
|
endpoint = this;
|
|
799
626
|
const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
800
627
|
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`);
|
|
802
628
|
await endpoint.construction.ready;
|
|
803
629
|
}
|
|
804
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
805
630
|
const events = endpoint.events;
|
|
806
631
|
if (!(clusterName in events)) {
|
|
807
632
|
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}`);
|
|
@@ -816,218 +641,67 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
816
641
|
log?.info(`${db}Subscribe endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${this.capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
|
|
817
642
|
return true;
|
|
818
643
|
}
|
|
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
|
-
*/
|
|
829
644
|
async triggerEvent(clusterId, event, payload, log, endpoint) {
|
|
830
645
|
if (!endpoint)
|
|
831
646
|
endpoint = this;
|
|
832
647
|
const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
833
648
|
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`);
|
|
835
649
|
await endpoint.construction.ready;
|
|
836
|
-
// return false;
|
|
837
650
|
}
|
|
838
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
839
651
|
const events = endpoint.events;
|
|
840
652
|
if (!(clusterName in events) || !(event in events[clusterName])) {
|
|
841
653
|
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}`);
|
|
842
654
|
return false;
|
|
843
655
|
}
|
|
844
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
845
|
-
// @ts-ignore
|
|
846
656
|
await endpoint.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
|
|
847
657
|
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} `);
|
|
848
658
|
return true;
|
|
849
659
|
}
|
|
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
|
|
858
660
|
addCommandHandler(command, handler) {
|
|
859
661
|
this.commandHandler.addHandler(command, handler);
|
|
860
662
|
}
|
|
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
|
-
*/
|
|
867
663
|
serialize() {
|
|
868
664
|
return undefined;
|
|
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
|
-
*/
|
|
665
|
+
}
|
|
897
666
|
static deserialize(serializedDevice) {
|
|
898
667
|
return undefined;
|
|
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
|
-
*/
|
|
668
|
+
}
|
|
933
669
|
getDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
934
670
|
return ClusterServer(IdentifyCluster, {
|
|
935
671
|
identifyTime,
|
|
936
672
|
identifyType,
|
|
937
673
|
}, {
|
|
938
674
|
identify: async (data) => {
|
|
939
|
-
// Never called in edge
|
|
940
675
|
},
|
|
941
676
|
triggerEffect: async (data) => {
|
|
942
|
-
// Never called in edge
|
|
943
677
|
},
|
|
944
678
|
});
|
|
945
679
|
}
|
|
946
|
-
/**
|
|
947
|
-
* Creates a default IdentifyCluster server.
|
|
948
|
-
*/
|
|
949
680
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
950
681
|
this.addClusterServer(this.getDefaultIdentifyClusterServer(identifyTime, identifyType));
|
|
951
682
|
return this;
|
|
952
683
|
}
|
|
953
|
-
/**
|
|
954
|
-
* Get a default IdentifyCluster server.
|
|
955
|
-
*/
|
|
956
684
|
getDefaultGroupsClusterServer() {
|
|
957
685
|
return ClusterServer(GroupsCluster, {
|
|
958
686
|
nameSupport: {
|
|
959
687
|
nameSupport: true,
|
|
960
688
|
},
|
|
961
689
|
}, GroupsClusterHandler());
|
|
962
|
-
// return createDefaultGroupsClusterServer();
|
|
963
690
|
}
|
|
964
|
-
/**
|
|
965
|
-
* Creates a default groups cluster server and adds it to the device.
|
|
966
|
-
*/
|
|
967
691
|
createDefaultGroupsClusterServer() {
|
|
968
692
|
this.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
969
693
|
return this;
|
|
970
694
|
}
|
|
971
|
-
/**
|
|
972
|
-
* Get a default scenes cluster server and adds it to the current instance.
|
|
973
|
-
* @deprecated This method is deprecated.
|
|
974
|
-
*
|
|
975
|
-
*/
|
|
976
695
|
getDefaultScenesClusterServer() {
|
|
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
697
|
createDefaultScenesClusterServer() {
|
|
999
|
-
/*
|
|
1000
|
-
this.addClusterServer(this.getDefaultScenesClusterServer());
|
|
1001
|
-
*/
|
|
1002
698
|
return this;
|
|
1003
699
|
}
|
|
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
|
-
*/
|
|
1012
700
|
createUniqueId(param1, param2, param3, param4) {
|
|
1013
701
|
const hash = createHash('md5');
|
|
1014
702
|
hash.update(param1 + param2 + param3 + param4);
|
|
1015
703
|
return hash.digest('hex');
|
|
1016
704
|
}
|
|
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
|
-
*/
|
|
1031
705
|
getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
1032
706
|
this.log.logName = deviceName;
|
|
1033
707
|
this.deviceName = deviceName;
|
|
@@ -1068,20 +742,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1068
742
|
reachableChanged: true,
|
|
1069
743
|
});
|
|
1070
744
|
}
|
|
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
|
-
*/
|
|
1085
745
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
1086
746
|
if (MatterbridgeEndpoint.bridgeMode === 'bridge') {
|
|
1087
747
|
this.addDeviceType(bridgedNode);
|
|
@@ -1091,19 +751,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1091
751
|
this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
1092
752
|
return this;
|
|
1093
753
|
}
|
|
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
|
-
*/
|
|
1107
754
|
getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
1108
755
|
this.log.logName = deviceName;
|
|
1109
756
|
this.deviceName = deviceName;
|
|
@@ -1118,7 +765,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1118
765
|
this.hardwareVersion = hardwareVersion;
|
|
1119
766
|
this.hardwareVersionString = hardwareVersionString;
|
|
1120
767
|
return ClusterServer(BridgedDeviceBasicInformationCluster, {
|
|
1121
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
768
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
1122
769
|
vendorName: vendorName.slice(0, 32),
|
|
1123
770
|
productName: productName.slice(0, 32),
|
|
1124
771
|
productUrl: 'https://www.npmjs.com/package/matterbridge',
|
|
@@ -1138,37 +785,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1138
785
|
reachableChanged: true,
|
|
1139
786
|
});
|
|
1140
787
|
}
|
|
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
|
-
*/
|
|
1154
788
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
1155
789
|
this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
1156
790
|
return this;
|
|
1157
791
|
}
|
|
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
|
-
*/
|
|
1163
792
|
getDefaultPowerTopologyClusterServer() {
|
|
1164
793
|
return ClusterServer(PowerTopologyCluster.with(PowerTopology.Feature.TreeTopology), {}, {}, {});
|
|
1165
794
|
}
|
|
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
|
-
*/
|
|
1172
795
|
getDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
1173
796
|
return ClusterServer(ElectricalEnergyMeasurementCluster.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1174
797
|
accuracy: {
|
|
@@ -1185,15 +808,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1185
808
|
cumulativeEnergyMeasured: true,
|
|
1186
809
|
});
|
|
1187
810
|
}
|
|
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
|
-
*/
|
|
1197
811
|
getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1198
812
|
return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1199
813
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1234,16 +848,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1234
848
|
frequency: frequency,
|
|
1235
849
|
}, {}, {});
|
|
1236
850
|
}
|
|
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
|
-
*/
|
|
1247
851
|
getDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
1248
852
|
return ClusterServer(OnOffCluster.with(OnOff.Feature.Lighting), {
|
|
1249
853
|
onOff,
|
|
@@ -1253,110 +857,55 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1253
857
|
startUpOnOff,
|
|
1254
858
|
}, {
|
|
1255
859
|
on: async (data) => {
|
|
1256
|
-
// Never called in edge
|
|
1257
860
|
},
|
|
1258
861
|
off: async (data) => {
|
|
1259
|
-
// Never called in edge
|
|
1260
862
|
},
|
|
1261
863
|
toggle: async (data) => {
|
|
1262
|
-
// Never called in edge
|
|
1263
864
|
},
|
|
1264
865
|
offWithEffect: async () => {
|
|
1265
|
-
// Never called in edge
|
|
1266
866
|
},
|
|
1267
867
|
onWithRecallGlobalScene: async () => {
|
|
1268
|
-
// Never called in edge
|
|
1269
868
|
},
|
|
1270
869
|
onWithTimedOff: async () => {
|
|
1271
|
-
// Never called in edge
|
|
1272
870
|
},
|
|
1273
871
|
}, {});
|
|
1274
872
|
}
|
|
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
|
-
*/
|
|
1285
873
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
1286
874
|
this.addClusterServer(this.getDefaultOnOffClusterServer(onOff, globalSceneControl, onTime, offWaitTime, startUpOnOff));
|
|
1287
875
|
return this;
|
|
1288
876
|
}
|
|
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
|
-
*/
|
|
1296
877
|
getOnOffClusterServer(onOff = false) {
|
|
1297
878
|
return ClusterServer(OnOffCluster, {
|
|
1298
879
|
onOff,
|
|
1299
880
|
}, {
|
|
1300
881
|
on: async (data) => {
|
|
1301
|
-
// Never called in edge
|
|
1302
882
|
},
|
|
1303
883
|
off: async (data) => {
|
|
1304
|
-
// Never called in edge
|
|
1305
884
|
},
|
|
1306
885
|
toggle: async (data) => {
|
|
1307
|
-
// Never called in edge
|
|
1308
886
|
},
|
|
1309
887
|
}, {});
|
|
1310
888
|
}
|
|
1311
|
-
/**
|
|
1312
|
-
* Creates an OnOff cluster server without features.
|
|
1313
|
-
*
|
|
1314
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1315
|
-
*/
|
|
1316
889
|
createOnOffClusterServer(onOff = false) {
|
|
1317
890
|
this.addClusterServer(this.getOnOffClusterServer(onOff));
|
|
1318
891
|
return this;
|
|
1319
892
|
}
|
|
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
|
-
*/
|
|
1327
893
|
getDeadFrontOnOffClusterServer(onOff = false) {
|
|
1328
894
|
return ClusterServer(OnOffCluster.with(OnOff.Feature.DeadFrontBehavior), {
|
|
1329
895
|
onOff,
|
|
1330
896
|
}, {
|
|
1331
897
|
on: async (data) => {
|
|
1332
|
-
// Never called in edge
|
|
1333
898
|
},
|
|
1334
899
|
off: async (data) => {
|
|
1335
|
-
// Never called in edge
|
|
1336
900
|
},
|
|
1337
901
|
toggle: async (data) => {
|
|
1338
|
-
// Never called in edge
|
|
1339
902
|
},
|
|
1340
903
|
}, {});
|
|
1341
904
|
}
|
|
1342
|
-
/**
|
|
1343
|
-
* Creates a DeadFront OnOff cluster server.
|
|
1344
|
-
*
|
|
1345
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1346
|
-
*/
|
|
1347
905
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
1348
906
|
this.addClusterServer(this.getDeadFrontOnOffClusterServer(onOff));
|
|
1349
907
|
return this;
|
|
1350
908
|
}
|
|
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
|
-
*/
|
|
1360
909
|
getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
1361
910
|
return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
1362
911
|
currentLevel,
|
|
@@ -1371,55 +920,27 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1371
920
|
},
|
|
1372
921
|
}, {
|
|
1373
922
|
moveToLevel: async (data) => {
|
|
1374
|
-
// Never called in edge
|
|
1375
923
|
},
|
|
1376
924
|
move: async () => {
|
|
1377
|
-
// Never called in edge
|
|
1378
925
|
},
|
|
1379
926
|
step: async () => {
|
|
1380
|
-
// Never called in edge
|
|
1381
927
|
},
|
|
1382
928
|
stop: async () => {
|
|
1383
|
-
// Never called in edge
|
|
1384
929
|
},
|
|
1385
930
|
moveToLevelWithOnOff: async (data) => {
|
|
1386
|
-
// Never called in edge
|
|
1387
931
|
},
|
|
1388
932
|
moveWithOnOff: async () => {
|
|
1389
|
-
// Never called in edge
|
|
1390
933
|
},
|
|
1391
934
|
stepWithOnOff: async () => {
|
|
1392
|
-
// Never called in edge
|
|
1393
935
|
},
|
|
1394
936
|
stopWithOnOff: async () => {
|
|
1395
|
-
// Never called in edge
|
|
1396
937
|
},
|
|
1397
938
|
});
|
|
1398
939
|
}
|
|
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
|
-
*/
|
|
1408
940
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
1409
941
|
this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel, startUpCurrentLevel));
|
|
1410
942
|
return this;
|
|
1411
943
|
}
|
|
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
|
-
*/
|
|
1423
944
|
getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1424
945
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1425
946
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1441,73 +962,39 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1441
962
|
startUpColorTemperatureMireds: null,
|
|
1442
963
|
}, {
|
|
1443
964
|
moveToColor: async (data) => {
|
|
1444
|
-
// Never called in edge
|
|
1445
965
|
},
|
|
1446
966
|
moveColor: async () => {
|
|
1447
|
-
// Never called in edge
|
|
1448
967
|
},
|
|
1449
968
|
stepColor: async () => {
|
|
1450
|
-
// Never called in edge
|
|
1451
969
|
},
|
|
1452
970
|
moveToHue: async (data) => {
|
|
1453
|
-
// Never called in edge
|
|
1454
971
|
},
|
|
1455
972
|
moveHue: async () => {
|
|
1456
|
-
// Never called in edge
|
|
1457
973
|
},
|
|
1458
974
|
stepHue: async () => {
|
|
1459
|
-
// Never called in edge
|
|
1460
975
|
},
|
|
1461
976
|
moveToSaturation: async (data) => {
|
|
1462
|
-
// Never called in edge
|
|
1463
977
|
},
|
|
1464
978
|
moveSaturation: async () => {
|
|
1465
|
-
// Never called in edge
|
|
1466
979
|
},
|
|
1467
980
|
stepSaturation: async () => {
|
|
1468
|
-
// Never called in edge
|
|
1469
981
|
},
|
|
1470
982
|
moveToHueAndSaturation: async (data) => {
|
|
1471
|
-
// Never called in edge
|
|
1472
983
|
},
|
|
1473
984
|
stopMoveStep: async () => {
|
|
1474
|
-
// Never called in edge
|
|
1475
985
|
},
|
|
1476
986
|
moveToColorTemperature: async (data) => {
|
|
1477
|
-
// Never called in edge
|
|
1478
987
|
},
|
|
1479
988
|
moveColorTemperature: async () => {
|
|
1480
|
-
// Never called in edge
|
|
1481
989
|
},
|
|
1482
990
|
stepColorTemperature: async () => {
|
|
1483
|
-
// Never called in edge
|
|
1484
991
|
},
|
|
1485
992
|
}, {});
|
|
1486
993
|
}
|
|
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
|
-
*/
|
|
1498
994
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1499
995
|
this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1500
996
|
return this;
|
|
1501
997
|
}
|
|
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
|
-
*/
|
|
1511
998
|
getXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1512
999
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
1513
1000
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -1527,50 +1014,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1527
1014
|
remainingTime: 0,
|
|
1528
1015
|
}, {
|
|
1529
1016
|
moveToColor: async () => {
|
|
1530
|
-
// Never called in edge
|
|
1531
1017
|
},
|
|
1532
1018
|
moveColor: async () => {
|
|
1533
|
-
// Never called in edge
|
|
1534
1019
|
},
|
|
1535
1020
|
stepColor: async () => {
|
|
1536
|
-
// Never called in edge
|
|
1537
1021
|
},
|
|
1538
1022
|
stopMoveStep: async () => {
|
|
1539
|
-
// Never called in edge
|
|
1540
1023
|
},
|
|
1541
1024
|
moveToColorTemperature: async () => {
|
|
1542
|
-
// Never called in edge
|
|
1543
1025
|
},
|
|
1544
1026
|
moveColorTemperature: async () => {
|
|
1545
|
-
// Never called in edge
|
|
1546
1027
|
},
|
|
1547
1028
|
stepColorTemperature: async () => {
|
|
1548
|
-
// Never called in edge
|
|
1549
1029
|
},
|
|
1550
1030
|
}, {});
|
|
1551
1031
|
}
|
|
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
|
-
*/
|
|
1561
1032
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1562
1033
|
this.addClusterServer(this.getXyColorControlClusterServer(currentX, currentY, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1563
1034
|
return this;
|
|
1564
1035
|
}
|
|
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
|
-
*/
|
|
1574
1036
|
getHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1575
1037
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1576
1038
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1590,60 +1052,33 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1590
1052
|
remainingTime: 0,
|
|
1591
1053
|
}, {
|
|
1592
1054
|
moveToHue: async () => {
|
|
1593
|
-
// Never called in edge
|
|
1594
1055
|
},
|
|
1595
1056
|
moveHue: async () => {
|
|
1596
|
-
// Never called in edge
|
|
1597
1057
|
},
|
|
1598
1058
|
stepHue: async () => {
|
|
1599
|
-
// Never called in edge
|
|
1600
1059
|
},
|
|
1601
1060
|
moveToSaturation: async () => {
|
|
1602
|
-
// Never called in edge
|
|
1603
1061
|
},
|
|
1604
1062
|
moveSaturation: async () => {
|
|
1605
|
-
// Never called in edge
|
|
1606
1063
|
},
|
|
1607
1064
|
stepSaturation: async () => {
|
|
1608
|
-
// Never called in edge
|
|
1609
1065
|
},
|
|
1610
1066
|
moveToHueAndSaturation: async () => {
|
|
1611
|
-
// Never called in edge
|
|
1612
1067
|
},
|
|
1613
1068
|
stopMoveStep: async () => {
|
|
1614
|
-
// Never called in edge
|
|
1615
1069
|
},
|
|
1616
1070
|
moveToColorTemperature: async () => {
|
|
1617
|
-
// Never called in edge
|
|
1618
1071
|
},
|
|
1619
1072
|
moveColorTemperature: async () => {
|
|
1620
|
-
// Never called in edge
|
|
1621
1073
|
},
|
|
1622
1074
|
stepColorTemperature: async () => {
|
|
1623
|
-
// Never called in edge
|
|
1624
1075
|
},
|
|
1625
1076
|
}, {});
|
|
1626
1077
|
}
|
|
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
|
-
*/
|
|
1636
1078
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1637
1079
|
this.addClusterServer(this.getHsColorControlClusterServer(currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1638
1080
|
return this;
|
|
1639
1081
|
}
|
|
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
|
-
*/
|
|
1647
1082
|
getCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1648
1083
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.ColorTemperature), {
|
|
1649
1084
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1661,45 +1096,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1661
1096
|
startUpColorTemperatureMireds: null,
|
|
1662
1097
|
}, {
|
|
1663
1098
|
stopMoveStep: async () => {
|
|
1664
|
-
// Never called in edge
|
|
1665
1099
|
},
|
|
1666
1100
|
moveToColorTemperature: async () => {
|
|
1667
|
-
// Never called in edge
|
|
1668
1101
|
},
|
|
1669
1102
|
moveColorTemperature: async () => {
|
|
1670
|
-
// Never called in edge
|
|
1671
1103
|
},
|
|
1672
1104
|
stepColorTemperature: async () => {
|
|
1673
|
-
// Never called in edge
|
|
1674
1105
|
},
|
|
1675
1106
|
}, {});
|
|
1676
1107
|
}
|
|
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
|
-
*/
|
|
1684
1108
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1685
1109
|
this.addClusterServer(this.getCtColorControlClusterServer(colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1686
1110
|
return this;
|
|
1687
1111
|
}
|
|
1688
1112
|
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
|
-
*/
|
|
1703
1113
|
async configureColorControlCluster(hueSaturation, xy, colorTemperature, colorMode, endpoint) {
|
|
1704
1114
|
if (!endpoint)
|
|
1705
1115
|
endpoint = this;
|
|
@@ -1723,12 +1133,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1723
1133
|
this.isColorControlConfigured = true;
|
|
1724
1134
|
return this;
|
|
1725
1135
|
}
|
|
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
|
-
*/
|
|
1732
1136
|
async configureColorControlMode(colorMode, endpoint) {
|
|
1733
1137
|
if (!endpoint)
|
|
1734
1138
|
endpoint = this;
|
|
@@ -1738,11 +1142,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1738
1142
|
}
|
|
1739
1143
|
return this;
|
|
1740
1144
|
}
|
|
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
|
-
*/
|
|
1746
1145
|
getDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1747
1146
|
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1748
1147
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
@@ -1758,39 +1157,26 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1758
1157
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1759
1158
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
1760
1159
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1761
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1762
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1160
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1161
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1763
1162
|
}, {
|
|
1764
1163
|
upOrOpen: async (data) => {
|
|
1765
|
-
// Never called in edge
|
|
1766
1164
|
},
|
|
1767
1165
|
downOrClose: async (data) => {
|
|
1768
|
-
// Never called in edge
|
|
1769
1166
|
},
|
|
1770
1167
|
stopMotion: async (data) => {
|
|
1771
|
-
// Never called in edge
|
|
1772
1168
|
},
|
|
1773
1169
|
goToLiftPercentage: async (data) => {
|
|
1774
|
-
// Never called in edge
|
|
1775
1170
|
},
|
|
1776
1171
|
}, {});
|
|
1777
1172
|
}
|
|
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
|
-
*/
|
|
1783
1173
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1784
1174
|
this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
|
|
1785
1175
|
}
|
|
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
|
-
*/
|
|
1790
1176
|
async setWindowCoveringTargetAsCurrentAndStopped(endpoint) {
|
|
1791
1177
|
if (!endpoint)
|
|
1792
1178
|
endpoint = this;
|
|
1793
|
-
const position = endpoint.getAttribute(WindowCoveringCluster.id, 'currentPositionLiftPercent100ths', this.log, endpoint);
|
|
1179
|
+
const position = endpoint.getAttribute(WindowCoveringCluster.id, 'currentPositionLiftPercent100ths', this.log, endpoint);
|
|
1794
1180
|
if (position !== null) {
|
|
1795
1181
|
await endpoint.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', position, this.log, endpoint);
|
|
1796
1182
|
await endpoint.setAttribute(WindowCoveringCluster.id, 'operationalStatus', {
|
|
@@ -1801,13 +1187,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1801
1187
|
}
|
|
1802
1188
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1803
1189
|
}
|
|
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
|
-
*/
|
|
1811
1190
|
async setWindowCoveringCurrentTargetStatus(current, target, status, endpoint) {
|
|
1812
1191
|
if (!endpoint)
|
|
1813
1192
|
endpoint = this;
|
|
@@ -1820,11 +1199,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1820
1199
|
}, this.log, endpoint);
|
|
1821
1200
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1822
1201
|
}
|
|
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
|
-
*/
|
|
1828
1202
|
async setWindowCoveringStatus(status, endpoint) {
|
|
1829
1203
|
if (!endpoint)
|
|
1830
1204
|
endpoint = this;
|
|
@@ -1835,12 +1209,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1835
1209
|
}, this.log, endpoint);
|
|
1836
1210
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1837
1211
|
}
|
|
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
|
-
*/
|
|
1844
1212
|
getWindowCoveringStatus(endpoint) {
|
|
1845
1213
|
if (!endpoint)
|
|
1846
1214
|
endpoint = this;
|
|
@@ -1848,12 +1216,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1848
1216
|
this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
|
|
1849
1217
|
return status.global;
|
|
1850
1218
|
}
|
|
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
|
-
*/
|
|
1857
1219
|
async setWindowCoveringTargetAndCurrentPosition(position, endpoint) {
|
|
1858
1220
|
if (!endpoint)
|
|
1859
1221
|
endpoint = this;
|
|
@@ -1861,13 +1223,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1861
1223
|
await endpoint.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', position, this.log, endpoint);
|
|
1862
1224
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
1863
1225
|
}
|
|
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
|
-
*/
|
|
1871
1226
|
getDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1872
1227
|
return ClusterServer(DoorLockCluster, {
|
|
1873
1228
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
@@ -1877,10 +1232,8 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1877
1232
|
supportedOperatingModes: { normal: true, vacation: false, privacy: false, noRemoteLockUnlock: false, passage: false },
|
|
1878
1233
|
}, {
|
|
1879
1234
|
lockDoor: async (data) => {
|
|
1880
|
-
// Never called in edge
|
|
1881
1235
|
},
|
|
1882
1236
|
unlockDoor: async (data) => {
|
|
1883
|
-
// Never called in edge
|
|
1884
1237
|
},
|
|
1885
1238
|
}, {
|
|
1886
1239
|
doorLockAlarm: true,
|
|
@@ -1888,22 +1241,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1888
1241
|
lockOperationError: true,
|
|
1889
1242
|
});
|
|
1890
1243
|
}
|
|
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
|
-
*/
|
|
1898
1244
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1899
1245
|
this.addClusterServer(this.getDefaultDoorLockClusterServer(lockState, lockType));
|
|
1900
1246
|
}
|
|
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
|
-
*/
|
|
1907
1247
|
getDefaultSwitchClusterServer() {
|
|
1908
1248
|
return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
|
|
1909
1249
|
numberOfPositions: 2,
|
|
@@ -1918,21 +1258,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1918
1258
|
multiPressComplete: true,
|
|
1919
1259
|
});
|
|
1920
1260
|
}
|
|
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
|
-
*/
|
|
1927
1261
|
createDefaultSwitchClusterServer() {
|
|
1928
1262
|
this.addClusterServer(this.getDefaultSwitchClusterServer());
|
|
1929
1263
|
}
|
|
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
|
-
*/
|
|
1936
1264
|
getDefaultLatchingSwitchClusterServer() {
|
|
1937
1265
|
return ClusterServer(SwitchCluster.with(Switch.Feature.LatchingSwitch), {
|
|
1938
1266
|
numberOfPositions: 2,
|
|
@@ -1941,22 +1269,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1941
1269
|
switchLatched: true,
|
|
1942
1270
|
});
|
|
1943
1271
|
}
|
|
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
|
-
*/
|
|
1950
1272
|
createDefaultLatchingSwitchClusterServer() {
|
|
1951
1273
|
this.addClusterServer(this.getDefaultLatchingSwitchClusterServer());
|
|
1952
1274
|
}
|
|
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
|
-
*/
|
|
1960
1275
|
async triggerSwitchEvent(event, log, endpoint) {
|
|
1961
1276
|
if (!endpoint)
|
|
1962
1277
|
endpoint = this;
|
|
@@ -2024,15 +1339,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2024
1339
|
}
|
|
2025
1340
|
return true;
|
|
2026
1341
|
}
|
|
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
|
-
*/
|
|
2036
1342
|
getDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
2037
1343
|
return ClusterServer(ModeSelectCluster, {
|
|
2038
1344
|
description: description,
|
|
@@ -2042,30 +1348,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2042
1348
|
startUpMode: startUpMode,
|
|
2043
1349
|
}, {
|
|
2044
1350
|
changeToMode: async (data) => {
|
|
2045
|
-
// Never called in edge
|
|
2046
1351
|
},
|
|
2047
1352
|
});
|
|
2048
1353
|
}
|
|
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
|
-
*/
|
|
2059
1354
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
|
|
2060
1355
|
if (!endpoint)
|
|
2061
1356
|
endpoint = this;
|
|
2062
1357
|
endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
|
|
2063
1358
|
}
|
|
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
|
-
*/
|
|
2069
1359
|
getDefaultOccupancySensingClusterServer(occupied = false) {
|
|
2070
1360
|
return ClusterServer(OccupancySensingCluster, {
|
|
2071
1361
|
occupancy: { occupied },
|
|
@@ -2074,19 +1364,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2074
1364
|
pirOccupiedToUnoccupiedDelay: 30,
|
|
2075
1365
|
}, {});
|
|
2076
1366
|
}
|
|
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
|
-
*/
|
|
2082
1367
|
createDefaultOccupancySensingClusterServer(occupied = false) {
|
|
2083
1368
|
this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
|
|
2084
1369
|
}
|
|
2085
|
-
/**
|
|
2086
|
-
* Get a default Illuminance Measurement Cluster Server.
|
|
2087
|
-
*
|
|
2088
|
-
* @param measuredValue - The measured value of illuminance.
|
|
2089
|
-
*/
|
|
2090
1370
|
getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
2091
1371
|
return ClusterServer(IlluminanceMeasurementCluster, {
|
|
2092
1372
|
measuredValue,
|
|
@@ -2095,19 +1375,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2095
1375
|
tolerance: 0,
|
|
2096
1376
|
}, {}, {});
|
|
2097
1377
|
}
|
|
2098
|
-
/**
|
|
2099
|
-
* Creates a default Illuminance Measurement Cluster Server.
|
|
2100
|
-
*
|
|
2101
|
-
* @param measuredValue - The measured value of illuminance.
|
|
2102
|
-
*/
|
|
2103
1378
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
2104
1379
|
this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
|
|
2105
1380
|
}
|
|
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
|
-
*/
|
|
2111
1381
|
getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
2112
1382
|
return ClusterServer(FlowMeasurementCluster, {
|
|
2113
1383
|
measuredValue,
|
|
@@ -2116,19 +1386,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2116
1386
|
tolerance: 0,
|
|
2117
1387
|
}, {}, {});
|
|
2118
1388
|
}
|
|
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
|
-
*/
|
|
2124
1389
|
createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
2125
1390
|
this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
|
|
2126
1391
|
}
|
|
2127
|
-
/**
|
|
2128
|
-
* Get a default temperature measurement cluster server.
|
|
2129
|
-
*
|
|
2130
|
-
* @param measuredValue - The measured value of the temperature x 100.
|
|
2131
|
-
*/
|
|
2132
1392
|
getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
2133
1393
|
return ClusterServer(TemperatureMeasurementCluster, {
|
|
2134
1394
|
measuredValue,
|
|
@@ -2137,19 +1397,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2137
1397
|
tolerance: 0,
|
|
2138
1398
|
}, {}, {});
|
|
2139
1399
|
}
|
|
2140
|
-
/**
|
|
2141
|
-
* Creates a default temperature measurement cluster server.
|
|
2142
|
-
*
|
|
2143
|
-
* @param measuredValue - The measured value of the temperature x 100.
|
|
2144
|
-
*/
|
|
2145
1400
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
2146
1401
|
this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
|
|
2147
1402
|
}
|
|
2148
|
-
/**
|
|
2149
|
-
* Get a default RelativeHumidityMeasurementCluster server.
|
|
2150
|
-
*
|
|
2151
|
-
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
2152
|
-
*/
|
|
2153
1403
|
getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
2154
1404
|
return ClusterServer(RelativeHumidityMeasurementCluster, {
|
|
2155
1405
|
measuredValue,
|
|
@@ -2158,19 +1408,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2158
1408
|
tolerance: 0,
|
|
2159
1409
|
}, {}, {});
|
|
2160
1410
|
}
|
|
2161
|
-
/**
|
|
2162
|
-
* Creates a default RelativeHumidityMeasurementCluster server.
|
|
2163
|
-
*
|
|
2164
|
-
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
2165
|
-
*/
|
|
2166
1411
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
2167
1412
|
this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
|
|
2168
1413
|
}
|
|
2169
|
-
/**
|
|
2170
|
-
* Get a default Pressure Measurement Cluster Server.
|
|
2171
|
-
*
|
|
2172
|
-
* @param measuredValue - The measured value for the pressure.
|
|
2173
|
-
*/
|
|
2174
1414
|
getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
2175
1415
|
return ClusterServer(PressureMeasurementCluster, {
|
|
2176
1416
|
measuredValue,
|
|
@@ -2179,39 +1419,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2179
1419
|
tolerance: 0,
|
|
2180
1420
|
}, {}, {});
|
|
2181
1421
|
}
|
|
2182
|
-
/**
|
|
2183
|
-
* Creates a default Pressure Measurement Cluster Server.
|
|
2184
|
-
*
|
|
2185
|
-
* @param measuredValue - The measured value for the pressure.
|
|
2186
|
-
*/
|
|
2187
1422
|
createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
2188
1423
|
this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
|
|
2189
1424
|
}
|
|
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
|
-
*/
|
|
2195
1425
|
getDefaultBooleanStateClusterServer(contact) {
|
|
2196
1426
|
return ClusterServer(BooleanStateCluster, {
|
|
2197
|
-
stateValue: contact ?? true,
|
|
1427
|
+
stateValue: contact ?? true,
|
|
2198
1428
|
}, {}, {
|
|
2199
1429
|
stateChange: true,
|
|
2200
1430
|
});
|
|
2201
1431
|
}
|
|
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
|
-
*/
|
|
2207
1432
|
createDefaultBooleanStateClusterServer(contact) {
|
|
2208
1433
|
this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
|
|
2209
1434
|
}
|
|
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
|
-
*/
|
|
2215
1435
|
getDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
2216
1436
|
return ClusterServer(BooleanStateConfigurationCluster.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel), {
|
|
2217
1437
|
currentSensitivityLevel: 0,
|
|
@@ -2220,34 +1440,18 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2220
1440
|
alarmsActive: { visual: false, audible: false },
|
|
2221
1441
|
alarmsEnabled: { visual: false, audible: false },
|
|
2222
1442
|
alarmsSupported: { visual: true, audible: true },
|
|
2223
|
-
// alarmsSuppressed: { visual: false, audible: false },
|
|
2224
1443
|
sensorFault: { generalFault: sensorFault },
|
|
2225
1444
|
}, {
|
|
2226
1445
|
enableDisableAlarm: async (data) => {
|
|
2227
|
-
// Never called in edge
|
|
2228
1446
|
},
|
|
2229
1447
|
}, {
|
|
2230
1448
|
alarmsStateChanged: true,
|
|
2231
1449
|
sensorFault: true,
|
|
2232
1450
|
});
|
|
2233
1451
|
}
|
|
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
|
-
*/
|
|
2239
1452
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
2240
1453
|
this.addClusterServer(this.getDefaultBooleanStateConfigurationClusterServer(sensorFault));
|
|
2241
1454
|
}
|
|
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
|
-
*/
|
|
2251
1455
|
getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
2252
1456
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
2253
1457
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -2264,25 +1468,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2264
1468
|
endpointList: [],
|
|
2265
1469
|
}, {}, {});
|
|
2266
1470
|
}
|
|
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
|
-
*/
|
|
2276
1471
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
2277
1472
|
this.addClusterServer(this.getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity));
|
|
2278
1473
|
}
|
|
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
|
-
*/
|
|
2286
1474
|
getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
2287
1475
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
2288
1476
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -2300,21 +1488,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2300
1488
|
endpointList: [],
|
|
2301
1489
|
}, {}, {});
|
|
2302
1490
|
}
|
|
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
|
-
*/
|
|
2310
1491
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
2311
1492
|
this.addClusterServer(this.getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage));
|
|
2312
1493
|
}
|
|
2313
|
-
/**
|
|
2314
|
-
* Get a default power source wired cluster server.
|
|
2315
|
-
*
|
|
2316
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
2317
|
-
*/
|
|
2318
1494
|
getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
2319
1495
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Wired), {
|
|
2320
1496
|
wiredCurrentType,
|
|
@@ -2324,45 +1500,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2324
1500
|
endpointList: [],
|
|
2325
1501
|
}, {}, {});
|
|
2326
1502
|
}
|
|
2327
|
-
/**
|
|
2328
|
-
* Creates a default power source wired cluster server.
|
|
2329
|
-
*
|
|
2330
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
2331
|
-
*/
|
|
2332
1503
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
2333
1504
|
this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
|
|
2334
1505
|
}
|
|
2335
|
-
/**
|
|
2336
|
-
* @deprecated This function is deprecated by Matter 1.3 spec and will be removed in a future version.
|
|
2337
|
-
*/
|
|
2338
1506
|
createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
|
|
2339
1507
|
this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
|
|
2340
1508
|
sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
|
|
2341
1509
|
}, {}, {}));
|
|
2342
1510
|
}
|
|
2343
|
-
/**
|
|
2344
|
-
* Get a default air quality cluster server.
|
|
2345
|
-
*
|
|
2346
|
-
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2347
|
-
*/
|
|
2348
1511
|
getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
2349
1512
|
return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
2350
1513
|
airQuality,
|
|
2351
1514
|
}, {}, {});
|
|
2352
1515
|
}
|
|
2353
|
-
/**
|
|
2354
|
-
* Creates a default air quality cluster server.
|
|
2355
|
-
*
|
|
2356
|
-
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2357
|
-
*/
|
|
2358
1516
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
2359
1517
|
this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
|
|
2360
1518
|
}
|
|
2361
|
-
/**
|
|
2362
|
-
* Get a default TVOC measurement cluster server.
|
|
2363
|
-
*
|
|
2364
|
-
* @param measuredValue - The measured value for TVOC.
|
|
2365
|
-
*/
|
|
2366
1519
|
getDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2367
1520
|
return ClusterServer(TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2368
1521
|
measuredValue,
|
|
@@ -2373,28 +1526,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2373
1526
|
measurementMedium,
|
|
2374
1527
|
}, {}, {});
|
|
2375
1528
|
}
|
|
2376
|
-
/**
|
|
2377
|
-
* Creates a default TVOC measurement cluster server.
|
|
2378
|
-
*
|
|
2379
|
-
* @param measuredValue - The measured value for TVOC.
|
|
2380
|
-
*/
|
|
2381
1529
|
createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2382
1530
|
this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2383
1531
|
}
|
|
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
|
-
*/
|
|
2392
1532
|
getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
2393
1533
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
|
|
2394
1534
|
localTemperature: localTemperature * 100,
|
|
2395
1535
|
systemMode: Thermostat.SystemMode.Heat,
|
|
2396
1536
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
2397
|
-
// Thermostat.Feature.Heating
|
|
2398
1537
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
2399
1538
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
2400
1539
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -2402,35 +1541,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2402
1541
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2403
1542
|
}, {
|
|
2404
1543
|
setpointRaiseLower: async (data) => {
|
|
2405
|
-
// Never called in edge
|
|
2406
1544
|
},
|
|
2407
1545
|
}, {});
|
|
2408
1546
|
}
|
|
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
|
-
*/
|
|
2417
1547
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
2418
1548
|
this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
|
|
2419
1549
|
}
|
|
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
|
-
*/
|
|
2428
1550
|
getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2429
1551
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
|
|
2430
1552
|
localTemperature: localTemperature * 100,
|
|
2431
1553
|
systemMode: Thermostat.SystemMode.Cool,
|
|
2432
1554
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
2433
|
-
// Thermostat.Feature.Cooling
|
|
2434
1555
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
2435
1556
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
2436
1557
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -2438,82 +1559,37 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2438
1559
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2439
1560
|
}, {
|
|
2440
1561
|
setpointRaiseLower: async (data) => {
|
|
2441
|
-
// Never called in edge
|
|
2442
1562
|
},
|
|
2443
1563
|
}, {});
|
|
2444
1564
|
}
|
|
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
|
-
*/
|
|
2453
1565
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2454
1566
|
this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
2455
1567
|
}
|
|
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
|
-
*/
|
|
2469
1568
|
getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2470
1569
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
2471
1570
|
localTemperature: localTemperature * 100,
|
|
2472
1571
|
systemMode: Thermostat.SystemMode.Auto,
|
|
2473
1572
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
2474
|
-
// Thermostat.Feature.Heating
|
|
2475
1573
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
2476
1574
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
2477
1575
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2478
1576
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
2479
1577
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2480
|
-
// Thermostat.Feature.Cooling
|
|
2481
1578
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
2482
1579
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
2483
1580
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2484
1581
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
2485
1582
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2486
|
-
// Thermostat.Feature.AutoMode
|
|
2487
1583
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
2488
1584
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
2489
1585
|
}, {
|
|
2490
1586
|
setpointRaiseLower: async (data) => {
|
|
2491
|
-
// Never called in edge
|
|
2492
1587
|
},
|
|
2493
1588
|
}, {});
|
|
2494
1589
|
}
|
|
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
|
-
*/
|
|
2507
1590
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2508
1591
|
this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
2509
1592
|
}
|
|
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
|
-
*/
|
|
2517
1593
|
getDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
2518
1594
|
return ClusterServer(SmokeCoAlarmCluster.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm), {
|
|
2519
1595
|
smokeState,
|
|
@@ -2528,7 +1604,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2528
1604
|
interconnectCoAlarm: SmokeCoAlarm.AlarmState.Normal,
|
|
2529
1605
|
}, {
|
|
2530
1606
|
selfTestRequest: async (data) => {
|
|
2531
|
-
// Never called in edge
|
|
2532
1607
|
},
|
|
2533
1608
|
}, {
|
|
2534
1609
|
smokeAlarm: true,
|
|
@@ -2544,24 +1619,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2544
1619
|
allClear: true,
|
|
2545
1620
|
});
|
|
2546
1621
|
}
|
|
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
|
-
*/
|
|
2554
1622
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
2555
1623
|
this.addClusterServer(this.getDefaultSmokeCOAlarmClusterServer(smokeState, coState));
|
|
2556
1624
|
}
|
|
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
|
-
*/
|
|
2565
1625
|
getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2566
1626
|
return ClusterServer(CarbonMonoxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2567
1627
|
measuredValue,
|
|
@@ -2572,24 +1632,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2572
1632
|
measurementMedium,
|
|
2573
1633
|
}, {}, {});
|
|
2574
1634
|
}
|
|
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
|
-
*/
|
|
2582
1635
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2583
1636
|
this.addClusterServer(this.getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2584
1637
|
}
|
|
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
|
-
*/
|
|
2593
1638
|
getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2594
1639
|
return ClusterServer(CarbonDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2595
1640
|
measuredValue,
|
|
@@ -2600,24 +1645,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2600
1645
|
measurementMedium,
|
|
2601
1646
|
}, {}, {});
|
|
2602
1647
|
}
|
|
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
|
-
*/
|
|
2610
1648
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2611
1649
|
this.addClusterServer(this.getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2612
1650
|
}
|
|
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
|
-
*/
|
|
2621
1651
|
getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2622
1652
|
return ClusterServer(FormaldehydeConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2623
1653
|
measuredValue,
|
|
@@ -2628,24 +1658,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2628
1658
|
measurementMedium,
|
|
2629
1659
|
}, {}, {});
|
|
2630
1660
|
}
|
|
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
|
-
*/
|
|
2638
1661
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2639
1662
|
this.addClusterServer(this.getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2640
1663
|
}
|
|
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
|
-
*/
|
|
2649
1664
|
getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2650
1665
|
return ClusterServer(Pm1ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2651
1666
|
measuredValue,
|
|
@@ -2656,24 +1671,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2656
1671
|
measurementMedium,
|
|
2657
1672
|
}, {}, {});
|
|
2658
1673
|
}
|
|
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
|
-
*/
|
|
2666
1674
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2667
1675
|
this.addClusterServer(this.getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2668
1676
|
}
|
|
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
|
-
*/
|
|
2677
1677
|
getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2678
1678
|
return ClusterServer(Pm25ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2679
1679
|
measuredValue,
|
|
@@ -2684,24 +1684,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2684
1684
|
measurementMedium,
|
|
2685
1685
|
}, {}, {});
|
|
2686
1686
|
}
|
|
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
|
-
*/
|
|
2694
1687
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2695
1688
|
this.addClusterServer(this.getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2696
1689
|
}
|
|
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
|
-
*/
|
|
2705
1690
|
getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2706
1691
|
return ClusterServer(Pm10ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2707
1692
|
measuredValue,
|
|
@@ -2712,24 +1697,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2712
1697
|
measurementMedium,
|
|
2713
1698
|
}, {}, {});
|
|
2714
1699
|
}
|
|
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
|
-
*/
|
|
2722
1700
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2723
1701
|
this.addClusterServer(this.getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2724
1702
|
}
|
|
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
|
-
*/
|
|
2733
1703
|
getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2734
1704
|
return ClusterServer(OzoneConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2735
1705
|
measuredValue,
|
|
@@ -2740,24 +1710,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2740
1710
|
measurementMedium,
|
|
2741
1711
|
}, {}, {});
|
|
2742
1712
|
}
|
|
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
|
-
*/
|
|
2750
1713
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2751
1714
|
this.addClusterServer(this.getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2752
1715
|
}
|
|
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
|
-
*/
|
|
2761
1716
|
getDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2762
1717
|
return ClusterServer(RadonConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2763
1718
|
measuredValue,
|
|
@@ -2768,24 +1723,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2768
1723
|
measurementMedium,
|
|
2769
1724
|
}, {}, {});
|
|
2770
1725
|
}
|
|
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
|
-
*/
|
|
2778
1726
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2779
1727
|
this.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2780
1728
|
}
|
|
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
|
-
*/
|
|
2789
1729
|
getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2790
1730
|
return ClusterServer(NitrogenDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2791
1731
|
measuredValue,
|
|
@@ -2796,22 +1736,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2796
1736
|
measurementMedium,
|
|
2797
1737
|
}, {}, {});
|
|
2798
1738
|
}
|
|
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
|
-
*/
|
|
2806
1739
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2807
1740
|
this.addClusterServer(this.getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2808
1741
|
}
|
|
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
|
-
*/
|
|
2815
1742
|
getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
2816
1743
|
return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
2817
1744
|
fanMode,
|
|
@@ -2823,25 +1750,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2823
1750
|
speedCurrent: 0,
|
|
2824
1751
|
}, {
|
|
2825
1752
|
step: async (data) => {
|
|
2826
|
-
// Never called in edge
|
|
2827
1753
|
},
|
|
2828
1754
|
}, {});
|
|
2829
1755
|
}
|
|
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
|
-
*/
|
|
2836
1756
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
2837
1757
|
this.addClusterServer(this.getDefaultFanControlClusterServer(fanMode));
|
|
2838
1758
|
}
|
|
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
|
-
*/
|
|
2845
1759
|
getDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
2846
1760
|
return ClusterServer(PumpConfigurationAndControlCluster.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
2847
1761
|
minConstSpeed: null,
|
|
@@ -2855,22 +1769,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2855
1769
|
operationMode: pumpMode,
|
|
2856
1770
|
}, {}, {});
|
|
2857
1771
|
}
|
|
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
|
-
*/
|
|
2864
1772
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
2865
1773
|
this.addClusterServer(this.getDefaultPumpConfigurationAndControlClusterServer(pumpMode));
|
|
2866
1774
|
}
|
|
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
|
-
*/
|
|
2874
1775
|
getDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
2875
1776
|
return ClusterServer(ValveConfigurationAndControlCluster.with(ValveConfigurationAndControl.Feature.Level), {
|
|
2876
1777
|
currentState: valveState,
|
|
@@ -2882,22 +1783,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2882
1783
|
remainingDuration: null,
|
|
2883
1784
|
}, {
|
|
2884
1785
|
open: async (data) => {
|
|
2885
|
-
// Never called in edge
|
|
2886
1786
|
},
|
|
2887
1787
|
close: async (data) => {
|
|
2888
|
-
// Never called in edge
|
|
2889
1788
|
},
|
|
2890
1789
|
}, {});
|
|
2891
1790
|
}
|
|
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
|
-
*/
|
|
2899
1791
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
2900
1792
|
this.addClusterServer(this.getDefaultValveConfigurationAndControlClusterServer(valveState, valveLevel));
|
|
2901
1793
|
}
|
|
2902
1794
|
}
|
|
2903
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|