matterbridge 1.6.7-dev.3 → 1.6.7
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 +5 -1
- package/dist/cli.d.ts +25 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +26 -0
- package/dist/cli.js.map +1 -0
- package/dist/cluster/export.d.ts +2 -0
- package/dist/cluster/export.d.ts.map +1 -0
- package/dist/cluster/export.js +2 -0
- package/dist/cluster/export.js.map +1 -0
- package/dist/defaultConfigSchema.d.ts +27 -0
- package/dist/defaultConfigSchema.d.ts.map +1 -0
- package/dist/defaultConfigSchema.js +23 -0
- package/dist/defaultConfigSchema.js.map +1 -0
- package/dist/deviceManager.d.ts +46 -0
- package/dist/deviceManager.d.ts.map +1 -0
- package/dist/deviceManager.js +26 -1
- package/dist/deviceManager.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/export.d.ts +2 -0
- package/dist/logger/export.d.ts.map +1 -0
- package/dist/logger/export.js +1 -0
- package/dist/logger/export.js.map +1 -0
- package/dist/matter/export.d.ts +6 -0
- package/dist/matter/export.d.ts.map +1 -0
- package/dist/matter/export.js +1 -0
- package/dist/matter/export.js.map +1 -0
- package/dist/matterbridge.d.ts +466 -0
- package/dist/matterbridge.d.ts.map +1 -0
- package/dist/matterbridge.js +660 -61
- package/dist/matterbridge.js.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts +39 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.js +33 -0
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
- package/dist/matterbridgeBehaviors.d.ts +942 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +29 -1
- package/dist/matterbridgeBehaviors.js.map +1 -0
- package/dist/matterbridgeDevice.d.ts +7063 -0
- package/dist/matterbridgeDevice.d.ts.map +1 -0
- package/dist/matterbridgeDevice.js +1026 -10
- package/dist/matterbridgeDevice.js.map +1 -0
- package/dist/matterbridgeDeviceTypes.d.ts +109 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +98 -12
- package/dist/matterbridgeDeviceTypes.js.map +1 -0
- package/dist/matterbridgeDynamicPlatform.d.ts +39 -0
- package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
- package/dist/matterbridgeDynamicPlatform.js +33 -0
- package/dist/matterbridgeDynamicPlatform.js.map +1 -0
- package/dist/matterbridgeEdge.d.ts +92 -0
- package/dist/matterbridgeEdge.d.ts.map +1 -0
- package/dist/matterbridgeEdge.js +530 -0
- package/dist/matterbridgeEdge.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +10164 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +1163 -15
- package/dist/matterbridgeEndpoint.js.map +1 -0
- package/dist/matterbridgePlatform.d.ts +114 -0
- package/dist/matterbridgePlatform.d.ts.map +1 -0
- package/dist/matterbridgePlatform.js +91 -3
- package/dist/matterbridgePlatform.js.map +1 -0
- package/dist/matterbridgeTypes.d.ts +162 -0
- package/dist/matterbridgeTypes.d.ts.map +1 -0
- package/dist/matterbridgeTypes.js +24 -0
- package/dist/matterbridgeTypes.js.map +1 -0
- package/dist/matterbridgeWebsocket.d.ts +49 -0
- package/dist/matterbridgeWebsocket.d.ts.map +1 -0
- package/dist/matterbridgeWebsocket.js +45 -0
- package/dist/matterbridgeWebsocket.js.map +1 -0
- package/dist/pluginManager.d.ts +238 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +238 -3
- package/dist/pluginManager.js.map +1 -0
- package/dist/storage/export.d.ts +2 -0
- package/dist/storage/export.d.ts.map +1 -0
- package/dist/storage/export.js +1 -0
- package/dist/storage/export.js.map +1 -0
- package/dist/utils/colorUtils.d.ts +61 -0
- package/dist/utils/colorUtils.d.ts.map +1 -0
- package/dist/utils/colorUtils.js +205 -2
- package/dist/utils/colorUtils.js.map +1 -0
- package/dist/utils/export.d.ts +3 -0
- package/dist/utils/export.d.ts.map +1 -0
- package/dist/utils/export.js +1 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/utils.d.ts +221 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +252 -7
- package/dist/utils/utils.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
|
@@ -1,15 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the class MatterbridgeDevice.
|
|
3
|
+
*
|
|
4
|
+
* @file matterbridgeDevice.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @date 2023-12-29
|
|
7
|
+
* @version 2.0.0
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2023, 2024, 2025 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
|
+
// @matter
|
|
24
|
+
import { AirQuality, AirQualityCluster, BasicInformationCluster, BooleanState, BooleanStateCluster, BooleanStateConfiguration, BooleanStateConfigurationCluster, BridgedDeviceBasicInformationCluster, CarbonDioxideConcentrationMeasurement, CarbonDioxideConcentrationMeasurementCluster, CarbonMonoxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurementCluster, ColorControl, ColorControlCluster, ConcentrationMeasurement, Descriptor, DescriptorCluster, DeviceEnergyManagement, DeviceEnergyManagementCluster, DeviceEnergyManagementMode, DeviceEnergyManagementModeCluster, DoorLock, DoorLockCluster, ElectricalEnergyMeasurement, ElectricalEnergyMeasurementCluster, ElectricalPowerMeasurement, ElectricalPowerMeasurementCluster, FanControl, FanControlCluster, FlowMeasurement, FlowMeasurementCluster, FormaldehydeConcentrationMeasurement, FormaldehydeConcentrationMeasurementCluster, Groups, GroupsCluster, Identify, IdentifyCluster, IlluminanceMeasurement, IlluminanceMeasurementCluster, LevelControl, LevelControlCluster, 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, ThreadNetworkDiagnostics, ThreadNetworkDiagnosticsCluster, TimeSynchronization, TimeSynchronizationCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster, ValveConfigurationAndControl, ValveConfigurationAndControlCluster, WindowCovering, WindowCoveringCluster, } from '@matter/main/clusters';
|
|
2
25
|
import { Specification } from '@matter/main/model';
|
|
3
26
|
import { EndpointNumber, extendPublicHandlerMethods, VendorId } from '@matter/main';
|
|
4
27
|
import { MeasurementType, getClusterNameById } from '@matter/main/types';
|
|
28
|
+
// @project-chip
|
|
5
29
|
import { Device } from '@project-chip/matter.js/device';
|
|
6
30
|
import { GroupsClusterHandler, ClusterServer } from '@project-chip/matter.js/cluster';
|
|
31
|
+
// AnsiLogger module
|
|
7
32
|
import { AnsiLogger, CYAN, YELLOW, db, hk, or, zb, debugStringify } from 'node-ansi-logger';
|
|
33
|
+
// Node.js modules
|
|
8
34
|
import { createHash } from 'crypto';
|
|
9
35
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
10
36
|
export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
11
37
|
static bridgeMode = '';
|
|
12
|
-
static logLevel = "info"
|
|
38
|
+
static logLevel = "info" /* LogLevel.INFO */;
|
|
13
39
|
log;
|
|
14
40
|
plugin = undefined;
|
|
15
41
|
configUrl = undefined;
|
|
@@ -24,6 +50,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
24
50
|
softwareVersionString = undefined;
|
|
25
51
|
hardwareVersion = undefined;
|
|
26
52
|
hardwareVersionString = undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Create a Matterbridge device.
|
|
55
|
+
* @constructor
|
|
56
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition of the device.
|
|
57
|
+
* @param {EndpointOptions} [options={}] - The options for the device.
|
|
58
|
+
* @param {boolean} [debug=false] - The debug level for the device.
|
|
59
|
+
*/
|
|
27
60
|
constructor(definition, options = {}, debug = false) {
|
|
28
61
|
let firstDefinition;
|
|
29
62
|
if (Array.isArray(definition))
|
|
@@ -31,7 +64,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
31
64
|
else
|
|
32
65
|
firstDefinition = definition;
|
|
33
66
|
super(firstDefinition, options);
|
|
34
|
-
this.log = new AnsiLogger({ logName: 'MatterbridgeDevice', logTimestampFormat: 4
|
|
67
|
+
this.log = new AnsiLogger({ logName: 'MatterbridgeDevice', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeDevice.logLevel });
|
|
35
68
|
this.log.debug(`new MatterbridgeDevice with deviceType: ${zb}${firstDefinition.code}${db}-${zb}${firstDefinition.name}${db}`);
|
|
36
69
|
if (Array.isArray(definition)) {
|
|
37
70
|
definition.forEach((deviceType) => {
|
|
@@ -41,12 +74,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
41
74
|
else
|
|
42
75
|
this.addDeviceType(firstDefinition);
|
|
43
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Loads asyncronously an instance of the MatterbridgeDevice class.
|
|
79
|
+
*
|
|
80
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition of the device.
|
|
81
|
+
* @param {EndpointOptions} [options={}] - The options for the device.
|
|
82
|
+
* @param {boolean} [debug=false] - The debug level for the device.
|
|
83
|
+
* @returns {Promise<MatterbridgeDevice>} A Promise of MatterbridgeDevice instance.
|
|
84
|
+
*/
|
|
44
85
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
45
86
|
return new MatterbridgeDevice(definition, options, debug);
|
|
46
87
|
}
|
|
88
|
+
// Present in new API but not here
|
|
47
89
|
get maybeNumber() {
|
|
48
90
|
return this.number;
|
|
49
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Adds a device type to the list of device types of the MatterbridgeDevice endpoint.
|
|
94
|
+
* If the device type is not already present in the list, it will be added.
|
|
95
|
+
*
|
|
96
|
+
* @param {DeviceTypeDefinition} deviceType - The device type to add.
|
|
97
|
+
* @returns {MatterbridgeDevice} The MatterbridgeDevice instance.
|
|
98
|
+
*/
|
|
50
99
|
addDeviceType(deviceType) {
|
|
51
100
|
const deviceTypes = this.getDeviceTypes();
|
|
52
101
|
if (!deviceTypes.includes(deviceType)) {
|
|
@@ -56,6 +105,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
56
105
|
}
|
|
57
106
|
return this;
|
|
58
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Adds one or more device types with the required cluster servers and the specified cluster servers.
|
|
110
|
+
*
|
|
111
|
+
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
112
|
+
* @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
|
|
113
|
+
* @returns {MatterbridgeDevice} The MatterbridgeDevice instance.
|
|
114
|
+
*/
|
|
59
115
|
addDeviceTypeWithClusterServer(deviceTypes, includeServerList = []) {
|
|
60
116
|
this.log.debug('addDeviceTypeWithClusterServer:');
|
|
61
117
|
deviceTypes.forEach((deviceType) => {
|
|
@@ -77,6 +133,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
77
133
|
this.addClusterServerFromList(this, includeServerList);
|
|
78
134
|
return this;
|
|
79
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Adds a child endpoint with the specified device types and options.
|
|
138
|
+
* If the child endpoint is not already present, it will be created and added.
|
|
139
|
+
* If the child endpoint is already present, the device types will be added to the existing child endpoint.
|
|
140
|
+
*
|
|
141
|
+
* @param {string} endpointName - The name of the new endpoint to add.
|
|
142
|
+
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
143
|
+
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
|
|
144
|
+
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
145
|
+
* @returns {MatterbridgeDevice} - The child endpoint that was found or added.
|
|
146
|
+
*/
|
|
80
147
|
addChildDeviceType(endpointName, deviceTypes, options = {}, debug = false) {
|
|
81
148
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
82
149
|
let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
@@ -101,6 +168,18 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
101
168
|
child.setDeviceTypes(childDeviceTypes);
|
|
102
169
|
return child;
|
|
103
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
173
|
+
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
174
|
+
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
175
|
+
*
|
|
176
|
+
* @param {string} endpointName - The name of the new enpoint to add.
|
|
177
|
+
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
178
|
+
* @param {ClusterId[]} [includeServerList=[]] - The list of cluster IDs to include.
|
|
179
|
+
* @param {EndpointOptions} [options={}] - The options for the device.
|
|
180
|
+
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
181
|
+
* @returns {MatterbridgeDevice} - The child endpoint that was found or added.
|
|
182
|
+
*/
|
|
104
183
|
addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
|
|
105
184
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
106
185
|
let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
@@ -133,6 +212,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
133
212
|
this.addClusterServerFromList(child, includeServerList);
|
|
134
213
|
return child;
|
|
135
214
|
}
|
|
215
|
+
/**
|
|
216
|
+
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
217
|
+
*
|
|
218
|
+
* @param {Endpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
219
|
+
* @returns {Endpoint} The updated endpoint with the required cluster servers added.
|
|
220
|
+
*/
|
|
136
221
|
addRequiredClusterServers(endpoint) {
|
|
137
222
|
const requiredServerList = [];
|
|
138
223
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.name}${db}`);
|
|
@@ -149,6 +234,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
149
234
|
this.addClusterServerFromList(endpoint, requiredServerList);
|
|
150
235
|
return endpoint;
|
|
151
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
239
|
+
*
|
|
240
|
+
* @param {Endpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
241
|
+
* @returns {Endpoint} The updated endpoint with the required cluster servers added.
|
|
242
|
+
*/
|
|
152
243
|
addOptionalClusterServers(endpoint) {
|
|
153
244
|
const optionalServerList = [];
|
|
154
245
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.name}${db}`);
|
|
@@ -165,11 +256,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
165
256
|
this.addClusterServerFromList(endpoint, optionalServerList);
|
|
166
257
|
return endpoint;
|
|
167
258
|
}
|
|
259
|
+
/**
|
|
260
|
+
* Adds cluster servers to the specified endpoint based on the provided server list.
|
|
261
|
+
*
|
|
262
|
+
* @param {Endpoint} endpoint - The endpoint to add cluster servers to.
|
|
263
|
+
* @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
|
|
264
|
+
* @returns {Endpoint} The updated endpoint with the cluster servers added.
|
|
265
|
+
*/
|
|
168
266
|
addClusterServerFromList(endpoint, includeServerList) {
|
|
169
267
|
if (includeServerList.includes(Identify.Cluster.id))
|
|
170
268
|
endpoint.addClusterServer(this.getDefaultIdentifyClusterServer());
|
|
171
269
|
if (includeServerList.includes(Groups.Cluster.id))
|
|
172
270
|
endpoint.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
271
|
+
// if (includeServerList.includes(ScenesManagement.Cluster.id)) endpoint.addClusterServer(this.getDefaultScenesClusterServer());
|
|
173
272
|
if (includeServerList.includes(OnOff.Cluster.id))
|
|
174
273
|
endpoint.addClusterServer(this.getDefaultOnOffClusterServer());
|
|
175
274
|
if (includeServerList.includes(LevelControl.Cluster.id))
|
|
@@ -242,9 +341,25 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
242
341
|
endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementModeClusterServer());
|
|
243
342
|
return endpoint;
|
|
244
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Retrieves a child endpoint by its name.
|
|
346
|
+
*
|
|
347
|
+
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
348
|
+
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
349
|
+
*/
|
|
245
350
|
getChildEndpointByName(endpointName) {
|
|
246
351
|
return this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
247
352
|
}
|
|
353
|
+
/**
|
|
354
|
+
* Retrieves the value of the specified attribute from the given endpoint and cluster.
|
|
355
|
+
*
|
|
356
|
+
* @param {ClusterId} clusterId - The ID of the cluster to retrieve the attribute from.
|
|
357
|
+
* @param {string} attribute - The name of the attribute to retrieve.
|
|
358
|
+
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
359
|
+
* @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the attribute from.
|
|
360
|
+
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
361
|
+
*/
|
|
362
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
248
363
|
getAttribute(clusterId, attribute, log, endpoint) {
|
|
249
364
|
if (!endpoint)
|
|
250
365
|
endpoint = this;
|
|
@@ -258,15 +373,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
258
373
|
this.log.error(`getAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
259
374
|
return undefined;
|
|
260
375
|
}
|
|
376
|
+
// Find the getter method
|
|
377
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
261
378
|
if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
|
|
262
379
|
this.log.error(`getAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
263
380
|
return undefined;
|
|
264
381
|
}
|
|
382
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
265
383
|
const getter = clusterServer[`get${capitalizedAttributeName}Attribute`];
|
|
266
384
|
const value = getter();
|
|
267
385
|
log?.info(`${db}Get endpoint ${or}${endpoint.name}:${endpoint.number}${db} attribute ${hk}${clusterServer.name}.${capitalizedAttributeName}${db} value ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
268
386
|
return value;
|
|
269
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* Sets the value of an attribute on a cluster server endpoint.
|
|
390
|
+
*
|
|
391
|
+
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
392
|
+
* @param {string} attribute - The name of the attribute.
|
|
393
|
+
* @param {any} value - The value to set for the attribute.
|
|
394
|
+
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
395
|
+
* @param {Endpoint} [endpoint] - (Optional) The endpoint to set the attribute on. If not provided, the attribute will be set on the current endpoint.
|
|
396
|
+
*/
|
|
397
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
270
398
|
setAttribute(clusterId, attribute, value, log, endpoint) {
|
|
271
399
|
if (!endpoint)
|
|
272
400
|
endpoint = this;
|
|
@@ -280,15 +408,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
280
408
|
this.log.error(`setAttribute error: Attribute ${attribute} not found on Cluster ${clusterId} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
281
409
|
return false;
|
|
282
410
|
}
|
|
411
|
+
// Find the getter method
|
|
412
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
283
413
|
if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
|
|
284
414
|
this.log.error(`setAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
285
415
|
return false;
|
|
286
416
|
}
|
|
417
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
287
418
|
const getter = clusterServer[`get${capitalizedAttributeName}Attribute`];
|
|
419
|
+
// Find the setter method
|
|
420
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
288
421
|
if (!clusterServer[`set${capitalizedAttributeName}Attribute`]) {
|
|
289
422
|
this.log.error(`setAttribute error: Setter set${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
290
423
|
return false;
|
|
291
424
|
}
|
|
425
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
292
426
|
const setter = clusterServer[`set${capitalizedAttributeName}Attribute`];
|
|
293
427
|
const oldValue = getter();
|
|
294
428
|
setter(value);
|
|
@@ -297,6 +431,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
297
431
|
`to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
298
432
|
return true;
|
|
299
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* Subscribes to an attribute on a cluster.
|
|
436
|
+
*
|
|
437
|
+
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
438
|
+
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
439
|
+
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
440
|
+
* @param {AnsiLogger} log - (Optional) An AnsiLogger instance for logging errors and information.
|
|
441
|
+
* @param {Endpoint} endpoint - (Optional) The endpoint to subscribe the attribute on. If not provided, the current endpoint will be used.
|
|
442
|
+
* @returns A boolean indicating whether the subscription was successful.
|
|
443
|
+
*/
|
|
444
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
300
445
|
subscribeAttribute(clusterId, attribute, listener, log, endpoint) {
|
|
301
446
|
if (!endpoint)
|
|
302
447
|
endpoint = this;
|
|
@@ -310,15 +455,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
310
455
|
this.log.error(`subscribeAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
311
456
|
return false;
|
|
312
457
|
}
|
|
458
|
+
// Find the subscribe method
|
|
459
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
313
460
|
if (!clusterServer[`subscribe${capitalizedAttributeName}Attribute`]) {
|
|
314
461
|
this.log.error(`subscribeAttribute error: subscribe${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
315
462
|
return false;
|
|
316
463
|
}
|
|
464
|
+
// Subscribe to the attribute
|
|
465
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
317
466
|
const subscribe = clusterServer[`subscribe${capitalizedAttributeName}Attribute`];
|
|
318
467
|
subscribe(listener);
|
|
319
468
|
log?.info(`${db}Subscribe endpoint ${or}${endpoint.name}:${endpoint.number}${db} attribute ${hk}${clusterServer.name}.${capitalizedAttributeName}${db}`);
|
|
320
469
|
return true;
|
|
321
470
|
}
|
|
471
|
+
/**
|
|
472
|
+
* Triggers the specified event of the specified cluster from the given endpoint and cluster.
|
|
473
|
+
*
|
|
474
|
+
* @param {ClusterId} clusterId - The ID of the cluster to retrieve the event from.
|
|
475
|
+
* @param {string} event - The name of the event to trigger.
|
|
476
|
+
* @param {Record<string, any>} payload - The payload of the event to trigger.
|
|
477
|
+
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
478
|
+
* @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the event from.
|
|
479
|
+
*/
|
|
322
480
|
triggerEvent(clusterId, event, payload, log, endpoint) {
|
|
323
481
|
if (!endpoint)
|
|
324
482
|
endpoint = this;
|
|
@@ -334,20 +492,43 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
334
492
|
this.log.error(`triggerEvent error: Event ${event} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
335
493
|
return;
|
|
336
494
|
}
|
|
495
|
+
// Find the getter method
|
|
496
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
337
497
|
if (!clusterServer[`trigger${capitalizedEventName}Event`]) {
|
|
338
498
|
this.log.error(`triggerEvent error: Trigger trigger${capitalizedEventName}Event not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
339
499
|
return;
|
|
340
500
|
}
|
|
501
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
341
502
|
const trigger = clusterServer[`trigger${capitalizedEventName}Event`];
|
|
342
503
|
trigger(payload);
|
|
343
504
|
log?.info(`${db}Trigger event ${hk}${clusterServer.name}.${capitalizedEventName}${db} on endpoint ${or}${endpoint.name}:${endpoint.number}${db}`);
|
|
344
505
|
}
|
|
506
|
+
/**
|
|
507
|
+
* Adds a tag to the tag list of the specified endpoint.
|
|
508
|
+
*
|
|
509
|
+
* @param {Endpoint} endpoint - The endpoint to add the tag to.
|
|
510
|
+
* @param {VendorId | null} mfgCode - The manufacturer code.
|
|
511
|
+
* @param {number} namespaceId - The namespace ID of the tag.
|
|
512
|
+
* @param {number} tag - The tag number.
|
|
513
|
+
* @param {string | null} [label=null] - The label for the tag.
|
|
514
|
+
*
|
|
515
|
+
* @remarks
|
|
516
|
+
* This method is used to add a tag to the tag list of a given endpoint.
|
|
517
|
+
* If the tag list already exists, the new tag is added to the existing list. Otherwise, a new tag list is created with the provided tag.
|
|
518
|
+
*
|
|
519
|
+
* Example usage:
|
|
520
|
+
* ```typescript
|
|
521
|
+
* this.addTagList(endpoint, null, NumberTag.One.namespaceId, NumberTag.One.tag, 'Label');
|
|
522
|
+
* this.addTagList(endpoint, null, SwitchesTag.Custom.namespaceId, SwitchesTag.Custom.tag, 'Label');
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
345
525
|
addTagList(endpoint, mfgCode, namespaceId, tag, label) {
|
|
346
526
|
const descriptor = endpoint.getClusterServer(DescriptorCluster.with(Descriptor.Feature.TagList));
|
|
347
527
|
if (!descriptor) {
|
|
348
528
|
this.log.error(`addTagList: descriptor cluster not found on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
349
529
|
return;
|
|
350
530
|
}
|
|
531
|
+
// tagList: { mfgCode: VendorId | null; namespaceId: number; tag: number; label?: string | null }[] = [];
|
|
351
532
|
if (descriptor.attributes.tagList) {
|
|
352
533
|
this.log.debug(`addTagList: adding ${CYAN}tagList${db} mfCode: ${mfgCode}, namespaceId: ${namespaceId}, tag: ${tag}, label: ${label} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
353
534
|
const tagList = descriptor.attributes.tagList.getLocal();
|
|
@@ -363,6 +544,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
363
544
|
partsList: [...descriptor.attributes.partsList.getLocal()],
|
|
364
545
|
}, {}, {}));
|
|
365
546
|
}
|
|
547
|
+
/**
|
|
548
|
+
* Serializes the Matterbridge device into a serialized object.
|
|
549
|
+
*
|
|
550
|
+
* @param pluginName - The name of the plugin.
|
|
551
|
+
* @returns The serialized Matterbridge device object.
|
|
552
|
+
*/
|
|
366
553
|
serialize() {
|
|
367
554
|
if (!this.serialNumber || !this.deviceName || !this.uniqueId)
|
|
368
555
|
return;
|
|
@@ -387,6 +574,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
387
574
|
});
|
|
388
575
|
return serialized;
|
|
389
576
|
}
|
|
577
|
+
/**
|
|
578
|
+
* Deserializes the device into a serialized object.
|
|
579
|
+
*
|
|
580
|
+
* @returns The deserialized MatterbridgeDevice.
|
|
581
|
+
*/
|
|
390
582
|
static deserialize(serializedDevice) {
|
|
391
583
|
const device = new MatterbridgeDevice(serializedDevice.deviceTypes);
|
|
392
584
|
device.serialNumber = serializedDevice.serialNumber;
|
|
@@ -402,6 +594,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
402
594
|
}
|
|
403
595
|
return device;
|
|
404
596
|
}
|
|
597
|
+
/**
|
|
598
|
+
* Get a default IdentifyCluster server.
|
|
599
|
+
*/
|
|
405
600
|
getDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
406
601
|
return ClusterServer(IdentifyCluster, {
|
|
407
602
|
identifyTime,
|
|
@@ -417,29 +612,89 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
417
612
|
},
|
|
418
613
|
});
|
|
419
614
|
}
|
|
615
|
+
/**
|
|
616
|
+
* Creates a default IdentifyCluster server.
|
|
617
|
+
*/
|
|
420
618
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
421
619
|
this.addClusterServer(this.getDefaultIdentifyClusterServer(identifyTime, identifyType));
|
|
422
620
|
return this;
|
|
423
621
|
}
|
|
622
|
+
/**
|
|
623
|
+
* Get a default IdentifyCluster server.
|
|
624
|
+
*/
|
|
424
625
|
getDefaultGroupsClusterServer() {
|
|
425
626
|
return ClusterServer(GroupsCluster, {
|
|
426
627
|
nameSupport: {
|
|
427
628
|
nameSupport: true,
|
|
428
629
|
},
|
|
429
630
|
}, GroupsClusterHandler());
|
|
631
|
+
// return createDefaultGroupsClusterServer();
|
|
430
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* Creates a default groups cluster server and adds it to the device.
|
|
635
|
+
*/
|
|
431
636
|
createDefaultGroupsClusterServer() {
|
|
432
637
|
this.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
433
638
|
}
|
|
639
|
+
/**
|
|
640
|
+
* Get a default scenes cluster server and adds it to the current instance.
|
|
641
|
+
* @deprecated This method is deprecated.
|
|
642
|
+
*
|
|
643
|
+
*/
|
|
434
644
|
getDefaultScenesClusterServer() {
|
|
435
|
-
|
|
645
|
+
/*
|
|
646
|
+
return ClusterServer(
|
|
647
|
+
ScenesCluster,
|
|
648
|
+
{
|
|
649
|
+
sceneCount: 0,
|
|
650
|
+
currentScene: 0,
|
|
651
|
+
currentGroup: GroupId(0),
|
|
652
|
+
sceneValid: false,
|
|
653
|
+
nameSupport: {
|
|
654
|
+
nameSupport: true,
|
|
655
|
+
},
|
|
656
|
+
lastConfiguredBy: null,
|
|
657
|
+
},
|
|
658
|
+
{},
|
|
659
|
+
);
|
|
660
|
+
*/
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Creates a default scenes cluster server and adds it to the current instance.
|
|
664
|
+
* @deprecated This method is deprecated.
|
|
665
|
+
*/
|
|
436
666
|
createDefaultScenesClusterServer() {
|
|
437
|
-
|
|
667
|
+
/*
|
|
668
|
+
this.addClusterServer(this.getDefaultScenesClusterServer());
|
|
669
|
+
*/
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* Creates a unique identifier based on the provided parameters.
|
|
673
|
+
* @param param1 - The first parameter.
|
|
674
|
+
* @param param2 - The second parameter.
|
|
675
|
+
* @param param3 - The third parameter.
|
|
676
|
+
* @param param4 - The fourth parameter.
|
|
677
|
+
* @returns A unique identifier generated using the MD5 hash algorithm.
|
|
678
|
+
*/
|
|
438
679
|
createUniqueId(param1, param2, param3, param4) {
|
|
439
680
|
const hash = createHash('md5');
|
|
440
681
|
hash.update(param1 + param2 + param3 + param4);
|
|
441
682
|
return hash.digest('hex');
|
|
442
683
|
}
|
|
684
|
+
/**
|
|
685
|
+
* Get a default Basic Information Cluster Server.
|
|
686
|
+
*
|
|
687
|
+
* @param deviceName - The name of the device.
|
|
688
|
+
* @param serialNumber - The serial number of the device.
|
|
689
|
+
* @param vendorId - The vendor ID of the device.
|
|
690
|
+
* @param vendorName - The vendor name of the device.
|
|
691
|
+
* @param productId - The product ID of the device.
|
|
692
|
+
* @param productName - The product name of the device.
|
|
693
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
694
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
695
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
696
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
697
|
+
*/
|
|
443
698
|
getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
444
699
|
this.log.logName = deviceName;
|
|
445
700
|
this.deviceName = deviceName;
|
|
@@ -480,6 +735,20 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
480
735
|
reachableChanged: true,
|
|
481
736
|
});
|
|
482
737
|
}
|
|
738
|
+
/**
|
|
739
|
+
* Creates a default Basic Information Cluster Server.
|
|
740
|
+
*
|
|
741
|
+
* @param deviceName - The name of the device.
|
|
742
|
+
* @param serialNumber - The serial number of the device.
|
|
743
|
+
* @param vendorId - The vendor ID of the device.
|
|
744
|
+
* @param vendorName - The vendor name of the device.
|
|
745
|
+
* @param productId - The product ID of the device.
|
|
746
|
+
* @param productName - The product name of the device.
|
|
747
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
748
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
749
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
750
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
751
|
+
*/
|
|
483
752
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
484
753
|
if (MatterbridgeDevice.bridgeMode === 'bridge') {
|
|
485
754
|
this.addDeviceType(bridgedNode);
|
|
@@ -488,6 +757,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
488
757
|
}
|
|
489
758
|
this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
490
759
|
}
|
|
760
|
+
/**
|
|
761
|
+
* Get a default BridgedDeviceBasicInformationClusterServer.
|
|
762
|
+
*
|
|
763
|
+
* @param deviceName - The name of the device.
|
|
764
|
+
* @param serialNumber - The serial number of the device.
|
|
765
|
+
* @param vendorId - The vendor ID of the device.
|
|
766
|
+
* @param vendorName - The name of the vendor.
|
|
767
|
+
* @param productName - The name of the product.
|
|
768
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
769
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
770
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
771
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
772
|
+
*/
|
|
491
773
|
getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
492
774
|
this.log.logName = deviceName;
|
|
493
775
|
this.deviceName = deviceName;
|
|
@@ -502,7 +784,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
502
784
|
this.hardwareVersion = hardwareVersion;
|
|
503
785
|
this.hardwareVersionString = hardwareVersionString;
|
|
504
786
|
return ClusterServer(BridgedDeviceBasicInformationCluster, {
|
|
505
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
787
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
|
|
506
788
|
vendorName: vendorName.slice(0, 32),
|
|
507
789
|
productName: productName.slice(0, 32),
|
|
508
790
|
productUrl: 'https://www.npmjs.com/package/matterbridge',
|
|
@@ -522,12 +804,36 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
522
804
|
reachableChanged: true,
|
|
523
805
|
});
|
|
524
806
|
}
|
|
807
|
+
/**
|
|
808
|
+
* Creates a default BridgedDeviceBasicInformationClusterServer.
|
|
809
|
+
*
|
|
810
|
+
* @param deviceName - The name of the device.
|
|
811
|
+
* @param serialNumber - The serial number of the device.
|
|
812
|
+
* @param vendorId - The vendor ID of the device.
|
|
813
|
+
* @param vendorName - The name of the vendor.
|
|
814
|
+
* @param productName - The name of the product.
|
|
815
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
816
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
817
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
818
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
819
|
+
*/
|
|
525
820
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
526
821
|
this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
527
822
|
}
|
|
823
|
+
/**
|
|
824
|
+
* Get a default Power Topology Cluster Server.
|
|
825
|
+
*
|
|
826
|
+
* @returns {ClusterServer} - The configured Power Topology Cluster Server.
|
|
827
|
+
*/
|
|
528
828
|
getDefaultPowerTopologyClusterServer() {
|
|
529
829
|
return ClusterServer(PowerTopologyCluster.with(PowerTopology.Feature.TreeTopology), {}, {}, {});
|
|
530
830
|
}
|
|
831
|
+
/**
|
|
832
|
+
* Get a default Electrical Energy Measurement Cluster Server.
|
|
833
|
+
*
|
|
834
|
+
* @param {number} energy - The total consumption value in mW/h.
|
|
835
|
+
* @returns {ClusterServer} - The configured Electrical Energy Measurement Cluster Server.
|
|
836
|
+
*/
|
|
531
837
|
getDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
532
838
|
return ClusterServer(ElectricalEnergyMeasurementCluster.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
533
839
|
accuracy: {
|
|
@@ -544,6 +850,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
544
850
|
cumulativeEnergyMeasured: true,
|
|
545
851
|
});
|
|
546
852
|
}
|
|
853
|
+
/**
|
|
854
|
+
* Get a default Electrical Power Measurement Cluster Server.
|
|
855
|
+
*
|
|
856
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
857
|
+
* @param {number} current - The current value in milliamperes.
|
|
858
|
+
* @param {number} power - The power value in milliwatts.
|
|
859
|
+
* @param {number} frequency - The frequency value in millihertz.
|
|
860
|
+
* @returns {ClusterServer} - The configured Electrical Power Measurement Cluster Server.
|
|
861
|
+
*/
|
|
547
862
|
getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
548
863
|
return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
549
864
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -584,6 +899,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
584
899
|
frequency: frequency,
|
|
585
900
|
}, {}, {});
|
|
586
901
|
}
|
|
902
|
+
/**
|
|
903
|
+
* Creates a default Dummy Thread Network Diagnostics Cluster server.
|
|
904
|
+
* @deprecated This method is deprecated and is only used for testing.
|
|
905
|
+
*
|
|
906
|
+
* @remarks
|
|
907
|
+
* This method adds a cluster server used only to give the networkName to Eve app.
|
|
908
|
+
*
|
|
909
|
+
* @returns void
|
|
910
|
+
*/
|
|
587
911
|
createDefaultDummyThreadNetworkDiagnosticsClusterServer() {
|
|
588
912
|
this.addClusterServer(ClusterServer(ThreadNetworkDiagnosticsCluster.with(ThreadNetworkDiagnostics.Feature.PacketCounts, ThreadNetworkDiagnostics.Feature.ErrorCounts), {
|
|
589
913
|
channel: 1,
|
|
@@ -611,6 +935,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
611
935
|
},
|
|
612
936
|
}, {}));
|
|
613
937
|
}
|
|
938
|
+
/**
|
|
939
|
+
* Get a default OnOff cluster server for light devices.
|
|
940
|
+
*
|
|
941
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
942
|
+
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
943
|
+
* @param {number} [onTime=0] - The on time value.
|
|
944
|
+
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
945
|
+
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
946
|
+
*
|
|
947
|
+
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
948
|
+
*/
|
|
614
949
|
getDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
615
950
|
return ClusterServer(OnOffCluster.with(OnOff.Feature.Lighting), {
|
|
616
951
|
onOff,
|
|
@@ -645,9 +980,25 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
645
980
|
},
|
|
646
981
|
}, {});
|
|
647
982
|
}
|
|
983
|
+
/**
|
|
984
|
+
* Creates a default OnOff cluster server for light devices.
|
|
985
|
+
*
|
|
986
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
987
|
+
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
988
|
+
* @param {number} [onTime=0] - The on time value.
|
|
989
|
+
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
990
|
+
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
991
|
+
*/
|
|
648
992
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
649
993
|
this.addClusterServer(this.getDefaultOnOffClusterServer(onOff, globalSceneControl, onTime, offWaitTime, startUpOnOff));
|
|
650
994
|
}
|
|
995
|
+
/**
|
|
996
|
+
* Get a DeadFront OnOff cluster server.
|
|
997
|
+
*
|
|
998
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
999
|
+
*
|
|
1000
|
+
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
1001
|
+
*/
|
|
651
1002
|
getDeadFrontOnOffClusterServer(onOff = false) {
|
|
652
1003
|
return ClusterServer(OnOffCluster.with(OnOff.Feature.DeadFrontBehavior), {
|
|
653
1004
|
onOff,
|
|
@@ -666,9 +1017,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
666
1017
|
},
|
|
667
1018
|
}, {});
|
|
668
1019
|
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Creates a DeadFront OnOff cluster server.
|
|
1022
|
+
*
|
|
1023
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1024
|
+
*/
|
|
669
1025
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
670
1026
|
this.addClusterServer(this.getDeadFrontOnOffClusterServer(onOff));
|
|
671
1027
|
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Get an OnOff cluster server without features.
|
|
1030
|
+
*
|
|
1031
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1032
|
+
*
|
|
1033
|
+
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
1034
|
+
*/
|
|
672
1035
|
getOnOffClusterServer(onOff = false) {
|
|
673
1036
|
return ClusterServer(OnOffCluster, {
|
|
674
1037
|
onOff,
|
|
@@ -687,9 +1050,23 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
687
1050
|
},
|
|
688
1051
|
}, {});
|
|
689
1052
|
}
|
|
1053
|
+
/**
|
|
1054
|
+
* Creates an OnOff cluster server without features.
|
|
1055
|
+
*
|
|
1056
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1057
|
+
*/
|
|
690
1058
|
createOnOffClusterServer(onOff = false) {
|
|
691
1059
|
this.addClusterServer(this.getOnOffClusterServer(onOff));
|
|
692
1060
|
}
|
|
1061
|
+
/**
|
|
1062
|
+
* Get a default level control cluster server.
|
|
1063
|
+
*
|
|
1064
|
+
* @param currentLevel - The current level (default: 254).
|
|
1065
|
+
* @param minLevel - The minimum level (default: 1).
|
|
1066
|
+
* @param maxLevel - The maximum level (default: 254).
|
|
1067
|
+
* @param onLevel - The on level (default: null).
|
|
1068
|
+
* @param startUpCurrentLevel - The startUp on level (default: null).
|
|
1069
|
+
*/
|
|
693
1070
|
getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
694
1071
|
return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
695
1072
|
currentLevel,
|
|
@@ -731,9 +1108,29 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
731
1108
|
},
|
|
732
1109
|
});
|
|
733
1110
|
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Creates a default level control cluster server.
|
|
1113
|
+
*
|
|
1114
|
+
* @param currentLevel - The current level (default: 254).
|
|
1115
|
+
* @param minLevel - The minimum level (default: 1).
|
|
1116
|
+
* @param maxLevel - The maximum level (default: 254).
|
|
1117
|
+
* @param onLevel - The on level (default: null).
|
|
1118
|
+
* @param startUpCurrentLevel - The startUp on level (default: null).
|
|
1119
|
+
*/
|
|
734
1120
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
735
1121
|
this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel, startUpCurrentLevel));
|
|
736
1122
|
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Get a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
1125
|
+
*
|
|
1126
|
+
* @param currentX - The current X value.
|
|
1127
|
+
* @param currentY - The current Y value.
|
|
1128
|
+
* @param currentHue - The current hue value.
|
|
1129
|
+
* @param currentSaturation - The current saturation value.
|
|
1130
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1131
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1132
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1133
|
+
*/
|
|
737
1134
|
getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
738
1135
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
739
1136
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -803,9 +1200,29 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
803
1200
|
},
|
|
804
1201
|
}, {});
|
|
805
1202
|
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
1205
|
+
*
|
|
1206
|
+
* @param currentX - The current X value.
|
|
1207
|
+
* @param currentY - The current Y value.
|
|
1208
|
+
* @param currentHue - The current hue value.
|
|
1209
|
+
* @param currentSaturation - The current saturation value.
|
|
1210
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1211
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1212
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1213
|
+
*/
|
|
806
1214
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
807
1215
|
this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
808
1216
|
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Get a Xy color control cluster server with Xy and ColorTemperature.
|
|
1219
|
+
*
|
|
1220
|
+
* @param currentX - The current X value.
|
|
1221
|
+
* @param currentY - The current Y value.
|
|
1222
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1223
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1224
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1225
|
+
*/
|
|
809
1226
|
getXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
810
1227
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
811
1228
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -849,9 +1266,27 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
849
1266
|
},
|
|
850
1267
|
}, {});
|
|
851
1268
|
}
|
|
1269
|
+
/**
|
|
1270
|
+
* Creates a Xy color control cluster server with Xy and ColorTemperature.
|
|
1271
|
+
*
|
|
1272
|
+
* @param currentX - The current X value.
|
|
1273
|
+
* @param currentY - The current Y value.
|
|
1274
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1275
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1276
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1277
|
+
*/
|
|
852
1278
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
853
1279
|
this.addClusterServer(this.getXyColorControlClusterServer(currentX, currentY, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
854
1280
|
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Get a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
|
|
1283
|
+
*
|
|
1284
|
+
* @param currentHue - The current hue value.
|
|
1285
|
+
* @param currentSaturation - The current saturation value.
|
|
1286
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1287
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1288
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1289
|
+
*/
|
|
855
1290
|
getHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
856
1291
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
857
1292
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -909,9 +1344,25 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
909
1344
|
},
|
|
910
1345
|
}, {});
|
|
911
1346
|
}
|
|
1347
|
+
/**
|
|
1348
|
+
* Creates a hue and saturation color control cluster server with HueSaturation and ColorTemperature.
|
|
1349
|
+
*
|
|
1350
|
+
* @param currentHue - The current hue value.
|
|
1351
|
+
* @param currentSaturation - The current saturation value.
|
|
1352
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1353
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1354
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1355
|
+
*/
|
|
912
1356
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
913
1357
|
this.addClusterServer(this.getHsColorControlClusterServer(currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
914
1358
|
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Get a color temperature color control cluster server.
|
|
1361
|
+
*
|
|
1362
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1363
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1364
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1365
|
+
*/
|
|
915
1366
|
getCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
916
1367
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.ColorTemperature), {
|
|
917
1368
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -943,9 +1394,30 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
943
1394
|
},
|
|
944
1395
|
}, {});
|
|
945
1396
|
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Creates a color temperature color control cluster server.
|
|
1399
|
+
*
|
|
1400
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1401
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1402
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1403
|
+
*/
|
|
946
1404
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
947
1405
|
this.addClusterServer(this.getCtColorControlClusterServer(colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
948
1406
|
}
|
|
1407
|
+
/**
|
|
1408
|
+
* Configures the color control cluster for a device.
|
|
1409
|
+
*
|
|
1410
|
+
* @remark This method must be called only after creating the cluster with getDefaultCompleteColorControlClusterServer or createDefaultCompleteColorControlClusterServer
|
|
1411
|
+
* and before starting the matter server.
|
|
1412
|
+
*
|
|
1413
|
+
* @deprecated Use configureColorControlMode instead.
|
|
1414
|
+
*
|
|
1415
|
+
* @param {boolean} hueSaturation - A boolean indicating whether the device supports hue and saturation control.
|
|
1416
|
+
* @param {boolean} xy - A boolean indicating whether the device supports XY control.
|
|
1417
|
+
* @param {boolean} colorTemperature - A boolean indicating whether the device supports color temperature control.
|
|
1418
|
+
* @param {ColorControl.ColorMode} colorMode - An optional parameter specifying the color mode of the device.
|
|
1419
|
+
* @param {Endpoint} endpoint - An optional parameter specifying the endpoint to configure. If not provided, the device endpoint will be used.
|
|
1420
|
+
*/
|
|
949
1421
|
configureColorControlCluster(hueSaturation, xy, colorTemperature, colorMode, endpoint) {
|
|
950
1422
|
if (!endpoint)
|
|
951
1423
|
endpoint = this;
|
|
@@ -956,6 +1428,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
956
1428
|
endpoint.getClusterServer(ColorControlCluster)?.setEnhancedColorModeAttribute(colorMode);
|
|
957
1429
|
}
|
|
958
1430
|
}
|
|
1431
|
+
/**
|
|
1432
|
+
* Configures the color control mode for the device.
|
|
1433
|
+
*
|
|
1434
|
+
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1435
|
+
* @param {Endpoint} endpoint - The optional endpoint to configure. If not provided, the method will configure the current endpoint.
|
|
1436
|
+
*/
|
|
959
1437
|
configureColorControlMode(colorMode, endpoint) {
|
|
960
1438
|
if (!endpoint)
|
|
961
1439
|
endpoint = this;
|
|
@@ -964,8 +1442,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
964
1442
|
endpoint.getClusterServer(ColorControlCluster)?.setEnhancedColorModeAttribute(colorMode);
|
|
965
1443
|
}
|
|
966
1444
|
}
|
|
1445
|
+
/**
|
|
1446
|
+
* Get a default window covering cluster server.
|
|
1447
|
+
*
|
|
1448
|
+
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
|
|
1449
|
+
*/
|
|
967
1450
|
getDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
968
|
-
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1451
|
+
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift /* , WindowCovering.Feature.AbsolutePosition*/), {
|
|
969
1452
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
970
1453
|
configStatus: {
|
|
971
1454
|
operational: true,
|
|
@@ -979,8 +1462,10 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
979
1462
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
980
1463
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
981
1464
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
982
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
983
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1465
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1466
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1467
|
+
// installedClosedLimitLift: 10000,
|
|
1468
|
+
// installedOpenLimitLift: 0,
|
|
984
1469
|
}, {
|
|
985
1470
|
upOrOpen: async (data) => {
|
|
986
1471
|
this.log.debug('Matter command: upOrOpen');
|
|
@@ -1001,9 +1486,18 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1001
1486
|
},
|
|
1002
1487
|
}, {});
|
|
1003
1488
|
}
|
|
1489
|
+
/**
|
|
1490
|
+
* Creates a default window covering cluster server.
|
|
1491
|
+
*
|
|
1492
|
+
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
|
|
1493
|
+
*/
|
|
1004
1494
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1005
1495
|
this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
|
|
1006
1496
|
}
|
|
1497
|
+
/**
|
|
1498
|
+
* Sets the window covering target position as the current position and stops the movement.
|
|
1499
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1500
|
+
*/
|
|
1007
1501
|
setWindowCoveringTargetAsCurrentAndStopped(endpoint) {
|
|
1008
1502
|
if (!endpoint)
|
|
1009
1503
|
endpoint = this;
|
|
@@ -1021,6 +1515,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1021
1515
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1022
1516
|
}
|
|
1023
1517
|
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Sets the current and target status of a window covering.
|
|
1520
|
+
* @param {number} current - The current position of the window covering.
|
|
1521
|
+
* @param {number} target - The target position of the window covering.
|
|
1522
|
+
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1523
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1524
|
+
*/
|
|
1024
1525
|
setWindowCoveringCurrentTargetStatus(current, target, status, endpoint) {
|
|
1025
1526
|
if (!endpoint)
|
|
1026
1527
|
endpoint = this;
|
|
@@ -1036,6 +1537,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1036
1537
|
}
|
|
1037
1538
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1038
1539
|
}
|
|
1540
|
+
/**
|
|
1541
|
+
* Sets the status of the window covering.
|
|
1542
|
+
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1543
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1544
|
+
*/
|
|
1039
1545
|
setWindowCoveringStatus(status, endpoint) {
|
|
1040
1546
|
if (!endpoint)
|
|
1041
1547
|
endpoint = this;
|
|
@@ -1045,6 +1551,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1045
1551
|
windowCovering.setOperationalStatusAttribute({ global: status, lift: status, tilt: status });
|
|
1046
1552
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1047
1553
|
}
|
|
1554
|
+
/**
|
|
1555
|
+
* Retrieves the status of the window covering.
|
|
1556
|
+
* @param {Endpoint} endpoint - The endpoint on which to get the window covering (default the device endpoint).
|
|
1557
|
+
*
|
|
1558
|
+
* @returns The global operational status of the window covering.
|
|
1559
|
+
*/
|
|
1048
1560
|
getWindowCoveringStatus(endpoint) {
|
|
1049
1561
|
if (!endpoint)
|
|
1050
1562
|
endpoint = this;
|
|
@@ -1055,6 +1567,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1055
1567
|
this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
|
|
1056
1568
|
return status.global;
|
|
1057
1569
|
}
|
|
1570
|
+
/**
|
|
1571
|
+
* Sets the target and current position of the window covering.
|
|
1572
|
+
*
|
|
1573
|
+
* @param position - The position to set, specified as a number.
|
|
1574
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1575
|
+
*/
|
|
1058
1576
|
setWindowCoveringTargetAndCurrentPosition(position, endpoint) {
|
|
1059
1577
|
if (!endpoint)
|
|
1060
1578
|
endpoint = this;
|
|
@@ -1065,6 +1583,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1065
1583
|
windowCovering.setTargetPositionLiftPercent100thsAttribute(position);
|
|
1066
1584
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
1067
1585
|
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Get a default door lock cluster server.
|
|
1588
|
+
*
|
|
1589
|
+
* @remarks
|
|
1590
|
+
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1591
|
+
*
|
|
1592
|
+
*/
|
|
1068
1593
|
getDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1069
1594
|
return ClusterServer(DoorLockCluster, {
|
|
1070
1595
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
@@ -1087,9 +1612,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1087
1612
|
lockOperationError: true,
|
|
1088
1613
|
});
|
|
1089
1614
|
}
|
|
1615
|
+
/**
|
|
1616
|
+
* Creates a default door lock cluster server.
|
|
1617
|
+
*
|
|
1618
|
+
* @remarks
|
|
1619
|
+
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1620
|
+
*
|
|
1621
|
+
*/
|
|
1090
1622
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1091
1623
|
this.addClusterServer(this.getDefaultDoorLockClusterServer(lockState, lockType));
|
|
1092
1624
|
}
|
|
1625
|
+
/**
|
|
1626
|
+
* Get a default momentary switch cluster server.
|
|
1627
|
+
*
|
|
1628
|
+
* @remarks
|
|
1629
|
+
* This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
|
|
1630
|
+
*/
|
|
1093
1631
|
getDefaultSwitchClusterServer() {
|
|
1094
1632
|
return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
|
|
1095
1633
|
numberOfPositions: 2,
|
|
@@ -1104,9 +1642,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1104
1642
|
multiPressComplete: true,
|
|
1105
1643
|
});
|
|
1106
1644
|
}
|
|
1645
|
+
/**
|
|
1646
|
+
* Creates a default momentary switch cluster server.
|
|
1647
|
+
*
|
|
1648
|
+
* @remarks
|
|
1649
|
+
* This method adds a cluster server with default momentary switch features and configurations.
|
|
1650
|
+
*/
|
|
1107
1651
|
createDefaultSwitchClusterServer() {
|
|
1108
1652
|
this.addClusterServer(this.getDefaultSwitchClusterServer());
|
|
1109
1653
|
}
|
|
1654
|
+
/**
|
|
1655
|
+
* Get a default latching switch cluster server.
|
|
1656
|
+
*
|
|
1657
|
+
* @remarks
|
|
1658
|
+
* This method adds a cluster server with default latching switch features and configuration.
|
|
1659
|
+
*/
|
|
1110
1660
|
getDefaultLatchingSwitchClusterServer() {
|
|
1111
1661
|
return ClusterServer(SwitchCluster.with(Switch.Feature.LatchingSwitch), {
|
|
1112
1662
|
numberOfPositions: 2,
|
|
@@ -1115,9 +1665,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1115
1665
|
switchLatched: true,
|
|
1116
1666
|
});
|
|
1117
1667
|
}
|
|
1668
|
+
/**
|
|
1669
|
+
* Creates a default latching switch cluster server.
|
|
1670
|
+
*
|
|
1671
|
+
* @remarks
|
|
1672
|
+
* This method adds a cluster server with default latching switch features and configuration.
|
|
1673
|
+
*/
|
|
1118
1674
|
createDefaultLatchingSwitchClusterServer() {
|
|
1119
1675
|
this.addClusterServer(this.getDefaultLatchingSwitchClusterServer());
|
|
1120
1676
|
}
|
|
1677
|
+
/**
|
|
1678
|
+
* Triggers a switch event on the specified endpoint.
|
|
1679
|
+
*
|
|
1680
|
+
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1681
|
+
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1682
|
+
* @returns {void}
|
|
1683
|
+
*/
|
|
1121
1684
|
triggerSwitchEvent(event, log, endpoint) {
|
|
1122
1685
|
if (!endpoint)
|
|
1123
1686
|
endpoint = this;
|
|
@@ -1189,6 +1752,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1189
1752
|
}
|
|
1190
1753
|
return true;
|
|
1191
1754
|
}
|
|
1755
|
+
/**
|
|
1756
|
+
* Retrieves the default mode select cluster server.
|
|
1757
|
+
*
|
|
1758
|
+
* @param description - The description of the cluster server.
|
|
1759
|
+
* @param supportedModes - The supported modes for the cluster server.
|
|
1760
|
+
* @param currentMode - The current mode of the cluster server. Defaults to 0.
|
|
1761
|
+
* @param startUpMode - The startup mode of the cluster server. Defaults to 0.
|
|
1762
|
+
* @returns The default mode select cluster server.
|
|
1763
|
+
*/
|
|
1192
1764
|
getDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1193
1765
|
return ClusterServer(ModeSelectCluster, {
|
|
1194
1766
|
description: description,
|
|
@@ -1203,11 +1775,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1203
1775
|
},
|
|
1204
1776
|
});
|
|
1205
1777
|
}
|
|
1778
|
+
/**
|
|
1779
|
+
* Creates a default mode select cluster server.
|
|
1780
|
+
*
|
|
1781
|
+
* @remarks
|
|
1782
|
+
* This method adds a cluster server for a mode select cluster with default settings.
|
|
1783
|
+
*
|
|
1784
|
+
* @param endpoint - The endpoint to add the cluster server to. Defaults to `this` if not provided.
|
|
1785
|
+
*/
|
|
1206
1786
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
|
|
1207
1787
|
if (!endpoint)
|
|
1208
1788
|
endpoint = this;
|
|
1209
1789
|
endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
|
|
1210
1790
|
}
|
|
1791
|
+
/**
|
|
1792
|
+
* Get a default occupancy sensing cluster server.
|
|
1793
|
+
*
|
|
1794
|
+
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1795
|
+
*/
|
|
1211
1796
|
getDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1212
1797
|
return ClusterServer(OccupancySensingCluster, {
|
|
1213
1798
|
occupancy: { occupied },
|
|
@@ -1216,9 +1801,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1216
1801
|
pirOccupiedToUnoccupiedDelay: 30,
|
|
1217
1802
|
}, {});
|
|
1218
1803
|
}
|
|
1804
|
+
/**
|
|
1805
|
+
* Creates a default occupancy sensing cluster server.
|
|
1806
|
+
*
|
|
1807
|
+
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1808
|
+
*/
|
|
1219
1809
|
createDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1220
1810
|
this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
|
|
1221
1811
|
}
|
|
1812
|
+
/**
|
|
1813
|
+
* Get a default Illuminance Measurement Cluster Server.
|
|
1814
|
+
*
|
|
1815
|
+
* @param measuredValue - The measured value of illuminance.
|
|
1816
|
+
*/
|
|
1222
1817
|
getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1223
1818
|
return ClusterServer(IlluminanceMeasurementCluster, {
|
|
1224
1819
|
measuredValue,
|
|
@@ -1227,9 +1822,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1227
1822
|
tolerance: 0,
|
|
1228
1823
|
}, {}, {});
|
|
1229
1824
|
}
|
|
1825
|
+
/**
|
|
1826
|
+
* Creates a default Illuminance Measurement Cluster Server.
|
|
1827
|
+
*
|
|
1828
|
+
* @param measuredValue - The measured value of illuminance.
|
|
1829
|
+
*/
|
|
1230
1830
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1231
1831
|
this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
|
|
1232
1832
|
}
|
|
1833
|
+
/**
|
|
1834
|
+
* Get a default flow measurement cluster server.
|
|
1835
|
+
*
|
|
1836
|
+
* @param measuredValue - The measured value of the flow in 10 x m/h.
|
|
1837
|
+
*/
|
|
1233
1838
|
getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1234
1839
|
return ClusterServer(FlowMeasurementCluster, {
|
|
1235
1840
|
measuredValue,
|
|
@@ -1238,9 +1843,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1238
1843
|
tolerance: 0,
|
|
1239
1844
|
}, {}, {});
|
|
1240
1845
|
}
|
|
1846
|
+
/**
|
|
1847
|
+
* Creates a default flow measurement cluster server.
|
|
1848
|
+
*
|
|
1849
|
+
* @param measuredValue - The measured value of the of the flow in 10 x m/h.
|
|
1850
|
+
*/
|
|
1241
1851
|
createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1242
1852
|
this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
|
|
1243
1853
|
}
|
|
1854
|
+
/**
|
|
1855
|
+
* Get a default temperature measurement cluster server.
|
|
1856
|
+
*
|
|
1857
|
+
* @param measuredValue - The measured value of the temperature x 100.
|
|
1858
|
+
*/
|
|
1244
1859
|
getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1245
1860
|
return ClusterServer(TemperatureMeasurementCluster, {
|
|
1246
1861
|
measuredValue,
|
|
@@ -1249,9 +1864,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1249
1864
|
tolerance: 0,
|
|
1250
1865
|
}, {}, {});
|
|
1251
1866
|
}
|
|
1867
|
+
/**
|
|
1868
|
+
* Creates a default temperature measurement cluster server.
|
|
1869
|
+
*
|
|
1870
|
+
* @param measuredValue - The measured value of the temperature x 100.
|
|
1871
|
+
*/
|
|
1252
1872
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1253
1873
|
this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
|
|
1254
1874
|
}
|
|
1875
|
+
/**
|
|
1876
|
+
* Get a default RelativeHumidityMeasurementCluster server.
|
|
1877
|
+
*
|
|
1878
|
+
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
1879
|
+
*/
|
|
1255
1880
|
getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1256
1881
|
return ClusterServer(RelativeHumidityMeasurementCluster, {
|
|
1257
1882
|
measuredValue,
|
|
@@ -1260,9 +1885,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1260
1885
|
tolerance: 0,
|
|
1261
1886
|
}, {}, {});
|
|
1262
1887
|
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Creates a default RelativeHumidityMeasurementCluster server.
|
|
1890
|
+
*
|
|
1891
|
+
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
1892
|
+
*/
|
|
1263
1893
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1264
1894
|
this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
|
|
1265
1895
|
}
|
|
1896
|
+
/**
|
|
1897
|
+
* Get a default Pressure Measurement Cluster Server.
|
|
1898
|
+
*
|
|
1899
|
+
* @param measuredValue - The measured value for the pressure.
|
|
1900
|
+
*/
|
|
1266
1901
|
getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1267
1902
|
return ClusterServer(PressureMeasurementCluster, {
|
|
1268
1903
|
measuredValue,
|
|
@@ -1271,19 +1906,39 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1271
1906
|
tolerance: 0,
|
|
1272
1907
|
}, {}, {});
|
|
1273
1908
|
}
|
|
1909
|
+
/**
|
|
1910
|
+
* Creates a default Pressure Measurement Cluster Server.
|
|
1911
|
+
*
|
|
1912
|
+
* @param measuredValue - The measured value for the pressure.
|
|
1913
|
+
*/
|
|
1274
1914
|
createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1275
1915
|
this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
|
|
1276
1916
|
}
|
|
1917
|
+
/**
|
|
1918
|
+
* Get a default boolean state cluster server.
|
|
1919
|
+
*
|
|
1920
|
+
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
1921
|
+
*/
|
|
1277
1922
|
getDefaultBooleanStateClusterServer(contact) {
|
|
1278
1923
|
return ClusterServer(BooleanStateCluster, {
|
|
1279
|
-
stateValue: contact ?? true,
|
|
1924
|
+
stateValue: contact ?? true, // true=contact false=no_contact
|
|
1280
1925
|
}, {}, {
|
|
1281
1926
|
stateChange: true,
|
|
1282
1927
|
});
|
|
1283
1928
|
}
|
|
1929
|
+
/**
|
|
1930
|
+
* Creates a default boolean state configuration cluster server.
|
|
1931
|
+
*
|
|
1932
|
+
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
1933
|
+
*/
|
|
1284
1934
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1285
1935
|
this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
|
|
1286
1936
|
}
|
|
1937
|
+
/**
|
|
1938
|
+
* Get a default boolean state configuration cluster server.
|
|
1939
|
+
*
|
|
1940
|
+
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1941
|
+
*/
|
|
1287
1942
|
getDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
1288
1943
|
return ClusterServer(BooleanStateConfigurationCluster.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel), {
|
|
1289
1944
|
currentSensitivityLevel: 0,
|
|
@@ -1292,6 +1947,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1292
1947
|
alarmsActive: { visual: false, audible: false },
|
|
1293
1948
|
alarmsEnabled: { visual: false, audible: false },
|
|
1294
1949
|
alarmsSupported: { visual: true, audible: true },
|
|
1950
|
+
// alarmsSuppressed: { visual: false, audible: false },
|
|
1295
1951
|
sensorFault: { generalFault: sensorFault },
|
|
1296
1952
|
}, {
|
|
1297
1953
|
enableDisableAlarm: async ({ request, attributes }) => {
|
|
@@ -1303,9 +1959,23 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1303
1959
|
sensorFault: true,
|
|
1304
1960
|
});
|
|
1305
1961
|
}
|
|
1962
|
+
/**
|
|
1963
|
+
* Creates a default boolean state configuration cluster server.
|
|
1964
|
+
*
|
|
1965
|
+
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1966
|
+
*/
|
|
1306
1967
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
1307
1968
|
this.addClusterServer(this.getDefaultBooleanStateConfigurationClusterServer(sensorFault));
|
|
1308
1969
|
}
|
|
1970
|
+
/**
|
|
1971
|
+
* Get a default power source replaceable battery cluster server.
|
|
1972
|
+
*
|
|
1973
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
1974
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
1975
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
1976
|
+
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
1977
|
+
* @param batQuantity - The battery quantity (default: 1).
|
|
1978
|
+
*/
|
|
1309
1979
|
getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
1310
1980
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
1311
1981
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -1322,9 +1992,25 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1322
1992
|
endpointList: [],
|
|
1323
1993
|
}, {}, {});
|
|
1324
1994
|
}
|
|
1995
|
+
/**
|
|
1996
|
+
* Creates a default power source replaceable battery cluster server.
|
|
1997
|
+
*
|
|
1998
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
1999
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2000
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
2001
|
+
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
2002
|
+
* @param batQuantity - The battery quantity (default: 1).
|
|
2003
|
+
*/
|
|
1325
2004
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
1326
2005
|
this.addClusterServer(this.getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity));
|
|
1327
2006
|
}
|
|
2007
|
+
/**
|
|
2008
|
+
* Get a default power source rechargeable battery cluster server.
|
|
2009
|
+
*
|
|
2010
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2011
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2012
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
2013
|
+
*/
|
|
1328
2014
|
getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
1329
2015
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
1330
2016
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -1342,9 +2028,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1342
2028
|
endpointList: [],
|
|
1343
2029
|
}, {}, {});
|
|
1344
2030
|
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Creates a default power source rechargeable battery cluster server.
|
|
2033
|
+
*
|
|
2034
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2035
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2036
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
2037
|
+
*/
|
|
1345
2038
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
1346
2039
|
this.addClusterServer(this.getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage));
|
|
1347
2040
|
}
|
|
2041
|
+
/**
|
|
2042
|
+
* Get a default power source wired cluster server.
|
|
2043
|
+
*
|
|
2044
|
+
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
2045
|
+
*/
|
|
1348
2046
|
getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
1349
2047
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Wired), {
|
|
1350
2048
|
wiredCurrentType,
|
|
@@ -1354,22 +2052,45 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1354
2052
|
endpointList: [],
|
|
1355
2053
|
}, {}, {});
|
|
1356
2054
|
}
|
|
2055
|
+
/**
|
|
2056
|
+
* Creates a default power source wired cluster server.
|
|
2057
|
+
*
|
|
2058
|
+
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
2059
|
+
*/
|
|
1357
2060
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
1358
2061
|
this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
|
|
1359
2062
|
}
|
|
2063
|
+
/**
|
|
2064
|
+
* @deprecated This function is deprecated by Matter 1.3 spec and will be removed in a future version.
|
|
2065
|
+
*/
|
|
1360
2066
|
createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
|
|
1361
2067
|
this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
|
|
1362
2068
|
sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
|
|
1363
2069
|
}, {}, {}));
|
|
1364
2070
|
}
|
|
2071
|
+
/**
|
|
2072
|
+
* Get a default air quality cluster server.
|
|
2073
|
+
*
|
|
2074
|
+
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2075
|
+
*/
|
|
1365
2076
|
getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1366
2077
|
return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1367
2078
|
airQuality,
|
|
1368
2079
|
}, {}, {});
|
|
1369
2080
|
}
|
|
2081
|
+
/**
|
|
2082
|
+
* Creates a default air quality cluster server.
|
|
2083
|
+
*
|
|
2084
|
+
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2085
|
+
*/
|
|
1370
2086
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1371
2087
|
this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
|
|
1372
2088
|
}
|
|
2089
|
+
/**
|
|
2090
|
+
* Get a default TVOC measurement cluster server.
|
|
2091
|
+
*
|
|
2092
|
+
* @param measuredValue - The measured value for TVOC.
|
|
2093
|
+
*/
|
|
1373
2094
|
getDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1374
2095
|
return ClusterServer(TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1375
2096
|
measuredValue,
|
|
@@ -1380,14 +2101,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1380
2101
|
measurementMedium,
|
|
1381
2102
|
}, {}, {});
|
|
1382
2103
|
}
|
|
2104
|
+
/**
|
|
2105
|
+
* Creates a default TVOC measurement cluster server.
|
|
2106
|
+
*
|
|
2107
|
+
* @param measuredValue - The measured value for TVOC.
|
|
2108
|
+
*/
|
|
1383
2109
|
createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1384
2110
|
this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1385
2111
|
}
|
|
2112
|
+
/**
|
|
2113
|
+
* Get a default heating thermostat cluster server with the specified parameters.
|
|
2114
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2115
|
+
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2116
|
+
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2117
|
+
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2118
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2119
|
+
*/
|
|
1386
2120
|
getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1387
2121
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
|
|
1388
2122
|
localTemperature: localTemperature * 100,
|
|
1389
2123
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1390
2124
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
2125
|
+
// Thermostat.Feature.Heating
|
|
1391
2126
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1392
2127
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1393
2128
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1400,14 +2135,31 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1400
2135
|
},
|
|
1401
2136
|
}, {});
|
|
1402
2137
|
}
|
|
2138
|
+
/**
|
|
2139
|
+
* Creates and adds a default heating thermostat cluster server to the device.
|
|
2140
|
+
*
|
|
2141
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2142
|
+
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2143
|
+
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2144
|
+
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2145
|
+
*/
|
|
1403
2146
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1404
2147
|
this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
|
|
1405
2148
|
}
|
|
2149
|
+
/**
|
|
2150
|
+
* Get a default cooling thermostat cluster server with the specified parameters.
|
|
2151
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2152
|
+
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2153
|
+
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2154
|
+
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2155
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2156
|
+
*/
|
|
1406
2157
|
getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1407
2158
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
|
|
1408
2159
|
localTemperature: localTemperature * 100,
|
|
1409
2160
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1410
2161
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
2162
|
+
// Thermostat.Feature.Cooling
|
|
1411
2163
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1412
2164
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1413
2165
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -1420,24 +2172,48 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1420
2172
|
},
|
|
1421
2173
|
}, {});
|
|
1422
2174
|
}
|
|
2175
|
+
/**
|
|
2176
|
+
* Creates and adds a default cooling thermostat cluster server to the device.
|
|
2177
|
+
*
|
|
2178
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2179
|
+
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2180
|
+
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2181
|
+
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2182
|
+
*/
|
|
1423
2183
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1424
2184
|
this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
1425
2185
|
}
|
|
2186
|
+
/**
|
|
2187
|
+
* Get a default thermostat cluster server with the specified parameters.
|
|
2188
|
+
*
|
|
2189
|
+
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2190
|
+
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2191
|
+
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2192
|
+
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2193
|
+
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2194
|
+
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2195
|
+
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2196
|
+
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2197
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2198
|
+
*/
|
|
1426
2199
|
getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1427
2200
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1428
2201
|
localTemperature: localTemperature * 100,
|
|
1429
2202
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1430
2203
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
2204
|
+
// Thermostat.Feature.Heating
|
|
1431
2205
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1432
2206
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1433
2207
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1434
2208
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1435
2209
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2210
|
+
// Thermostat.Feature.Cooling
|
|
1436
2211
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1437
2212
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1438
2213
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1439
2214
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1440
2215
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2216
|
+
// Thermostat.Feature.AutoMode
|
|
1441
2217
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1442
2218
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1443
2219
|
}, {
|
|
@@ -1447,9 +2223,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1447
2223
|
},
|
|
1448
2224
|
}, {});
|
|
1449
2225
|
}
|
|
2226
|
+
/**
|
|
2227
|
+
* Creates and adds a default thermostat cluster server to the device.
|
|
2228
|
+
*
|
|
2229
|
+
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2230
|
+
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2231
|
+
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2232
|
+
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2233
|
+
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2234
|
+
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2235
|
+
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2236
|
+
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2237
|
+
*/
|
|
1450
2238
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1451
2239
|
this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
1452
2240
|
}
|
|
2241
|
+
/**
|
|
2242
|
+
* Get a default dummy time sync cluster server. Only needed to create a thermostat.
|
|
2243
|
+
*/
|
|
1453
2244
|
getDefaultTimeSyncClusterServer() {
|
|
1454
2245
|
return ClusterServer(TimeSynchronizationCluster.with(TimeSynchronization.Feature.TimeZone), {
|
|
1455
2246
|
utcTime: null,
|
|
@@ -1481,9 +2272,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1481
2272
|
timeFailure: true,
|
|
1482
2273
|
});
|
|
1483
2274
|
}
|
|
2275
|
+
/**
|
|
2276
|
+
* Creates a default dummy time sync cluster server. Only needed to create a thermostat.
|
|
2277
|
+
*/
|
|
1484
2278
|
createDefaultTimeSyncClusterServer() {
|
|
1485
2279
|
this.addClusterServer(this.getDefaultTimeSyncClusterServer());
|
|
1486
2280
|
}
|
|
2281
|
+
/**
|
|
2282
|
+
* Returns the default SmokeCOAlarm Cluster Server.
|
|
2283
|
+
*
|
|
2284
|
+
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2285
|
+
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2286
|
+
* @returns The default SmokeCOAlarmClusterServer.
|
|
2287
|
+
*/
|
|
1487
2288
|
getDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1488
2289
|
return ClusterServer(SmokeCoAlarmCluster.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm), {
|
|
1489
2290
|
smokeState,
|
|
@@ -1515,9 +2316,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1515
2316
|
allClear: true,
|
|
1516
2317
|
});
|
|
1517
2318
|
}
|
|
2319
|
+
/**
|
|
2320
|
+
* Create the default SmokeCOAlarm Cluster Server.
|
|
2321
|
+
*
|
|
2322
|
+
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2323
|
+
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2324
|
+
* @returns The default SmokeCOAlarmClusterServer.
|
|
2325
|
+
*/
|
|
1518
2326
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1519
2327
|
this.addClusterServer(this.getDefaultSmokeCOAlarmClusterServer(smokeState, coState));
|
|
1520
2328
|
}
|
|
2329
|
+
/**
|
|
2330
|
+
* Returns the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2331
|
+
*
|
|
2332
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2333
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2334
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2335
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2336
|
+
*/
|
|
1521
2337
|
getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1522
2338
|
return ClusterServer(CarbonMonoxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1523
2339
|
measuredValue,
|
|
@@ -1528,9 +2344,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1528
2344
|
measurementMedium,
|
|
1529
2345
|
}, {}, {});
|
|
1530
2346
|
}
|
|
2347
|
+
/**
|
|
2348
|
+
* Create the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2349
|
+
*
|
|
2350
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2351
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2352
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2353
|
+
*/
|
|
1531
2354
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1532
2355
|
this.addClusterServer(this.getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1533
2356
|
}
|
|
2357
|
+
/**
|
|
2358
|
+
* Returns the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2359
|
+
*
|
|
2360
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2361
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2362
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2363
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2364
|
+
*/
|
|
1534
2365
|
getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1535
2366
|
return ClusterServer(CarbonDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1536
2367
|
measuredValue,
|
|
@@ -1541,9 +2372,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1541
2372
|
measurementMedium,
|
|
1542
2373
|
}, {}, {});
|
|
1543
2374
|
}
|
|
2375
|
+
/**
|
|
2376
|
+
* Create the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2377
|
+
*
|
|
2378
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2379
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2380
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2381
|
+
*/
|
|
1544
2382
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1545
2383
|
this.addClusterServer(this.getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1546
2384
|
}
|
|
2385
|
+
/**
|
|
2386
|
+
* Returns the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2387
|
+
*
|
|
2388
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2389
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2390
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2391
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2392
|
+
*/
|
|
1547
2393
|
getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1548
2394
|
return ClusterServer(FormaldehydeConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1549
2395
|
measuredValue,
|
|
@@ -1554,9 +2400,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1554
2400
|
measurementMedium,
|
|
1555
2401
|
}, {}, {});
|
|
1556
2402
|
}
|
|
2403
|
+
/**
|
|
2404
|
+
* Create the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2405
|
+
*
|
|
2406
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2407
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2408
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2409
|
+
*/
|
|
1557
2410
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1558
2411
|
this.addClusterServer(this.getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1559
2412
|
}
|
|
2413
|
+
/**
|
|
2414
|
+
* Returns the default Pm1 Concentration Measurement Cluster Server.
|
|
2415
|
+
*
|
|
2416
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2417
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2418
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2419
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2420
|
+
*/
|
|
1560
2421
|
getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1561
2422
|
return ClusterServer(Pm1ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1562
2423
|
measuredValue,
|
|
@@ -1567,9 +2428,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1567
2428
|
measurementMedium,
|
|
1568
2429
|
}, {}, {});
|
|
1569
2430
|
}
|
|
2431
|
+
/**
|
|
2432
|
+
* Create the default Pm1 Concentration Measurement Cluster Server.
|
|
2433
|
+
*
|
|
2434
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2435
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2436
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2437
|
+
*/
|
|
1570
2438
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1571
2439
|
this.addClusterServer(this.getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1572
2440
|
}
|
|
2441
|
+
/**
|
|
2442
|
+
* Returns the default Pm25 Concentration Measurement Cluster Server.
|
|
2443
|
+
*
|
|
2444
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2445
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2446
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2447
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2448
|
+
*/
|
|
1573
2449
|
getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1574
2450
|
return ClusterServer(Pm25ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1575
2451
|
measuredValue,
|
|
@@ -1580,9 +2456,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1580
2456
|
measurementMedium,
|
|
1581
2457
|
}, {}, {});
|
|
1582
2458
|
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Create the default Pm25 Concentration Measurement Cluster Server.
|
|
2461
|
+
*
|
|
2462
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2463
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2464
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2465
|
+
*/
|
|
1583
2466
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1584
2467
|
this.addClusterServer(this.getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1585
2468
|
}
|
|
2469
|
+
/**
|
|
2470
|
+
* Returns the default Pm10 Concentration Measurement Cluster Server.
|
|
2471
|
+
*
|
|
2472
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2473
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2474
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2475
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2476
|
+
*/
|
|
1586
2477
|
getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1587
2478
|
return ClusterServer(Pm10ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1588
2479
|
measuredValue,
|
|
@@ -1593,9 +2484,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1593
2484
|
measurementMedium,
|
|
1594
2485
|
}, {}, {});
|
|
1595
2486
|
}
|
|
2487
|
+
/**
|
|
2488
|
+
* Create the default Pm10 Concentration Measurement Cluster Server.
|
|
2489
|
+
*
|
|
2490
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2491
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2492
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2493
|
+
*/
|
|
1596
2494
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1597
2495
|
this.addClusterServer(this.getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1598
2496
|
}
|
|
2497
|
+
/**
|
|
2498
|
+
* Returns the default Ozone Concentration Measurement Cluster Server.
|
|
2499
|
+
*
|
|
2500
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2501
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2502
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2503
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2504
|
+
*/
|
|
1599
2505
|
getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1600
2506
|
return ClusterServer(OzoneConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1601
2507
|
measuredValue,
|
|
@@ -1606,9 +2512,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1606
2512
|
measurementMedium,
|
|
1607
2513
|
}, {}, {});
|
|
1608
2514
|
}
|
|
2515
|
+
/**
|
|
2516
|
+
* Create the default Ozone Concentration Measurement Cluster Server.
|
|
2517
|
+
*
|
|
2518
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2519
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2520
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2521
|
+
*/
|
|
1609
2522
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1610
2523
|
this.addClusterServer(this.getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1611
2524
|
}
|
|
2525
|
+
/**
|
|
2526
|
+
* Returns the default Radon Concentration Measurement Cluster Server.
|
|
2527
|
+
*
|
|
2528
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2529
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2530
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2531
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2532
|
+
*/
|
|
1612
2533
|
getDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1613
2534
|
return ClusterServer(RadonConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1614
2535
|
measuredValue,
|
|
@@ -1619,9 +2540,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1619
2540
|
measurementMedium,
|
|
1620
2541
|
}, {}, {});
|
|
1621
2542
|
}
|
|
2543
|
+
/**
|
|
2544
|
+
* Create the default Radon Concentration Measurement Cluster Server.
|
|
2545
|
+
*
|
|
2546
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2547
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2548
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2549
|
+
*/
|
|
1622
2550
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1623
2551
|
this.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1624
2552
|
}
|
|
2553
|
+
/**
|
|
2554
|
+
* Returns the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2555
|
+
*
|
|
2556
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2557
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2558
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2559
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2560
|
+
*/
|
|
1625
2561
|
getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1626
2562
|
return ClusterServer(NitrogenDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1627
2563
|
measuredValue,
|
|
@@ -1632,9 +2568,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1632
2568
|
measurementMedium,
|
|
1633
2569
|
}, {}, {});
|
|
1634
2570
|
}
|
|
2571
|
+
/**
|
|
2572
|
+
* Create the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2573
|
+
*
|
|
2574
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2575
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2576
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2577
|
+
*/
|
|
1635
2578
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1636
2579
|
this.addClusterServer(this.getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1637
2580
|
}
|
|
2581
|
+
/**
|
|
2582
|
+
* Returns the default fan control cluster server rev 2.
|
|
2583
|
+
*
|
|
2584
|
+
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2585
|
+
* @returns The default fan control cluster server.
|
|
2586
|
+
*/
|
|
1638
2587
|
getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1639
2588
|
return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1640
2589
|
fanMode,
|
|
@@ -1651,9 +2600,74 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1651
2600
|
},
|
|
1652
2601
|
}, {});
|
|
1653
2602
|
}
|
|
2603
|
+
/**
|
|
2604
|
+
* Create the default fan control cluster server rev 2.
|
|
2605
|
+
*
|
|
2606
|
+
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2607
|
+
* @returns The default fan control cluster server.
|
|
2608
|
+
*/
|
|
1654
2609
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1655
2610
|
this.addClusterServer(this.getDefaultFanControlClusterServer(fanMode));
|
|
1656
2611
|
}
|
|
2612
|
+
/**
|
|
2613
|
+
* Returns the default Pump Configuration And Control cluster server.
|
|
2614
|
+
*
|
|
2615
|
+
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
2616
|
+
* @returns {ClusterServer} - The default Pump Configuration And Control cluster server.
|
|
2617
|
+
*/
|
|
2618
|
+
getDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
2619
|
+
return ClusterServer(PumpConfigurationAndControlCluster.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
2620
|
+
minConstSpeed: null,
|
|
2621
|
+
maxConstSpeed: null,
|
|
2622
|
+
maxPressure: null,
|
|
2623
|
+
maxSpeed: null,
|
|
2624
|
+
maxFlow: null,
|
|
2625
|
+
effectiveOperationMode: pumpMode,
|
|
2626
|
+
effectiveControlMode: PumpConfigurationAndControl.ControlMode.ConstantSpeed,
|
|
2627
|
+
capacity: null,
|
|
2628
|
+
operationMode: pumpMode,
|
|
2629
|
+
}, {}, {});
|
|
2630
|
+
}
|
|
2631
|
+
/**
|
|
2632
|
+
* Creates the default Pump Configuration And Control cluster server.
|
|
2633
|
+
*
|
|
2634
|
+
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
2635
|
+
* @returns {void}
|
|
2636
|
+
*/
|
|
2637
|
+
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
2638
|
+
this.addClusterServer(this.getDefaultPumpConfigurationAndControlClusterServer(pumpMode));
|
|
2639
|
+
}
|
|
2640
|
+
getDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
2641
|
+
return ClusterServer(ValveConfigurationAndControlCluster.with(ValveConfigurationAndControl.Feature.Level), {
|
|
2642
|
+
currentState: valveState,
|
|
2643
|
+
targetState: valveState,
|
|
2644
|
+
currentLevel: valveLevel,
|
|
2645
|
+
targetLevel: valveLevel,
|
|
2646
|
+
openDuration: null,
|
|
2647
|
+
defaultOpenDuration: null,
|
|
2648
|
+
remainingDuration: null,
|
|
2649
|
+
}, {
|
|
2650
|
+
open: async (data) => {
|
|
2651
|
+
this.log.debug('Matter command: open', data.request);
|
|
2652
|
+
await this.commandHandler.executeHandler('open', data);
|
|
2653
|
+
},
|
|
2654
|
+
close: async (data) => {
|
|
2655
|
+
this.log.debug('Matter command: close');
|
|
2656
|
+
await this.commandHandler.executeHandler('close', data);
|
|
2657
|
+
},
|
|
2658
|
+
}, {});
|
|
2659
|
+
}
|
|
2660
|
+
/**
|
|
2661
|
+
* Create the default Valve Configuration And Control cluster server rev 2.
|
|
2662
|
+
*
|
|
2663
|
+
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
2664
|
+
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
2665
|
+
* @returns {void}
|
|
2666
|
+
*/
|
|
2667
|
+
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
2668
|
+
this.addClusterServer(this.getDefaultValveConfigurationAndControlClusterServer(valveState, valveLevel));
|
|
2669
|
+
}
|
|
2670
|
+
// NOTE Support of Device Energy Management Cluster is provisional.
|
|
1657
2671
|
getDefaultDeviceEnergyManagementClusterServer() {
|
|
1658
2672
|
return ClusterServer(DeviceEnergyManagementCluster.with(DeviceEnergyManagement.Feature.Pausable, DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.StateForecastReporting), {
|
|
1659
2673
|
esaType: DeviceEnergyManagement.EsaType.Other,
|
|
@@ -1677,6 +2691,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1677
2691
|
resumed: true,
|
|
1678
2692
|
});
|
|
1679
2693
|
}
|
|
2694
|
+
// NOTE Support of Device Energy Management Mode Cluster is provisional.
|
|
1680
2695
|
getDefaultDeviceEnergyManagementModeClusterServer() {
|
|
1681
2696
|
return ClusterServer(DeviceEnergyManagementModeCluster, {
|
|
1682
2697
|
supportedModes: [
|
|
@@ -1693,3 +2708,4 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1693
2708
|
}, {});
|
|
1694
2709
|
}
|
|
1695
2710
|
}
|
|
2711
|
+
//# sourceMappingURL=matterbridgeDevice.js.map
|