matterbridge 1.6.7 → 1.6.8-dev.1
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 +15 -0
- 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 +5 -1
- package/dist/matterbridge.js +61 -659
- package/dist/matterbridgeAccessoryPlatform.js +0 -33
- package/dist/matterbridgeBehaviors.js +1 -29
- package/dist/matterbridgeDevice.js +9 -986
- package/dist/matterbridgeDeviceTypes.js +11 -82
- package/dist/matterbridgeDynamicPlatform.js +0 -33
- package/dist/matterbridgeEdge.js +1 -532
- package/dist/matterbridgeEndpoint.js +12 -1111
- package/dist/matterbridgePlatform.js +3 -91
- 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 +7 -252
- package/npm-shrinkwrap.json +7 -71
- package/package.json +1 -2
- package/dist/cli.d.ts +0 -25
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cluster/export.d.ts +0 -2
- package/dist/cluster/export.d.ts.map +0 -1
- package/dist/cluster/export.js.map +0 -1
- package/dist/defaultConfigSchema.d.ts +0 -27
- 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 +0 -40
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger/export.d.ts +0 -2
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/export.d.ts +0 -6
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -466
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -39
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -942
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDevice.d.ts +0 -7063
- 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 +0 -39
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEdge.d.ts +0 -92
- package/dist/matterbridgeEdge.d.ts.map +0 -1
- package/dist/matterbridgeEdge.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -10164
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -114
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -162
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/matterbridgeWebsocket.d.ts +0 -49
- 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 +0 -2
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -61
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/export.d.ts +0 -3
- 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
|
-
// AnsiLogger module
|
|
27
2
|
import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, rs, zb } from 'node-ansi-logger';
|
|
28
|
-
// Matterbridge
|
|
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 = "info"
|
|
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: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* 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,17 +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
309
|
addChildDeviceType(endpointName, deviceTypes, options = {}, debug = false) {
|
|
400
310
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
401
311
|
let child = this.getChildEndpointByName(endpointName);
|
|
@@ -426,18 +336,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
426
336
|
}
|
|
427
337
|
return child;
|
|
428
338
|
}
|
|
429
|
-
/**
|
|
430
|
-
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
431
|
-
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
432
|
-
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
433
|
-
*
|
|
434
|
-
* @param {string} endpointName - The name of the new enpoint to add.
|
|
435
|
-
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
436
|
-
* @param {ClusterId[]} [includeServerList=[]] - The list of cluster IDs to include.
|
|
437
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
438
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
439
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
440
|
-
*/
|
|
441
339
|
addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
|
|
442
340
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
443
341
|
let child = this.getChildEndpointByName(endpointName);
|
|
@@ -481,12 +379,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
481
379
|
}
|
|
482
380
|
return child;
|
|
483
381
|
}
|
|
484
|
-
/**
|
|
485
|
-
* Retrieves a child endpoint by its name.
|
|
486
|
-
*
|
|
487
|
-
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
488
|
-
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
489
|
-
*/
|
|
490
382
|
getChildEndpointByName(endpointName) {
|
|
491
383
|
return this.parts.find((part) => part.id === endpointName);
|
|
492
384
|
}
|
|
@@ -505,8 +397,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
505
397
|
});
|
|
506
398
|
}
|
|
507
399
|
async setBridgedDeviceReachability(reachable) {
|
|
508
|
-
// await this.setAttribute(BridgedDeviceBasicInformationCluster.id, 'reachable', reachable, this.log);
|
|
509
|
-
// await this.triggerEvent(BridgedDeviceBasicInformationCluster.id, 'reachableChanged', { reachableNewValue: reachable }, this.log);
|
|
510
400
|
}
|
|
511
401
|
hasClusterServer(cluster) {
|
|
512
402
|
return this.clusterServers.has(cluster.id);
|
|
@@ -524,25 +414,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
524
414
|
return this.clusterServers.get(clusterId);
|
|
525
415
|
}
|
|
526
416
|
addTagList(endpoint, mfgCode, namespaceId, tag, label) {
|
|
527
|
-
// Do nothing here only for old api compatibility
|
|
528
417
|
}
|
|
529
418
|
addClusterServer(cluster) {
|
|
530
|
-
// console.log('addClusterServer:', cluster.id, cluster.name, cluster.attributes, cluster.events, cluster.commands);
|
|
531
419
|
let features = {};
|
|
532
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
533
420
|
const options = {};
|
|
534
421
|
for (const attribute of Object.values(cluster.attributes)) {
|
|
535
|
-
// console.error('Attribute:', (attribute as any).id, (attribute as any).name, (attribute as any).value);
|
|
536
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
537
422
|
if (attribute.name === 'featureMap') {
|
|
538
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
539
423
|
features = attribute.value;
|
|
540
|
-
// console.log('Cluster', cluster.name, 'FeatureMap:', features);
|
|
541
|
-
// options[(attribute as any).name] = (attribute as any).value;
|
|
542
424
|
}
|
|
543
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
544
425
|
if (attribute.id < 0xfff0) {
|
|
545
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
546
426
|
options[attribute.name] = attribute.value;
|
|
547
427
|
}
|
|
548
428
|
}
|
|
@@ -582,16 +462,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
582
462
|
const behavior = MatterbridgeEndpoint.getBehaviourTypeFromClusterServerId(cluster.id, this.subType);
|
|
583
463
|
this.clusterServers.set(cluster.id, cluster);
|
|
584
464
|
if (cluster.id === BasicInformationCluster.id)
|
|
585
|
-
return;
|
|
465
|
+
return;
|
|
586
466
|
this.behaviors.require(behavior, options);
|
|
587
467
|
}
|
|
588
|
-
/**
|
|
589
|
-
* Adds cluster servers to the specified endpoint based on the provided server list.
|
|
590
|
-
*
|
|
591
|
-
* @param {Endpoint} endpoint - The endpoint to add cluster servers to.
|
|
592
|
-
* @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
|
|
593
|
-
* @returns void
|
|
594
|
-
*/
|
|
595
468
|
addClusterServerFromList(endpoint, includeServerList) {
|
|
596
469
|
if (includeServerList.includes(Identify.Cluster.id))
|
|
597
470
|
endpoint.addClusterServer(this.getDefaultIdentifyClusterServer());
|
|
@@ -661,8 +534,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
661
534
|
endpoint.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer());
|
|
662
535
|
if (includeServerList.includes(TotalVolatileOrganicCompoundsConcentrationMeasurement.Cluster.id))
|
|
663
536
|
endpoint.addClusterServer(this.getDefaultTvocMeasurementClusterServer());
|
|
664
|
-
// if (includeServerList.includes(DeviceEnergyManagement.Cluster.id)) endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementClusterServer());
|
|
665
|
-
// if (includeServerList.includes(DeviceEnergyManagementMode.Cluster.id)) endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementModeClusterServer());
|
|
666
537
|
}
|
|
667
538
|
async addFixedLabel(label, value) {
|
|
668
539
|
if (!this.clusterServers.get(FixedLabelCluster.id)) {
|
|
@@ -700,16 +571,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
700
571
|
return name;
|
|
701
572
|
return name.charAt(0).toLowerCase() + name.slice(1);
|
|
702
573
|
}
|
|
703
|
-
/**
|
|
704
|
-
* Retrieves the value of the specified attribute from the given endpoint and cluster.
|
|
705
|
-
*
|
|
706
|
-
* @param {ClusterId} clusterId - The ID of the cluster to retrieve the attribute from.
|
|
707
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
708
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
709
|
-
* @param {MatterbridgeEndpoint} [endpoint] - Optional the child endpoint to retrieve the attribute from.
|
|
710
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
711
|
-
*/
|
|
712
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
713
574
|
getAttribute(clusterId, attribute, log, endpoint) {
|
|
714
575
|
if (!endpoint)
|
|
715
576
|
endpoint = this;
|
|
@@ -718,7 +579,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
718
579
|
this.log.error(`getAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
719
580
|
return undefined;
|
|
720
581
|
}
|
|
721
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
722
582
|
const state = endpoint.state;
|
|
723
583
|
if (!(clusterName in state)) {
|
|
724
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}`);
|
|
@@ -733,17 +593,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
733
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}`);
|
|
734
594
|
return value;
|
|
735
595
|
}
|
|
736
|
-
/**
|
|
737
|
-
* Sets the value of an attribute on a cluster server endpoint.
|
|
738
|
-
*
|
|
739
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
740
|
-
* @param {string} attribute - The name of the attribute.
|
|
741
|
-
* @param {any} value - The value to set for the attribute.
|
|
742
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
743
|
-
* @param {MatterbridgeEndpoint} [endpoint] - (Optional) The endpoint to set the attribute on. If not provided, the attribute will be set on the current endpoint.
|
|
744
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
745
|
-
*/
|
|
746
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
747
596
|
async setAttribute(clusterId, attribute, value, log, endpoint) {
|
|
748
597
|
if (!endpoint)
|
|
749
598
|
endpoint = this;
|
|
@@ -752,7 +601,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
752
601
|
this.log.error(`setAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
753
602
|
return false;
|
|
754
603
|
}
|
|
755
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
756
604
|
const state = endpoint.state;
|
|
757
605
|
if (!(clusterName in state)) {
|
|
758
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}`);
|
|
@@ -772,26 +620,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
772
620
|
`to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
773
621
|
return true;
|
|
774
622
|
}
|
|
775
|
-
/**
|
|
776
|
-
* Subscribes to an attribute on a cluster.
|
|
777
|
-
*
|
|
778
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
779
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
780
|
-
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
781
|
-
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
782
|
-
* @param {MatterbridgeEndpoint} [endpoint] - Optional endpoint to subscribe the attribute on. Defaults to the current endpoint.
|
|
783
|
-
* @returns {boolean} - A boolean indicating whether the subscription was successful.
|
|
784
|
-
*/
|
|
785
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
786
623
|
async subscribeAttribute(clusterId, attribute, listener, log, endpoint) {
|
|
787
624
|
if (!endpoint)
|
|
788
625
|
endpoint = this;
|
|
789
626
|
const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
790
627
|
if (endpoint.construction.status !== Lifecycle.Status.Active) {
|
|
791
|
-
// this.log.error(`subscribeAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
792
628
|
await endpoint.construction.ready;
|
|
793
629
|
}
|
|
794
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
795
630
|
const events = endpoint.events;
|
|
796
631
|
if (!(clusterName in events)) {
|
|
797
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}`);
|
|
@@ -806,216 +641,65 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
806
641
|
log?.info(`${db}Subscribe endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${this.capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
|
|
807
642
|
return true;
|
|
808
643
|
}
|
|
809
|
-
/**
|
|
810
|
-
* Triggers an event on the specified cluster.
|
|
811
|
-
*
|
|
812
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
813
|
-
* @param {string} event - The name of the event to trigger.
|
|
814
|
-
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
815
|
-
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
816
|
-
* @param {MatterbridgeEndpoint} [endpoint] - Optional endpoint to trigger the event on. Defaults to the current endpoint.
|
|
817
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
818
|
-
*/
|
|
819
644
|
async triggerEvent(clusterId, event, payload, log, endpoint) {
|
|
820
645
|
if (!endpoint)
|
|
821
646
|
endpoint = this;
|
|
822
647
|
const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
823
648
|
if (endpoint.construction.status !== Lifecycle.Status.Active) {
|
|
824
|
-
// this.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
825
649
|
await endpoint.construction.ready;
|
|
826
|
-
// return false;
|
|
827
650
|
}
|
|
828
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
829
651
|
const events = endpoint.events;
|
|
830
652
|
if (!(clusterName in events) || !(event in events[clusterName])) {
|
|
831
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}`);
|
|
832
654
|
return false;
|
|
833
655
|
}
|
|
834
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
835
|
-
// @ts-ignore
|
|
836
656
|
await endpoint.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
|
|
837
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} `);
|
|
838
658
|
return true;
|
|
839
659
|
}
|
|
840
|
-
/**
|
|
841
|
-
* Adds a command handler for the specified command.
|
|
842
|
-
*
|
|
843
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
844
|
-
* @param {(data: any) => void} handler - The handler function to execute when the command is received.
|
|
845
|
-
* @returns {void}
|
|
846
|
-
*/
|
|
847
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
848
660
|
addCommandHandler(command, handler) {
|
|
849
661
|
this.commandHandler.addHandler(command, handler);
|
|
850
662
|
}
|
|
851
|
-
/**
|
|
852
|
-
* Serializes the Matterbridge device into a serialized object.
|
|
853
|
-
*
|
|
854
|
-
* @param pluginName - The name of the plugin.
|
|
855
|
-
* @returns The serialized Matterbridge device object.
|
|
856
|
-
*/
|
|
857
663
|
serialize() {
|
|
858
664
|
return undefined;
|
|
859
|
-
|
|
860
|
-
if (!this.serialNumber || !this.deviceName || !this.uniqueId) return;
|
|
861
|
-
const cluster = this.getClusterServer(BasicInformationCluster) ?? this.getClusterServer(BridgedDeviceBasicInformationCluster);
|
|
862
|
-
if (!cluster) return;
|
|
863
|
-
const serialized: SerializedMatterbridgeDevice = {
|
|
864
|
-
pluginName: this.plugin ?? 'Unknown',
|
|
865
|
-
serialNumber: this.serialNumber,
|
|
866
|
-
deviceName: this.deviceName,
|
|
867
|
-
uniqueId: this.uniqueId,
|
|
868
|
-
productName: cluster.attributes.productName?.getLocal(),
|
|
869
|
-
vendorId: cluster.attributes.vendorId?.getLocal(),
|
|
870
|
-
vendorName: cluster.attributes.vendorName?.getLocal(),
|
|
871
|
-
deviceTypes: Array.from(this.deviceTypes.values()),
|
|
872
|
-
endpoint: this.number,
|
|
873
|
-
endpointName: this.id,
|
|
874
|
-
clusterServersId: [],
|
|
875
|
-
};
|
|
876
|
-
this.getAllClusterServers().forEach((clusterServer) => {
|
|
877
|
-
serialized.clusterServersId.push(clusterServer.id);
|
|
878
|
-
});
|
|
879
|
-
return serialized;
|
|
880
|
-
*/
|
|
881
|
-
}
|
|
882
|
-
/**
|
|
883
|
-
* Deserializes the device into a serialized object.
|
|
884
|
-
*
|
|
885
|
-
* @returns The deserialized MatterbridgeDevice.
|
|
886
|
-
*/
|
|
665
|
+
}
|
|
887
666
|
static deserialize(serializedDevice) {
|
|
888
667
|
return undefined;
|
|
889
|
-
|
|
890
|
-
const device = new MatterbridgeDevice(serializedDevice.deviceTypes);
|
|
891
|
-
device.serialNumber = serializedDevice.serialNumber;
|
|
892
|
-
device.deviceName = serializedDevice.deviceName;
|
|
893
|
-
device.uniqueId = serializedDevice.uniqueId;
|
|
894
|
-
for (const clusterId of serializedDevice.clusterServersId) {
|
|
895
|
-
if (clusterId === BasicInformationCluster.id)
|
|
896
|
-
device.createDefaultBasicInformationClusterServer(
|
|
897
|
-
serializedDevice.deviceName,
|
|
898
|
-
serializedDevice.serialNumber,
|
|
899
|
-
serializedDevice.vendorId ?? 0xfff1,
|
|
900
|
-
serializedDevice.vendorName ?? 'Matterbridge',
|
|
901
|
-
serializedDevice.productId ?? 0x8000,
|
|
902
|
-
serializedDevice.productName ?? 'Matterbridge device',
|
|
903
|
-
);
|
|
904
|
-
else if (clusterId === BridgedDeviceBasicInformationCluster.id)
|
|
905
|
-
device.createDefaultBridgedDeviceBasicInformationClusterServer(
|
|
906
|
-
serializedDevice.deviceName,
|
|
907
|
-
serializedDevice.serialNumber,
|
|
908
|
-
serializedDevice.vendorId ?? 0xfff1,
|
|
909
|
-
serializedDevice.vendorName ?? 'Matterbridge',
|
|
910
|
-
serializedDevice.productName ?? 'Matterbridge device',
|
|
911
|
-
);
|
|
912
|
-
else device.addClusterServerFromList(device, [clusterId]);
|
|
913
|
-
}
|
|
914
|
-
return device;
|
|
915
|
-
*/
|
|
916
|
-
}
|
|
917
|
-
/**
|
|
918
|
-
* From here copy paste from MatterbridgeDevice
|
|
919
|
-
*/
|
|
920
|
-
/**
|
|
921
|
-
* Get a default IdentifyCluster server.
|
|
922
|
-
*/
|
|
668
|
+
}
|
|
923
669
|
getDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
924
670
|
return ClusterServer(IdentifyCluster, {
|
|
925
671
|
identifyTime,
|
|
926
672
|
identifyType,
|
|
927
673
|
}, {
|
|
928
674
|
identify: async (data) => {
|
|
929
|
-
// Never called in edge
|
|
930
675
|
},
|
|
931
676
|
triggerEffect: async (data) => {
|
|
932
|
-
// Never called in edge
|
|
933
677
|
},
|
|
934
678
|
});
|
|
935
679
|
}
|
|
936
|
-
/**
|
|
937
|
-
* Creates a default IdentifyCluster server.
|
|
938
|
-
*/
|
|
939
680
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
940
681
|
this.addClusterServer(this.getDefaultIdentifyClusterServer(identifyTime, identifyType));
|
|
941
682
|
return this;
|
|
942
683
|
}
|
|
943
|
-
/**
|
|
944
|
-
* Get a default IdentifyCluster server.
|
|
945
|
-
*/
|
|
946
684
|
getDefaultGroupsClusterServer() {
|
|
947
685
|
return ClusterServer(GroupsCluster, {
|
|
948
686
|
nameSupport: {
|
|
949
687
|
nameSupport: true,
|
|
950
688
|
},
|
|
951
689
|
}, GroupsClusterHandler());
|
|
952
|
-
// return createDefaultGroupsClusterServer();
|
|
953
690
|
}
|
|
954
|
-
/**
|
|
955
|
-
* Creates a default groups cluster server and adds it to the device.
|
|
956
|
-
*/
|
|
957
691
|
createDefaultGroupsClusterServer() {
|
|
958
692
|
this.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
959
693
|
}
|
|
960
|
-
/**
|
|
961
|
-
* Get a default scenes cluster server and adds it to the current instance.
|
|
962
|
-
* @deprecated This method is deprecated.
|
|
963
|
-
*
|
|
964
|
-
*/
|
|
965
694
|
getDefaultScenesClusterServer() {
|
|
966
|
-
|
|
967
|
-
return ClusterServer(
|
|
968
|
-
ScenesCluster,
|
|
969
|
-
{
|
|
970
|
-
sceneCount: 0,
|
|
971
|
-
currentScene: 0,
|
|
972
|
-
currentGroup: GroupId(0),
|
|
973
|
-
sceneValid: false,
|
|
974
|
-
nameSupport: {
|
|
975
|
-
nameSupport: true,
|
|
976
|
-
},
|
|
977
|
-
lastConfiguredBy: null,
|
|
978
|
-
},
|
|
979
|
-
{},
|
|
980
|
-
);
|
|
981
|
-
*/
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Creates a default scenes cluster server and adds it to the current instance.
|
|
985
|
-
* @deprecated This method is deprecated.
|
|
986
|
-
*/
|
|
695
|
+
}
|
|
987
696
|
createDefaultScenesClusterServer() {
|
|
988
|
-
|
|
989
|
-
this.addClusterServer(this.getDefaultScenesClusterServer());
|
|
990
|
-
*/
|
|
991
|
-
}
|
|
992
|
-
/**
|
|
993
|
-
* Creates a unique identifier based on the provided parameters.
|
|
994
|
-
* @param param1 - The first parameter.
|
|
995
|
-
* @param param2 - The second parameter.
|
|
996
|
-
* @param param3 - The third parameter.
|
|
997
|
-
* @param param4 - The fourth parameter.
|
|
998
|
-
* @returns A unique identifier generated using the MD5 hash algorithm.
|
|
999
|
-
*/
|
|
697
|
+
}
|
|
1000
698
|
createUniqueId(param1, param2, param3, param4) {
|
|
1001
699
|
const hash = createHash('md5');
|
|
1002
700
|
hash.update(param1 + param2 + param3 + param4);
|
|
1003
701
|
return hash.digest('hex');
|
|
1004
702
|
}
|
|
1005
|
-
/**
|
|
1006
|
-
* Get a default Basic Information Cluster Server.
|
|
1007
|
-
*
|
|
1008
|
-
* @param deviceName - The name of the device.
|
|
1009
|
-
* @param serialNumber - The serial number of the device.
|
|
1010
|
-
* @param vendorId - The vendor ID of the device.
|
|
1011
|
-
* @param vendorName - The vendor name of the device.
|
|
1012
|
-
* @param productId - The product ID of the device.
|
|
1013
|
-
* @param productName - The product name of the device.
|
|
1014
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
1015
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
1016
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
1017
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
1018
|
-
*/
|
|
1019
703
|
getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
1020
704
|
this.log.logName = deviceName;
|
|
1021
705
|
this.deviceName = deviceName;
|
|
@@ -1056,20 +740,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1056
740
|
reachableChanged: true,
|
|
1057
741
|
});
|
|
1058
742
|
}
|
|
1059
|
-
/**
|
|
1060
|
-
* Creates a default Basic Information Cluster Server.
|
|
1061
|
-
*
|
|
1062
|
-
* @param deviceName - The name of the device.
|
|
1063
|
-
* @param serialNumber - The serial number of the device.
|
|
1064
|
-
* @param vendorId - The vendor ID of the device.
|
|
1065
|
-
* @param vendorName - The vendor name of the device.
|
|
1066
|
-
* @param productId - The product ID of the device.
|
|
1067
|
-
* @param productName - The product name of the device.
|
|
1068
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
1069
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
1070
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
1071
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
1072
|
-
*/
|
|
1073
743
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
1074
744
|
if (MatterbridgeEndpoint.bridgeMode === 'bridge') {
|
|
1075
745
|
this.addDeviceType(bridgedNode);
|
|
@@ -1078,19 +748,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1078
748
|
}
|
|
1079
749
|
this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
1080
750
|
}
|
|
1081
|
-
/**
|
|
1082
|
-
* Get a default BridgedDeviceBasicInformationClusterServer.
|
|
1083
|
-
*
|
|
1084
|
-
* @param deviceName - The name of the device.
|
|
1085
|
-
* @param serialNumber - The serial number of the device.
|
|
1086
|
-
* @param vendorId - The vendor ID of the device.
|
|
1087
|
-
* @param vendorName - The name of the vendor.
|
|
1088
|
-
* @param productName - The name of the product.
|
|
1089
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
1090
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
1091
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
1092
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
1093
|
-
*/
|
|
1094
751
|
getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
1095
752
|
this.log.logName = deviceName;
|
|
1096
753
|
this.deviceName = deviceName;
|
|
@@ -1105,7 +762,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1105
762
|
this.hardwareVersion = hardwareVersion;
|
|
1106
763
|
this.hardwareVersionString = hardwareVersionString;
|
|
1107
764
|
return ClusterServer(BridgedDeviceBasicInformationCluster, {
|
|
1108
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
765
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
1109
766
|
vendorName: vendorName.slice(0, 32),
|
|
1110
767
|
productName: productName.slice(0, 32),
|
|
1111
768
|
productUrl: 'https://www.npmjs.com/package/matterbridge',
|
|
@@ -1125,36 +782,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1125
782
|
reachableChanged: true,
|
|
1126
783
|
});
|
|
1127
784
|
}
|
|
1128
|
-
/**
|
|
1129
|
-
* Creates a default BridgedDeviceBasicInformationClusterServer.
|
|
1130
|
-
*
|
|
1131
|
-
* @param deviceName - The name of the device.
|
|
1132
|
-
* @param serialNumber - The serial number of the device.
|
|
1133
|
-
* @param vendorId - The vendor ID of the device.
|
|
1134
|
-
* @param vendorName - The name of the vendor.
|
|
1135
|
-
* @param productName - The name of the product.
|
|
1136
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
1137
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
1138
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
1139
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
1140
|
-
*/
|
|
1141
785
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
1142
786
|
this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
1143
787
|
}
|
|
1144
|
-
/**
|
|
1145
|
-
* Get a default Power Topology Cluster Server. Only needed for an electricalSensor device type.
|
|
1146
|
-
*
|
|
1147
|
-
* @returns {ClusterServer} - The configured Power Topology Cluster Server.
|
|
1148
|
-
*/
|
|
1149
788
|
getDefaultPowerTopologyClusterServer() {
|
|
1150
789
|
return ClusterServer(PowerTopologyCluster.with(PowerTopology.Feature.TreeTopology), {}, {}, {});
|
|
1151
790
|
}
|
|
1152
|
-
/**
|
|
1153
|
-
* Get a default Electrical Energy Measurement Cluster Server.
|
|
1154
|
-
*
|
|
1155
|
-
* @param {number} energy - The total consumption value in mW/h.
|
|
1156
|
-
* @returns {ClusterServer} - The configured Electrical Energy Measurement Cluster Server.
|
|
1157
|
-
*/
|
|
1158
791
|
getDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
1159
792
|
return ClusterServer(ElectricalEnergyMeasurementCluster.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1160
793
|
accuracy: {
|
|
@@ -1171,15 +804,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1171
804
|
cumulativeEnergyMeasured: true,
|
|
1172
805
|
});
|
|
1173
806
|
}
|
|
1174
|
-
/**
|
|
1175
|
-
* Get a default Electrical Power Measurement Cluster Server.
|
|
1176
|
-
*
|
|
1177
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
1178
|
-
* @param {number} current - The current value in milliamperes.
|
|
1179
|
-
* @param {number} power - The power value in milliwatts.
|
|
1180
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
1181
|
-
* @returns {ClusterServer} - The configured Electrical Power Measurement Cluster Server.
|
|
1182
|
-
*/
|
|
1183
807
|
getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1184
808
|
return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1185
809
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1220,16 +844,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1220
844
|
frequency: frequency,
|
|
1221
845
|
}, {}, {});
|
|
1222
846
|
}
|
|
1223
|
-
/**
|
|
1224
|
-
* Get a default OnOff cluster server for light devices.
|
|
1225
|
-
*
|
|
1226
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1227
|
-
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
1228
|
-
* @param {number} [onTime=0] - The on time value.
|
|
1229
|
-
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
1230
|
-
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
1231
|
-
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
1232
|
-
*/
|
|
1233
847
|
getDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
1234
848
|
return ClusterServer(OnOffCluster.with(OnOff.Feature.Lighting), {
|
|
1235
849
|
onOff,
|
|
@@ -1239,107 +853,52 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1239
853
|
startUpOnOff,
|
|
1240
854
|
}, {
|
|
1241
855
|
on: async (data) => {
|
|
1242
|
-
// Never called in edge
|
|
1243
856
|
},
|
|
1244
857
|
off: async (data) => {
|
|
1245
|
-
// Never called in edge
|
|
1246
858
|
},
|
|
1247
859
|
toggle: async (data) => {
|
|
1248
|
-
// Never called in edge
|
|
1249
860
|
},
|
|
1250
861
|
offWithEffect: async () => {
|
|
1251
|
-
// Never called in edge
|
|
1252
862
|
},
|
|
1253
863
|
onWithRecallGlobalScene: async () => {
|
|
1254
|
-
// Never called in edge
|
|
1255
864
|
},
|
|
1256
865
|
onWithTimedOff: async () => {
|
|
1257
|
-
// Never called in edge
|
|
1258
866
|
},
|
|
1259
867
|
}, {});
|
|
1260
868
|
}
|
|
1261
|
-
/**
|
|
1262
|
-
* Creates a default OnOff cluster server for light devices.
|
|
1263
|
-
*
|
|
1264
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1265
|
-
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
1266
|
-
* @param {number} [onTime=0] - The on time value.
|
|
1267
|
-
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
1268
|
-
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
1269
|
-
* @returns {void}
|
|
1270
|
-
*/
|
|
1271
869
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
1272
870
|
this.addClusterServer(this.getDefaultOnOffClusterServer(onOff, globalSceneControl, onTime, offWaitTime, startUpOnOff));
|
|
1273
871
|
}
|
|
1274
|
-
/**
|
|
1275
|
-
* Get an OnOff cluster server without features.
|
|
1276
|
-
*
|
|
1277
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1278
|
-
*
|
|
1279
|
-
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
1280
|
-
*/
|
|
1281
872
|
getOnOffClusterServer(onOff = false) {
|
|
1282
873
|
return ClusterServer(OnOffCluster, {
|
|
1283
874
|
onOff,
|
|
1284
875
|
}, {
|
|
1285
876
|
on: async (data) => {
|
|
1286
|
-
// Never called in edge
|
|
1287
877
|
},
|
|
1288
878
|
off: async (data) => {
|
|
1289
|
-
// Never called in edge
|
|
1290
879
|
},
|
|
1291
880
|
toggle: async (data) => {
|
|
1292
|
-
// Never called in edge
|
|
1293
881
|
},
|
|
1294
882
|
}, {});
|
|
1295
883
|
}
|
|
1296
|
-
/**
|
|
1297
|
-
* Creates an OnOff cluster server without features.
|
|
1298
|
-
*
|
|
1299
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1300
|
-
*/
|
|
1301
884
|
createOnOffClusterServer(onOff = false) {
|
|
1302
885
|
this.addClusterServer(this.getOnOffClusterServer(onOff));
|
|
1303
886
|
}
|
|
1304
|
-
/**
|
|
1305
|
-
* Get a DeadFront OnOff cluster server.
|
|
1306
|
-
*
|
|
1307
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1308
|
-
*
|
|
1309
|
-
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
1310
|
-
*/
|
|
1311
887
|
getDeadFrontOnOffClusterServer(onOff = false) {
|
|
1312
888
|
return ClusterServer(OnOffCluster.with(OnOff.Feature.DeadFrontBehavior), {
|
|
1313
889
|
onOff,
|
|
1314
890
|
}, {
|
|
1315
891
|
on: async (data) => {
|
|
1316
|
-
// Never called in edge
|
|
1317
892
|
},
|
|
1318
893
|
off: async (data) => {
|
|
1319
|
-
// Never called in edge
|
|
1320
894
|
},
|
|
1321
895
|
toggle: async (data) => {
|
|
1322
|
-
// Never called in edge
|
|
1323
896
|
},
|
|
1324
897
|
}, {});
|
|
1325
898
|
}
|
|
1326
|
-
/**
|
|
1327
|
-
* Creates a DeadFront OnOff cluster server.
|
|
1328
|
-
*
|
|
1329
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1330
|
-
*/
|
|
1331
899
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
1332
900
|
this.addClusterServer(this.getDeadFrontOnOffClusterServer(onOff));
|
|
1333
901
|
}
|
|
1334
|
-
/**
|
|
1335
|
-
* Get a default level control cluster server.
|
|
1336
|
-
*
|
|
1337
|
-
* @param currentLevel - The current level (default: 254).
|
|
1338
|
-
* @param minLevel - The minimum level (default: 1).
|
|
1339
|
-
* @param maxLevel - The maximum level (default: 254).
|
|
1340
|
-
* @param onLevel - The on level (default: null).
|
|
1341
|
-
* @param startUpCurrentLevel - The startUp on level (default: null).
|
|
1342
|
-
*/
|
|
1343
902
|
getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
1344
903
|
return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
1345
904
|
currentLevel,
|
|
@@ -1354,54 +913,26 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1354
913
|
},
|
|
1355
914
|
}, {
|
|
1356
915
|
moveToLevel: async (data) => {
|
|
1357
|
-
// Never called in edge
|
|
1358
916
|
},
|
|
1359
917
|
move: async () => {
|
|
1360
|
-
// Never called in edge
|
|
1361
918
|
},
|
|
1362
919
|
step: async () => {
|
|
1363
|
-
// Never called in edge
|
|
1364
920
|
},
|
|
1365
921
|
stop: async () => {
|
|
1366
|
-
// Never called in edge
|
|
1367
922
|
},
|
|
1368
923
|
moveToLevelWithOnOff: async (data) => {
|
|
1369
|
-
// Never called in edge
|
|
1370
924
|
},
|
|
1371
925
|
moveWithOnOff: async () => {
|
|
1372
|
-
// Never called in edge
|
|
1373
926
|
},
|
|
1374
927
|
stepWithOnOff: async () => {
|
|
1375
|
-
// Never called in edge
|
|
1376
928
|
},
|
|
1377
929
|
stopWithOnOff: async () => {
|
|
1378
|
-
// Never called in edge
|
|
1379
930
|
},
|
|
1380
931
|
});
|
|
1381
932
|
}
|
|
1382
|
-
/**
|
|
1383
|
-
* Creates a default level control cluster server.
|
|
1384
|
-
*
|
|
1385
|
-
* @param currentLevel - The current level (default: 254).
|
|
1386
|
-
* @param minLevel - The minimum level (default: 1).
|
|
1387
|
-
* @param maxLevel - The maximum level (default: 254).
|
|
1388
|
-
* @param onLevel - The on level (default: null).
|
|
1389
|
-
* @param startUpCurrentLevel - The startUp on level (default: null).
|
|
1390
|
-
*/
|
|
1391
933
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
1392
934
|
this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel, startUpCurrentLevel));
|
|
1393
935
|
}
|
|
1394
|
-
/**
|
|
1395
|
-
* Get a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
1396
|
-
*
|
|
1397
|
-
* @param currentX - The current X value.
|
|
1398
|
-
* @param currentY - The current Y value.
|
|
1399
|
-
* @param currentHue - The current hue value.
|
|
1400
|
-
* @param currentSaturation - The current saturation value.
|
|
1401
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1402
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1403
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1404
|
-
*/
|
|
1405
936
|
getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1406
937
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1407
938
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1423,72 +954,38 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1423
954
|
startUpColorTemperatureMireds: null,
|
|
1424
955
|
}, {
|
|
1425
956
|
moveToColor: async (data) => {
|
|
1426
|
-
// Never called in edge
|
|
1427
957
|
},
|
|
1428
958
|
moveColor: async () => {
|
|
1429
|
-
// Never called in edge
|
|
1430
959
|
},
|
|
1431
960
|
stepColor: async () => {
|
|
1432
|
-
// Never called in edge
|
|
1433
961
|
},
|
|
1434
962
|
moveToHue: async (data) => {
|
|
1435
|
-
// Never called in edge
|
|
1436
963
|
},
|
|
1437
964
|
moveHue: async () => {
|
|
1438
|
-
// Never called in edge
|
|
1439
965
|
},
|
|
1440
966
|
stepHue: async () => {
|
|
1441
|
-
// Never called in edge
|
|
1442
967
|
},
|
|
1443
968
|
moveToSaturation: async (data) => {
|
|
1444
|
-
// Never called in edge
|
|
1445
969
|
},
|
|
1446
970
|
moveSaturation: async () => {
|
|
1447
|
-
// Never called in edge
|
|
1448
971
|
},
|
|
1449
972
|
stepSaturation: async () => {
|
|
1450
|
-
// Never called in edge
|
|
1451
973
|
},
|
|
1452
974
|
moveToHueAndSaturation: async (data) => {
|
|
1453
|
-
// Never called in edge
|
|
1454
975
|
},
|
|
1455
976
|
stopMoveStep: async () => {
|
|
1456
|
-
// Never called in edge
|
|
1457
977
|
},
|
|
1458
978
|
moveToColorTemperature: async (data) => {
|
|
1459
|
-
// Never called in edge
|
|
1460
979
|
},
|
|
1461
980
|
moveColorTemperature: async () => {
|
|
1462
|
-
// Never called in edge
|
|
1463
981
|
},
|
|
1464
982
|
stepColorTemperature: async () => {
|
|
1465
|
-
// Never called in edge
|
|
1466
983
|
},
|
|
1467
984
|
}, {});
|
|
1468
985
|
}
|
|
1469
|
-
/**
|
|
1470
|
-
* Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
1471
|
-
*
|
|
1472
|
-
* @param currentX - The current X value.
|
|
1473
|
-
* @param currentY - The current Y value.
|
|
1474
|
-
* @param currentHue - The current hue value.
|
|
1475
|
-
* @param currentSaturation - The current saturation value.
|
|
1476
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1477
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1478
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1479
|
-
*/
|
|
1480
986
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1481
987
|
this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1482
988
|
}
|
|
1483
|
-
/**
|
|
1484
|
-
* Get a Xy color control cluster server with Xy and ColorTemperature.
|
|
1485
|
-
*
|
|
1486
|
-
* @param currentX - The current X value.
|
|
1487
|
-
* @param currentY - The current Y value.
|
|
1488
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1489
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1490
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1491
|
-
*/
|
|
1492
989
|
getXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1493
990
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
1494
991
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -1508,49 +1005,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1508
1005
|
remainingTime: 0,
|
|
1509
1006
|
}, {
|
|
1510
1007
|
moveToColor: async () => {
|
|
1511
|
-
// Never called in edge
|
|
1512
1008
|
},
|
|
1513
1009
|
moveColor: async () => {
|
|
1514
|
-
// Never called in edge
|
|
1515
1010
|
},
|
|
1516
1011
|
stepColor: async () => {
|
|
1517
|
-
// Never called in edge
|
|
1518
1012
|
},
|
|
1519
1013
|
stopMoveStep: async () => {
|
|
1520
|
-
// Never called in edge
|
|
1521
1014
|
},
|
|
1522
1015
|
moveToColorTemperature: async () => {
|
|
1523
|
-
// Never called in edge
|
|
1524
1016
|
},
|
|
1525
1017
|
moveColorTemperature: async () => {
|
|
1526
|
-
// Never called in edge
|
|
1527
1018
|
},
|
|
1528
1019
|
stepColorTemperature: async () => {
|
|
1529
|
-
// Never called in edge
|
|
1530
1020
|
},
|
|
1531
1021
|
}, {});
|
|
1532
1022
|
}
|
|
1533
|
-
/**
|
|
1534
|
-
* Creates a Xy color control cluster server with Xy and ColorTemperature.
|
|
1535
|
-
*
|
|
1536
|
-
* @param currentX - The current X value.
|
|
1537
|
-
* @param currentY - The current Y value.
|
|
1538
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1539
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1540
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1541
|
-
*/
|
|
1542
1023
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1543
1024
|
this.addClusterServer(this.getXyColorControlClusterServer(currentX, currentY, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1544
1025
|
}
|
|
1545
|
-
/**
|
|
1546
|
-
* Get a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
|
|
1547
|
-
*
|
|
1548
|
-
* @param currentHue - The current hue value.
|
|
1549
|
-
* @param currentSaturation - The current saturation value.
|
|
1550
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1551
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1552
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1553
|
-
*/
|
|
1554
1026
|
getHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1555
1027
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1556
1028
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1570,59 +1042,32 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1570
1042
|
remainingTime: 0,
|
|
1571
1043
|
}, {
|
|
1572
1044
|
moveToHue: async () => {
|
|
1573
|
-
// Never called in edge
|
|
1574
1045
|
},
|
|
1575
1046
|
moveHue: async () => {
|
|
1576
|
-
// Never called in edge
|
|
1577
1047
|
},
|
|
1578
1048
|
stepHue: async () => {
|
|
1579
|
-
// Never called in edge
|
|
1580
1049
|
},
|
|
1581
1050
|
moveToSaturation: async () => {
|
|
1582
|
-
// Never called in edge
|
|
1583
1051
|
},
|
|
1584
1052
|
moveSaturation: async () => {
|
|
1585
|
-
// Never called in edge
|
|
1586
1053
|
},
|
|
1587
1054
|
stepSaturation: async () => {
|
|
1588
|
-
// Never called in edge
|
|
1589
1055
|
},
|
|
1590
1056
|
moveToHueAndSaturation: async () => {
|
|
1591
|
-
// Never called in edge
|
|
1592
1057
|
},
|
|
1593
1058
|
stopMoveStep: async () => {
|
|
1594
|
-
// Never called in edge
|
|
1595
1059
|
},
|
|
1596
1060
|
moveToColorTemperature: async () => {
|
|
1597
|
-
// Never called in edge
|
|
1598
1061
|
},
|
|
1599
1062
|
moveColorTemperature: async () => {
|
|
1600
|
-
// Never called in edge
|
|
1601
1063
|
},
|
|
1602
1064
|
stepColorTemperature: async () => {
|
|
1603
|
-
// Never called in edge
|
|
1604
1065
|
},
|
|
1605
1066
|
}, {});
|
|
1606
1067
|
}
|
|
1607
|
-
/**
|
|
1608
|
-
* Creates a hue and saturation color control cluster server with HueSaturation and ColorTemperature.
|
|
1609
|
-
*
|
|
1610
|
-
* @param currentHue - The current hue value.
|
|
1611
|
-
* @param currentSaturation - The current saturation value.
|
|
1612
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1613
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1614
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1615
|
-
*/
|
|
1616
1068
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1617
1069
|
this.addClusterServer(this.getHsColorControlClusterServer(currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1618
1070
|
}
|
|
1619
|
-
/**
|
|
1620
|
-
* Get a color temperature color control cluster server.
|
|
1621
|
-
*
|
|
1622
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1623
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1624
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1625
|
-
*/
|
|
1626
1071
|
getCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1627
1072
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.ColorTemperature), {
|
|
1628
1073
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1640,44 +1085,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1640
1085
|
startUpColorTemperatureMireds: null,
|
|
1641
1086
|
}, {
|
|
1642
1087
|
stopMoveStep: async () => {
|
|
1643
|
-
// Never called in edge
|
|
1644
1088
|
},
|
|
1645
1089
|
moveToColorTemperature: async () => {
|
|
1646
|
-
// Never called in edge
|
|
1647
1090
|
},
|
|
1648
1091
|
moveColorTemperature: async () => {
|
|
1649
|
-
// Never called in edge
|
|
1650
1092
|
},
|
|
1651
1093
|
stepColorTemperature: async () => {
|
|
1652
|
-
// Never called in edge
|
|
1653
1094
|
},
|
|
1654
1095
|
}, {});
|
|
1655
1096
|
}
|
|
1656
|
-
/**
|
|
1657
|
-
* Creates a color temperature color control cluster server.
|
|
1658
|
-
*
|
|
1659
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1660
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1661
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1662
|
-
*/
|
|
1663
1097
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1664
1098
|
this.addClusterServer(this.getCtColorControlClusterServer(colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1665
1099
|
}
|
|
1666
1100
|
isColorControlConfigured = false;
|
|
1667
|
-
/**
|
|
1668
|
-
* Configures the color control cluster for a device.
|
|
1669
|
-
*
|
|
1670
|
-
* @remark This method must be called only after creating the cluster with getDefaultColorControlClusterServer or createDefaultColorControlClusterServer
|
|
1671
|
-
* and before starting the matter node.
|
|
1672
|
-
*
|
|
1673
|
-
* @deprecated Use configureColorControlMode instead.
|
|
1674
|
-
*
|
|
1675
|
-
* @param {boolean} hueSaturation - A boolean indicating whether the device supports hue and saturation control.
|
|
1676
|
-
* @param {boolean} xy - A boolean indicating whether the device supports XY control.
|
|
1677
|
-
* @param {boolean} colorTemperature - A boolean indicating whether the device supports color temperature control.
|
|
1678
|
-
* @param {ColorControl.ColorMode} colorMode - An optional parameter specifying the color mode of the device.
|
|
1679
|
-
* @param {Endpoint} endpoint - An optional parameter specifying the endpoint to configure. If not provided, the device endpoint will be used.
|
|
1680
|
-
*/
|
|
1681
1101
|
async configureColorControlCluster(hueSaturation, xy, colorTemperature, colorMode, endpoint) {
|
|
1682
1102
|
if (!endpoint)
|
|
1683
1103
|
endpoint = this;
|
|
@@ -1700,12 +1120,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1700
1120
|
}
|
|
1701
1121
|
this.isColorControlConfigured = true;
|
|
1702
1122
|
}
|
|
1703
|
-
/**
|
|
1704
|
-
* Configures the color control mode for the device.
|
|
1705
|
-
*
|
|
1706
|
-
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1707
|
-
* @param {Endpoint} endpoint - The optional endpoint to configure. If not provided, the method will configure the current endpoint.
|
|
1708
|
-
*/
|
|
1709
1123
|
async configureColorControlMode(colorMode, endpoint) {
|
|
1710
1124
|
if (!endpoint)
|
|
1711
1125
|
endpoint = this;
|
|
@@ -1714,11 +1128,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1714
1128
|
await endpoint.setAttribute(ColorControlCluster.id, 'enhancedColorMode', colorMode, this.log, endpoint);
|
|
1715
1129
|
}
|
|
1716
1130
|
}
|
|
1717
|
-
/**
|
|
1718
|
-
* Get a default window covering cluster server.
|
|
1719
|
-
*
|
|
1720
|
-
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1721
|
-
*/
|
|
1722
1131
|
getDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1723
1132
|
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1724
1133
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
@@ -1734,39 +1143,26 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1734
1143
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1735
1144
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
1736
1145
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1737
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1738
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1146
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1147
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1739
1148
|
}, {
|
|
1740
1149
|
upOrOpen: async (data) => {
|
|
1741
|
-
// Never called in edge
|
|
1742
1150
|
},
|
|
1743
1151
|
downOrClose: async (data) => {
|
|
1744
|
-
// Never called in edge
|
|
1745
1152
|
},
|
|
1746
1153
|
stopMotion: async (data) => {
|
|
1747
|
-
// Never called in edge
|
|
1748
1154
|
},
|
|
1749
1155
|
goToLiftPercentage: async (data) => {
|
|
1750
|
-
// Never called in edge
|
|
1751
1156
|
},
|
|
1752
1157
|
}, {});
|
|
1753
1158
|
}
|
|
1754
|
-
/**
|
|
1755
|
-
* Creates a default window covering cluster server.
|
|
1756
|
-
*
|
|
1757
|
-
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1758
|
-
*/
|
|
1759
1159
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1760
1160
|
this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
|
|
1761
1161
|
}
|
|
1762
|
-
/**
|
|
1763
|
-
* Sets the window covering target position as the current position and stops the movement.
|
|
1764
|
-
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1765
|
-
*/
|
|
1766
1162
|
async setWindowCoveringTargetAsCurrentAndStopped(endpoint) {
|
|
1767
1163
|
if (!endpoint)
|
|
1768
1164
|
endpoint = this;
|
|
1769
|
-
const position = endpoint.getAttribute(WindowCoveringCluster.id, 'currentPositionLiftPercent100ths', this.log, endpoint);
|
|
1165
|
+
const position = endpoint.getAttribute(WindowCoveringCluster.id, 'currentPositionLiftPercent100ths', this.log, endpoint);
|
|
1770
1166
|
if (position !== null) {
|
|
1771
1167
|
await endpoint.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', position, this.log, endpoint);
|
|
1772
1168
|
await endpoint.setAttribute(WindowCoveringCluster.id, 'operationalStatus', {
|
|
@@ -1777,13 +1173,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1777
1173
|
}
|
|
1778
1174
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1779
1175
|
}
|
|
1780
|
-
/**
|
|
1781
|
-
* Sets the current and target status of a window covering.
|
|
1782
|
-
* @param {number} current - The current position of the window covering.
|
|
1783
|
-
* @param {number} target - The target position of the window covering.
|
|
1784
|
-
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1785
|
-
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1786
|
-
*/
|
|
1787
1176
|
async setWindowCoveringCurrentTargetStatus(current, target, status, endpoint) {
|
|
1788
1177
|
if (!endpoint)
|
|
1789
1178
|
endpoint = this;
|
|
@@ -1796,11 +1185,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1796
1185
|
}, this.log, endpoint);
|
|
1797
1186
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1798
1187
|
}
|
|
1799
|
-
/**
|
|
1800
|
-
* Sets the status of the window covering.
|
|
1801
|
-
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1802
|
-
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1803
|
-
*/
|
|
1804
1188
|
async setWindowCoveringStatus(status, endpoint) {
|
|
1805
1189
|
if (!endpoint)
|
|
1806
1190
|
endpoint = this;
|
|
@@ -1811,12 +1195,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1811
1195
|
}, this.log, endpoint);
|
|
1812
1196
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1813
1197
|
}
|
|
1814
|
-
/**
|
|
1815
|
-
* Retrieves the status of the window covering.
|
|
1816
|
-
* @param {Endpoint} endpoint - The endpoint on which to get the window covering (default the device endpoint).
|
|
1817
|
-
*
|
|
1818
|
-
* @returns The global operational status of the window covering.
|
|
1819
|
-
*/
|
|
1820
1198
|
getWindowCoveringStatus(endpoint) {
|
|
1821
1199
|
if (!endpoint)
|
|
1822
1200
|
endpoint = this;
|
|
@@ -1824,12 +1202,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1824
1202
|
this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
|
|
1825
1203
|
return status.global;
|
|
1826
1204
|
}
|
|
1827
|
-
/**
|
|
1828
|
-
* Sets the target and current position of the window covering.
|
|
1829
|
-
*
|
|
1830
|
-
* @param position - The position to set, specified as a number.
|
|
1831
|
-
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1832
|
-
*/
|
|
1833
1205
|
async setWindowCoveringTargetAndCurrentPosition(position, endpoint) {
|
|
1834
1206
|
if (!endpoint)
|
|
1835
1207
|
endpoint = this;
|
|
@@ -1837,13 +1209,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1837
1209
|
await endpoint.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', position, this.log, endpoint);
|
|
1838
1210
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
1839
1211
|
}
|
|
1840
|
-
/**
|
|
1841
|
-
* Get a default door lock cluster server.
|
|
1842
|
-
*
|
|
1843
|
-
* @remarks
|
|
1844
|
-
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1845
|
-
*
|
|
1846
|
-
*/
|
|
1847
1212
|
getDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1848
1213
|
return ClusterServer(DoorLockCluster, {
|
|
1849
1214
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
@@ -1853,10 +1218,8 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1853
1218
|
supportedOperatingModes: { normal: true, vacation: false, privacy: false, noRemoteLockUnlock: false, passage: false },
|
|
1854
1219
|
}, {
|
|
1855
1220
|
lockDoor: async (data) => {
|
|
1856
|
-
// Never called in edge
|
|
1857
1221
|
},
|
|
1858
1222
|
unlockDoor: async (data) => {
|
|
1859
|
-
// Never called in edge
|
|
1860
1223
|
},
|
|
1861
1224
|
}, {
|
|
1862
1225
|
doorLockAlarm: true,
|
|
@@ -1864,22 +1227,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1864
1227
|
lockOperationError: true,
|
|
1865
1228
|
});
|
|
1866
1229
|
}
|
|
1867
|
-
/**
|
|
1868
|
-
* Creates a default door lock cluster server.
|
|
1869
|
-
*
|
|
1870
|
-
* @remarks
|
|
1871
|
-
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1872
|
-
*
|
|
1873
|
-
*/
|
|
1874
1230
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1875
1231
|
this.addClusterServer(this.getDefaultDoorLockClusterServer(lockState, lockType));
|
|
1876
1232
|
}
|
|
1877
|
-
/**
|
|
1878
|
-
* Get a default momentary switch cluster server.
|
|
1879
|
-
*
|
|
1880
|
-
* @remarks
|
|
1881
|
-
* This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
|
|
1882
|
-
*/
|
|
1883
1233
|
getDefaultSwitchClusterServer() {
|
|
1884
1234
|
return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
|
|
1885
1235
|
numberOfPositions: 2,
|
|
@@ -1894,21 +1244,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1894
1244
|
multiPressComplete: true,
|
|
1895
1245
|
});
|
|
1896
1246
|
}
|
|
1897
|
-
/**
|
|
1898
|
-
* Creates a default momentary switch cluster server.
|
|
1899
|
-
*
|
|
1900
|
-
* @remarks
|
|
1901
|
-
* This method adds a cluster server with default momentary switch features and configurations.
|
|
1902
|
-
*/
|
|
1903
1247
|
createDefaultSwitchClusterServer() {
|
|
1904
1248
|
this.addClusterServer(this.getDefaultSwitchClusterServer());
|
|
1905
1249
|
}
|
|
1906
|
-
/**
|
|
1907
|
-
* Get a default latching switch cluster server.
|
|
1908
|
-
*
|
|
1909
|
-
* @remarks
|
|
1910
|
-
* This method adds a cluster server with default latching switch features and configuration.
|
|
1911
|
-
*/
|
|
1912
1250
|
getDefaultLatchingSwitchClusterServer() {
|
|
1913
1251
|
return ClusterServer(SwitchCluster.with(Switch.Feature.LatchingSwitch), {
|
|
1914
1252
|
numberOfPositions: 2,
|
|
@@ -1917,22 +1255,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1917
1255
|
switchLatched: true,
|
|
1918
1256
|
});
|
|
1919
1257
|
}
|
|
1920
|
-
/**
|
|
1921
|
-
* Creates a default latching switch cluster server.
|
|
1922
|
-
*
|
|
1923
|
-
* @remarks
|
|
1924
|
-
* This method adds a cluster server with default latching switch features and configuration.
|
|
1925
|
-
*/
|
|
1926
1258
|
createDefaultLatchingSwitchClusterServer() {
|
|
1927
1259
|
this.addClusterServer(this.getDefaultLatchingSwitchClusterServer());
|
|
1928
1260
|
}
|
|
1929
|
-
/**
|
|
1930
|
-
* Triggers a switch event on the specified endpoint.
|
|
1931
|
-
*
|
|
1932
|
-
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1933
|
-
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1934
|
-
* @returns {void}
|
|
1935
|
-
*/
|
|
1936
1261
|
async triggerSwitchEvent(event, log, endpoint) {
|
|
1937
1262
|
if (!endpoint)
|
|
1938
1263
|
endpoint = this;
|
|
@@ -2000,15 +1325,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2000
1325
|
}
|
|
2001
1326
|
return true;
|
|
2002
1327
|
}
|
|
2003
|
-
/**
|
|
2004
|
-
* Retrieves the default mode select cluster server.
|
|
2005
|
-
*
|
|
2006
|
-
* @param description - The description of the cluster server.
|
|
2007
|
-
* @param supportedModes - The supported modes for the cluster server.
|
|
2008
|
-
* @param currentMode - The current mode of the cluster server. Defaults to 0.
|
|
2009
|
-
* @param startUpMode - The startup mode of the cluster server. Defaults to 0.
|
|
2010
|
-
* @returns The default mode select cluster server.
|
|
2011
|
-
*/
|
|
2012
1328
|
getDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
2013
1329
|
return ClusterServer(ModeSelectCluster, {
|
|
2014
1330
|
description: description,
|
|
@@ -2018,30 +1334,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2018
1334
|
startUpMode: startUpMode,
|
|
2019
1335
|
}, {
|
|
2020
1336
|
changeToMode: async (data) => {
|
|
2021
|
-
// Never called in edge
|
|
2022
1337
|
},
|
|
2023
1338
|
});
|
|
2024
1339
|
}
|
|
2025
|
-
/**
|
|
2026
|
-
* Creates a default mode select cluster server.
|
|
2027
|
-
*
|
|
2028
|
-
* @param description - The description of the cluster server.
|
|
2029
|
-
* @param supportedModes - The supported modes for the cluster server.
|
|
2030
|
-
* @param currentMode - The current mode of the cluster server. Defaults to 0.
|
|
2031
|
-
* @param startUpMode - The startup mode of the cluster server. Defaults to 0.
|
|
2032
|
-
* @param endpoint - The endpoint to add the cluster server to. Defaults to `this` if not provided.
|
|
2033
|
-
*
|
|
2034
|
-
*/
|
|
2035
1340
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
|
|
2036
1341
|
if (!endpoint)
|
|
2037
1342
|
endpoint = this;
|
|
2038
1343
|
endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
|
|
2039
1344
|
}
|
|
2040
|
-
/**
|
|
2041
|
-
* Get a default occupancy sensing cluster server.
|
|
2042
|
-
*
|
|
2043
|
-
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
2044
|
-
*/
|
|
2045
1345
|
getDefaultOccupancySensingClusterServer(occupied = false) {
|
|
2046
1346
|
return ClusterServer(OccupancySensingCluster, {
|
|
2047
1347
|
occupancy: { occupied },
|
|
@@ -2050,19 +1350,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2050
1350
|
pirOccupiedToUnoccupiedDelay: 30,
|
|
2051
1351
|
}, {});
|
|
2052
1352
|
}
|
|
2053
|
-
/**
|
|
2054
|
-
* Creates a default occupancy sensing cluster server.
|
|
2055
|
-
*
|
|
2056
|
-
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
2057
|
-
*/
|
|
2058
1353
|
createDefaultOccupancySensingClusterServer(occupied = false) {
|
|
2059
1354
|
this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
|
|
2060
1355
|
}
|
|
2061
|
-
/**
|
|
2062
|
-
* Get a default Illuminance Measurement Cluster Server.
|
|
2063
|
-
*
|
|
2064
|
-
* @param measuredValue - The measured value of illuminance.
|
|
2065
|
-
*/
|
|
2066
1356
|
getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
2067
1357
|
return ClusterServer(IlluminanceMeasurementCluster, {
|
|
2068
1358
|
measuredValue,
|
|
@@ -2071,19 +1361,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2071
1361
|
tolerance: 0,
|
|
2072
1362
|
}, {}, {});
|
|
2073
1363
|
}
|
|
2074
|
-
/**
|
|
2075
|
-
* Creates a default Illuminance Measurement Cluster Server.
|
|
2076
|
-
*
|
|
2077
|
-
* @param measuredValue - The measured value of illuminance.
|
|
2078
|
-
*/
|
|
2079
1364
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
2080
1365
|
this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
|
|
2081
1366
|
}
|
|
2082
|
-
/**
|
|
2083
|
-
* Get a default flow measurement cluster server.
|
|
2084
|
-
*
|
|
2085
|
-
* @param measuredValue - The measured value of the flow in 10 x m/h.
|
|
2086
|
-
*/
|
|
2087
1367
|
getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
2088
1368
|
return ClusterServer(FlowMeasurementCluster, {
|
|
2089
1369
|
measuredValue,
|
|
@@ -2092,19 +1372,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2092
1372
|
tolerance: 0,
|
|
2093
1373
|
}, {}, {});
|
|
2094
1374
|
}
|
|
2095
|
-
/**
|
|
2096
|
-
* Creates a default flow measurement cluster server.
|
|
2097
|
-
*
|
|
2098
|
-
* @param measuredValue - The measured value of the flow in 10 x m/h.
|
|
2099
|
-
*/
|
|
2100
1375
|
createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
2101
1376
|
this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
|
|
2102
1377
|
}
|
|
2103
|
-
/**
|
|
2104
|
-
* Get a default temperature measurement cluster server.
|
|
2105
|
-
*
|
|
2106
|
-
* @param measuredValue - The measured value of the temperature x 100.
|
|
2107
|
-
*/
|
|
2108
1378
|
getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
2109
1379
|
return ClusterServer(TemperatureMeasurementCluster, {
|
|
2110
1380
|
measuredValue,
|
|
@@ -2113,19 +1383,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2113
1383
|
tolerance: 0,
|
|
2114
1384
|
}, {}, {});
|
|
2115
1385
|
}
|
|
2116
|
-
/**
|
|
2117
|
-
* Creates a default temperature measurement cluster server.
|
|
2118
|
-
*
|
|
2119
|
-
* @param measuredValue - The measured value of the temperature x 100.
|
|
2120
|
-
*/
|
|
2121
1386
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
2122
1387
|
this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
|
|
2123
1388
|
}
|
|
2124
|
-
/**
|
|
2125
|
-
* Get a default RelativeHumidityMeasurementCluster server.
|
|
2126
|
-
*
|
|
2127
|
-
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
2128
|
-
*/
|
|
2129
1389
|
getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
2130
1390
|
return ClusterServer(RelativeHumidityMeasurementCluster, {
|
|
2131
1391
|
measuredValue,
|
|
@@ -2134,19 +1394,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2134
1394
|
tolerance: 0,
|
|
2135
1395
|
}, {}, {});
|
|
2136
1396
|
}
|
|
2137
|
-
/**
|
|
2138
|
-
* Creates a default RelativeHumidityMeasurementCluster server.
|
|
2139
|
-
*
|
|
2140
|
-
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
2141
|
-
*/
|
|
2142
1397
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
2143
1398
|
this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
|
|
2144
1399
|
}
|
|
2145
|
-
/**
|
|
2146
|
-
* Get a default Pressure Measurement Cluster Server.
|
|
2147
|
-
*
|
|
2148
|
-
* @param measuredValue - The measured value for the pressure.
|
|
2149
|
-
*/
|
|
2150
1400
|
getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
2151
1401
|
return ClusterServer(PressureMeasurementCluster, {
|
|
2152
1402
|
measuredValue,
|
|
@@ -2155,39 +1405,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2155
1405
|
tolerance: 0,
|
|
2156
1406
|
}, {}, {});
|
|
2157
1407
|
}
|
|
2158
|
-
/**
|
|
2159
|
-
* Creates a default Pressure Measurement Cluster Server.
|
|
2160
|
-
*
|
|
2161
|
-
* @param measuredValue - The measured value for the pressure.
|
|
2162
|
-
*/
|
|
2163
1408
|
createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
2164
1409
|
this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
|
|
2165
1410
|
}
|
|
2166
|
-
/**
|
|
2167
|
-
* Get a default boolean state cluster server.
|
|
2168
|
-
*
|
|
2169
|
-
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
2170
|
-
*/
|
|
2171
1411
|
getDefaultBooleanStateClusterServer(contact) {
|
|
2172
1412
|
return ClusterServer(BooleanStateCluster, {
|
|
2173
|
-
stateValue: contact ?? true,
|
|
1413
|
+
stateValue: contact ?? true,
|
|
2174
1414
|
}, {}, {
|
|
2175
1415
|
stateChange: true,
|
|
2176
1416
|
});
|
|
2177
1417
|
}
|
|
2178
|
-
/**
|
|
2179
|
-
* Creates a default boolean state configuration cluster server.
|
|
2180
|
-
*
|
|
2181
|
-
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
2182
|
-
*/
|
|
2183
1418
|
createDefaultBooleanStateClusterServer(contact) {
|
|
2184
1419
|
this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
|
|
2185
1420
|
}
|
|
2186
|
-
/**
|
|
2187
|
-
* Get a default boolean state configuration cluster server.
|
|
2188
|
-
*
|
|
2189
|
-
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
2190
|
-
*/
|
|
2191
1421
|
getDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
2192
1422
|
return ClusterServer(BooleanStateConfigurationCluster.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel), {
|
|
2193
1423
|
currentSensitivityLevel: 0,
|
|
@@ -2196,34 +1426,18 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2196
1426
|
alarmsActive: { visual: false, audible: false },
|
|
2197
1427
|
alarmsEnabled: { visual: false, audible: false },
|
|
2198
1428
|
alarmsSupported: { visual: true, audible: true },
|
|
2199
|
-
// alarmsSuppressed: { visual: false, audible: false },
|
|
2200
1429
|
sensorFault: { generalFault: sensorFault },
|
|
2201
1430
|
}, {
|
|
2202
1431
|
enableDisableAlarm: async (data) => {
|
|
2203
|
-
// Never called in edge
|
|
2204
1432
|
},
|
|
2205
1433
|
}, {
|
|
2206
1434
|
alarmsStateChanged: true,
|
|
2207
1435
|
sensorFault: true,
|
|
2208
1436
|
});
|
|
2209
1437
|
}
|
|
2210
|
-
/**
|
|
2211
|
-
* Creates 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
1438
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
2216
1439
|
this.addClusterServer(this.getDefaultBooleanStateConfigurationClusterServer(sensorFault));
|
|
2217
1440
|
}
|
|
2218
|
-
/**
|
|
2219
|
-
* Get a default power source replaceable battery cluster server.
|
|
2220
|
-
*
|
|
2221
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2222
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2223
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
2224
|
-
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
2225
|
-
* @param batQuantity - The battery quantity (default: 1).
|
|
2226
|
-
*/
|
|
2227
1441
|
getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
2228
1442
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
2229
1443
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -2240,25 +1454,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2240
1454
|
endpointList: [],
|
|
2241
1455
|
}, {}, {});
|
|
2242
1456
|
}
|
|
2243
|
-
/**
|
|
2244
|
-
* Creates a default power source replaceable battery cluster server.
|
|
2245
|
-
*
|
|
2246
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2247
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2248
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
2249
|
-
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
2250
|
-
* @param batQuantity - The battery quantity (default: 1).
|
|
2251
|
-
*/
|
|
2252
1457
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
2253
1458
|
this.addClusterServer(this.getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity));
|
|
2254
1459
|
}
|
|
2255
|
-
/**
|
|
2256
|
-
* Get a default power source rechargeable battery cluster server.
|
|
2257
|
-
*
|
|
2258
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2259
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2260
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
2261
|
-
*/
|
|
2262
1460
|
getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
2263
1461
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
2264
1462
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -2276,21 +1474,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2276
1474
|
endpointList: [],
|
|
2277
1475
|
}, {}, {});
|
|
2278
1476
|
}
|
|
2279
|
-
/**
|
|
2280
|
-
* Creates 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
1477
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
2287
1478
|
this.addClusterServer(this.getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage));
|
|
2288
1479
|
}
|
|
2289
|
-
/**
|
|
2290
|
-
* Get a default power source wired cluster server.
|
|
2291
|
-
*
|
|
2292
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
2293
|
-
*/
|
|
2294
1480
|
getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
2295
1481
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Wired), {
|
|
2296
1482
|
wiredCurrentType,
|
|
@@ -2300,45 +1486,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2300
1486
|
endpointList: [],
|
|
2301
1487
|
}, {}, {});
|
|
2302
1488
|
}
|
|
2303
|
-
/**
|
|
2304
|
-
* Creates a default power source wired cluster server.
|
|
2305
|
-
*
|
|
2306
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
2307
|
-
*/
|
|
2308
1489
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
2309
1490
|
this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
|
|
2310
1491
|
}
|
|
2311
|
-
/**
|
|
2312
|
-
* @deprecated This function is deprecated by Matter 1.3 spec and will be removed in a future version.
|
|
2313
|
-
*/
|
|
2314
1492
|
createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
|
|
2315
1493
|
this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
|
|
2316
1494
|
sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
|
|
2317
1495
|
}, {}, {}));
|
|
2318
1496
|
}
|
|
2319
|
-
/**
|
|
2320
|
-
* Get a default air quality cluster server.
|
|
2321
|
-
*
|
|
2322
|
-
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2323
|
-
*/
|
|
2324
1497
|
getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
2325
1498
|
return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
2326
1499
|
airQuality,
|
|
2327
1500
|
}, {}, {});
|
|
2328
1501
|
}
|
|
2329
|
-
/**
|
|
2330
|
-
* Creates a default air quality cluster server.
|
|
2331
|
-
*
|
|
2332
|
-
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2333
|
-
*/
|
|
2334
1502
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
2335
1503
|
this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
|
|
2336
1504
|
}
|
|
2337
|
-
/**
|
|
2338
|
-
* Get a default TVOC measurement cluster server.
|
|
2339
|
-
*
|
|
2340
|
-
* @param measuredValue - The measured value for TVOC.
|
|
2341
|
-
*/
|
|
2342
1505
|
getDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2343
1506
|
return ClusterServer(TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2344
1507
|
measuredValue,
|
|
@@ -2349,28 +1512,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2349
1512
|
measurementMedium,
|
|
2350
1513
|
}, {}, {});
|
|
2351
1514
|
}
|
|
2352
|
-
/**
|
|
2353
|
-
* Creates a default TVOC measurement cluster server.
|
|
2354
|
-
*
|
|
2355
|
-
* @param measuredValue - The measured value for TVOC.
|
|
2356
|
-
*/
|
|
2357
1515
|
createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2358
1516
|
this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2359
1517
|
}
|
|
2360
|
-
/**
|
|
2361
|
-
* Get a default heating thermostat cluster server with the specified parameters.
|
|
2362
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2363
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2364
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2365
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2366
|
-
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2367
|
-
*/
|
|
2368
1518
|
getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
2369
1519
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
|
|
2370
1520
|
localTemperature: localTemperature * 100,
|
|
2371
1521
|
systemMode: Thermostat.SystemMode.Heat,
|
|
2372
1522
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
2373
|
-
// Thermostat.Feature.Heating
|
|
2374
1523
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
2375
1524
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
2376
1525
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -2378,35 +1527,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2378
1527
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2379
1528
|
}, {
|
|
2380
1529
|
setpointRaiseLower: async (data) => {
|
|
2381
|
-
// Never called in edge
|
|
2382
1530
|
},
|
|
2383
1531
|
}, {});
|
|
2384
1532
|
}
|
|
2385
|
-
/**
|
|
2386
|
-
* Creates and adds a default heating thermostat cluster server to the device.
|
|
2387
|
-
*
|
|
2388
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2389
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2390
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2391
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2392
|
-
*/
|
|
2393
1533
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
2394
1534
|
this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
|
|
2395
1535
|
}
|
|
2396
|
-
/**
|
|
2397
|
-
* Get a default cooling thermostat cluster server with the specified parameters.
|
|
2398
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2399
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2400
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2401
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2402
|
-
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2403
|
-
*/
|
|
2404
1536
|
getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2405
1537
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
|
|
2406
1538
|
localTemperature: localTemperature * 100,
|
|
2407
1539
|
systemMode: Thermostat.SystemMode.Cool,
|
|
2408
1540
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
2409
|
-
// Thermostat.Feature.Cooling
|
|
2410
1541
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
2411
1542
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
2412
1543
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -2414,82 +1545,37 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2414
1545
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2415
1546
|
}, {
|
|
2416
1547
|
setpointRaiseLower: async (data) => {
|
|
2417
|
-
// Never called in edge
|
|
2418
1548
|
},
|
|
2419
1549
|
}, {});
|
|
2420
1550
|
}
|
|
2421
|
-
/**
|
|
2422
|
-
* Creates and adds a default cooling thermostat cluster server to the device.
|
|
2423
|
-
*
|
|
2424
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2425
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2426
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2427
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2428
|
-
*/
|
|
2429
1551
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2430
1552
|
this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
2431
1553
|
}
|
|
2432
|
-
/**
|
|
2433
|
-
* Get a default thermostat cluster server with the specified parameters.
|
|
2434
|
-
*
|
|
2435
|
-
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2436
|
-
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2437
|
-
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2438
|
-
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2439
|
-
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2440
|
-
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2441
|
-
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2442
|
-
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2443
|
-
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2444
|
-
*/
|
|
2445
1554
|
getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2446
1555
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
2447
1556
|
localTemperature: localTemperature * 100,
|
|
2448
1557
|
systemMode: Thermostat.SystemMode.Auto,
|
|
2449
1558
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
2450
|
-
// Thermostat.Feature.Heating
|
|
2451
1559
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
2452
1560
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
2453
1561
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2454
1562
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
2455
1563
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2456
|
-
// Thermostat.Feature.Cooling
|
|
2457
1564
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
2458
1565
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
2459
1566
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2460
1567
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
2461
1568
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2462
|
-
// Thermostat.Feature.AutoMode
|
|
2463
1569
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
2464
1570
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
2465
1571
|
}, {
|
|
2466
1572
|
setpointRaiseLower: async (data) => {
|
|
2467
|
-
// Never called in edge
|
|
2468
1573
|
},
|
|
2469
1574
|
}, {});
|
|
2470
1575
|
}
|
|
2471
|
-
/**
|
|
2472
|
-
* Creates and adds a default thermostat cluster server to the device.
|
|
2473
|
-
*
|
|
2474
|
-
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2475
|
-
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2476
|
-
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2477
|
-
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2478
|
-
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2479
|
-
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2480
|
-
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2481
|
-
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2482
|
-
*/
|
|
2483
1576
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2484
1577
|
this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
2485
1578
|
}
|
|
2486
|
-
/**
|
|
2487
|
-
* Returns the default SmokeCOAlarm Cluster Server.
|
|
2488
|
-
*
|
|
2489
|
-
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2490
|
-
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2491
|
-
* @returns The default SmokeCOAlarmClusterServer.
|
|
2492
|
-
*/
|
|
2493
1579
|
getDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
2494
1580
|
return ClusterServer(SmokeCoAlarmCluster.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm), {
|
|
2495
1581
|
smokeState,
|
|
@@ -2504,7 +1590,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2504
1590
|
interconnectCoAlarm: SmokeCoAlarm.AlarmState.Normal,
|
|
2505
1591
|
}, {
|
|
2506
1592
|
selfTestRequest: async (data) => {
|
|
2507
|
-
// Never called in edge
|
|
2508
1593
|
},
|
|
2509
1594
|
}, {
|
|
2510
1595
|
smokeAlarm: true,
|
|
@@ -2520,24 +1605,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2520
1605
|
allClear: true,
|
|
2521
1606
|
});
|
|
2522
1607
|
}
|
|
2523
|
-
/**
|
|
2524
|
-
* Create the default SmokeCOAlarm Cluster Server.
|
|
2525
|
-
*
|
|
2526
|
-
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2527
|
-
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2528
|
-
* @returns The default SmokeCOAlarmClusterServer.
|
|
2529
|
-
*/
|
|
2530
1608
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
2531
1609
|
this.addClusterServer(this.getDefaultSmokeCOAlarmClusterServer(smokeState, coState));
|
|
2532
1610
|
}
|
|
2533
|
-
/**
|
|
2534
|
-
* Returns the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2535
|
-
*
|
|
2536
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2537
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2538
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2539
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2540
|
-
*/
|
|
2541
1611
|
getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2542
1612
|
return ClusterServer(CarbonMonoxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2543
1613
|
measuredValue,
|
|
@@ -2548,24 +1618,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2548
1618
|
measurementMedium,
|
|
2549
1619
|
}, {}, {});
|
|
2550
1620
|
}
|
|
2551
|
-
/**
|
|
2552
|
-
* Create the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2553
|
-
*
|
|
2554
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2555
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2556
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2557
|
-
*/
|
|
2558
1621
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2559
1622
|
this.addClusterServer(this.getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2560
1623
|
}
|
|
2561
|
-
/**
|
|
2562
|
-
* Returns the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2563
|
-
*
|
|
2564
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2565
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2566
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2567
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2568
|
-
*/
|
|
2569
1624
|
getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2570
1625
|
return ClusterServer(CarbonDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2571
1626
|
measuredValue,
|
|
@@ -2576,24 +1631,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2576
1631
|
measurementMedium,
|
|
2577
1632
|
}, {}, {});
|
|
2578
1633
|
}
|
|
2579
|
-
/**
|
|
2580
|
-
* Create the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2581
|
-
*
|
|
2582
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2583
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2584
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2585
|
-
*/
|
|
2586
1634
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2587
1635
|
this.addClusterServer(this.getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2588
1636
|
}
|
|
2589
|
-
/**
|
|
2590
|
-
* Returns the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2591
|
-
*
|
|
2592
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2593
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2594
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2595
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2596
|
-
*/
|
|
2597
1637
|
getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2598
1638
|
return ClusterServer(FormaldehydeConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2599
1639
|
measuredValue,
|
|
@@ -2604,24 +1644,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2604
1644
|
measurementMedium,
|
|
2605
1645
|
}, {}, {});
|
|
2606
1646
|
}
|
|
2607
|
-
/**
|
|
2608
|
-
* Create the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2609
|
-
*
|
|
2610
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2611
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2612
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2613
|
-
*/
|
|
2614
1647
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2615
1648
|
this.addClusterServer(this.getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2616
1649
|
}
|
|
2617
|
-
/**
|
|
2618
|
-
* Returns the default Pm1 Concentration Measurement Cluster Server.
|
|
2619
|
-
*
|
|
2620
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2621
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2622
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2623
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2624
|
-
*/
|
|
2625
1650
|
getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2626
1651
|
return ClusterServer(Pm1ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2627
1652
|
measuredValue,
|
|
@@ -2632,24 +1657,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2632
1657
|
measurementMedium,
|
|
2633
1658
|
}, {}, {});
|
|
2634
1659
|
}
|
|
2635
|
-
/**
|
|
2636
|
-
* Create the default Pm1 Concentration Measurement Cluster Server.
|
|
2637
|
-
*
|
|
2638
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2639
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2640
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2641
|
-
*/
|
|
2642
1660
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2643
1661
|
this.addClusterServer(this.getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2644
1662
|
}
|
|
2645
|
-
/**
|
|
2646
|
-
* Returns the default Pm25 Concentration Measurement Cluster Server.
|
|
2647
|
-
*
|
|
2648
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2649
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2650
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2651
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2652
|
-
*/
|
|
2653
1663
|
getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2654
1664
|
return ClusterServer(Pm25ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2655
1665
|
measuredValue,
|
|
@@ -2660,24 +1670,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2660
1670
|
measurementMedium,
|
|
2661
1671
|
}, {}, {});
|
|
2662
1672
|
}
|
|
2663
|
-
/**
|
|
2664
|
-
* Create the default Pm25 Concentration Measurement Cluster Server.
|
|
2665
|
-
*
|
|
2666
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2667
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2668
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2669
|
-
*/
|
|
2670
1673
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2671
1674
|
this.addClusterServer(this.getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2672
1675
|
}
|
|
2673
|
-
/**
|
|
2674
|
-
* Returns the default Pm10 Concentration Measurement Cluster Server.
|
|
2675
|
-
*
|
|
2676
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2677
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2678
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2679
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2680
|
-
*/
|
|
2681
1676
|
getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2682
1677
|
return ClusterServer(Pm10ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2683
1678
|
measuredValue,
|
|
@@ -2688,24 +1683,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2688
1683
|
measurementMedium,
|
|
2689
1684
|
}, {}, {});
|
|
2690
1685
|
}
|
|
2691
|
-
/**
|
|
2692
|
-
* Create the default Pm10 Concentration Measurement Cluster Server.
|
|
2693
|
-
*
|
|
2694
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2695
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2696
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2697
|
-
*/
|
|
2698
1686
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2699
1687
|
this.addClusterServer(this.getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2700
1688
|
}
|
|
2701
|
-
/**
|
|
2702
|
-
* Returns the default Ozone Concentration Measurement Cluster Server.
|
|
2703
|
-
*
|
|
2704
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2705
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2706
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2707
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2708
|
-
*/
|
|
2709
1689
|
getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2710
1690
|
return ClusterServer(OzoneConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2711
1691
|
measuredValue,
|
|
@@ -2716,24 +1696,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2716
1696
|
measurementMedium,
|
|
2717
1697
|
}, {}, {});
|
|
2718
1698
|
}
|
|
2719
|
-
/**
|
|
2720
|
-
* Create the default Ozone Concentration Measurement Cluster Server.
|
|
2721
|
-
*
|
|
2722
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2723
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2724
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2725
|
-
*/
|
|
2726
1699
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2727
1700
|
this.addClusterServer(this.getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2728
1701
|
}
|
|
2729
|
-
/**
|
|
2730
|
-
* Returns the default Radon Concentration Measurement Cluster Server.
|
|
2731
|
-
*
|
|
2732
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2733
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2734
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2735
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2736
|
-
*/
|
|
2737
1702
|
getDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2738
1703
|
return ClusterServer(RadonConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2739
1704
|
measuredValue,
|
|
@@ -2744,24 +1709,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2744
1709
|
measurementMedium,
|
|
2745
1710
|
}, {}, {});
|
|
2746
1711
|
}
|
|
2747
|
-
/**
|
|
2748
|
-
* Create the default Radon Concentration Measurement Cluster Server.
|
|
2749
|
-
*
|
|
2750
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2751
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2752
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2753
|
-
*/
|
|
2754
1712
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2755
1713
|
this.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2756
1714
|
}
|
|
2757
|
-
/**
|
|
2758
|
-
* Returns the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2759
|
-
*
|
|
2760
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2761
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2762
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2763
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2764
|
-
*/
|
|
2765
1715
|
getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2766
1716
|
return ClusterServer(NitrogenDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2767
1717
|
measuredValue,
|
|
@@ -2772,22 +1722,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2772
1722
|
measurementMedium,
|
|
2773
1723
|
}, {}, {});
|
|
2774
1724
|
}
|
|
2775
|
-
/**
|
|
2776
|
-
* Create the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2777
|
-
*
|
|
2778
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2779
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2780
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2781
|
-
*/
|
|
2782
1725
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2783
1726
|
this.addClusterServer(this.getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2784
1727
|
}
|
|
2785
|
-
/**
|
|
2786
|
-
* Returns the default fan control cluster server rev 2.
|
|
2787
|
-
*
|
|
2788
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2789
|
-
* @returns The default fan control cluster server.
|
|
2790
|
-
*/
|
|
2791
1728
|
getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
2792
1729
|
return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
2793
1730
|
fanMode,
|
|
@@ -2799,25 +1736,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2799
1736
|
speedCurrent: 0,
|
|
2800
1737
|
}, {
|
|
2801
1738
|
step: async (data) => {
|
|
2802
|
-
// Never called in edge
|
|
2803
1739
|
},
|
|
2804
1740
|
}, {});
|
|
2805
1741
|
}
|
|
2806
|
-
/**
|
|
2807
|
-
* Create the default fan control cluster server rev 2.
|
|
2808
|
-
*
|
|
2809
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2810
|
-
* @returns The default fan control cluster server.
|
|
2811
|
-
*/
|
|
2812
1742
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
2813
1743
|
this.addClusterServer(this.getDefaultFanControlClusterServer(fanMode));
|
|
2814
1744
|
}
|
|
2815
|
-
/**
|
|
2816
|
-
* Returns the default Pump Configuration And Control cluster server.
|
|
2817
|
-
*
|
|
2818
|
-
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
2819
|
-
* @returns {ClusterServer} - The default Pump Configuration And Control cluster server.
|
|
2820
|
-
*/
|
|
2821
1745
|
getDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
2822
1746
|
return ClusterServer(PumpConfigurationAndControlCluster.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
2823
1747
|
minConstSpeed: null,
|
|
@@ -2831,22 +1755,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2831
1755
|
operationMode: pumpMode,
|
|
2832
1756
|
}, {}, {});
|
|
2833
1757
|
}
|
|
2834
|
-
/**
|
|
2835
|
-
* Creates the default Pump Configuration And Control cluster server.
|
|
2836
|
-
*
|
|
2837
|
-
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
2838
|
-
* @returns {void}
|
|
2839
|
-
*/
|
|
2840
1758
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
2841
1759
|
this.addClusterServer(this.getDefaultPumpConfigurationAndControlClusterServer(pumpMode));
|
|
2842
1760
|
}
|
|
2843
|
-
/**
|
|
2844
|
-
* Returns the default Valve Configuration And Control cluster server rev 2.
|
|
2845
|
-
*
|
|
2846
|
-
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
2847
|
-
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
2848
|
-
* @returns {ClusterServer} - The default Valve Configuration And Control cluster server.
|
|
2849
|
-
*/
|
|
2850
1761
|
getDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
2851
1762
|
return ClusterServer(ValveConfigurationAndControlCluster.with(ValveConfigurationAndControl.Feature.Level), {
|
|
2852
1763
|
currentState: valveState,
|
|
@@ -2858,22 +1769,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2858
1769
|
remainingDuration: null,
|
|
2859
1770
|
}, {
|
|
2860
1771
|
open: async (data) => {
|
|
2861
|
-
// Never called in edge
|
|
2862
1772
|
},
|
|
2863
1773
|
close: async (data) => {
|
|
2864
|
-
// Never called in edge
|
|
2865
1774
|
},
|
|
2866
1775
|
}, {});
|
|
2867
1776
|
}
|
|
2868
|
-
/**
|
|
2869
|
-
* Create the default Valve Configuration And Control cluster server rev 2.
|
|
2870
|
-
*
|
|
2871
|
-
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
2872
|
-
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
2873
|
-
* @returns {void}
|
|
2874
|
-
*/
|
|
2875
1777
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
2876
1778
|
this.addClusterServer(this.getDefaultValveConfigurationAndControlClusterServer(valveState, valveLevel));
|
|
2877
1779
|
}
|
|
2878
1780
|
}
|
|
2879
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|