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