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