matterbridge 1.6.6 → 1.6.7-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 +18 -4
- package/README.md +5 -3
- package/dist/cli.js +0 -26
- package/dist/cluster/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -23
- package/dist/deviceManager.js +1 -26
- package/dist/index.js +0 -30
- package/dist/logger/export.js +0 -1
- package/dist/matter/export.js +0 -1
- package/dist/matterbridge.js +66 -706
- package/dist/matterbridgeAccessoryPlatform.js +0 -33
- package/dist/matterbridgeBehaviors.js +1 -29
- package/dist/matterbridgeDevice.js +11 -947
- package/dist/matterbridgeDeviceTypes.js +12 -59
- package/dist/matterbridgeDynamicPlatform.js +0 -33
- package/dist/matterbridgeEdge.js +65 -538
- package/dist/matterbridgeEndpoint.js +12 -1056
- package/dist/matterbridgePlatform.js +5 -94
- package/dist/matterbridgeTypes.js +0 -24
- package/dist/matterbridgeWebsocket.js +0 -45
- package/dist/pluginManager.js +11 -240
- 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/frontend/build/asset-manifest.json +3 -3
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/js/{main.a742de4e.js → main.4dd7e165.js} +3 -3
- package/frontend/build/static/js/main.4dd7e165.js.map +1 -0
- package/npm-shrinkwrap.json +17 -13
- package/package.json +2 -3
- 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 -5
- 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 -6674
- package/dist/matterbridgeDevice.d.ts.map +0 -1
- package/dist/matterbridgeDevice.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -82
- 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 -89
- package/dist/matterbridgeEdge.d.ts.map +0 -1
- package/dist/matterbridgeEdge.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -9774
- 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 -161
- 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
- package/frontend/build/static/js/main.a742de4e.js.map +0 -1
- /package/frontend/build/static/js/{main.a742de4e.js.LICENSE.txt → main.4dd7e165.js.LICENSE.txt} +0 -0
|
@@ -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, RadonConcentrationMeasurement, RadonConcentrationMeasurementCluster, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, SmokeCoAlarm, SmokeCoAlarmCluster, Switch, SwitchCluster, TemperatureMeasurement, TemperatureMeasurementCluster, Thermostat, ThermostatCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster, UserLabel, UserLabelCluster, 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)
|
|
@@ -275,21 +223,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
275
223
|
return MatterbridgeIdentifyServer;
|
|
276
224
|
}
|
|
277
225
|
static getBehaviourTypeFromClusterClientId(clusterId) {
|
|
278
|
-
// Map ClusterId to Behavior.Type
|
|
279
226
|
return IdentifyBehavior;
|
|
280
227
|
}
|
|
281
|
-
/**
|
|
282
|
-
* Adds a device type to the list of device types.
|
|
283
|
-
* If the device type is not already present in the list, it will be added.
|
|
284
|
-
*
|
|
285
|
-
* @param {DeviceTypeDefinition} deviceType - The device type to add.
|
|
286
|
-
*/
|
|
287
228
|
addDeviceType(deviceType) {
|
|
288
229
|
if (!this.deviceTypes.has(deviceType.code)) {
|
|
289
|
-
// Keep the Matterbridge internal map
|
|
290
230
|
this.log.debug(`addDeviceType: ${zb}${'0x' + deviceType.code.toString(16).padStart(4, '0')}${db}-${zb}${deviceType.name}${db}`);
|
|
291
231
|
this.deviceTypes.set(deviceType.code, deviceType);
|
|
292
|
-
// Add the device types to the descriptor server
|
|
293
232
|
const deviceTypeList = Array.from(this.deviceTypes.values()).map((dt) => ({
|
|
294
233
|
deviceType: dt.code,
|
|
295
234
|
revision: dt.revision,
|
|
@@ -307,12 +246,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
307
246
|
}
|
|
308
247
|
}
|
|
309
248
|
}
|
|
310
|
-
/**
|
|
311
|
-
* Adds one or more device types with the required cluster servers and the specified cluster servers.
|
|
312
|
-
*
|
|
313
|
-
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
314
|
-
* @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
|
|
315
|
-
*/
|
|
316
249
|
addDeviceTypeWithClusterServer(deviceTypes, includeServerList) {
|
|
317
250
|
this.log.debug('addDeviceTypeWithClusterServer:');
|
|
318
251
|
deviceTypes.forEach((deviceType) => {
|
|
@@ -335,12 +268,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
335
268
|
});
|
|
336
269
|
this.addClusterServerFromList(this, includeServerList);
|
|
337
270
|
}
|
|
338
|
-
/**
|
|
339
|
-
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
340
|
-
*
|
|
341
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
342
|
-
* @returns {MatterbridgeEndpoint} The updated endpoint with the required cluster servers added.
|
|
343
|
-
*/
|
|
344
271
|
addRequiredClusterServers(endpoint) {
|
|
345
272
|
const requiredServerList = [];
|
|
346
273
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.id}${db}`);
|
|
@@ -357,12 +284,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
357
284
|
this.addClusterServerFromList(endpoint, requiredServerList);
|
|
358
285
|
return endpoint;
|
|
359
286
|
}
|
|
360
|
-
/**
|
|
361
|
-
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
362
|
-
*
|
|
363
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
364
|
-
* @returns {MatterbridgeEndpoint} The updated endpoint with the required cluster servers added.
|
|
365
|
-
*/
|
|
366
287
|
addOptionalClusterServers(endpoint) {
|
|
367
288
|
const optionalServerList = [];
|
|
368
289
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.id}${db}`);
|
|
@@ -379,17 +300,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
379
300
|
this.addClusterServerFromList(endpoint, optionalServerList);
|
|
380
301
|
return endpoint;
|
|
381
302
|
}
|
|
382
|
-
/**
|
|
383
|
-
* Adds a child endpoint with the specified device types and options.
|
|
384
|
-
* If the child endpoint is not already present, it will be created and added.
|
|
385
|
-
* If the child endpoint is already present, the device types will be added to the existing child endpoint.
|
|
386
|
-
*
|
|
387
|
-
* @param {string} endpointName - The name of the new endpoint to add.
|
|
388
|
-
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
389
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
|
|
390
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
391
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
392
|
-
*/
|
|
393
303
|
addChildDeviceType(endpointName, deviceTypes, options = {}, debug = false) {
|
|
394
304
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
395
305
|
let child = this.getChildEndpointByName(endpointName);
|
|
@@ -420,18 +330,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
420
330
|
}
|
|
421
331
|
return child;
|
|
422
332
|
}
|
|
423
|
-
/**
|
|
424
|
-
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
425
|
-
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
426
|
-
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
427
|
-
*
|
|
428
|
-
* @param {string} endpointName - The name of the new enpoint to add.
|
|
429
|
-
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
430
|
-
* @param {ClusterId[]} [includeServerList=[]] - The list of cluster IDs to include.
|
|
431
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
432
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
433
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
434
|
-
*/
|
|
435
333
|
addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
|
|
436
334
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
437
335
|
let child = this.getChildEndpointByName(endpointName);
|
|
@@ -475,12 +373,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
475
373
|
}
|
|
476
374
|
return child;
|
|
477
375
|
}
|
|
478
|
-
/**
|
|
479
|
-
* Retrieves a child endpoint by its name.
|
|
480
|
-
*
|
|
481
|
-
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
482
|
-
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
483
|
-
*/
|
|
484
376
|
getChildEndpointByName(endpointName) {
|
|
485
377
|
return this.parts.find((part) => part.id === endpointName);
|
|
486
378
|
}
|
|
@@ -499,8 +391,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
499
391
|
});
|
|
500
392
|
}
|
|
501
393
|
async setBridgedDeviceReachability(reachable) {
|
|
502
|
-
// await this.setAttribute(BridgedDeviceBasicInformationCluster.id, 'reachable', reachable, this.log);
|
|
503
|
-
// await this.triggerEvent(BridgedDeviceBasicInformationCluster.id, 'reachableChanged', { reachableNewValue: reachable }, this.log);
|
|
504
394
|
}
|
|
505
395
|
hasClusterServer(cluster) {
|
|
506
396
|
return this.clusterServers.has(cluster.id);
|
|
@@ -518,16 +408,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
518
408
|
return this.clusterServers.get(clusterId);
|
|
519
409
|
}
|
|
520
410
|
addTagList(endpoint, mfgCode, namespaceId, tag, label) {
|
|
521
|
-
// Do nothing here only for old api compatibility
|
|
522
411
|
}
|
|
523
412
|
addClusterServer(cluster) {
|
|
524
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
525
413
|
const options = {};
|
|
526
414
|
for (const attribute of Object.values(cluster.attributes)) {
|
|
527
|
-
// console.error('Attribute:', (attribute as any).id, (attribute as any).name, (attribute as any).value);
|
|
528
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
529
415
|
if (attribute.id < 0xfff0) {
|
|
530
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
531
416
|
options[attribute.name] = attribute.value;
|
|
532
417
|
}
|
|
533
418
|
}
|
|
@@ -561,24 +446,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
561
446
|
if (cluster.id === ThermostatCluster.id && cluster.isAttributeSupportedByName('minSetpointDeadBand'))
|
|
562
447
|
this.subType = 'AutoModeThermostat';
|
|
563
448
|
const behavior = MatterbridgeEndpoint.getBehaviourTypeFromClusterServerId(cluster.id, this.subType);
|
|
564
|
-
/*
|
|
565
|
-
if (cluster.id === PowerTopologyCluster.id && this.clusterServers.has(cluster.id)) return; // TODO remove this workaround
|
|
566
|
-
if (cluster.id === ElectricalPowerMeasurementCluster.id && this.clusterServers.has(cluster.id)) return; // TODO remove this workaround
|
|
567
|
-
if (cluster.id === ElectricalEnergyMeasurementCluster.id && this.clusterServers.has(cluster.id)) return; // TODO remove this workaround
|
|
568
|
-
if (cluster.id === ThermostatCluster.id && this.clusterServers.has(cluster.id)) return; // TODO remove this workaround
|
|
569
|
-
*/
|
|
570
449
|
this.clusterServers.set(cluster.id, cluster);
|
|
571
450
|
if (cluster.id === BasicInformationCluster.id)
|
|
572
|
-
return;
|
|
451
|
+
return;
|
|
573
452
|
this.behaviors.require(behavior, options);
|
|
574
453
|
}
|
|
575
|
-
/**
|
|
576
|
-
* Adds cluster servers to the specified endpoint based on the provided server list.
|
|
577
|
-
*
|
|
578
|
-
* @param {Endpoint} endpoint - The endpoint to add cluster servers to.
|
|
579
|
-
* @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
|
|
580
|
-
* @returns void
|
|
581
|
-
*/
|
|
582
454
|
addClusterServerFromList(endpoint, includeServerList) {
|
|
583
455
|
if (includeServerList.includes(Identify.Cluster.id))
|
|
584
456
|
endpoint.addClusterServer(this.getDefaultIdentifyClusterServer());
|
|
@@ -648,8 +520,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
648
520
|
endpoint.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer());
|
|
649
521
|
if (includeServerList.includes(TotalVolatileOrganicCompoundsConcentrationMeasurement.Cluster.id))
|
|
650
522
|
endpoint.addClusterServer(this.getDefaultTvocMeasurementClusterServer());
|
|
651
|
-
// if (includeServerList.includes(DeviceEnergyManagement.Cluster.id)) endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementClusterServer());
|
|
652
|
-
// if (includeServerList.includes(DeviceEnergyManagementMode.Cluster.id)) endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementModeClusterServer());
|
|
653
523
|
}
|
|
654
524
|
async addFixedLabel(label, value) {
|
|
655
525
|
if (!this.clusterServers.get(FixedLabelCluster.id)) {
|
|
@@ -660,7 +530,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
660
530
|
return;
|
|
661
531
|
}
|
|
662
532
|
this.log.debug(`addFixedLabel: add label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
|
|
663
|
-
// if (this.construction.status !== Lifecycle.Status.Active) await this.construction.ready;
|
|
664
533
|
const labelList = (this.getAttribute(FixedLabelCluster.id, 'labelList', this.log) ?? []).filter((entryLabel) => entryLabel.label !== label);
|
|
665
534
|
labelList.push({ label, value });
|
|
666
535
|
await this.setAttribute(FixedLabelCluster.id, 'labelList', labelList, this.log);
|
|
@@ -674,7 +543,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
674
543
|
return;
|
|
675
544
|
}
|
|
676
545
|
this.log.debug(`addUserLabel: add label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
|
|
677
|
-
// if (this.construction.status !== Lifecycle.Status.Active) await this.construction.ready;
|
|
678
546
|
const labelList = (this.getAttribute(UserLabelCluster.id, 'labelList', this.log) ?? []).filter((entryLabel) => entryLabel.label !== label);
|
|
679
547
|
labelList.push({ label, value });
|
|
680
548
|
await this.setAttribute(UserLabelCluster.id, 'labelList', labelList, this.log);
|
|
@@ -689,16 +557,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
689
557
|
return name;
|
|
690
558
|
return name.charAt(0).toLowerCase() + name.slice(1);
|
|
691
559
|
}
|
|
692
|
-
/**
|
|
693
|
-
* Retrieves the value of the specified attribute from the given endpoint and cluster.
|
|
694
|
-
*
|
|
695
|
-
* @param {ClusterId} clusterId - The ID of the cluster to retrieve the attribute from.
|
|
696
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
697
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
698
|
-
* @param {MatterbridgeEndpoint} [endpoint] - Optional the child endpoint to retrieve the attribute from.
|
|
699
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
700
|
-
*/
|
|
701
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
702
560
|
getAttribute(clusterId, attribute, log, endpoint) {
|
|
703
561
|
if (!endpoint)
|
|
704
562
|
endpoint = this;
|
|
@@ -707,7 +565,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
707
565
|
this.log.error(`getAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
708
566
|
return undefined;
|
|
709
567
|
}
|
|
710
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
711
568
|
const state = endpoint.state;
|
|
712
569
|
if (!(clusterName in state)) {
|
|
713
570
|
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}`);
|
|
@@ -722,27 +579,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
722
579
|
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}`);
|
|
723
580
|
return value;
|
|
724
581
|
}
|
|
725
|
-
/**
|
|
726
|
-
* Sets the value of an attribute on a cluster server endpoint.
|
|
727
|
-
*
|
|
728
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
729
|
-
* @param {string} attribute - The name of the attribute.
|
|
730
|
-
* @param {any} value - The value to set for the attribute.
|
|
731
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
732
|
-
* @param {MatterbridgeEndpoint} [endpoint] - (Optional) The endpoint to set the attribute on. If not provided, the attribute will be set on the current endpoint.
|
|
733
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
734
|
-
*/
|
|
735
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
736
582
|
async setAttribute(clusterId, attribute, value, log, endpoint) {
|
|
737
583
|
if (!endpoint)
|
|
738
584
|
endpoint = this;
|
|
739
585
|
const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
740
586
|
if (endpoint.construction.status !== Lifecycle.Status.Active) {
|
|
741
587
|
this.log.error(`setAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
742
|
-
// await endpoint.construction.ready;
|
|
743
588
|
return false;
|
|
744
589
|
}
|
|
745
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
746
590
|
const state = endpoint.state;
|
|
747
591
|
if (!(clusterName in state)) {
|
|
748
592
|
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}`);
|
|
@@ -757,32 +601,18 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
757
601
|
if (typeof oldValue === 'object')
|
|
758
602
|
oldValue = deepCopy(oldValue);
|
|
759
603
|
await endpoint.setStateOf(endpoint.behaviors.supported[clusterName], { [attribute]: value });
|
|
760
|
-
// await endpoint.set({ [clusterName]: { [attribute]: value } });
|
|
761
604
|
log?.info(`${db}Set endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${this.capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db} ` +
|
|
762
605
|
`from ${YELLOW}${typeof oldValue === 'object' ? debugStringify(oldValue) : oldValue}${db} ` +
|
|
763
606
|
`to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
764
607
|
return true;
|
|
765
608
|
}
|
|
766
|
-
/**
|
|
767
|
-
* Subscribes to an attribute on a cluster.
|
|
768
|
-
*
|
|
769
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
770
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
771
|
-
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
772
|
-
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
773
|
-
* @param {MatterbridgeEndpoint} [endpoint] - Optional endpoint to subscribe the attribute on. Defaults to the current endpoint.
|
|
774
|
-
* @returns {boolean} - A boolean indicating whether the subscription was successful.
|
|
775
|
-
*/
|
|
776
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
777
609
|
async subscribeAttribute(clusterId, attribute, listener, log, endpoint) {
|
|
778
610
|
if (!endpoint)
|
|
779
611
|
endpoint = this;
|
|
780
612
|
const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
781
613
|
if (endpoint.construction.status !== Lifecycle.Status.Active) {
|
|
782
|
-
// this.log.error(`subscribeAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
783
614
|
await endpoint.construction.ready;
|
|
784
615
|
}
|
|
785
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
786
616
|
const events = endpoint.events;
|
|
787
617
|
if (!(clusterName in events)) {
|
|
788
618
|
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}`);
|
|
@@ -797,120 +627,31 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
797
627
|
log?.info(`${db}Subscribe endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${this.capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
|
|
798
628
|
return true;
|
|
799
629
|
}
|
|
800
|
-
/**
|
|
801
|
-
* Triggers an event on the specified cluster.
|
|
802
|
-
*
|
|
803
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
804
|
-
* @param {string} event - The name of the event to trigger.
|
|
805
|
-
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
806
|
-
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
807
|
-
* @param {MatterbridgeEndpoint} [endpoint] - Optional endpoint to trigger the event on. Defaults to the current endpoint.
|
|
808
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
809
|
-
*/
|
|
810
630
|
async triggerEvent(clusterId, event, payload, log, endpoint) {
|
|
811
631
|
if (!endpoint)
|
|
812
632
|
endpoint = this;
|
|
813
633
|
const clusterName = this.lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
814
634
|
if (endpoint.construction.status !== Lifecycle.Status.Active) {
|
|
815
|
-
// this.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${endpoint.id}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
816
635
|
await endpoint.construction.ready;
|
|
817
|
-
// return false;
|
|
818
636
|
}
|
|
819
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
820
637
|
const events = endpoint.events;
|
|
821
638
|
if (!(clusterName in events) || !(event in events[clusterName])) {
|
|
822
639
|
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}`);
|
|
823
640
|
return false;
|
|
824
641
|
}
|
|
825
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
826
|
-
// @ts-ignore
|
|
827
642
|
await endpoint.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
|
|
828
643
|
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} `);
|
|
829
644
|
return true;
|
|
830
645
|
}
|
|
831
|
-
/**
|
|
832
|
-
* Adds a command handler for the specified command.
|
|
833
|
-
*
|
|
834
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
835
|
-
* @param {(data: any) => void} handler - The handler function to execute when the command is received.
|
|
836
|
-
* @returns {void}
|
|
837
|
-
*/
|
|
838
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
839
646
|
addCommandHandler(command, handler) {
|
|
840
647
|
this.commandHandler.addHandler(command, handler);
|
|
841
648
|
}
|
|
842
|
-
/**
|
|
843
|
-
* Serializes the Matterbridge device into a serialized object.
|
|
844
|
-
*
|
|
845
|
-
* @param pluginName - The name of the plugin.
|
|
846
|
-
* @returns The serialized Matterbridge device object.
|
|
847
|
-
*/
|
|
848
649
|
serialize() {
|
|
849
650
|
return undefined;
|
|
850
|
-
|
|
851
|
-
if (!this.serialNumber || !this.deviceName || !this.uniqueId) return;
|
|
852
|
-
const cluster = this.getClusterServer(BasicInformationCluster) ?? this.getClusterServer(BridgedDeviceBasicInformationCluster);
|
|
853
|
-
if (!cluster) return;
|
|
854
|
-
const serialized: SerializedMatterbridgeDevice = {
|
|
855
|
-
pluginName: this.plugin ?? 'Unknown',
|
|
856
|
-
serialNumber: this.serialNumber,
|
|
857
|
-
deviceName: this.deviceName,
|
|
858
|
-
uniqueId: this.uniqueId,
|
|
859
|
-
productName: cluster.attributes.productName?.getLocal(),
|
|
860
|
-
vendorId: cluster.attributes.vendorId?.getLocal(),
|
|
861
|
-
vendorName: cluster.attributes.vendorName?.getLocal(),
|
|
862
|
-
deviceTypes: Array.from(this.deviceTypes.values()),
|
|
863
|
-
endpoint: this.number,
|
|
864
|
-
endpointName: this.id,
|
|
865
|
-
clusterServersId: [],
|
|
866
|
-
};
|
|
867
|
-
this.getAllClusterServers().forEach((clusterServer) => {
|
|
868
|
-
serialized.clusterServersId.push(clusterServer.id);
|
|
869
|
-
});
|
|
870
|
-
return serialized;
|
|
871
|
-
*/
|
|
872
|
-
}
|
|
873
|
-
/**
|
|
874
|
-
* Deserializes the device into a serialized object.
|
|
875
|
-
*
|
|
876
|
-
* @returns The deserialized MatterbridgeDevice.
|
|
877
|
-
*/
|
|
651
|
+
}
|
|
878
652
|
static deserialize(serializedDevice) {
|
|
879
653
|
return undefined;
|
|
880
|
-
|
|
881
|
-
const device = new MatterbridgeDevice(serializedDevice.deviceTypes);
|
|
882
|
-
device.serialNumber = serializedDevice.serialNumber;
|
|
883
|
-
device.deviceName = serializedDevice.deviceName;
|
|
884
|
-
device.uniqueId = serializedDevice.uniqueId;
|
|
885
|
-
for (const clusterId of serializedDevice.clusterServersId) {
|
|
886
|
-
if (clusterId === BasicInformationCluster.id)
|
|
887
|
-
device.createDefaultBasicInformationClusterServer(
|
|
888
|
-
serializedDevice.deviceName,
|
|
889
|
-
serializedDevice.serialNumber,
|
|
890
|
-
serializedDevice.vendorId ?? 0xfff1,
|
|
891
|
-
serializedDevice.vendorName ?? 'Matterbridge',
|
|
892
|
-
serializedDevice.productId ?? 0x8000,
|
|
893
|
-
serializedDevice.productName ?? 'Matterbridge device',
|
|
894
|
-
);
|
|
895
|
-
else if (clusterId === BridgedDeviceBasicInformationCluster.id)
|
|
896
|
-
device.createDefaultBridgedDeviceBasicInformationClusterServer(
|
|
897
|
-
serializedDevice.deviceName,
|
|
898
|
-
serializedDevice.serialNumber,
|
|
899
|
-
serializedDevice.vendorId ?? 0xfff1,
|
|
900
|
-
serializedDevice.vendorName ?? 'Matterbridge',
|
|
901
|
-
serializedDevice.productName ?? 'Matterbridge device',
|
|
902
|
-
);
|
|
903
|
-
else device.addClusterServerFromList(device, [clusterId]);
|
|
904
|
-
}
|
|
905
|
-
return device;
|
|
906
|
-
*/
|
|
907
|
-
}
|
|
908
|
-
/**
|
|
909
|
-
* From here copy paste from MatterbridgeDevice
|
|
910
|
-
*/
|
|
911
|
-
/**
|
|
912
|
-
* Get a default IdentifyCluster server.
|
|
913
|
-
*/
|
|
654
|
+
}
|
|
914
655
|
getDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
915
656
|
return ClusterServer(IdentifyCluster, {
|
|
916
657
|
identifyTime,
|
|
@@ -926,88 +667,28 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
926
667
|
},
|
|
927
668
|
});
|
|
928
669
|
}
|
|
929
|
-
/**
|
|
930
|
-
* Creates a default IdentifyCluster server.
|
|
931
|
-
*/
|
|
932
670
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
933
671
|
this.addClusterServer(this.getDefaultIdentifyClusterServer(identifyTime, identifyType));
|
|
934
672
|
}
|
|
935
|
-
/**
|
|
936
|
-
* Get a default IdentifyCluster server.
|
|
937
|
-
*/
|
|
938
673
|
getDefaultGroupsClusterServer() {
|
|
939
674
|
return ClusterServer(GroupsCluster, {
|
|
940
675
|
nameSupport: {
|
|
941
676
|
nameSupport: true,
|
|
942
677
|
},
|
|
943
678
|
}, GroupsClusterHandler());
|
|
944
|
-
// return createDefaultGroupsClusterServer();
|
|
945
679
|
}
|
|
946
|
-
/**
|
|
947
|
-
* Creates a default groups cluster server and adds it to the device.
|
|
948
|
-
*/
|
|
949
680
|
createDefaultGroupsClusterServer() {
|
|
950
681
|
this.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
951
682
|
}
|
|
952
|
-
/**
|
|
953
|
-
* Get a default scenes cluster server and adds it to the current instance.
|
|
954
|
-
* @deprecated This method is deprecated.
|
|
955
|
-
*
|
|
956
|
-
*/
|
|
957
683
|
getDefaultScenesClusterServer() {
|
|
958
|
-
|
|
959
|
-
return ClusterServer(
|
|
960
|
-
ScenesCluster,
|
|
961
|
-
{
|
|
962
|
-
sceneCount: 0,
|
|
963
|
-
currentScene: 0,
|
|
964
|
-
currentGroup: GroupId(0),
|
|
965
|
-
sceneValid: false,
|
|
966
|
-
nameSupport: {
|
|
967
|
-
nameSupport: true,
|
|
968
|
-
},
|
|
969
|
-
lastConfiguredBy: null,
|
|
970
|
-
},
|
|
971
|
-
{},
|
|
972
|
-
);
|
|
973
|
-
*/
|
|
974
|
-
}
|
|
975
|
-
/**
|
|
976
|
-
* Creates a default scenes cluster server and adds it to the current instance.
|
|
977
|
-
* @deprecated This method is deprecated.
|
|
978
|
-
*/
|
|
684
|
+
}
|
|
979
685
|
createDefaultScenesClusterServer() {
|
|
980
|
-
|
|
981
|
-
this.addClusterServer(this.getDefaultScenesClusterServer());
|
|
982
|
-
*/
|
|
983
|
-
}
|
|
984
|
-
/**
|
|
985
|
-
* Creates a unique identifier based on the provided parameters.
|
|
986
|
-
* @param param1 - The first parameter.
|
|
987
|
-
* @param param2 - The second parameter.
|
|
988
|
-
* @param param3 - The third parameter.
|
|
989
|
-
* @param param4 - The fourth parameter.
|
|
990
|
-
* @returns A unique identifier generated using the MD5 hash algorithm.
|
|
991
|
-
*/
|
|
686
|
+
}
|
|
992
687
|
createUniqueId(param1, param2, param3, param4) {
|
|
993
688
|
const hash = createHash('md5');
|
|
994
689
|
hash.update(param1 + param2 + param3 + param4);
|
|
995
690
|
return hash.digest('hex');
|
|
996
691
|
}
|
|
997
|
-
/**
|
|
998
|
-
* Get a default Basic Information Cluster Server.
|
|
999
|
-
*
|
|
1000
|
-
* @param deviceName - The name of the device.
|
|
1001
|
-
* @param serialNumber - The serial number of the device.
|
|
1002
|
-
* @param vendorId - The vendor ID of the device.
|
|
1003
|
-
* @param vendorName - The vendor name of the device.
|
|
1004
|
-
* @param productId - The product ID of the device.
|
|
1005
|
-
* @param productName - The product name of the device.
|
|
1006
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
1007
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
1008
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
1009
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
1010
|
-
*/
|
|
1011
692
|
getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
1012
693
|
this.log.logName = deviceName;
|
|
1013
694
|
this.deviceName = deviceName;
|
|
@@ -1048,20 +729,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1048
729
|
reachableChanged: true,
|
|
1049
730
|
});
|
|
1050
731
|
}
|
|
1051
|
-
/**
|
|
1052
|
-
* Creates a default Basic Information Cluster Server.
|
|
1053
|
-
*
|
|
1054
|
-
* @param deviceName - The name of the device.
|
|
1055
|
-
* @param serialNumber - The serial number of the device.
|
|
1056
|
-
* @param vendorId - The vendor ID of the device.
|
|
1057
|
-
* @param vendorName - The vendor name of the device.
|
|
1058
|
-
* @param productId - The product ID of the device.
|
|
1059
|
-
* @param productName - The product name of the device.
|
|
1060
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
1061
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
1062
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
1063
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
1064
|
-
*/
|
|
1065
732
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
1066
733
|
if (MatterbridgeEndpoint.bridgeMode === 'bridge') {
|
|
1067
734
|
this.addDeviceType(bridgedNode);
|
|
@@ -1070,19 +737,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1070
737
|
}
|
|
1071
738
|
this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
1072
739
|
}
|
|
1073
|
-
/**
|
|
1074
|
-
* Get a default BridgedDeviceBasicInformationClusterServer.
|
|
1075
|
-
*
|
|
1076
|
-
* @param deviceName - The name of the device.
|
|
1077
|
-
* @param serialNumber - The serial number of the device.
|
|
1078
|
-
* @param vendorId - The vendor ID of the device.
|
|
1079
|
-
* @param vendorName - The name of the vendor.
|
|
1080
|
-
* @param productName - The name of the product.
|
|
1081
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
1082
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
1083
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
1084
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
1085
|
-
*/
|
|
1086
740
|
getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
1087
741
|
this.log.logName = deviceName;
|
|
1088
742
|
this.deviceName = deviceName;
|
|
@@ -1097,7 +751,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1097
751
|
this.hardwareVersion = hardwareVersion;
|
|
1098
752
|
this.hardwareVersionString = hardwareVersionString;
|
|
1099
753
|
return ClusterServer(BridgedDeviceBasicInformationCluster, {
|
|
1100
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
754
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
1101
755
|
vendorName: vendorName.slice(0, 32),
|
|
1102
756
|
productName: productName.slice(0, 32),
|
|
1103
757
|
productUrl: 'https://www.npmjs.com/package/matterbridge',
|
|
@@ -1117,36 +771,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1117
771
|
reachableChanged: true,
|
|
1118
772
|
});
|
|
1119
773
|
}
|
|
1120
|
-
/**
|
|
1121
|
-
* Creates a default BridgedDeviceBasicInformationClusterServer.
|
|
1122
|
-
*
|
|
1123
|
-
* @param deviceName - The name of the device.
|
|
1124
|
-
* @param serialNumber - The serial number of the device.
|
|
1125
|
-
* @param vendorId - The vendor ID of the device.
|
|
1126
|
-
* @param vendorName - The name of the vendor.
|
|
1127
|
-
* @param productName - The name of the product.
|
|
1128
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
1129
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
1130
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
1131
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
1132
|
-
*/
|
|
1133
774
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
1134
775
|
this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
1135
776
|
}
|
|
1136
|
-
/**
|
|
1137
|
-
* Get a default Power Topology Cluster Server. Only needed for an electricalSensor device type.
|
|
1138
|
-
*
|
|
1139
|
-
* @returns {ClusterServer} - The configured Power Topology Cluster Server.
|
|
1140
|
-
*/
|
|
1141
777
|
getDefaultPowerTopologyClusterServer() {
|
|
1142
778
|
return ClusterServer(PowerTopologyCluster.with(PowerTopology.Feature.TreeTopology), {}, {}, {});
|
|
1143
779
|
}
|
|
1144
|
-
/**
|
|
1145
|
-
* Get a default Electrical Energy Measurement Cluster Server.
|
|
1146
|
-
*
|
|
1147
|
-
* @param {number} energy - The total consumption value in mW/h.
|
|
1148
|
-
* @returns {ClusterServer} - The configured Electrical Energy Measurement Cluster Server.
|
|
1149
|
-
*/
|
|
1150
780
|
getDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
1151
781
|
return ClusterServer(ElectricalEnergyMeasurementCluster.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1152
782
|
accuracy: {
|
|
@@ -1163,15 +793,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1163
793
|
cumulativeEnergyMeasured: true,
|
|
1164
794
|
});
|
|
1165
795
|
}
|
|
1166
|
-
/**
|
|
1167
|
-
* Get a default Electrical Power Measurement Cluster Server.
|
|
1168
|
-
*
|
|
1169
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
1170
|
-
* @param {number} current - The current value in milliamperes.
|
|
1171
|
-
* @param {number} power - The power value in milliwatts.
|
|
1172
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
1173
|
-
* @returns {ClusterServer} - The configured Electrical Power Measurement Cluster Server.
|
|
1174
|
-
*/
|
|
1175
796
|
getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1176
797
|
return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1177
798
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1212,16 +833,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1212
833
|
frequency: frequency,
|
|
1213
834
|
}, {}, {});
|
|
1214
835
|
}
|
|
1215
|
-
/**
|
|
1216
|
-
* Get a default OnOff cluster server.
|
|
1217
|
-
*
|
|
1218
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1219
|
-
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
1220
|
-
* @param {number} [onTime=0] - The on time value.
|
|
1221
|
-
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
1222
|
-
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
1223
|
-
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
1224
|
-
*/
|
|
1225
836
|
getDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
1226
837
|
return ClusterServer(OnOffCluster.with(OnOff.Feature.Lighting), {
|
|
1227
838
|
onOff,
|
|
@@ -1231,47 +842,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1231
842
|
startUpOnOff,
|
|
1232
843
|
}, {
|
|
1233
844
|
on: async (data) => {
|
|
1234
|
-
// Never called in edge
|
|
1235
845
|
},
|
|
1236
846
|
off: async (data) => {
|
|
1237
|
-
// Never called in edge
|
|
1238
847
|
},
|
|
1239
848
|
toggle: async (data) => {
|
|
1240
|
-
// Never called in edge
|
|
1241
849
|
},
|
|
1242
850
|
offWithEffect: async () => {
|
|
1243
|
-
// Never called in edge
|
|
1244
851
|
},
|
|
1245
852
|
onWithRecallGlobalScene: async () => {
|
|
1246
|
-
// Never called in edge
|
|
1247
853
|
},
|
|
1248
854
|
onWithTimedOff: async () => {
|
|
1249
|
-
// Never called in edge
|
|
1250
855
|
},
|
|
1251
856
|
}, {});
|
|
1252
857
|
}
|
|
1253
|
-
/**
|
|
1254
|
-
* Creates a default OnOff cluster server.
|
|
1255
|
-
*
|
|
1256
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1257
|
-
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
1258
|
-
* @param {number} [onTime=0] - The on time value.
|
|
1259
|
-
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
1260
|
-
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
1261
|
-
* @returns {void}
|
|
1262
|
-
*/
|
|
1263
858
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
1264
859
|
this.addClusterServer(this.getDefaultOnOffClusterServer(onOff, globalSceneControl, onTime, offWaitTime, startUpOnOff));
|
|
1265
860
|
}
|
|
1266
|
-
/**
|
|
1267
|
-
* Get a default level control cluster server.
|
|
1268
|
-
*
|
|
1269
|
-
* @param currentLevel - The current level (default: 254).
|
|
1270
|
-
* @param minLevel - The minimum level (default: 1).
|
|
1271
|
-
* @param maxLevel - The maximum level (default: 254).
|
|
1272
|
-
* @param onLevel - The on level (default: null).
|
|
1273
|
-
* @param startUpCurrentLevel - The startUp on level (default: null).
|
|
1274
|
-
*/
|
|
1275
861
|
getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
1276
862
|
return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
1277
863
|
currentLevel,
|
|
@@ -1286,54 +872,26 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1286
872
|
},
|
|
1287
873
|
}, {
|
|
1288
874
|
moveToLevel: async (data) => {
|
|
1289
|
-
// Never called in edge
|
|
1290
875
|
},
|
|
1291
876
|
move: async () => {
|
|
1292
|
-
// Never called in edge
|
|
1293
877
|
},
|
|
1294
878
|
step: async () => {
|
|
1295
|
-
// Never called in edge
|
|
1296
879
|
},
|
|
1297
880
|
stop: async () => {
|
|
1298
|
-
// Never called in edge
|
|
1299
881
|
},
|
|
1300
882
|
moveToLevelWithOnOff: async (data) => {
|
|
1301
|
-
// Never called in edge
|
|
1302
883
|
},
|
|
1303
884
|
moveWithOnOff: async () => {
|
|
1304
|
-
// Never called in edge
|
|
1305
885
|
},
|
|
1306
886
|
stepWithOnOff: async () => {
|
|
1307
|
-
// Never called in edge
|
|
1308
887
|
},
|
|
1309
888
|
stopWithOnOff: async () => {
|
|
1310
|
-
// Never called in edge
|
|
1311
889
|
},
|
|
1312
890
|
});
|
|
1313
891
|
}
|
|
1314
|
-
/**
|
|
1315
|
-
* Creates a default level control cluster server.
|
|
1316
|
-
*
|
|
1317
|
-
* @param currentLevel - The current level (default: 254).
|
|
1318
|
-
* @param minLevel - The minimum level (default: 1).
|
|
1319
|
-
* @param maxLevel - The maximum level (default: 254).
|
|
1320
|
-
* @param onLevel - The on level (default: null).
|
|
1321
|
-
* @param startUpCurrentLevel - The startUp on level (default: null).
|
|
1322
|
-
*/
|
|
1323
892
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
1324
893
|
this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel, startUpCurrentLevel));
|
|
1325
894
|
}
|
|
1326
|
-
/**
|
|
1327
|
-
* Get a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
1328
|
-
*
|
|
1329
|
-
* @param currentX - The current X value.
|
|
1330
|
-
* @param currentY - The current Y value.
|
|
1331
|
-
* @param currentHue - The current hue value.
|
|
1332
|
-
* @param currentSaturation - The current saturation value.
|
|
1333
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1334
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1335
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1336
|
-
*/
|
|
1337
895
|
getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1338
896
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1339
897
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1355,72 +913,38 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1355
913
|
startUpColorTemperatureMireds: null,
|
|
1356
914
|
}, {
|
|
1357
915
|
moveToColor: async (data) => {
|
|
1358
|
-
// Never called in edge
|
|
1359
916
|
},
|
|
1360
917
|
moveColor: async () => {
|
|
1361
|
-
// Never called in edge
|
|
1362
918
|
},
|
|
1363
919
|
stepColor: async () => {
|
|
1364
|
-
// Never called in edge
|
|
1365
920
|
},
|
|
1366
921
|
moveToHue: async (data) => {
|
|
1367
|
-
// Never called in edge
|
|
1368
922
|
},
|
|
1369
923
|
moveHue: async () => {
|
|
1370
|
-
// Never called in edge
|
|
1371
924
|
},
|
|
1372
925
|
stepHue: async () => {
|
|
1373
|
-
// Never called in edge
|
|
1374
926
|
},
|
|
1375
927
|
moveToSaturation: async (data) => {
|
|
1376
|
-
// Never called in edge
|
|
1377
928
|
},
|
|
1378
929
|
moveSaturation: async () => {
|
|
1379
|
-
// Never called in edge
|
|
1380
930
|
},
|
|
1381
931
|
stepSaturation: async () => {
|
|
1382
|
-
// Never called in edge
|
|
1383
932
|
},
|
|
1384
933
|
moveToHueAndSaturation: async (data) => {
|
|
1385
|
-
// Never called in edge
|
|
1386
934
|
},
|
|
1387
935
|
stopMoveStep: async () => {
|
|
1388
|
-
// Never called in edge
|
|
1389
936
|
},
|
|
1390
937
|
moveToColorTemperature: async (data) => {
|
|
1391
|
-
// Never called in edge
|
|
1392
938
|
},
|
|
1393
939
|
moveColorTemperature: async () => {
|
|
1394
|
-
// Never called in edge
|
|
1395
940
|
},
|
|
1396
941
|
stepColorTemperature: async () => {
|
|
1397
|
-
// Never called in edge
|
|
1398
942
|
},
|
|
1399
943
|
}, {});
|
|
1400
944
|
}
|
|
1401
|
-
/**
|
|
1402
|
-
* Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
1403
|
-
*
|
|
1404
|
-
* @param currentX - The current X value.
|
|
1405
|
-
* @param currentY - The current Y value.
|
|
1406
|
-
* @param currentHue - The current hue value.
|
|
1407
|
-
* @param currentSaturation - The current saturation value.
|
|
1408
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1409
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1410
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1411
|
-
*/
|
|
1412
945
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1413
946
|
this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1414
947
|
}
|
|
1415
|
-
/**
|
|
1416
|
-
* Get a Xy color control cluster server with Xy and ColorTemperature.
|
|
1417
|
-
*
|
|
1418
|
-
* @param currentX - The current X value.
|
|
1419
|
-
* @param currentY - The current Y value.
|
|
1420
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1421
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1422
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1423
|
-
*/
|
|
1424
948
|
getXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1425
949
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
1426
950
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -1440,49 +964,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1440
964
|
remainingTime: 0,
|
|
1441
965
|
}, {
|
|
1442
966
|
moveToColor: async () => {
|
|
1443
|
-
// Never called in edge
|
|
1444
967
|
},
|
|
1445
968
|
moveColor: async () => {
|
|
1446
|
-
// Never called in edge
|
|
1447
969
|
},
|
|
1448
970
|
stepColor: async () => {
|
|
1449
|
-
// Never called in edge
|
|
1450
971
|
},
|
|
1451
972
|
stopMoveStep: async () => {
|
|
1452
|
-
// Never called in edge
|
|
1453
973
|
},
|
|
1454
974
|
moveToColorTemperature: async () => {
|
|
1455
|
-
// Never called in edge
|
|
1456
975
|
},
|
|
1457
976
|
moveColorTemperature: async () => {
|
|
1458
|
-
// Never called in edge
|
|
1459
977
|
},
|
|
1460
978
|
stepColorTemperature: async () => {
|
|
1461
|
-
// Never called in edge
|
|
1462
979
|
},
|
|
1463
980
|
}, {});
|
|
1464
981
|
}
|
|
1465
|
-
/**
|
|
1466
|
-
* Creates a Xy color control cluster server with Xy and ColorTemperature.
|
|
1467
|
-
*
|
|
1468
|
-
* @param currentX - The current X value.
|
|
1469
|
-
* @param currentY - The current Y value.
|
|
1470
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1471
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1472
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1473
|
-
*/
|
|
1474
982
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1475
983
|
this.addClusterServer(this.getXyColorControlClusterServer(currentX, currentY, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1476
984
|
}
|
|
1477
|
-
/**
|
|
1478
|
-
* Get a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
|
|
1479
|
-
*
|
|
1480
|
-
* @param currentHue - The current hue value.
|
|
1481
|
-
* @param currentSaturation - The current saturation value.
|
|
1482
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1483
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1484
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1485
|
-
*/
|
|
1486
985
|
getHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1487
986
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1488
987
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1502,59 +1001,32 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1502
1001
|
remainingTime: 0,
|
|
1503
1002
|
}, {
|
|
1504
1003
|
moveToHue: async () => {
|
|
1505
|
-
// Never called in edge
|
|
1506
1004
|
},
|
|
1507
1005
|
moveHue: async () => {
|
|
1508
|
-
// Never called in edge
|
|
1509
1006
|
},
|
|
1510
1007
|
stepHue: async () => {
|
|
1511
|
-
// Never called in edge
|
|
1512
1008
|
},
|
|
1513
1009
|
moveToSaturation: async () => {
|
|
1514
|
-
// Never called in edge
|
|
1515
1010
|
},
|
|
1516
1011
|
moveSaturation: async () => {
|
|
1517
|
-
// Never called in edge
|
|
1518
1012
|
},
|
|
1519
1013
|
stepSaturation: async () => {
|
|
1520
|
-
// Never called in edge
|
|
1521
1014
|
},
|
|
1522
1015
|
moveToHueAndSaturation: async () => {
|
|
1523
|
-
// Never called in edge
|
|
1524
1016
|
},
|
|
1525
1017
|
stopMoveStep: async () => {
|
|
1526
|
-
// Never called in edge
|
|
1527
1018
|
},
|
|
1528
1019
|
moveToColorTemperature: async () => {
|
|
1529
|
-
// Never called in edge
|
|
1530
1020
|
},
|
|
1531
1021
|
moveColorTemperature: async () => {
|
|
1532
|
-
// Never called in edge
|
|
1533
1022
|
},
|
|
1534
1023
|
stepColorTemperature: async () => {
|
|
1535
|
-
// Never called in edge
|
|
1536
1024
|
},
|
|
1537
1025
|
}, {});
|
|
1538
1026
|
}
|
|
1539
|
-
/**
|
|
1540
|
-
* Creates a hue and saturation color control cluster server with HueSaturation and ColorTemperature.
|
|
1541
|
-
*
|
|
1542
|
-
* @param currentHue - The current hue value.
|
|
1543
|
-
* @param currentSaturation - The current saturation value.
|
|
1544
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1545
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1546
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1547
|
-
*/
|
|
1548
1027
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1549
1028
|
this.addClusterServer(this.getHsColorControlClusterServer(currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1550
1029
|
}
|
|
1551
|
-
/**
|
|
1552
|
-
* Get a color temperature color control cluster server.
|
|
1553
|
-
*
|
|
1554
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1555
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1556
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1557
|
-
*/
|
|
1558
1030
|
getCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1559
1031
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.ColorTemperature), {
|
|
1560
1032
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1572,44 +1044,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1572
1044
|
startUpColorTemperatureMireds: null,
|
|
1573
1045
|
}, {
|
|
1574
1046
|
stopMoveStep: async () => {
|
|
1575
|
-
// Never called in edge
|
|
1576
1047
|
},
|
|
1577
1048
|
moveToColorTemperature: async () => {
|
|
1578
|
-
// Never called in edge
|
|
1579
1049
|
},
|
|
1580
1050
|
moveColorTemperature: async () => {
|
|
1581
|
-
// Never called in edge
|
|
1582
1051
|
},
|
|
1583
1052
|
stepColorTemperature: async () => {
|
|
1584
|
-
// Never called in edge
|
|
1585
1053
|
},
|
|
1586
1054
|
}, {});
|
|
1587
1055
|
}
|
|
1588
|
-
/**
|
|
1589
|
-
* Creates a color temperature color control cluster server.
|
|
1590
|
-
*
|
|
1591
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1592
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1593
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1594
|
-
*/
|
|
1595
1056
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1596
1057
|
this.addClusterServer(this.getCtColorControlClusterServer(colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1597
1058
|
}
|
|
1598
1059
|
isColorControlConfigured = false;
|
|
1599
|
-
/**
|
|
1600
|
-
* Configures the color control cluster for a device.
|
|
1601
|
-
*
|
|
1602
|
-
* @remark This method must be called only after creating the cluster with getDefaultColorControlClusterServer or createDefaultColorControlClusterServer
|
|
1603
|
-
* and before starting the matter node.
|
|
1604
|
-
*
|
|
1605
|
-
* @deprecated Use configureColorControlMode instead.
|
|
1606
|
-
*
|
|
1607
|
-
* @param {boolean} hueSaturation - A boolean indicating whether the device supports hue and saturation control.
|
|
1608
|
-
* @param {boolean} xy - A boolean indicating whether the device supports XY control.
|
|
1609
|
-
* @param {boolean} colorTemperature - A boolean indicating whether the device supports color temperature control.
|
|
1610
|
-
* @param {ColorControl.ColorMode} colorMode - An optional parameter specifying the color mode of the device.
|
|
1611
|
-
* @param {Endpoint} endpoint - An optional parameter specifying the endpoint to configure. If not provided, the device endpoint will be used.
|
|
1612
|
-
*/
|
|
1613
1060
|
async configureColorControlCluster(hueSaturation, xy, colorTemperature, colorMode, endpoint) {
|
|
1614
1061
|
if (!endpoint)
|
|
1615
1062
|
endpoint = this;
|
|
@@ -1632,12 +1079,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1632
1079
|
}
|
|
1633
1080
|
this.isColorControlConfigured = true;
|
|
1634
1081
|
}
|
|
1635
|
-
/**
|
|
1636
|
-
* Configures the color control mode for the device.
|
|
1637
|
-
*
|
|
1638
|
-
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1639
|
-
* @param {Endpoint} endpoint - The optional endpoint to configure. If not provided, the method will configure the current endpoint.
|
|
1640
|
-
*/
|
|
1641
1082
|
async configureColorControlMode(colorMode, endpoint) {
|
|
1642
1083
|
if (!endpoint)
|
|
1643
1084
|
endpoint = this;
|
|
@@ -1646,11 +1087,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1646
1087
|
await endpoint.setAttribute(ColorControlCluster.id, 'enhancedColorMode', colorMode, this.log, endpoint);
|
|
1647
1088
|
}
|
|
1648
1089
|
}
|
|
1649
|
-
/**
|
|
1650
|
-
* Get a default window covering cluster server.
|
|
1651
|
-
*
|
|
1652
|
-
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1653
|
-
*/
|
|
1654
1090
|
getDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1655
1091
|
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1656
1092
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
@@ -1666,39 +1102,26 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1666
1102
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1667
1103
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
1668
1104
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1669
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1670
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1105
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1106
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1671
1107
|
}, {
|
|
1672
1108
|
upOrOpen: async (data) => {
|
|
1673
|
-
// Never called in edge
|
|
1674
1109
|
},
|
|
1675
1110
|
downOrClose: async (data) => {
|
|
1676
|
-
// Never called in edge
|
|
1677
1111
|
},
|
|
1678
1112
|
stopMotion: async (data) => {
|
|
1679
|
-
// Never called in edge
|
|
1680
1113
|
},
|
|
1681
1114
|
goToLiftPercentage: async (data) => {
|
|
1682
|
-
// Never called in edge
|
|
1683
1115
|
},
|
|
1684
1116
|
}, {});
|
|
1685
1117
|
}
|
|
1686
|
-
/**
|
|
1687
|
-
* Creates a default window covering cluster server.
|
|
1688
|
-
*
|
|
1689
|
-
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1690
|
-
*/
|
|
1691
1118
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1692
1119
|
this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
|
|
1693
1120
|
}
|
|
1694
|
-
/**
|
|
1695
|
-
* Sets the window covering target position as the current position and stops the movement.
|
|
1696
|
-
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1697
|
-
*/
|
|
1698
1121
|
async setWindowCoveringTargetAsCurrentAndStopped(endpoint) {
|
|
1699
1122
|
if (!endpoint)
|
|
1700
1123
|
endpoint = this;
|
|
1701
|
-
const position = endpoint.getAttribute(WindowCoveringCluster.id, 'currentPositionLiftPercent100ths', this.log, endpoint);
|
|
1124
|
+
const position = endpoint.getAttribute(WindowCoveringCluster.id, 'currentPositionLiftPercent100ths', this.log, endpoint);
|
|
1702
1125
|
if (position !== null) {
|
|
1703
1126
|
await endpoint.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', position, this.log, endpoint);
|
|
1704
1127
|
await endpoint.setAttribute(WindowCoveringCluster.id, 'operationalStatus', {
|
|
@@ -1709,13 +1132,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1709
1132
|
}
|
|
1710
1133
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1711
1134
|
}
|
|
1712
|
-
/**
|
|
1713
|
-
* Sets the current and target status of a window covering.
|
|
1714
|
-
* @param {number} current - The current position of the window covering.
|
|
1715
|
-
* @param {number} target - The target position of the window covering.
|
|
1716
|
-
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1717
|
-
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1718
|
-
*/
|
|
1719
1135
|
async setWindowCoveringCurrentTargetStatus(current, target, status, endpoint) {
|
|
1720
1136
|
if (!endpoint)
|
|
1721
1137
|
endpoint = this;
|
|
@@ -1728,11 +1144,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1728
1144
|
}, this.log, endpoint);
|
|
1729
1145
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1730
1146
|
}
|
|
1731
|
-
/**
|
|
1732
|
-
* Sets the status of the window covering.
|
|
1733
|
-
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1734
|
-
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1735
|
-
*/
|
|
1736
1147
|
async setWindowCoveringStatus(status, endpoint) {
|
|
1737
1148
|
if (!endpoint)
|
|
1738
1149
|
endpoint = this;
|
|
@@ -1743,12 +1154,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1743
1154
|
}, this.log, endpoint);
|
|
1744
1155
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1745
1156
|
}
|
|
1746
|
-
/**
|
|
1747
|
-
* Retrieves the status of the window covering.
|
|
1748
|
-
* @param {Endpoint} endpoint - The endpoint on which to get the window covering (default the device endpoint).
|
|
1749
|
-
*
|
|
1750
|
-
* @returns The global operational status of the window covering.
|
|
1751
|
-
*/
|
|
1752
1157
|
getWindowCoveringStatus(endpoint) {
|
|
1753
1158
|
if (!endpoint)
|
|
1754
1159
|
endpoint = this;
|
|
@@ -1756,12 +1161,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1756
1161
|
this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
|
|
1757
1162
|
return status.global;
|
|
1758
1163
|
}
|
|
1759
|
-
/**
|
|
1760
|
-
* Sets the target and current position of the window covering.
|
|
1761
|
-
*
|
|
1762
|
-
* @param position - The position to set, specified as a number.
|
|
1763
|
-
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1764
|
-
*/
|
|
1765
1164
|
async setWindowCoveringTargetAndCurrentPosition(position, endpoint) {
|
|
1766
1165
|
if (!endpoint)
|
|
1767
1166
|
endpoint = this;
|
|
@@ -1769,13 +1168,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1769
1168
|
await endpoint.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', position, this.log, endpoint);
|
|
1770
1169
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
1771
1170
|
}
|
|
1772
|
-
/**
|
|
1773
|
-
* Get a default door lock cluster server.
|
|
1774
|
-
*
|
|
1775
|
-
* @remarks
|
|
1776
|
-
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1777
|
-
*
|
|
1778
|
-
*/
|
|
1779
1171
|
getDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1780
1172
|
return ClusterServer(DoorLockCluster, {
|
|
1781
1173
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
@@ -1785,10 +1177,8 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1785
1177
|
supportedOperatingModes: { normal: true, vacation: false, privacy: false, noRemoteLockUnlock: false, passage: false },
|
|
1786
1178
|
}, {
|
|
1787
1179
|
lockDoor: async (data) => {
|
|
1788
|
-
// Never called in edge
|
|
1789
1180
|
},
|
|
1790
1181
|
unlockDoor: async (data) => {
|
|
1791
|
-
// Never called in edge
|
|
1792
1182
|
},
|
|
1793
1183
|
}, {
|
|
1794
1184
|
doorLockAlarm: true,
|
|
@@ -1796,22 +1186,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1796
1186
|
lockOperationError: true,
|
|
1797
1187
|
});
|
|
1798
1188
|
}
|
|
1799
|
-
/**
|
|
1800
|
-
* Creates a default door lock cluster server.
|
|
1801
|
-
*
|
|
1802
|
-
* @remarks
|
|
1803
|
-
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1804
|
-
*
|
|
1805
|
-
*/
|
|
1806
1189
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1807
1190
|
this.addClusterServer(this.getDefaultDoorLockClusterServer(lockState, lockType));
|
|
1808
1191
|
}
|
|
1809
|
-
/**
|
|
1810
|
-
* Get a default momentary switch cluster server.
|
|
1811
|
-
*
|
|
1812
|
-
* @remarks
|
|
1813
|
-
* This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
|
|
1814
|
-
*/
|
|
1815
1192
|
getDefaultSwitchClusterServer() {
|
|
1816
1193
|
return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
|
|
1817
1194
|
numberOfPositions: 2,
|
|
@@ -1826,21 +1203,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1826
1203
|
multiPressComplete: true,
|
|
1827
1204
|
});
|
|
1828
1205
|
}
|
|
1829
|
-
/**
|
|
1830
|
-
* Creates a default momentary switch cluster server.
|
|
1831
|
-
*
|
|
1832
|
-
* @remarks
|
|
1833
|
-
* This method adds a cluster server with default momentary switch features and configurations.
|
|
1834
|
-
*/
|
|
1835
1206
|
createDefaultSwitchClusterServer() {
|
|
1836
1207
|
this.addClusterServer(this.getDefaultSwitchClusterServer());
|
|
1837
1208
|
}
|
|
1838
|
-
/**
|
|
1839
|
-
* Get a default latching switch cluster server.
|
|
1840
|
-
*
|
|
1841
|
-
* @remarks
|
|
1842
|
-
* This method adds a cluster server with default latching switch features and configuration.
|
|
1843
|
-
*/
|
|
1844
1209
|
getDefaultLatchingSwitchClusterServer() {
|
|
1845
1210
|
return ClusterServer(SwitchCluster.with(Switch.Feature.LatchingSwitch), {
|
|
1846
1211
|
numberOfPositions: 2,
|
|
@@ -1849,22 +1214,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1849
1214
|
switchLatched: true,
|
|
1850
1215
|
});
|
|
1851
1216
|
}
|
|
1852
|
-
/**
|
|
1853
|
-
* Creates a default latching switch cluster server.
|
|
1854
|
-
*
|
|
1855
|
-
* @remarks
|
|
1856
|
-
* This method adds a cluster server with default latching switch features and configuration.
|
|
1857
|
-
*/
|
|
1858
1217
|
createDefaultLatchingSwitchClusterServer() {
|
|
1859
1218
|
this.addClusterServer(this.getDefaultLatchingSwitchClusterServer());
|
|
1860
1219
|
}
|
|
1861
|
-
/**
|
|
1862
|
-
* Triggers a switch event on the specified endpoint.
|
|
1863
|
-
*
|
|
1864
|
-
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1865
|
-
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1866
|
-
* @returns {void}
|
|
1867
|
-
*/
|
|
1868
1220
|
async triggerSwitchEvent(event, log, endpoint) {
|
|
1869
1221
|
if (!endpoint)
|
|
1870
1222
|
endpoint = this;
|
|
@@ -1932,15 +1284,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1932
1284
|
}
|
|
1933
1285
|
return true;
|
|
1934
1286
|
}
|
|
1935
|
-
/**
|
|
1936
|
-
* Retrieves the default mode select cluster server.
|
|
1937
|
-
*
|
|
1938
|
-
* @param description - The description of the cluster server.
|
|
1939
|
-
* @param supportedModes - The supported modes for the cluster server.
|
|
1940
|
-
* @param currentMode - The current mode of the cluster server. Defaults to 0.
|
|
1941
|
-
* @param startUpMode - The startup mode of the cluster server. Defaults to 0.
|
|
1942
|
-
* @returns The default mode select cluster server.
|
|
1943
|
-
*/
|
|
1944
1287
|
getDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1945
1288
|
return ClusterServer(ModeSelectCluster, {
|
|
1946
1289
|
description: description,
|
|
@@ -1950,30 +1293,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1950
1293
|
startUpMode: startUpMode,
|
|
1951
1294
|
}, {
|
|
1952
1295
|
changeToMode: async (data) => {
|
|
1953
|
-
// Never called in edge
|
|
1954
1296
|
},
|
|
1955
1297
|
});
|
|
1956
1298
|
}
|
|
1957
|
-
/**
|
|
1958
|
-
* Creates a default mode select cluster server.
|
|
1959
|
-
*
|
|
1960
|
-
* @param description - The description of the cluster server.
|
|
1961
|
-
* @param supportedModes - The supported modes for the cluster server.
|
|
1962
|
-
* @param currentMode - The current mode of the cluster server. Defaults to 0.
|
|
1963
|
-
* @param startUpMode - The startup mode of the cluster server. Defaults to 0.
|
|
1964
|
-
* @param endpoint - The endpoint to add the cluster server to. Defaults to `this` if not provided.
|
|
1965
|
-
*
|
|
1966
|
-
*/
|
|
1967
1299
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
|
|
1968
1300
|
if (!endpoint)
|
|
1969
1301
|
endpoint = this;
|
|
1970
1302
|
endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
|
|
1971
1303
|
}
|
|
1972
|
-
/**
|
|
1973
|
-
* Get a default occupancy sensing cluster server.
|
|
1974
|
-
*
|
|
1975
|
-
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1976
|
-
*/
|
|
1977
1304
|
getDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1978
1305
|
return ClusterServer(OccupancySensingCluster, {
|
|
1979
1306
|
occupancy: { occupied },
|
|
@@ -1982,19 +1309,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1982
1309
|
pirOccupiedToUnoccupiedDelay: 30,
|
|
1983
1310
|
}, {});
|
|
1984
1311
|
}
|
|
1985
|
-
/**
|
|
1986
|
-
* Creates a default occupancy sensing cluster server.
|
|
1987
|
-
*
|
|
1988
|
-
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1989
|
-
*/
|
|
1990
1312
|
createDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1991
1313
|
this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
|
|
1992
1314
|
}
|
|
1993
|
-
/**
|
|
1994
|
-
* Get a default Illuminance Measurement Cluster Server.
|
|
1995
|
-
*
|
|
1996
|
-
* @param measuredValue - The measured value of illuminance.
|
|
1997
|
-
*/
|
|
1998
1315
|
getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1999
1316
|
return ClusterServer(IlluminanceMeasurementCluster, {
|
|
2000
1317
|
measuredValue,
|
|
@@ -2003,19 +1320,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2003
1320
|
tolerance: 0,
|
|
2004
1321
|
}, {}, {});
|
|
2005
1322
|
}
|
|
2006
|
-
/**
|
|
2007
|
-
* Creates a default Illuminance Measurement Cluster Server.
|
|
2008
|
-
*
|
|
2009
|
-
* @param measuredValue - The measured value of illuminance.
|
|
2010
|
-
*/
|
|
2011
1323
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
2012
1324
|
this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
|
|
2013
1325
|
}
|
|
2014
|
-
/**
|
|
2015
|
-
* Get a default flow measurement cluster server.
|
|
2016
|
-
*
|
|
2017
|
-
* @param measuredValue - The measured value of the flow in 10 x m/h.
|
|
2018
|
-
*/
|
|
2019
1326
|
getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
2020
1327
|
return ClusterServer(FlowMeasurementCluster, {
|
|
2021
1328
|
measuredValue,
|
|
@@ -2024,19 +1331,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2024
1331
|
tolerance: 0,
|
|
2025
1332
|
}, {}, {});
|
|
2026
1333
|
}
|
|
2027
|
-
/**
|
|
2028
|
-
* Creates a default flow measurement cluster server.
|
|
2029
|
-
*
|
|
2030
|
-
* @param measuredValue - The measured value of the flow in 10 x m/h.
|
|
2031
|
-
*/
|
|
2032
1334
|
createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
2033
1335
|
this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
|
|
2034
1336
|
}
|
|
2035
|
-
/**
|
|
2036
|
-
* Get a default temperature measurement cluster server.
|
|
2037
|
-
*
|
|
2038
|
-
* @param measuredValue - The measured value of the temperature x 100.
|
|
2039
|
-
*/
|
|
2040
1337
|
getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
2041
1338
|
return ClusterServer(TemperatureMeasurementCluster, {
|
|
2042
1339
|
measuredValue,
|
|
@@ -2045,19 +1342,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2045
1342
|
tolerance: 0,
|
|
2046
1343
|
}, {}, {});
|
|
2047
1344
|
}
|
|
2048
|
-
/**
|
|
2049
|
-
* Creates a default temperature measurement cluster server.
|
|
2050
|
-
*
|
|
2051
|
-
* @param measuredValue - The measured value of the temperature x 100.
|
|
2052
|
-
*/
|
|
2053
1345
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
2054
1346
|
this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
|
|
2055
1347
|
}
|
|
2056
|
-
/**
|
|
2057
|
-
* Get a default RelativeHumidityMeasurementCluster server.
|
|
2058
|
-
*
|
|
2059
|
-
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
2060
|
-
*/
|
|
2061
1348
|
getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
2062
1349
|
return ClusterServer(RelativeHumidityMeasurementCluster, {
|
|
2063
1350
|
measuredValue,
|
|
@@ -2066,19 +1353,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2066
1353
|
tolerance: 0,
|
|
2067
1354
|
}, {}, {});
|
|
2068
1355
|
}
|
|
2069
|
-
/**
|
|
2070
|
-
* Creates a default RelativeHumidityMeasurementCluster server.
|
|
2071
|
-
*
|
|
2072
|
-
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
2073
|
-
*/
|
|
2074
1356
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
2075
1357
|
this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
|
|
2076
1358
|
}
|
|
2077
|
-
/**
|
|
2078
|
-
* Get a default Pressure Measurement Cluster Server.
|
|
2079
|
-
*
|
|
2080
|
-
* @param measuredValue - The measured value for the pressure.
|
|
2081
|
-
*/
|
|
2082
1359
|
getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
2083
1360
|
return ClusterServer(PressureMeasurementCluster, {
|
|
2084
1361
|
measuredValue,
|
|
@@ -2087,39 +1364,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2087
1364
|
tolerance: 0,
|
|
2088
1365
|
}, {}, {});
|
|
2089
1366
|
}
|
|
2090
|
-
/**
|
|
2091
|
-
* Creates a default Pressure Measurement Cluster Server.
|
|
2092
|
-
*
|
|
2093
|
-
* @param measuredValue - The measured value for the pressure.
|
|
2094
|
-
*/
|
|
2095
1367
|
createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
2096
1368
|
this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
|
|
2097
1369
|
}
|
|
2098
|
-
/**
|
|
2099
|
-
* Get a default boolean state cluster server.
|
|
2100
|
-
*
|
|
2101
|
-
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
2102
|
-
*/
|
|
2103
1370
|
getDefaultBooleanStateClusterServer(contact) {
|
|
2104
1371
|
return ClusterServer(BooleanStateCluster, {
|
|
2105
|
-
stateValue: contact ?? true,
|
|
1372
|
+
stateValue: contact ?? true,
|
|
2106
1373
|
}, {}, {
|
|
2107
1374
|
stateChange: true,
|
|
2108
1375
|
});
|
|
2109
1376
|
}
|
|
2110
|
-
/**
|
|
2111
|
-
* Creates a default boolean state configuration cluster server.
|
|
2112
|
-
*
|
|
2113
|
-
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
2114
|
-
*/
|
|
2115
1377
|
createDefaultBooleanStateClusterServer(contact) {
|
|
2116
1378
|
this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
|
|
2117
1379
|
}
|
|
2118
|
-
/**
|
|
2119
|
-
* Get a default boolean state configuration cluster server.
|
|
2120
|
-
*
|
|
2121
|
-
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
2122
|
-
*/
|
|
2123
1380
|
getDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
2124
1381
|
return ClusterServer(BooleanStateConfigurationCluster.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel), {
|
|
2125
1382
|
currentSensitivityLevel: 0,
|
|
@@ -2128,34 +1385,18 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2128
1385
|
alarmsActive: { visual: false, audible: false },
|
|
2129
1386
|
alarmsEnabled: { visual: false, audible: false },
|
|
2130
1387
|
alarmsSupported: { visual: true, audible: true },
|
|
2131
|
-
// alarmsSuppressed: { visual: false, audible: false },
|
|
2132
1388
|
sensorFault: { generalFault: sensorFault },
|
|
2133
1389
|
}, {
|
|
2134
1390
|
enableDisableAlarm: async (data) => {
|
|
2135
|
-
// Never called in edge
|
|
2136
1391
|
},
|
|
2137
1392
|
}, {
|
|
2138
1393
|
alarmsStateChanged: true,
|
|
2139
1394
|
sensorFault: true,
|
|
2140
1395
|
});
|
|
2141
1396
|
}
|
|
2142
|
-
/**
|
|
2143
|
-
* Creates a default boolean state configuration cluster server.
|
|
2144
|
-
*
|
|
2145
|
-
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
2146
|
-
*/
|
|
2147
1397
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
2148
1398
|
this.addClusterServer(this.getDefaultBooleanStateConfigurationClusterServer(sensorFault));
|
|
2149
1399
|
}
|
|
2150
|
-
/**
|
|
2151
|
-
* Get a default power source replaceable battery cluster server.
|
|
2152
|
-
*
|
|
2153
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2154
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2155
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
2156
|
-
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
2157
|
-
* @param batQuantity - The battery quantity (default: 1).
|
|
2158
|
-
*/
|
|
2159
1400
|
getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
2160
1401
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
2161
1402
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -2172,25 +1413,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2172
1413
|
endpointList: [],
|
|
2173
1414
|
}, {}, {});
|
|
2174
1415
|
}
|
|
2175
|
-
/**
|
|
2176
|
-
* Creates a default power source replaceable battery cluster server.
|
|
2177
|
-
*
|
|
2178
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2179
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2180
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
2181
|
-
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
2182
|
-
* @param batQuantity - The battery quantity (default: 1).
|
|
2183
|
-
*/
|
|
2184
1416
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
2185
1417
|
this.addClusterServer(this.getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity));
|
|
2186
1418
|
}
|
|
2187
|
-
/**
|
|
2188
|
-
* Get a default power source rechargeable battery cluster server.
|
|
2189
|
-
*
|
|
2190
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2191
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2192
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
2193
|
-
*/
|
|
2194
1419
|
getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
2195
1420
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
2196
1421
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -2208,21 +1433,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2208
1433
|
endpointList: [],
|
|
2209
1434
|
}, {}, {});
|
|
2210
1435
|
}
|
|
2211
|
-
/**
|
|
2212
|
-
* Creates a default power source rechargeable battery cluster server.
|
|
2213
|
-
*
|
|
2214
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2215
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2216
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
2217
|
-
*/
|
|
2218
1436
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
2219
1437
|
this.addClusterServer(this.getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage));
|
|
2220
1438
|
}
|
|
2221
|
-
/**
|
|
2222
|
-
* Get a default power source wired cluster server.
|
|
2223
|
-
*
|
|
2224
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
2225
|
-
*/
|
|
2226
1439
|
getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
2227
1440
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Wired), {
|
|
2228
1441
|
wiredCurrentType,
|
|
@@ -2232,45 +1445,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2232
1445
|
endpointList: [],
|
|
2233
1446
|
}, {}, {});
|
|
2234
1447
|
}
|
|
2235
|
-
/**
|
|
2236
|
-
* Creates a default power source wired cluster server.
|
|
2237
|
-
*
|
|
2238
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
2239
|
-
*/
|
|
2240
1448
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
2241
1449
|
this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
|
|
2242
1450
|
}
|
|
2243
|
-
/**
|
|
2244
|
-
* @deprecated This function is deprecated by Matter 1.3 spec and will be removed in a future version.
|
|
2245
|
-
*/
|
|
2246
1451
|
createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
|
|
2247
1452
|
this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
|
|
2248
1453
|
sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
|
|
2249
1454
|
}, {}, {}));
|
|
2250
1455
|
}
|
|
2251
|
-
/**
|
|
2252
|
-
* Get a default air quality cluster server.
|
|
2253
|
-
*
|
|
2254
|
-
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2255
|
-
*/
|
|
2256
1456
|
getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
2257
1457
|
return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
2258
1458
|
airQuality,
|
|
2259
1459
|
}, {}, {});
|
|
2260
1460
|
}
|
|
2261
|
-
/**
|
|
2262
|
-
* Creates a default air quality cluster server.
|
|
2263
|
-
*
|
|
2264
|
-
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2265
|
-
*/
|
|
2266
1461
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
2267
1462
|
this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
|
|
2268
1463
|
}
|
|
2269
|
-
/**
|
|
2270
|
-
* Get a default TVOC measurement cluster server.
|
|
2271
|
-
*
|
|
2272
|
-
* @param measuredValue - The measured value for TVOC.
|
|
2273
|
-
*/
|
|
2274
1464
|
getDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2275
1465
|
return ClusterServer(TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2276
1466
|
measuredValue,
|
|
@@ -2281,28 +1471,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2281
1471
|
measurementMedium,
|
|
2282
1472
|
}, {}, {});
|
|
2283
1473
|
}
|
|
2284
|
-
/**
|
|
2285
|
-
* Creates a default TVOC measurement cluster server.
|
|
2286
|
-
*
|
|
2287
|
-
* @param measuredValue - The measured value for TVOC.
|
|
2288
|
-
*/
|
|
2289
1474
|
createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2290
1475
|
this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2291
1476
|
}
|
|
2292
|
-
/**
|
|
2293
|
-
* Get a default heating thermostat cluster server with the specified parameters.
|
|
2294
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2295
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2296
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2297
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2298
|
-
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2299
|
-
*/
|
|
2300
1477
|
getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
2301
1478
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
|
|
2302
1479
|
localTemperature: localTemperature * 100,
|
|
2303
1480
|
systemMode: Thermostat.SystemMode.Heat,
|
|
2304
1481
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
2305
|
-
// Thermostat.Feature.Heating
|
|
2306
1482
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
2307
1483
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
2308
1484
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -2310,35 +1486,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2310
1486
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2311
1487
|
}, {
|
|
2312
1488
|
setpointRaiseLower: async (data) => {
|
|
2313
|
-
// Never called in edge
|
|
2314
1489
|
},
|
|
2315
1490
|
}, {});
|
|
2316
1491
|
}
|
|
2317
|
-
/**
|
|
2318
|
-
* Creates and adds a default heating thermostat cluster server to the device.
|
|
2319
|
-
*
|
|
2320
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2321
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2322
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2323
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2324
|
-
*/
|
|
2325
1492
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
2326
1493
|
this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
|
|
2327
1494
|
}
|
|
2328
|
-
/**
|
|
2329
|
-
* Get a default cooling thermostat cluster server with the specified parameters.
|
|
2330
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2331
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2332
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2333
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2334
|
-
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2335
|
-
*/
|
|
2336
1495
|
getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2337
1496
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
|
|
2338
1497
|
localTemperature: localTemperature * 100,
|
|
2339
1498
|
systemMode: Thermostat.SystemMode.Cool,
|
|
2340
1499
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
2341
|
-
// Thermostat.Feature.Cooling
|
|
2342
1500
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
2343
1501
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
2344
1502
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -2346,82 +1504,37 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2346
1504
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2347
1505
|
}, {
|
|
2348
1506
|
setpointRaiseLower: async (data) => {
|
|
2349
|
-
// Never called in edge
|
|
2350
1507
|
},
|
|
2351
1508
|
}, {});
|
|
2352
1509
|
}
|
|
2353
|
-
/**
|
|
2354
|
-
* Creates and adds a default cooling thermostat cluster server to the device.
|
|
2355
|
-
*
|
|
2356
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2357
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2358
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2359
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2360
|
-
*/
|
|
2361
1510
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2362
1511
|
this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
2363
1512
|
}
|
|
2364
|
-
/**
|
|
2365
|
-
* Get a default thermostat cluster server with the specified parameters.
|
|
2366
|
-
*
|
|
2367
|
-
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2368
|
-
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2369
|
-
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2370
|
-
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2371
|
-
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2372
|
-
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2373
|
-
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2374
|
-
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2375
|
-
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2376
|
-
*/
|
|
2377
1513
|
getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2378
1514
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
2379
1515
|
localTemperature: localTemperature * 100,
|
|
2380
1516
|
systemMode: Thermostat.SystemMode.Auto,
|
|
2381
1517
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
2382
|
-
// Thermostat.Feature.Heating
|
|
2383
1518
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
2384
1519
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
2385
1520
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2386
1521
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
2387
1522
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2388
|
-
// Thermostat.Feature.Cooling
|
|
2389
1523
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
2390
1524
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
2391
1525
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2392
1526
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
2393
1527
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2394
|
-
// Thermostat.Feature.AutoMode
|
|
2395
1528
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
2396
1529
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
2397
1530
|
}, {
|
|
2398
1531
|
setpointRaiseLower: async (data) => {
|
|
2399
|
-
// Never called in edge
|
|
2400
1532
|
},
|
|
2401
1533
|
}, {});
|
|
2402
1534
|
}
|
|
2403
|
-
/**
|
|
2404
|
-
* Creates and adds a default thermostat cluster server to the device.
|
|
2405
|
-
*
|
|
2406
|
-
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2407
|
-
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2408
|
-
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2409
|
-
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2410
|
-
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2411
|
-
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2412
|
-
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2413
|
-
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2414
|
-
*/
|
|
2415
1535
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2416
1536
|
this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
2417
1537
|
}
|
|
2418
|
-
/**
|
|
2419
|
-
* Returns the default SmokeCOAlarm Cluster Server.
|
|
2420
|
-
*
|
|
2421
|
-
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2422
|
-
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2423
|
-
* @returns The default SmokeCOAlarmClusterServer.
|
|
2424
|
-
*/
|
|
2425
1538
|
getDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
2426
1539
|
return ClusterServer(SmokeCoAlarmCluster.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm), {
|
|
2427
1540
|
smokeState,
|
|
@@ -2436,7 +1549,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2436
1549
|
interconnectCoAlarm: SmokeCoAlarm.AlarmState.Normal,
|
|
2437
1550
|
}, {
|
|
2438
1551
|
selfTestRequest: async (data) => {
|
|
2439
|
-
// Never called in edge
|
|
2440
1552
|
},
|
|
2441
1553
|
}, {
|
|
2442
1554
|
smokeAlarm: true,
|
|
@@ -2452,24 +1564,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2452
1564
|
allClear: true,
|
|
2453
1565
|
});
|
|
2454
1566
|
}
|
|
2455
|
-
/**
|
|
2456
|
-
* Create the default SmokeCOAlarm Cluster Server.
|
|
2457
|
-
*
|
|
2458
|
-
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2459
|
-
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2460
|
-
* @returns The default SmokeCOAlarmClusterServer.
|
|
2461
|
-
*/
|
|
2462
1567
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
2463
1568
|
this.addClusterServer(this.getDefaultSmokeCOAlarmClusterServer(smokeState, coState));
|
|
2464
1569
|
}
|
|
2465
|
-
/**
|
|
2466
|
-
* Returns the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2467
|
-
*
|
|
2468
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2469
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2470
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2471
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2472
|
-
*/
|
|
2473
1570
|
getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2474
1571
|
return ClusterServer(CarbonMonoxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2475
1572
|
measuredValue,
|
|
@@ -2480,24 +1577,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2480
1577
|
measurementMedium,
|
|
2481
1578
|
}, {}, {});
|
|
2482
1579
|
}
|
|
2483
|
-
/**
|
|
2484
|
-
* Create the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2485
|
-
*
|
|
2486
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2487
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2488
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2489
|
-
*/
|
|
2490
1580
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2491
1581
|
this.addClusterServer(this.getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2492
1582
|
}
|
|
2493
|
-
/**
|
|
2494
|
-
* Returns the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2495
|
-
*
|
|
2496
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2497
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2498
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2499
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2500
|
-
*/
|
|
2501
1583
|
getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2502
1584
|
return ClusterServer(CarbonDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2503
1585
|
measuredValue,
|
|
@@ -2508,24 +1590,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2508
1590
|
measurementMedium,
|
|
2509
1591
|
}, {}, {});
|
|
2510
1592
|
}
|
|
2511
|
-
/**
|
|
2512
|
-
* Create the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2513
|
-
*
|
|
2514
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2515
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2516
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2517
|
-
*/
|
|
2518
1593
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2519
1594
|
this.addClusterServer(this.getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2520
1595
|
}
|
|
2521
|
-
/**
|
|
2522
|
-
* Returns the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2523
|
-
*
|
|
2524
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2525
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2526
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2527
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2528
|
-
*/
|
|
2529
1596
|
getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2530
1597
|
return ClusterServer(FormaldehydeConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2531
1598
|
measuredValue,
|
|
@@ -2536,24 +1603,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2536
1603
|
measurementMedium,
|
|
2537
1604
|
}, {}, {});
|
|
2538
1605
|
}
|
|
2539
|
-
/**
|
|
2540
|
-
* Create the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2541
|
-
*
|
|
2542
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2543
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2544
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2545
|
-
*/
|
|
2546
1606
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2547
1607
|
this.addClusterServer(this.getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2548
1608
|
}
|
|
2549
|
-
/**
|
|
2550
|
-
* Returns the default Pm1 Concentration Measurement Cluster Server.
|
|
2551
|
-
*
|
|
2552
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2553
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2554
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2555
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2556
|
-
*/
|
|
2557
1609
|
getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2558
1610
|
return ClusterServer(Pm1ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2559
1611
|
measuredValue,
|
|
@@ -2564,24 +1616,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2564
1616
|
measurementMedium,
|
|
2565
1617
|
}, {}, {});
|
|
2566
1618
|
}
|
|
2567
|
-
/**
|
|
2568
|
-
* Create the default Pm1 Concentration Measurement Cluster Server.
|
|
2569
|
-
*
|
|
2570
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2571
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2572
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2573
|
-
*/
|
|
2574
1619
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2575
1620
|
this.addClusterServer(this.getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2576
1621
|
}
|
|
2577
|
-
/**
|
|
2578
|
-
* Returns the default Pm25 Concentration Measurement Cluster Server.
|
|
2579
|
-
*
|
|
2580
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2581
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2582
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2583
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2584
|
-
*/
|
|
2585
1622
|
getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2586
1623
|
return ClusterServer(Pm25ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2587
1624
|
measuredValue,
|
|
@@ -2592,24 +1629,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2592
1629
|
measurementMedium,
|
|
2593
1630
|
}, {}, {});
|
|
2594
1631
|
}
|
|
2595
|
-
/**
|
|
2596
|
-
* Create the default Pm25 Concentration Measurement Cluster Server.
|
|
2597
|
-
*
|
|
2598
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2599
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2600
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2601
|
-
*/
|
|
2602
1632
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2603
1633
|
this.addClusterServer(this.getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2604
1634
|
}
|
|
2605
|
-
/**
|
|
2606
|
-
* Returns the default Pm10 Concentration Measurement Cluster Server.
|
|
2607
|
-
*
|
|
2608
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2609
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2610
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2611
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2612
|
-
*/
|
|
2613
1635
|
getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2614
1636
|
return ClusterServer(Pm10ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2615
1637
|
measuredValue,
|
|
@@ -2620,24 +1642,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2620
1642
|
measurementMedium,
|
|
2621
1643
|
}, {}, {});
|
|
2622
1644
|
}
|
|
2623
|
-
/**
|
|
2624
|
-
* Create the default Pm10 Concentration Measurement Cluster Server.
|
|
2625
|
-
*
|
|
2626
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2627
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2628
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2629
|
-
*/
|
|
2630
1645
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2631
1646
|
this.addClusterServer(this.getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2632
1647
|
}
|
|
2633
|
-
/**
|
|
2634
|
-
* Returns the default Ozone Concentration Measurement Cluster Server.
|
|
2635
|
-
*
|
|
2636
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2637
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2638
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2639
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2640
|
-
*/
|
|
2641
1648
|
getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2642
1649
|
return ClusterServer(OzoneConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2643
1650
|
measuredValue,
|
|
@@ -2648,24 +1655,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2648
1655
|
measurementMedium,
|
|
2649
1656
|
}, {}, {});
|
|
2650
1657
|
}
|
|
2651
|
-
/**
|
|
2652
|
-
* Create the default Ozone Concentration Measurement Cluster Server.
|
|
2653
|
-
*
|
|
2654
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2655
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2656
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2657
|
-
*/
|
|
2658
1658
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2659
1659
|
this.addClusterServer(this.getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2660
1660
|
}
|
|
2661
|
-
/**
|
|
2662
|
-
* Returns the default Radon Concentration Measurement Cluster Server.
|
|
2663
|
-
*
|
|
2664
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2665
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2666
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2667
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2668
|
-
*/
|
|
2669
1661
|
getDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2670
1662
|
return ClusterServer(RadonConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2671
1663
|
measuredValue,
|
|
@@ -2676,24 +1668,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2676
1668
|
measurementMedium,
|
|
2677
1669
|
}, {}, {});
|
|
2678
1670
|
}
|
|
2679
|
-
/**
|
|
2680
|
-
* Create the default Radon Concentration Measurement Cluster Server.
|
|
2681
|
-
*
|
|
2682
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2683
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2684
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2685
|
-
*/
|
|
2686
1671
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2687
1672
|
this.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2688
1673
|
}
|
|
2689
|
-
/**
|
|
2690
|
-
* Returns the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2691
|
-
*
|
|
2692
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2693
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2694
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2695
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2696
|
-
*/
|
|
2697
1674
|
getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2698
1675
|
return ClusterServer(NitrogenDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2699
1676
|
measuredValue,
|
|
@@ -2704,22 +1681,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2704
1681
|
measurementMedium,
|
|
2705
1682
|
}, {}, {});
|
|
2706
1683
|
}
|
|
2707
|
-
/**
|
|
2708
|
-
* Create the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2709
|
-
*
|
|
2710
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2711
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2712
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2713
|
-
*/
|
|
2714
1684
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2715
1685
|
this.addClusterServer(this.getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2716
1686
|
}
|
|
2717
|
-
/**
|
|
2718
|
-
* Returns the default fan control cluster server rev 2.
|
|
2719
|
-
*
|
|
2720
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2721
|
-
* @returns The default fan control cluster server.
|
|
2722
|
-
*/
|
|
2723
1687
|
getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
2724
1688
|
return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
2725
1689
|
fanMode,
|
|
@@ -2731,18 +1695,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2731
1695
|
speedCurrent: 0,
|
|
2732
1696
|
}, {
|
|
2733
1697
|
step: async (data) => {
|
|
2734
|
-
// Never called in edge
|
|
2735
1698
|
},
|
|
2736
1699
|
}, {});
|
|
2737
1700
|
}
|
|
2738
|
-
/**
|
|
2739
|
-
* Create the default fan control cluster server rev 2.
|
|
2740
|
-
*
|
|
2741
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2742
|
-
* @returns The default fan control cluster server.
|
|
2743
|
-
*/
|
|
2744
1701
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
2745
1702
|
this.addClusterServer(this.getDefaultFanControlClusterServer(fanMode));
|
|
2746
1703
|
}
|
|
2747
1704
|
}
|
|
2748
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|