matterbridge 1.6.8-dev.1 → 1.6.8-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -1
- package/README-SERVICE.md +12 -3
- package/README.md +2 -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.map +1 -0
- package/dist/cluster/export.js +2 -0
- package/dist/cluster/export.js.map +1 -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.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -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.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 +661 -62
- package/dist/matterbridge.js.map +1 -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 +116 -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 +1142 -0
- package/dist/matterbridgeDevice.d.ts.map +1 -0
- package/dist/matterbridgeDevice.js +1009 -8
- 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 +82 -11
- package/dist/matterbridgeDeviceTypes.js.map +1 -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 +90 -0
- package/dist/matterbridgeEdge.d.ts.map +1 -0
- package/dist/matterbridgeEdge.js +529 -0
- package/dist/matterbridgeEdge.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +1134 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +1134 -11
- 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.map +1 -0
- package/dist/matterbridgeTypes.js +24 -0
- package/dist/matterbridgeTypes.js.map +1 -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.map +1 -0
- package/dist/storage/export.js +1 -0
- package/dist/storage/export.js.map +1 -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.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 +1 -1
|
@@ -1,15 +1,41 @@
|
|
|
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
|
|
1
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,22 @@ 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
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
80
152
|
addChildDeviceType(endpointName, deviceTypes, options = {}, debug = false) {
|
|
81
153
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
82
154
|
let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
@@ -101,6 +173,23 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
101
173
|
child.setDeviceTypes(childDeviceTypes);
|
|
102
174
|
return child;
|
|
103
175
|
}
|
|
176
|
+
/**
|
|
177
|
+
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
178
|
+
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
179
|
+
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
180
|
+
*
|
|
181
|
+
* @param {string} endpointName - The name of the new enpoint to add.
|
|
182
|
+
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
183
|
+
* @param {ClusterId[]} [includeServerList=[]] - The list of cluster IDs to include.
|
|
184
|
+
* @param {EndpointOptions} [options={}] - The options for the device.
|
|
185
|
+
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
186
|
+
* @returns {MatterbridgeDevice} - The child endpoint that was found or added.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
104
193
|
addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
|
|
105
194
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
106
195
|
let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
@@ -133,6 +222,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
133
222
|
this.addClusterServerFromList(child, includeServerList);
|
|
134
223
|
return child;
|
|
135
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
227
|
+
*
|
|
228
|
+
* @param {Endpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
229
|
+
* @returns {Endpoint} The updated endpoint with the required cluster servers added.
|
|
230
|
+
*/
|
|
136
231
|
addRequiredClusterServers(endpoint) {
|
|
137
232
|
const requiredServerList = [];
|
|
138
233
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.name}${db}`);
|
|
@@ -149,6 +244,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
149
244
|
this.addClusterServerFromList(endpoint, requiredServerList);
|
|
150
245
|
return endpoint;
|
|
151
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
249
|
+
*
|
|
250
|
+
* @param {Endpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
251
|
+
* @returns {Endpoint} The updated endpoint with the required cluster servers added.
|
|
252
|
+
*/
|
|
152
253
|
addOptionalClusterServers(endpoint) {
|
|
153
254
|
const optionalServerList = [];
|
|
154
255
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.name}${db}`);
|
|
@@ -165,11 +266,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
165
266
|
this.addClusterServerFromList(endpoint, optionalServerList);
|
|
166
267
|
return endpoint;
|
|
167
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* Adds cluster servers to the specified endpoint based on the provided server list.
|
|
271
|
+
*
|
|
272
|
+
* @param {Endpoint} endpoint - The endpoint to add cluster servers to.
|
|
273
|
+
* @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
|
|
274
|
+
* @returns {Endpoint} The updated endpoint with the cluster servers added.
|
|
275
|
+
*/
|
|
168
276
|
addClusterServerFromList(endpoint, includeServerList) {
|
|
169
277
|
if (includeServerList.includes(Identify.Cluster.id))
|
|
170
278
|
endpoint.addClusterServer(this.getDefaultIdentifyClusterServer());
|
|
171
279
|
if (includeServerList.includes(Groups.Cluster.id))
|
|
172
280
|
endpoint.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
281
|
+
// if (includeServerList.includes(ScenesManagement.Cluster.id)) endpoint.addClusterServer(this.getDefaultScenesClusterServer());
|
|
173
282
|
if (includeServerList.includes(OnOff.Cluster.id))
|
|
174
283
|
endpoint.addClusterServer(this.getDefaultOnOffClusterServer());
|
|
175
284
|
if (includeServerList.includes(LevelControl.Cluster.id))
|
|
@@ -242,9 +351,25 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
242
351
|
endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementModeClusterServer());
|
|
243
352
|
return endpoint;
|
|
244
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* Retrieves a child endpoint by its name.
|
|
356
|
+
*
|
|
357
|
+
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
358
|
+
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
359
|
+
*/
|
|
245
360
|
getChildEndpointByName(endpointName) {
|
|
246
361
|
return this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
247
362
|
}
|
|
363
|
+
/**
|
|
364
|
+
* Retrieves the value of the specified attribute from the given endpoint and cluster.
|
|
365
|
+
*
|
|
366
|
+
* @param {ClusterId} clusterId - The ID of the cluster to retrieve the attribute from.
|
|
367
|
+
* @param {string} attribute - The name of the attribute to retrieve.
|
|
368
|
+
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
369
|
+
* @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the attribute from.
|
|
370
|
+
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
371
|
+
*/
|
|
372
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
248
373
|
getAttribute(clusterId, attribute, log, endpoint) {
|
|
249
374
|
if (!endpoint)
|
|
250
375
|
endpoint = this;
|
|
@@ -258,15 +383,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
258
383
|
this.log.error(`getAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
259
384
|
return undefined;
|
|
260
385
|
}
|
|
386
|
+
// Find the getter method
|
|
387
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
261
388
|
if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
|
|
262
389
|
this.log.error(`getAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
263
390
|
return undefined;
|
|
264
391
|
}
|
|
392
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
265
393
|
const getter = clusterServer[`get${capitalizedAttributeName}Attribute`];
|
|
266
394
|
const value = getter();
|
|
267
395
|
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
396
|
return value;
|
|
269
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* Sets the value of an attribute on a cluster server endpoint.
|
|
400
|
+
*
|
|
401
|
+
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
402
|
+
* @param {string} attribute - The name of the attribute.
|
|
403
|
+
* @param {any} value - The value to set for the attribute.
|
|
404
|
+
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
405
|
+
* @param {Endpoint} [endpoint] - (Optional) The endpoint to set the attribute on. If not provided, the attribute will be set on the current endpoint.
|
|
406
|
+
*/
|
|
407
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
270
408
|
setAttribute(clusterId, attribute, value, log, endpoint) {
|
|
271
409
|
if (!endpoint)
|
|
272
410
|
endpoint = this;
|
|
@@ -280,15 +418,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
280
418
|
this.log.error(`setAttribute error: Attribute ${attribute} not found on Cluster ${clusterId} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
281
419
|
return false;
|
|
282
420
|
}
|
|
421
|
+
// Find the getter method
|
|
422
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
283
423
|
if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
|
|
284
424
|
this.log.error(`setAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
285
425
|
return false;
|
|
286
426
|
}
|
|
427
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
287
428
|
const getter = clusterServer[`get${capitalizedAttributeName}Attribute`];
|
|
429
|
+
// Find the setter method
|
|
430
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
288
431
|
if (!clusterServer[`set${capitalizedAttributeName}Attribute`]) {
|
|
289
432
|
this.log.error(`setAttribute error: Setter set${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
290
433
|
return false;
|
|
291
434
|
}
|
|
435
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
292
436
|
const setter = clusterServer[`set${capitalizedAttributeName}Attribute`];
|
|
293
437
|
const oldValue = getter();
|
|
294
438
|
setter(value);
|
|
@@ -297,6 +441,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
297
441
|
`to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
298
442
|
return true;
|
|
299
443
|
}
|
|
444
|
+
/**
|
|
445
|
+
* Subscribes to an attribute on a cluster.
|
|
446
|
+
*
|
|
447
|
+
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
448
|
+
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
449
|
+
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
450
|
+
* @param {AnsiLogger} log - (Optional) An AnsiLogger instance for logging errors and information.
|
|
451
|
+
* @param {Endpoint} endpoint - (Optional) The endpoint to subscribe the attribute on. If not provided, the current endpoint will be used.
|
|
452
|
+
* @returns A boolean indicating whether the subscription was successful.
|
|
453
|
+
*/
|
|
454
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
300
455
|
subscribeAttribute(clusterId, attribute, listener, log, endpoint) {
|
|
301
456
|
if (!endpoint)
|
|
302
457
|
endpoint = this;
|
|
@@ -310,15 +465,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
310
465
|
this.log.error(`subscribeAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
311
466
|
return false;
|
|
312
467
|
}
|
|
468
|
+
// Find the subscribe method
|
|
469
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
313
470
|
if (!clusterServer[`subscribe${capitalizedAttributeName}Attribute`]) {
|
|
314
471
|
this.log.error(`subscribeAttribute error: subscribe${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
315
472
|
return false;
|
|
316
473
|
}
|
|
474
|
+
// Subscribe to the attribute
|
|
475
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
317
476
|
const subscribe = clusterServer[`subscribe${capitalizedAttributeName}Attribute`];
|
|
318
477
|
subscribe(listener);
|
|
319
478
|
log?.info(`${db}Subscribe endpoint ${or}${endpoint.name}:${endpoint.number}${db} attribute ${hk}${clusterServer.name}.${capitalizedAttributeName}${db}`);
|
|
320
479
|
return true;
|
|
321
480
|
}
|
|
481
|
+
/**
|
|
482
|
+
* Triggers the specified event of the specified cluster from the given endpoint and cluster.
|
|
483
|
+
*
|
|
484
|
+
* @param {ClusterId} clusterId - The ID of the cluster to retrieve the event from.
|
|
485
|
+
* @param {string} event - The name of the event to trigger.
|
|
486
|
+
* @param {Record<string, any>} payload - The payload of the event to trigger.
|
|
487
|
+
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
488
|
+
* @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the event from.
|
|
489
|
+
*/
|
|
322
490
|
triggerEvent(clusterId, event, payload, log, endpoint) {
|
|
323
491
|
if (!endpoint)
|
|
324
492
|
endpoint = this;
|
|
@@ -334,20 +502,43 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
334
502
|
this.log.error(`triggerEvent error: Event ${event} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
335
503
|
return;
|
|
336
504
|
}
|
|
505
|
+
// Find the getter method
|
|
506
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
337
507
|
if (!clusterServer[`trigger${capitalizedEventName}Event`]) {
|
|
338
508
|
this.log.error(`triggerEvent error: Trigger trigger${capitalizedEventName}Event not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
339
509
|
return;
|
|
340
510
|
}
|
|
511
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
341
512
|
const trigger = clusterServer[`trigger${capitalizedEventName}Event`];
|
|
342
513
|
trigger(payload);
|
|
343
514
|
log?.info(`${db}Trigger event ${hk}${clusterServer.name}.${capitalizedEventName}${db} on endpoint ${or}${endpoint.name}:${endpoint.number}${db}`);
|
|
344
515
|
}
|
|
516
|
+
/**
|
|
517
|
+
* Adds a tag to the tag list of the specified endpoint.
|
|
518
|
+
*
|
|
519
|
+
* @param {Endpoint} endpoint - The endpoint to add the tag to.
|
|
520
|
+
* @param {VendorId | null} mfgCode - The manufacturer code.
|
|
521
|
+
* @param {number} namespaceId - The namespace ID of the tag.
|
|
522
|
+
* @param {number} tag - The tag number.
|
|
523
|
+
* @param {string | null} [label=null] - The label for the tag.
|
|
524
|
+
*
|
|
525
|
+
* @remarks
|
|
526
|
+
* This method is used to add a tag to the tag list of a given endpoint.
|
|
527
|
+
* 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.
|
|
528
|
+
*
|
|
529
|
+
* Example usage:
|
|
530
|
+
* ```typescript
|
|
531
|
+
* this.addTagList(endpoint, null, NumberTag.One.namespaceId, NumberTag.One.tag, 'Label');
|
|
532
|
+
* this.addTagList(endpoint, null, SwitchesTag.Custom.namespaceId, SwitchesTag.Custom.tag, 'Label');
|
|
533
|
+
* ```
|
|
534
|
+
*/
|
|
345
535
|
addTagList(endpoint, mfgCode, namespaceId, tag, label) {
|
|
346
536
|
const descriptor = endpoint.getClusterServer(DescriptorCluster.with(Descriptor.Feature.TagList));
|
|
347
537
|
if (!descriptor) {
|
|
348
538
|
this.log.error(`addTagList: descriptor cluster not found on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
349
539
|
return;
|
|
350
540
|
}
|
|
541
|
+
// tagList: { mfgCode: VendorId | null; namespaceId: number; tag: number; label?: string | null }[] = [];
|
|
351
542
|
if (descriptor.attributes.tagList) {
|
|
352
543
|
this.log.debug(`addTagList: adding ${CYAN}tagList${db} mfCode: ${mfgCode}, namespaceId: ${namespaceId}, tag: ${tag}, label: ${label} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
353
544
|
const tagList = descriptor.attributes.tagList.getLocal();
|
|
@@ -363,6 +554,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
363
554
|
partsList: [...descriptor.attributes.partsList.getLocal()],
|
|
364
555
|
}, {}, {}));
|
|
365
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Serializes the Matterbridge device into a serialized object.
|
|
559
|
+
*
|
|
560
|
+
* @param pluginName - The name of the plugin.
|
|
561
|
+
* @returns The serialized Matterbridge device object.
|
|
562
|
+
*/
|
|
366
563
|
serialize() {
|
|
367
564
|
if (!this.serialNumber || !this.deviceName || !this.uniqueId)
|
|
368
565
|
return;
|
|
@@ -387,6 +584,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
387
584
|
});
|
|
388
585
|
return serialized;
|
|
389
586
|
}
|
|
587
|
+
/**
|
|
588
|
+
* Deserializes the device into a serialized object.
|
|
589
|
+
*
|
|
590
|
+
* @returns The deserialized MatterbridgeDevice.
|
|
591
|
+
*/
|
|
390
592
|
static deserialize(serializedDevice) {
|
|
391
593
|
const device = new MatterbridgeDevice(serializedDevice.deviceTypes);
|
|
392
594
|
device.serialNumber = serializedDevice.serialNumber;
|
|
@@ -402,6 +604,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
402
604
|
}
|
|
403
605
|
return device;
|
|
404
606
|
}
|
|
607
|
+
/**
|
|
608
|
+
* Get a default IdentifyCluster server.
|
|
609
|
+
*/
|
|
405
610
|
getDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
406
611
|
return ClusterServer(IdentifyCluster, {
|
|
407
612
|
identifyTime,
|
|
@@ -417,29 +622,91 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
417
622
|
},
|
|
418
623
|
});
|
|
419
624
|
}
|
|
625
|
+
/**
|
|
626
|
+
* Creates a default IdentifyCluster server.
|
|
627
|
+
*/
|
|
420
628
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
421
629
|
this.addClusterServer(this.getDefaultIdentifyClusterServer(identifyTime, identifyType));
|
|
422
630
|
return this;
|
|
423
631
|
}
|
|
632
|
+
/**
|
|
633
|
+
* Get a default IdentifyCluster server.
|
|
634
|
+
*/
|
|
424
635
|
getDefaultGroupsClusterServer() {
|
|
425
636
|
return ClusterServer(GroupsCluster, {
|
|
426
637
|
nameSupport: {
|
|
427
638
|
nameSupport: true,
|
|
428
639
|
},
|
|
429
640
|
}, GroupsClusterHandler());
|
|
641
|
+
// return createDefaultGroupsClusterServer();
|
|
430
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Creates a default groups cluster server and adds it to the device.
|
|
645
|
+
*/
|
|
431
646
|
createDefaultGroupsClusterServer() {
|
|
432
647
|
this.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
648
|
+
return this;
|
|
433
649
|
}
|
|
650
|
+
/**
|
|
651
|
+
* Get a default scenes cluster server and adds it to the current instance.
|
|
652
|
+
* @deprecated This method is deprecated.
|
|
653
|
+
*
|
|
654
|
+
*/
|
|
434
655
|
getDefaultScenesClusterServer() {
|
|
435
|
-
|
|
656
|
+
/*
|
|
657
|
+
return ClusterServer(
|
|
658
|
+
ScenesCluster,
|
|
659
|
+
{
|
|
660
|
+
sceneCount: 0,
|
|
661
|
+
currentScene: 0,
|
|
662
|
+
currentGroup: GroupId(0),
|
|
663
|
+
sceneValid: false,
|
|
664
|
+
nameSupport: {
|
|
665
|
+
nameSupport: true,
|
|
666
|
+
},
|
|
667
|
+
lastConfiguredBy: null,
|
|
668
|
+
},
|
|
669
|
+
{},
|
|
670
|
+
);
|
|
671
|
+
*/
|
|
672
|
+
}
|
|
673
|
+
/**
|
|
674
|
+
* Creates a default scenes cluster server and adds it to the current instance.
|
|
675
|
+
* @deprecated This method is deprecated.
|
|
676
|
+
*/
|
|
436
677
|
createDefaultScenesClusterServer() {
|
|
678
|
+
/*
|
|
679
|
+
this.addClusterServer(this.getDefaultScenesClusterServer());
|
|
680
|
+
*/
|
|
681
|
+
return this;
|
|
437
682
|
}
|
|
683
|
+
/**
|
|
684
|
+
* Creates a unique identifier based on the provided parameters.
|
|
685
|
+
* @param param1 - The first parameter.
|
|
686
|
+
* @param param2 - The second parameter.
|
|
687
|
+
* @param param3 - The third parameter.
|
|
688
|
+
* @param param4 - The fourth parameter.
|
|
689
|
+
* @returns A unique identifier generated using the MD5 hash algorithm.
|
|
690
|
+
*/
|
|
438
691
|
createUniqueId(param1, param2, param3, param4) {
|
|
439
692
|
const hash = createHash('md5');
|
|
440
693
|
hash.update(param1 + param2 + param3 + param4);
|
|
441
694
|
return hash.digest('hex');
|
|
442
695
|
}
|
|
696
|
+
/**
|
|
697
|
+
* Get a default Basic Information Cluster Server.
|
|
698
|
+
*
|
|
699
|
+
* @param deviceName - The name of the device.
|
|
700
|
+
* @param serialNumber - The serial number of the device.
|
|
701
|
+
* @param vendorId - The vendor ID of the device.
|
|
702
|
+
* @param vendorName - The vendor name of the device.
|
|
703
|
+
* @param productId - The product ID of the device.
|
|
704
|
+
* @param productName - The product name of the device.
|
|
705
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
706
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
707
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
708
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
709
|
+
*/
|
|
443
710
|
getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
444
711
|
this.log.logName = deviceName;
|
|
445
712
|
this.deviceName = deviceName;
|
|
@@ -480,6 +747,20 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
480
747
|
reachableChanged: true,
|
|
481
748
|
});
|
|
482
749
|
}
|
|
750
|
+
/**
|
|
751
|
+
* Creates a default Basic Information Cluster Server.
|
|
752
|
+
*
|
|
753
|
+
* @param deviceName - The name of the device.
|
|
754
|
+
* @param serialNumber - The serial number of the device.
|
|
755
|
+
* @param vendorId - The vendor ID of the device.
|
|
756
|
+
* @param vendorName - The vendor name of the device.
|
|
757
|
+
* @param productId - The product ID of the device.
|
|
758
|
+
* @param productName - The product name of the device.
|
|
759
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
760
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
761
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
762
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
763
|
+
*/
|
|
483
764
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
484
765
|
if (MatterbridgeDevice.bridgeMode === 'bridge') {
|
|
485
766
|
this.addDeviceType(bridgedNode);
|
|
@@ -487,7 +768,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
487
768
|
return;
|
|
488
769
|
}
|
|
489
770
|
this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
771
|
+
return this;
|
|
490
772
|
}
|
|
773
|
+
/**
|
|
774
|
+
* Get a default BridgedDeviceBasicInformationClusterServer.
|
|
775
|
+
*
|
|
776
|
+
* @param deviceName - The name of the device.
|
|
777
|
+
* @param serialNumber - The serial number of the device.
|
|
778
|
+
* @param vendorId - The vendor ID of the device.
|
|
779
|
+
* @param vendorName - The name of the vendor.
|
|
780
|
+
* @param productName - The name of the product.
|
|
781
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
782
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
783
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
784
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
785
|
+
*/
|
|
491
786
|
getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
492
787
|
this.log.logName = deviceName;
|
|
493
788
|
this.deviceName = deviceName;
|
|
@@ -502,7 +797,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
502
797
|
this.hardwareVersion = hardwareVersion;
|
|
503
798
|
this.hardwareVersionString = hardwareVersionString;
|
|
504
799
|
return ClusterServer(BridgedDeviceBasicInformationCluster, {
|
|
505
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
800
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
|
|
506
801
|
vendorName: vendorName.slice(0, 32),
|
|
507
802
|
productName: productName.slice(0, 32),
|
|
508
803
|
productUrl: 'https://www.npmjs.com/package/matterbridge',
|
|
@@ -522,12 +817,37 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
522
817
|
reachableChanged: true,
|
|
523
818
|
});
|
|
524
819
|
}
|
|
820
|
+
/**
|
|
821
|
+
* Creates a default BridgedDeviceBasicInformationClusterServer.
|
|
822
|
+
*
|
|
823
|
+
* @param deviceName - The name of the device.
|
|
824
|
+
* @param serialNumber - The serial number of the device.
|
|
825
|
+
* @param vendorId - The vendor ID of the device.
|
|
826
|
+
* @param vendorName - The name of the vendor.
|
|
827
|
+
* @param productName - The name of the product.
|
|
828
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
829
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
830
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
831
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
832
|
+
*/
|
|
525
833
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
526
834
|
this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
835
|
+
return this;
|
|
527
836
|
}
|
|
837
|
+
/**
|
|
838
|
+
* Get a default Power Topology Cluster Server.
|
|
839
|
+
*
|
|
840
|
+
* @returns {ClusterServer} - The configured Power Topology Cluster Server.
|
|
841
|
+
*/
|
|
528
842
|
getDefaultPowerTopologyClusterServer() {
|
|
529
843
|
return ClusterServer(PowerTopologyCluster.with(PowerTopology.Feature.TreeTopology), {}, {}, {});
|
|
530
844
|
}
|
|
845
|
+
/**
|
|
846
|
+
* Get a default Electrical Energy Measurement Cluster Server.
|
|
847
|
+
*
|
|
848
|
+
* @param {number} energy - The total consumption value in mW/h.
|
|
849
|
+
* @returns {ClusterServer} - The configured Electrical Energy Measurement Cluster Server.
|
|
850
|
+
*/
|
|
531
851
|
getDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
532
852
|
return ClusterServer(ElectricalEnergyMeasurementCluster.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
533
853
|
accuracy: {
|
|
@@ -544,6 +864,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
544
864
|
cumulativeEnergyMeasured: true,
|
|
545
865
|
});
|
|
546
866
|
}
|
|
867
|
+
/**
|
|
868
|
+
* Get a default Electrical Power Measurement Cluster Server.
|
|
869
|
+
*
|
|
870
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
871
|
+
* @param {number} current - The current value in milliamperes.
|
|
872
|
+
* @param {number} power - The power value in milliwatts.
|
|
873
|
+
* @param {number} frequency - The frequency value in millihertz.
|
|
874
|
+
* @returns {ClusterServer} - The configured Electrical Power Measurement Cluster Server.
|
|
875
|
+
*/
|
|
547
876
|
getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
548
877
|
return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
549
878
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -584,6 +913,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
584
913
|
frequency: frequency,
|
|
585
914
|
}, {}, {});
|
|
586
915
|
}
|
|
916
|
+
/**
|
|
917
|
+
* Creates a default Dummy Thread Network Diagnostics Cluster server.
|
|
918
|
+
* @deprecated This method is deprecated and is only used for testing.
|
|
919
|
+
*
|
|
920
|
+
* @remarks
|
|
921
|
+
* This method adds a cluster server used only to give the networkName to Eve app.
|
|
922
|
+
*
|
|
923
|
+
* @returns void
|
|
924
|
+
*/
|
|
587
925
|
createDefaultDummyThreadNetworkDiagnosticsClusterServer() {
|
|
588
926
|
this.addClusterServer(ClusterServer(ThreadNetworkDiagnosticsCluster.with(ThreadNetworkDiagnostics.Feature.PacketCounts, ThreadNetworkDiagnostics.Feature.ErrorCounts), {
|
|
589
927
|
channel: 1,
|
|
@@ -611,6 +949,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
611
949
|
},
|
|
612
950
|
}, {}));
|
|
613
951
|
}
|
|
952
|
+
/**
|
|
953
|
+
* Get a default OnOff cluster server for light devices.
|
|
954
|
+
*
|
|
955
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
956
|
+
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
957
|
+
* @param {number} [onTime=0] - The on time value.
|
|
958
|
+
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
959
|
+
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
960
|
+
*
|
|
961
|
+
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
962
|
+
*/
|
|
614
963
|
getDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
615
964
|
return ClusterServer(OnOffCluster.with(OnOff.Feature.Lighting), {
|
|
616
965
|
onOff,
|
|
@@ -645,9 +994,26 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
645
994
|
},
|
|
646
995
|
}, {});
|
|
647
996
|
}
|
|
997
|
+
/**
|
|
998
|
+
* Creates a default OnOff cluster server for light devices.
|
|
999
|
+
*
|
|
1000
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1001
|
+
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
1002
|
+
* @param {number} [onTime=0] - The on time value.
|
|
1003
|
+
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
1004
|
+
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
1005
|
+
*/
|
|
648
1006
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
649
1007
|
this.addClusterServer(this.getDefaultOnOffClusterServer(onOff, globalSceneControl, onTime, offWaitTime, startUpOnOff));
|
|
1008
|
+
return this;
|
|
650
1009
|
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Get a DeadFront OnOff cluster server.
|
|
1012
|
+
*
|
|
1013
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1014
|
+
*
|
|
1015
|
+
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
1016
|
+
*/
|
|
651
1017
|
getDeadFrontOnOffClusterServer(onOff = false) {
|
|
652
1018
|
return ClusterServer(OnOffCluster.with(OnOff.Feature.DeadFrontBehavior), {
|
|
653
1019
|
onOff,
|
|
@@ -666,9 +1032,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
666
1032
|
},
|
|
667
1033
|
}, {});
|
|
668
1034
|
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Creates a DeadFront OnOff cluster server.
|
|
1037
|
+
*
|
|
1038
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1039
|
+
*/
|
|
669
1040
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
670
1041
|
this.addClusterServer(this.getDeadFrontOnOffClusterServer(onOff));
|
|
1042
|
+
return this;
|
|
671
1043
|
}
|
|
1044
|
+
/**
|
|
1045
|
+
* Get an OnOff cluster server without features.
|
|
1046
|
+
*
|
|
1047
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1048
|
+
*
|
|
1049
|
+
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
1050
|
+
*/
|
|
672
1051
|
getOnOffClusterServer(onOff = false) {
|
|
673
1052
|
return ClusterServer(OnOffCluster, {
|
|
674
1053
|
onOff,
|
|
@@ -687,9 +1066,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
687
1066
|
},
|
|
688
1067
|
}, {});
|
|
689
1068
|
}
|
|
1069
|
+
/**
|
|
1070
|
+
* Creates an OnOff cluster server without features.
|
|
1071
|
+
*
|
|
1072
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
1073
|
+
*/
|
|
690
1074
|
createOnOffClusterServer(onOff = false) {
|
|
691
1075
|
this.addClusterServer(this.getOnOffClusterServer(onOff));
|
|
1076
|
+
return this;
|
|
692
1077
|
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Get a default level control cluster server.
|
|
1080
|
+
*
|
|
1081
|
+
* @param currentLevel - The current level (default: 254).
|
|
1082
|
+
* @param minLevel - The minimum level (default: 1).
|
|
1083
|
+
* @param maxLevel - The maximum level (default: 254).
|
|
1084
|
+
* @param onLevel - The on level (default: null).
|
|
1085
|
+
* @param startUpCurrentLevel - The startUp on level (default: null).
|
|
1086
|
+
*/
|
|
693
1087
|
getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
694
1088
|
return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
695
1089
|
currentLevel,
|
|
@@ -731,9 +1125,30 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
731
1125
|
},
|
|
732
1126
|
});
|
|
733
1127
|
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Creates a default level control cluster server.
|
|
1130
|
+
*
|
|
1131
|
+
* @param currentLevel - The current level (default: 254).
|
|
1132
|
+
* @param minLevel - The minimum level (default: 1).
|
|
1133
|
+
* @param maxLevel - The maximum level (default: 254).
|
|
1134
|
+
* @param onLevel - The on level (default: null).
|
|
1135
|
+
* @param startUpCurrentLevel - The startUp on level (default: null).
|
|
1136
|
+
*/
|
|
734
1137
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
735
1138
|
this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel, startUpCurrentLevel));
|
|
1139
|
+
return this;
|
|
736
1140
|
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Get a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
1143
|
+
*
|
|
1144
|
+
* @param currentX - The current X value.
|
|
1145
|
+
* @param currentY - The current Y value.
|
|
1146
|
+
* @param currentHue - The current hue value.
|
|
1147
|
+
* @param currentSaturation - The current saturation value.
|
|
1148
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1149
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1150
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1151
|
+
*/
|
|
737
1152
|
getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
738
1153
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
739
1154
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -803,9 +1218,30 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
803
1218
|
},
|
|
804
1219
|
}, {});
|
|
805
1220
|
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
1223
|
+
*
|
|
1224
|
+
* @param currentX - The current X value.
|
|
1225
|
+
* @param currentY - The current Y value.
|
|
1226
|
+
* @param currentHue - The current hue value.
|
|
1227
|
+
* @param currentSaturation - The current saturation value.
|
|
1228
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1229
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1230
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1231
|
+
*/
|
|
806
1232
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
807
1233
|
this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1234
|
+
return this;
|
|
808
1235
|
}
|
|
1236
|
+
/**
|
|
1237
|
+
* Get a Xy color control cluster server with Xy and ColorTemperature.
|
|
1238
|
+
*
|
|
1239
|
+
* @param currentX - The current X value.
|
|
1240
|
+
* @param currentY - The current Y value.
|
|
1241
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1242
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1243
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1244
|
+
*/
|
|
809
1245
|
getXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
810
1246
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
811
1247
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -849,9 +1285,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
849
1285
|
},
|
|
850
1286
|
}, {});
|
|
851
1287
|
}
|
|
1288
|
+
/**
|
|
1289
|
+
* Creates a Xy color control cluster server with Xy and ColorTemperature.
|
|
1290
|
+
*
|
|
1291
|
+
* @param currentX - The current X value.
|
|
1292
|
+
* @param currentY - The current Y value.
|
|
1293
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1294
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1295
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1296
|
+
*/
|
|
852
1297
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
853
1298
|
this.addClusterServer(this.getXyColorControlClusterServer(currentX, currentY, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1299
|
+
return this;
|
|
854
1300
|
}
|
|
1301
|
+
/**
|
|
1302
|
+
* Get a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
|
|
1303
|
+
*
|
|
1304
|
+
* @param currentHue - The current hue value.
|
|
1305
|
+
* @param currentSaturation - The current saturation value.
|
|
1306
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1307
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1308
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1309
|
+
*/
|
|
855
1310
|
getHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
856
1311
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
857
1312
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -909,9 +1364,26 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
909
1364
|
},
|
|
910
1365
|
}, {});
|
|
911
1366
|
}
|
|
1367
|
+
/**
|
|
1368
|
+
* Creates a hue and saturation color control cluster server with HueSaturation and ColorTemperature.
|
|
1369
|
+
*
|
|
1370
|
+
* @param currentHue - The current hue value.
|
|
1371
|
+
* @param currentSaturation - The current saturation value.
|
|
1372
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1373
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1374
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1375
|
+
*/
|
|
912
1376
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
913
1377
|
this.addClusterServer(this.getHsColorControlClusterServer(currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1378
|
+
return this;
|
|
914
1379
|
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Get a color temperature color control cluster server.
|
|
1382
|
+
*
|
|
1383
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1384
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1385
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1386
|
+
*/
|
|
915
1387
|
getCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
916
1388
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.ColorTemperature), {
|
|
917
1389
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -943,9 +1415,31 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
943
1415
|
},
|
|
944
1416
|
}, {});
|
|
945
1417
|
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Creates a color temperature color control cluster server.
|
|
1420
|
+
*
|
|
1421
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1422
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1423
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1424
|
+
*/
|
|
946
1425
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
947
1426
|
this.addClusterServer(this.getCtColorControlClusterServer(colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1427
|
+
return this;
|
|
948
1428
|
}
|
|
1429
|
+
/**
|
|
1430
|
+
* Configures the color control cluster for a device.
|
|
1431
|
+
*
|
|
1432
|
+
* @remark This method must be called only after creating the cluster with getDefaultCompleteColorControlClusterServer or createDefaultCompleteColorControlClusterServer
|
|
1433
|
+
* and before starting the matter server.
|
|
1434
|
+
*
|
|
1435
|
+
* @deprecated Use configureColorControlMode instead.
|
|
1436
|
+
*
|
|
1437
|
+
* @param {boolean} hueSaturation - A boolean indicating whether the device supports hue and saturation control.
|
|
1438
|
+
* @param {boolean} xy - A boolean indicating whether the device supports XY control.
|
|
1439
|
+
* @param {boolean} colorTemperature - A boolean indicating whether the device supports color temperature control.
|
|
1440
|
+
* @param {ColorControl.ColorMode} colorMode - An optional parameter specifying the color mode of the device.
|
|
1441
|
+
* @param {Endpoint} endpoint - An optional parameter specifying the endpoint to configure. If not provided, the device endpoint will be used.
|
|
1442
|
+
*/
|
|
949
1443
|
configureColorControlCluster(hueSaturation, xy, colorTemperature, colorMode, endpoint) {
|
|
950
1444
|
if (!endpoint)
|
|
951
1445
|
endpoint = this;
|
|
@@ -955,7 +1449,14 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
955
1449
|
endpoint.getClusterServer(ColorControlCluster)?.setColorModeAttribute(colorMode);
|
|
956
1450
|
endpoint.getClusterServer(ColorControlCluster)?.setEnhancedColorModeAttribute(colorMode);
|
|
957
1451
|
}
|
|
1452
|
+
return this;
|
|
958
1453
|
}
|
|
1454
|
+
/**
|
|
1455
|
+
* Configures the color control mode for the device.
|
|
1456
|
+
*
|
|
1457
|
+
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1458
|
+
* @param {Endpoint} endpoint - The optional endpoint to configure. If not provided, the method will configure the current endpoint.
|
|
1459
|
+
*/
|
|
959
1460
|
configureColorControlMode(colorMode, endpoint) {
|
|
960
1461
|
if (!endpoint)
|
|
961
1462
|
endpoint = this;
|
|
@@ -963,9 +1464,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
963
1464
|
endpoint.getClusterServer(ColorControlCluster)?.setColorModeAttribute(colorMode);
|
|
964
1465
|
endpoint.getClusterServer(ColorControlCluster)?.setEnhancedColorModeAttribute(colorMode);
|
|
965
1466
|
}
|
|
1467
|
+
return this;
|
|
966
1468
|
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Get a default window covering cluster server.
|
|
1471
|
+
*
|
|
1472
|
+
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
|
|
1473
|
+
*/
|
|
967
1474
|
getDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
968
|
-
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1475
|
+
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift /* , WindowCovering.Feature.AbsolutePosition*/), {
|
|
969
1476
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
970
1477
|
configStatus: {
|
|
971
1478
|
operational: true,
|
|
@@ -979,8 +1486,10 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
979
1486
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
980
1487
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
981
1488
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
982
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
983
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1489
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1490
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1491
|
+
// installedClosedLimitLift: 10000,
|
|
1492
|
+
// installedOpenLimitLift: 0,
|
|
984
1493
|
}, {
|
|
985
1494
|
upOrOpen: async (data) => {
|
|
986
1495
|
this.log.debug('Matter command: upOrOpen');
|
|
@@ -1001,9 +1510,18 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1001
1510
|
},
|
|
1002
1511
|
}, {});
|
|
1003
1512
|
}
|
|
1513
|
+
/**
|
|
1514
|
+
* Creates a default window covering cluster server.
|
|
1515
|
+
*
|
|
1516
|
+
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
|
|
1517
|
+
*/
|
|
1004
1518
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1005
1519
|
this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
|
|
1006
1520
|
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Sets the window covering target position as the current position and stops the movement.
|
|
1523
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1524
|
+
*/
|
|
1007
1525
|
setWindowCoveringTargetAsCurrentAndStopped(endpoint) {
|
|
1008
1526
|
if (!endpoint)
|
|
1009
1527
|
endpoint = this;
|
|
@@ -1021,6 +1539,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1021
1539
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1022
1540
|
}
|
|
1023
1541
|
}
|
|
1542
|
+
/**
|
|
1543
|
+
* Sets the current and target status of a window covering.
|
|
1544
|
+
* @param {number} current - The current position of the window covering.
|
|
1545
|
+
* @param {number} target - The target position of the window covering.
|
|
1546
|
+
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1547
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1548
|
+
*/
|
|
1024
1549
|
setWindowCoveringCurrentTargetStatus(current, target, status, endpoint) {
|
|
1025
1550
|
if (!endpoint)
|
|
1026
1551
|
endpoint = this;
|
|
@@ -1036,6 +1561,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1036
1561
|
}
|
|
1037
1562
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1038
1563
|
}
|
|
1564
|
+
/**
|
|
1565
|
+
* Sets the status of the window covering.
|
|
1566
|
+
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1567
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1568
|
+
*/
|
|
1039
1569
|
setWindowCoveringStatus(status, endpoint) {
|
|
1040
1570
|
if (!endpoint)
|
|
1041
1571
|
endpoint = this;
|
|
@@ -1045,6 +1575,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1045
1575
|
windowCovering.setOperationalStatusAttribute({ global: status, lift: status, tilt: status });
|
|
1046
1576
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1047
1577
|
}
|
|
1578
|
+
/**
|
|
1579
|
+
* Retrieves the status of the window covering.
|
|
1580
|
+
* @param {Endpoint} endpoint - The endpoint on which to get the window covering (default the device endpoint).
|
|
1581
|
+
*
|
|
1582
|
+
* @returns The global operational status of the window covering.
|
|
1583
|
+
*/
|
|
1048
1584
|
getWindowCoveringStatus(endpoint) {
|
|
1049
1585
|
if (!endpoint)
|
|
1050
1586
|
endpoint = this;
|
|
@@ -1055,6 +1591,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1055
1591
|
this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
|
|
1056
1592
|
return status.global;
|
|
1057
1593
|
}
|
|
1594
|
+
/**
|
|
1595
|
+
* Sets the target and current position of the window covering.
|
|
1596
|
+
*
|
|
1597
|
+
* @param position - The position to set, specified as a number.
|
|
1598
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1599
|
+
*/
|
|
1058
1600
|
setWindowCoveringTargetAndCurrentPosition(position, endpoint) {
|
|
1059
1601
|
if (!endpoint)
|
|
1060
1602
|
endpoint = this;
|
|
@@ -1065,6 +1607,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1065
1607
|
windowCovering.setTargetPositionLiftPercent100thsAttribute(position);
|
|
1066
1608
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
1067
1609
|
}
|
|
1610
|
+
/**
|
|
1611
|
+
* Get a default door lock cluster server.
|
|
1612
|
+
*
|
|
1613
|
+
* @remarks
|
|
1614
|
+
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1615
|
+
*
|
|
1616
|
+
*/
|
|
1068
1617
|
getDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1069
1618
|
return ClusterServer(DoorLockCluster, {
|
|
1070
1619
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
@@ -1087,9 +1636,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1087
1636
|
lockOperationError: true,
|
|
1088
1637
|
});
|
|
1089
1638
|
}
|
|
1639
|
+
/**
|
|
1640
|
+
* Creates a default door lock cluster server.
|
|
1641
|
+
*
|
|
1642
|
+
* @remarks
|
|
1643
|
+
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1644
|
+
*
|
|
1645
|
+
*/
|
|
1090
1646
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1091
1647
|
this.addClusterServer(this.getDefaultDoorLockClusterServer(lockState, lockType));
|
|
1092
1648
|
}
|
|
1649
|
+
/**
|
|
1650
|
+
* Get a default momentary switch cluster server.
|
|
1651
|
+
*
|
|
1652
|
+
* @remarks
|
|
1653
|
+
* This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
|
|
1654
|
+
*/
|
|
1093
1655
|
getDefaultSwitchClusterServer() {
|
|
1094
1656
|
return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
|
|
1095
1657
|
numberOfPositions: 2,
|
|
@@ -1104,9 +1666,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1104
1666
|
multiPressComplete: true,
|
|
1105
1667
|
});
|
|
1106
1668
|
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Creates a default momentary switch cluster server.
|
|
1671
|
+
*
|
|
1672
|
+
* @remarks
|
|
1673
|
+
* This method adds a cluster server with default momentary switch features and configurations.
|
|
1674
|
+
*/
|
|
1107
1675
|
createDefaultSwitchClusterServer() {
|
|
1108
1676
|
this.addClusterServer(this.getDefaultSwitchClusterServer());
|
|
1109
1677
|
}
|
|
1678
|
+
/**
|
|
1679
|
+
* Get a default latching switch cluster server.
|
|
1680
|
+
*
|
|
1681
|
+
* @remarks
|
|
1682
|
+
* This method adds a cluster server with default latching switch features and configuration.
|
|
1683
|
+
*/
|
|
1110
1684
|
getDefaultLatchingSwitchClusterServer() {
|
|
1111
1685
|
return ClusterServer(SwitchCluster.with(Switch.Feature.LatchingSwitch), {
|
|
1112
1686
|
numberOfPositions: 2,
|
|
@@ -1115,9 +1689,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1115
1689
|
switchLatched: true,
|
|
1116
1690
|
});
|
|
1117
1691
|
}
|
|
1692
|
+
/**
|
|
1693
|
+
* Creates a default latching switch cluster server.
|
|
1694
|
+
*
|
|
1695
|
+
* @remarks
|
|
1696
|
+
* This method adds a cluster server with default latching switch features and configuration.
|
|
1697
|
+
*/
|
|
1118
1698
|
createDefaultLatchingSwitchClusterServer() {
|
|
1119
1699
|
this.addClusterServer(this.getDefaultLatchingSwitchClusterServer());
|
|
1120
1700
|
}
|
|
1701
|
+
/**
|
|
1702
|
+
* Triggers a switch event on the specified endpoint.
|
|
1703
|
+
*
|
|
1704
|
+
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1705
|
+
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1706
|
+
* @returns {void}
|
|
1707
|
+
*/
|
|
1121
1708
|
triggerSwitchEvent(event, log, endpoint) {
|
|
1122
1709
|
if (!endpoint)
|
|
1123
1710
|
endpoint = this;
|
|
@@ -1189,6 +1776,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1189
1776
|
}
|
|
1190
1777
|
return true;
|
|
1191
1778
|
}
|
|
1779
|
+
/**
|
|
1780
|
+
* Retrieves the default mode select cluster server.
|
|
1781
|
+
*
|
|
1782
|
+
* @param description - The description of the cluster server.
|
|
1783
|
+
* @param supportedModes - The supported modes for the cluster server.
|
|
1784
|
+
* @param currentMode - The current mode of the cluster server. Defaults to 0.
|
|
1785
|
+
* @param startUpMode - The startup mode of the cluster server. Defaults to 0.
|
|
1786
|
+
* @returns The default mode select cluster server.
|
|
1787
|
+
*/
|
|
1192
1788
|
getDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1193
1789
|
return ClusterServer(ModeSelectCluster, {
|
|
1194
1790
|
description: description,
|
|
@@ -1203,11 +1799,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1203
1799
|
},
|
|
1204
1800
|
});
|
|
1205
1801
|
}
|
|
1802
|
+
/**
|
|
1803
|
+
* Creates a default mode select cluster server.
|
|
1804
|
+
*
|
|
1805
|
+
* @remarks
|
|
1806
|
+
* This method adds a cluster server for a mode select cluster with default settings.
|
|
1807
|
+
*
|
|
1808
|
+
* @param endpoint - The endpoint to add the cluster server to. Defaults to `this` if not provided.
|
|
1809
|
+
*/
|
|
1206
1810
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
|
|
1207
1811
|
if (!endpoint)
|
|
1208
1812
|
endpoint = this;
|
|
1209
1813
|
endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
|
|
1210
1814
|
}
|
|
1815
|
+
/**
|
|
1816
|
+
* Get a default occupancy sensing cluster server.
|
|
1817
|
+
*
|
|
1818
|
+
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1819
|
+
*/
|
|
1211
1820
|
getDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1212
1821
|
return ClusterServer(OccupancySensingCluster, {
|
|
1213
1822
|
occupancy: { occupied },
|
|
@@ -1216,9 +1825,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1216
1825
|
pirOccupiedToUnoccupiedDelay: 30,
|
|
1217
1826
|
}, {});
|
|
1218
1827
|
}
|
|
1828
|
+
/**
|
|
1829
|
+
* Creates a default occupancy sensing cluster server.
|
|
1830
|
+
*
|
|
1831
|
+
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1832
|
+
*/
|
|
1219
1833
|
createDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1220
1834
|
this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
|
|
1221
1835
|
}
|
|
1836
|
+
/**
|
|
1837
|
+
* Get a default Illuminance Measurement Cluster Server.
|
|
1838
|
+
*
|
|
1839
|
+
* @param measuredValue - The measured value of illuminance.
|
|
1840
|
+
*/
|
|
1222
1841
|
getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1223
1842
|
return ClusterServer(IlluminanceMeasurementCluster, {
|
|
1224
1843
|
measuredValue,
|
|
@@ -1227,9 +1846,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1227
1846
|
tolerance: 0,
|
|
1228
1847
|
}, {}, {});
|
|
1229
1848
|
}
|
|
1849
|
+
/**
|
|
1850
|
+
* Creates a default Illuminance Measurement Cluster Server.
|
|
1851
|
+
*
|
|
1852
|
+
* @param measuredValue - The measured value of illuminance.
|
|
1853
|
+
*/
|
|
1230
1854
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1231
1855
|
this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
|
|
1232
1856
|
}
|
|
1857
|
+
/**
|
|
1858
|
+
* Get a default flow measurement cluster server.
|
|
1859
|
+
*
|
|
1860
|
+
* @param measuredValue - The measured value of the flow in 10 x m/h.
|
|
1861
|
+
*/
|
|
1233
1862
|
getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1234
1863
|
return ClusterServer(FlowMeasurementCluster, {
|
|
1235
1864
|
measuredValue,
|
|
@@ -1238,9 +1867,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1238
1867
|
tolerance: 0,
|
|
1239
1868
|
}, {}, {});
|
|
1240
1869
|
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Creates a default flow measurement cluster server.
|
|
1872
|
+
*
|
|
1873
|
+
* @param measuredValue - The measured value of the of the flow in 10 x m/h.
|
|
1874
|
+
*/
|
|
1241
1875
|
createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1242
1876
|
this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
|
|
1243
1877
|
}
|
|
1878
|
+
/**
|
|
1879
|
+
* Get a default temperature measurement cluster server.
|
|
1880
|
+
*
|
|
1881
|
+
* @param measuredValue - The measured value of the temperature x 100.
|
|
1882
|
+
*/
|
|
1244
1883
|
getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1245
1884
|
return ClusterServer(TemperatureMeasurementCluster, {
|
|
1246
1885
|
measuredValue,
|
|
@@ -1249,9 +1888,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1249
1888
|
tolerance: 0,
|
|
1250
1889
|
}, {}, {});
|
|
1251
1890
|
}
|
|
1891
|
+
/**
|
|
1892
|
+
* Creates a default temperature measurement cluster server.
|
|
1893
|
+
*
|
|
1894
|
+
* @param measuredValue - The measured value of the temperature x 100.
|
|
1895
|
+
*/
|
|
1252
1896
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1253
1897
|
this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
|
|
1254
1898
|
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Get a default RelativeHumidityMeasurementCluster server.
|
|
1901
|
+
*
|
|
1902
|
+
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
1903
|
+
*/
|
|
1255
1904
|
getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1256
1905
|
return ClusterServer(RelativeHumidityMeasurementCluster, {
|
|
1257
1906
|
measuredValue,
|
|
@@ -1260,9 +1909,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1260
1909
|
tolerance: 0,
|
|
1261
1910
|
}, {}, {});
|
|
1262
1911
|
}
|
|
1912
|
+
/**
|
|
1913
|
+
* Creates a default RelativeHumidityMeasurementCluster server.
|
|
1914
|
+
*
|
|
1915
|
+
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
1916
|
+
*/
|
|
1263
1917
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1264
1918
|
this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
|
|
1265
1919
|
}
|
|
1920
|
+
/**
|
|
1921
|
+
* Get a default Pressure Measurement Cluster Server.
|
|
1922
|
+
*
|
|
1923
|
+
* @param measuredValue - The measured value for the pressure.
|
|
1924
|
+
*/
|
|
1266
1925
|
getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1267
1926
|
return ClusterServer(PressureMeasurementCluster, {
|
|
1268
1927
|
measuredValue,
|
|
@@ -1271,19 +1930,39 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1271
1930
|
tolerance: 0,
|
|
1272
1931
|
}, {}, {});
|
|
1273
1932
|
}
|
|
1933
|
+
/**
|
|
1934
|
+
* Creates a default Pressure Measurement Cluster Server.
|
|
1935
|
+
*
|
|
1936
|
+
* @param measuredValue - The measured value for the pressure.
|
|
1937
|
+
*/
|
|
1274
1938
|
createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1275
1939
|
this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
|
|
1276
1940
|
}
|
|
1941
|
+
/**
|
|
1942
|
+
* Get a default boolean state cluster server.
|
|
1943
|
+
*
|
|
1944
|
+
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
1945
|
+
*/
|
|
1277
1946
|
getDefaultBooleanStateClusterServer(contact) {
|
|
1278
1947
|
return ClusterServer(BooleanStateCluster, {
|
|
1279
|
-
stateValue: contact ?? true,
|
|
1948
|
+
stateValue: contact ?? true, // true=contact false=no_contact
|
|
1280
1949
|
}, {}, {
|
|
1281
1950
|
stateChange: true,
|
|
1282
1951
|
});
|
|
1283
1952
|
}
|
|
1953
|
+
/**
|
|
1954
|
+
* Creates a default boolean state configuration cluster server.
|
|
1955
|
+
*
|
|
1956
|
+
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
1957
|
+
*/
|
|
1284
1958
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1285
1959
|
this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
|
|
1286
1960
|
}
|
|
1961
|
+
/**
|
|
1962
|
+
* Get a default boolean state configuration cluster server.
|
|
1963
|
+
*
|
|
1964
|
+
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1965
|
+
*/
|
|
1287
1966
|
getDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
1288
1967
|
return ClusterServer(BooleanStateConfigurationCluster.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel), {
|
|
1289
1968
|
currentSensitivityLevel: 0,
|
|
@@ -1292,6 +1971,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1292
1971
|
alarmsActive: { visual: false, audible: false },
|
|
1293
1972
|
alarmsEnabled: { visual: false, audible: false },
|
|
1294
1973
|
alarmsSupported: { visual: true, audible: true },
|
|
1974
|
+
// alarmsSuppressed: { visual: false, audible: false },
|
|
1295
1975
|
sensorFault: { generalFault: sensorFault },
|
|
1296
1976
|
}, {
|
|
1297
1977
|
enableDisableAlarm: async ({ request, attributes }) => {
|
|
@@ -1303,9 +1983,23 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1303
1983
|
sensorFault: true,
|
|
1304
1984
|
});
|
|
1305
1985
|
}
|
|
1986
|
+
/**
|
|
1987
|
+
* Creates a default boolean state configuration cluster server.
|
|
1988
|
+
*
|
|
1989
|
+
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1990
|
+
*/
|
|
1306
1991
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
1307
1992
|
this.addClusterServer(this.getDefaultBooleanStateConfigurationClusterServer(sensorFault));
|
|
1308
1993
|
}
|
|
1994
|
+
/**
|
|
1995
|
+
* Get a default power source replaceable battery cluster server.
|
|
1996
|
+
*
|
|
1997
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
1998
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
1999
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
2000
|
+
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
2001
|
+
* @param batQuantity - The battery quantity (default: 1).
|
|
2002
|
+
*/
|
|
1309
2003
|
getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
1310
2004
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
1311
2005
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -1322,9 +2016,25 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1322
2016
|
endpointList: [],
|
|
1323
2017
|
}, {}, {});
|
|
1324
2018
|
}
|
|
2019
|
+
/**
|
|
2020
|
+
* Creates a default power source replaceable battery cluster server.
|
|
2021
|
+
*
|
|
2022
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2023
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2024
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
2025
|
+
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
2026
|
+
* @param batQuantity - The battery quantity (default: 1).
|
|
2027
|
+
*/
|
|
1325
2028
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
1326
2029
|
this.addClusterServer(this.getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity));
|
|
1327
2030
|
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Get 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
|
+
*/
|
|
1328
2038
|
getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
1329
2039
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
1330
2040
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -1342,9 +2052,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1342
2052
|
endpointList: [],
|
|
1343
2053
|
}, {}, {});
|
|
1344
2054
|
}
|
|
2055
|
+
/**
|
|
2056
|
+
* Creates a default power source rechargeable battery cluster server.
|
|
2057
|
+
*
|
|
2058
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
2059
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
2060
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
2061
|
+
*/
|
|
1345
2062
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
1346
2063
|
this.addClusterServer(this.getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage));
|
|
1347
2064
|
}
|
|
2065
|
+
/**
|
|
2066
|
+
* Get a default power source wired cluster server.
|
|
2067
|
+
*
|
|
2068
|
+
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
2069
|
+
*/
|
|
1348
2070
|
getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
1349
2071
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Wired), {
|
|
1350
2072
|
wiredCurrentType,
|
|
@@ -1354,22 +2076,45 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1354
2076
|
endpointList: [],
|
|
1355
2077
|
}, {}, {});
|
|
1356
2078
|
}
|
|
2079
|
+
/**
|
|
2080
|
+
* Creates a default power source wired cluster server.
|
|
2081
|
+
*
|
|
2082
|
+
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
2083
|
+
*/
|
|
1357
2084
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
1358
2085
|
this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
|
|
1359
2086
|
}
|
|
2087
|
+
/**
|
|
2088
|
+
* @deprecated This function is deprecated by Matter 1.3 spec and will be removed in a future version.
|
|
2089
|
+
*/
|
|
1360
2090
|
createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
|
|
1361
2091
|
this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
|
|
1362
2092
|
sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
|
|
1363
2093
|
}, {}, {}));
|
|
1364
2094
|
}
|
|
2095
|
+
/**
|
|
2096
|
+
* Get a default air quality cluster server.
|
|
2097
|
+
*
|
|
2098
|
+
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2099
|
+
*/
|
|
1365
2100
|
getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1366
2101
|
return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1367
2102
|
airQuality,
|
|
1368
2103
|
}, {}, {});
|
|
1369
2104
|
}
|
|
2105
|
+
/**
|
|
2106
|
+
* Creates a default air quality cluster server.
|
|
2107
|
+
*
|
|
2108
|
+
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2109
|
+
*/
|
|
1370
2110
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1371
2111
|
this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
|
|
1372
2112
|
}
|
|
2113
|
+
/**
|
|
2114
|
+
* Get a default TVOC measurement cluster server.
|
|
2115
|
+
*
|
|
2116
|
+
* @param measuredValue - The measured value for TVOC.
|
|
2117
|
+
*/
|
|
1373
2118
|
getDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1374
2119
|
return ClusterServer(TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1375
2120
|
measuredValue,
|
|
@@ -1380,14 +2125,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1380
2125
|
measurementMedium,
|
|
1381
2126
|
}, {}, {});
|
|
1382
2127
|
}
|
|
2128
|
+
/**
|
|
2129
|
+
* Creates a default TVOC measurement cluster server.
|
|
2130
|
+
*
|
|
2131
|
+
* @param measuredValue - The measured value for TVOC.
|
|
2132
|
+
*/
|
|
1383
2133
|
createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1384
2134
|
this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1385
2135
|
}
|
|
2136
|
+
/**
|
|
2137
|
+
* Get a default heating thermostat cluster server with the specified parameters.
|
|
2138
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2139
|
+
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2140
|
+
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2141
|
+
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2142
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2143
|
+
*/
|
|
1386
2144
|
getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1387
2145
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
|
|
1388
2146
|
localTemperature: localTemperature * 100,
|
|
1389
2147
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1390
2148
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
2149
|
+
// Thermostat.Feature.Heating
|
|
1391
2150
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1392
2151
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1393
2152
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1400,14 +2159,31 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1400
2159
|
},
|
|
1401
2160
|
}, {});
|
|
1402
2161
|
}
|
|
2162
|
+
/**
|
|
2163
|
+
* Creates and adds a default heating thermostat cluster server to the device.
|
|
2164
|
+
*
|
|
2165
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2166
|
+
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2167
|
+
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2168
|
+
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2169
|
+
*/
|
|
1403
2170
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1404
2171
|
this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
|
|
1405
2172
|
}
|
|
2173
|
+
/**
|
|
2174
|
+
* Get a default cooling thermostat cluster server with the specified parameters.
|
|
2175
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2176
|
+
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2177
|
+
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2178
|
+
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2179
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2180
|
+
*/
|
|
1406
2181
|
getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1407
2182
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
|
|
1408
2183
|
localTemperature: localTemperature * 100,
|
|
1409
2184
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1410
2185
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
2186
|
+
// Thermostat.Feature.Cooling
|
|
1411
2187
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1412
2188
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1413
2189
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -1420,24 +2196,48 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1420
2196
|
},
|
|
1421
2197
|
}, {});
|
|
1422
2198
|
}
|
|
2199
|
+
/**
|
|
2200
|
+
* Creates and adds a default cooling thermostat cluster server to the device.
|
|
2201
|
+
*
|
|
2202
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2203
|
+
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2204
|
+
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2205
|
+
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2206
|
+
*/
|
|
1423
2207
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1424
2208
|
this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
1425
2209
|
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Get a default thermostat cluster server with the specified parameters.
|
|
2212
|
+
*
|
|
2213
|
+
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2214
|
+
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2215
|
+
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2216
|
+
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2217
|
+
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2218
|
+
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2219
|
+
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2220
|
+
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2221
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2222
|
+
*/
|
|
1426
2223
|
getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1427
2224
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1428
2225
|
localTemperature: localTemperature * 100,
|
|
1429
2226
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1430
2227
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
2228
|
+
// Thermostat.Feature.Heating
|
|
1431
2229
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1432
2230
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1433
2231
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1434
2232
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1435
2233
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2234
|
+
// Thermostat.Feature.Cooling
|
|
1436
2235
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1437
2236
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1438
2237
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1439
2238
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1440
2239
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2240
|
+
// Thermostat.Feature.AutoMode
|
|
1441
2241
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1442
2242
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1443
2243
|
}, {
|
|
@@ -1447,9 +2247,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1447
2247
|
},
|
|
1448
2248
|
}, {});
|
|
1449
2249
|
}
|
|
2250
|
+
/**
|
|
2251
|
+
* Creates and adds a default thermostat cluster server to the device.
|
|
2252
|
+
*
|
|
2253
|
+
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2254
|
+
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2255
|
+
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2256
|
+
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2257
|
+
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2258
|
+
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2259
|
+
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2260
|
+
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2261
|
+
*/
|
|
1450
2262
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1451
2263
|
this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
1452
2264
|
}
|
|
2265
|
+
/**
|
|
2266
|
+
* Get a default dummy time sync cluster server. Only needed to create a thermostat.
|
|
2267
|
+
*/
|
|
1453
2268
|
getDefaultTimeSyncClusterServer() {
|
|
1454
2269
|
return ClusterServer(TimeSynchronizationCluster.with(TimeSynchronization.Feature.TimeZone), {
|
|
1455
2270
|
utcTime: null,
|
|
@@ -1481,9 +2296,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1481
2296
|
timeFailure: true,
|
|
1482
2297
|
});
|
|
1483
2298
|
}
|
|
2299
|
+
/**
|
|
2300
|
+
* Creates a default dummy time sync cluster server. Only needed to create a thermostat.
|
|
2301
|
+
*/
|
|
1484
2302
|
createDefaultTimeSyncClusterServer() {
|
|
1485
2303
|
this.addClusterServer(this.getDefaultTimeSyncClusterServer());
|
|
1486
2304
|
}
|
|
2305
|
+
/**
|
|
2306
|
+
* Returns the default SmokeCOAlarm Cluster Server.
|
|
2307
|
+
*
|
|
2308
|
+
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2309
|
+
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2310
|
+
* @returns The default SmokeCOAlarmClusterServer.
|
|
2311
|
+
*/
|
|
1487
2312
|
getDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1488
2313
|
return ClusterServer(SmokeCoAlarmCluster.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm), {
|
|
1489
2314
|
smokeState,
|
|
@@ -1515,9 +2340,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1515
2340
|
allClear: true,
|
|
1516
2341
|
});
|
|
1517
2342
|
}
|
|
2343
|
+
/**
|
|
2344
|
+
* Create the default SmokeCOAlarm Cluster Server.
|
|
2345
|
+
*
|
|
2346
|
+
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2347
|
+
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2348
|
+
* @returns The default SmokeCOAlarmClusterServer.
|
|
2349
|
+
*/
|
|
1518
2350
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1519
2351
|
this.addClusterServer(this.getDefaultSmokeCOAlarmClusterServer(smokeState, coState));
|
|
1520
2352
|
}
|
|
2353
|
+
/**
|
|
2354
|
+
* Returns the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2355
|
+
*
|
|
2356
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2357
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2358
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2359
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2360
|
+
*/
|
|
1521
2361
|
getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1522
2362
|
return ClusterServer(CarbonMonoxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1523
2363
|
measuredValue,
|
|
@@ -1528,9 +2368,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1528
2368
|
measurementMedium,
|
|
1529
2369
|
}, {}, {});
|
|
1530
2370
|
}
|
|
2371
|
+
/**
|
|
2372
|
+
* Create the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2373
|
+
*
|
|
2374
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2375
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2376
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2377
|
+
*/
|
|
1531
2378
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1532
2379
|
this.addClusterServer(this.getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1533
2380
|
}
|
|
2381
|
+
/**
|
|
2382
|
+
* Returns the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2383
|
+
*
|
|
2384
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2385
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2386
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2387
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2388
|
+
*/
|
|
1534
2389
|
getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1535
2390
|
return ClusterServer(CarbonDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1536
2391
|
measuredValue,
|
|
@@ -1541,9 +2396,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1541
2396
|
measurementMedium,
|
|
1542
2397
|
}, {}, {});
|
|
1543
2398
|
}
|
|
2399
|
+
/**
|
|
2400
|
+
* Create the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2401
|
+
*
|
|
2402
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2403
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2404
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2405
|
+
*/
|
|
1544
2406
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1545
2407
|
this.addClusterServer(this.getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1546
2408
|
}
|
|
2409
|
+
/**
|
|
2410
|
+
* Returns the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2411
|
+
*
|
|
2412
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2413
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2414
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2415
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2416
|
+
*/
|
|
1547
2417
|
getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1548
2418
|
return ClusterServer(FormaldehydeConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1549
2419
|
measuredValue,
|
|
@@ -1554,9 +2424,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1554
2424
|
measurementMedium,
|
|
1555
2425
|
}, {}, {});
|
|
1556
2426
|
}
|
|
2427
|
+
/**
|
|
2428
|
+
* Create the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2429
|
+
*
|
|
2430
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2431
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2432
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2433
|
+
*/
|
|
1557
2434
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1558
2435
|
this.addClusterServer(this.getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1559
2436
|
}
|
|
2437
|
+
/**
|
|
2438
|
+
* Returns the default Pm1 Concentration Measurement Cluster Server.
|
|
2439
|
+
*
|
|
2440
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2441
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2442
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2443
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2444
|
+
*/
|
|
1560
2445
|
getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1561
2446
|
return ClusterServer(Pm1ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1562
2447
|
measuredValue,
|
|
@@ -1567,9 +2452,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1567
2452
|
measurementMedium,
|
|
1568
2453
|
}, {}, {});
|
|
1569
2454
|
}
|
|
2455
|
+
/**
|
|
2456
|
+
* Create the default Pm1 Concentration Measurement Cluster Server.
|
|
2457
|
+
*
|
|
2458
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2459
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2460
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2461
|
+
*/
|
|
1570
2462
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1571
2463
|
this.addClusterServer(this.getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1572
2464
|
}
|
|
2465
|
+
/**
|
|
2466
|
+
* Returns the default Pm25 Concentration Measurement Cluster Server.
|
|
2467
|
+
*
|
|
2468
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2469
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2470
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2471
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2472
|
+
*/
|
|
1573
2473
|
getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1574
2474
|
return ClusterServer(Pm25ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1575
2475
|
measuredValue,
|
|
@@ -1580,9 +2480,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1580
2480
|
measurementMedium,
|
|
1581
2481
|
}, {}, {});
|
|
1582
2482
|
}
|
|
2483
|
+
/**
|
|
2484
|
+
* Create the default Pm25 Concentration Measurement Cluster Server.
|
|
2485
|
+
*
|
|
2486
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2487
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2488
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2489
|
+
*/
|
|
1583
2490
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1584
2491
|
this.addClusterServer(this.getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1585
2492
|
}
|
|
2493
|
+
/**
|
|
2494
|
+
* Returns the default Pm10 Concentration Measurement Cluster Server.
|
|
2495
|
+
*
|
|
2496
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2497
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2498
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2499
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2500
|
+
*/
|
|
1586
2501
|
getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1587
2502
|
return ClusterServer(Pm10ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1588
2503
|
measuredValue,
|
|
@@ -1593,9 +2508,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1593
2508
|
measurementMedium,
|
|
1594
2509
|
}, {}, {});
|
|
1595
2510
|
}
|
|
2511
|
+
/**
|
|
2512
|
+
* Create the default Pm10 Concentration Measurement Cluster Server.
|
|
2513
|
+
*
|
|
2514
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2515
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2516
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2517
|
+
*/
|
|
1596
2518
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1597
2519
|
this.addClusterServer(this.getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1598
2520
|
}
|
|
2521
|
+
/**
|
|
2522
|
+
* Returns the default Ozone Concentration Measurement Cluster Server.
|
|
2523
|
+
*
|
|
2524
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2525
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2526
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2527
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2528
|
+
*/
|
|
1599
2529
|
getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1600
2530
|
return ClusterServer(OzoneConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1601
2531
|
measuredValue,
|
|
@@ -1606,9 +2536,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1606
2536
|
measurementMedium,
|
|
1607
2537
|
}, {}, {});
|
|
1608
2538
|
}
|
|
2539
|
+
/**
|
|
2540
|
+
* Create the default Ozone Concentration Measurement Cluster Server.
|
|
2541
|
+
*
|
|
2542
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2543
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2544
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2545
|
+
*/
|
|
1609
2546
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1610
2547
|
this.addClusterServer(this.getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1611
2548
|
}
|
|
2549
|
+
/**
|
|
2550
|
+
* Returns the default Radon Concentration Measurement Cluster Server.
|
|
2551
|
+
*
|
|
2552
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2553
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2554
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2555
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2556
|
+
*/
|
|
1612
2557
|
getDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1613
2558
|
return ClusterServer(RadonConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1614
2559
|
measuredValue,
|
|
@@ -1619,9 +2564,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1619
2564
|
measurementMedium,
|
|
1620
2565
|
}, {}, {});
|
|
1621
2566
|
}
|
|
2567
|
+
/**
|
|
2568
|
+
* Create the default Radon Concentration Measurement Cluster Server.
|
|
2569
|
+
*
|
|
2570
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2571
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2572
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2573
|
+
*/
|
|
1622
2574
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1623
2575
|
this.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1624
2576
|
}
|
|
2577
|
+
/**
|
|
2578
|
+
* Returns the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2579
|
+
*
|
|
2580
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2581
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2582
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2583
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2584
|
+
*/
|
|
1625
2585
|
getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1626
2586
|
return ClusterServer(NitrogenDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1627
2587
|
measuredValue,
|
|
@@ -1632,9 +2592,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1632
2592
|
measurementMedium,
|
|
1633
2593
|
}, {}, {});
|
|
1634
2594
|
}
|
|
2595
|
+
/**
|
|
2596
|
+
* Create the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2597
|
+
*
|
|
2598
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2599
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2600
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2601
|
+
*/
|
|
1635
2602
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1636
2603
|
this.addClusterServer(this.getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1637
2604
|
}
|
|
2605
|
+
/**
|
|
2606
|
+
* Returns the default fan control cluster server rev 2.
|
|
2607
|
+
*
|
|
2608
|
+
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2609
|
+
* @returns The default fan control cluster server.
|
|
2610
|
+
*/
|
|
1638
2611
|
getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1639
2612
|
return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1640
2613
|
fanMode,
|
|
@@ -1651,9 +2624,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1651
2624
|
},
|
|
1652
2625
|
}, {});
|
|
1653
2626
|
}
|
|
2627
|
+
/**
|
|
2628
|
+
* Create the default fan control cluster server rev 2.
|
|
2629
|
+
*
|
|
2630
|
+
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2631
|
+
* @returns The default fan control cluster server.
|
|
2632
|
+
*/
|
|
1654
2633
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1655
2634
|
this.addClusterServer(this.getDefaultFanControlClusterServer(fanMode));
|
|
1656
2635
|
}
|
|
2636
|
+
/**
|
|
2637
|
+
* Returns the default Pump Configuration And Control cluster server.
|
|
2638
|
+
*
|
|
2639
|
+
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
2640
|
+
* @returns {ClusterServer} - The default Pump Configuration And Control cluster server.
|
|
2641
|
+
*/
|
|
1657
2642
|
getDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1658
2643
|
return ClusterServer(PumpConfigurationAndControlCluster.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
1659
2644
|
minConstSpeed: null,
|
|
@@ -1667,6 +2652,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1667
2652
|
operationMode: pumpMode,
|
|
1668
2653
|
}, {}, {});
|
|
1669
2654
|
}
|
|
2655
|
+
/**
|
|
2656
|
+
* Creates the default Pump Configuration And Control cluster server.
|
|
2657
|
+
*
|
|
2658
|
+
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
2659
|
+
* @returns {void}
|
|
2660
|
+
*/
|
|
1670
2661
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1671
2662
|
this.addClusterServer(this.getDefaultPumpConfigurationAndControlClusterServer(pumpMode));
|
|
1672
2663
|
}
|
|
@@ -1690,9 +2681,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1690
2681
|
},
|
|
1691
2682
|
}, {});
|
|
1692
2683
|
}
|
|
2684
|
+
/**
|
|
2685
|
+
* Create the default Valve Configuration And Control cluster server rev 2.
|
|
2686
|
+
*
|
|
2687
|
+
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
2688
|
+
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
2689
|
+
* @returns {void}
|
|
2690
|
+
*/
|
|
1693
2691
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
1694
2692
|
this.addClusterServer(this.getDefaultValveConfigurationAndControlClusterServer(valveState, valveLevel));
|
|
1695
2693
|
}
|
|
2694
|
+
// NOTE Support of Device Energy Management Cluster is provisional.
|
|
1696
2695
|
getDefaultDeviceEnergyManagementClusterServer() {
|
|
1697
2696
|
return ClusterServer(DeviceEnergyManagementCluster.with(DeviceEnergyManagement.Feature.Pausable, DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.StateForecastReporting), {
|
|
1698
2697
|
esaType: DeviceEnergyManagement.EsaType.Other,
|
|
@@ -1716,6 +2715,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1716
2715
|
resumed: true,
|
|
1717
2716
|
});
|
|
1718
2717
|
}
|
|
2718
|
+
// NOTE Support of Device Energy Management Mode Cluster is provisional.
|
|
1719
2719
|
getDefaultDeviceEnergyManagementModeClusterServer() {
|
|
1720
2720
|
return ClusterServer(DeviceEnergyManagementModeCluster, {
|
|
1721
2721
|
supportedModes: [
|
|
@@ -1732,3 +2732,4 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1732
2732
|
}, {});
|
|
1733
2733
|
}
|
|
1734
2734
|
}
|
|
2735
|
+
//# sourceMappingURL=matterbridgeDevice.js.map
|