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