matterbridge 1.6.6-dev.9 → 1.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -9
- package/README-DEV.md +3 -3
- package/README.md +4 -0
- package/dist/cli.d.ts +25 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +26 -0
- package/dist/cli.js.map +1 -0
- package/dist/cluster/export.d.ts +2 -0
- package/dist/cluster/export.d.ts.map +1 -0
- package/dist/cluster/export.js +2 -0
- package/dist/cluster/export.js.map +1 -0
- package/dist/defaultConfigSchema.d.ts +27 -0
- package/dist/defaultConfigSchema.d.ts.map +1 -0
- package/dist/defaultConfigSchema.js +23 -0
- package/dist/defaultConfigSchema.js.map +1 -0
- package/dist/deviceManager.d.ts +46 -0
- package/dist/deviceManager.d.ts.map +1 -0
- package/dist/deviceManager.js +26 -1
- package/dist/deviceManager.js.map +1 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/export.d.ts +2 -0
- package/dist/logger/export.d.ts.map +1 -0
- package/dist/logger/export.js +1 -0
- package/dist/logger/export.js.map +1 -0
- package/dist/matter/export.d.ts +5 -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 +712 -65
- package/dist/matterbridge.js.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts +39 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.js +33 -0
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
- package/dist/matterbridgeBehaviors.d.ts +942 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +38 -1
- package/dist/matterbridgeBehaviors.js.map +1 -0
- package/dist/matterbridgeDevice.d.ts +6674 -0
- package/dist/matterbridgeDevice.d.ts.map +1 -0
- package/dist/matterbridgeDevice.js +1001 -26
- package/dist/matterbridgeDevice.js.map +1 -0
- package/dist/matterbridgeDeviceTypes.d.ts +82 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +59 -13
- package/dist/matterbridgeDeviceTypes.js.map +1 -0
- package/dist/matterbridgeDynamicPlatform.d.ts +39 -0
- package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
- package/dist/matterbridgeDynamicPlatform.js +33 -0
- package/dist/matterbridgeDynamicPlatform.js.map +1 -0
- package/dist/matterbridgeEdge.d.ts +89 -0
- package/dist/matterbridgeEdge.d.ts.map +1 -0
- package/dist/matterbridgeEdge.js +528 -0
- package/dist/matterbridgeEdge.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +9774 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +1113 -94
- 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 +115 -10
- package/dist/matterbridgePlatform.js.map +1 -0
- package/dist/matterbridgeTypes.d.ts +161 -0
- package/dist/matterbridgeTypes.d.ts.map +1 -0
- package/dist/matterbridgeTypes.js +24 -0
- package/dist/matterbridgeTypes.js.map +1 -0
- package/dist/matterbridgeWebsocket.d.ts +49 -0
- package/dist/matterbridgeWebsocket.d.ts.map +1 -0
- package/dist/matterbridgeWebsocket.js +50 -0
- package/dist/matterbridgeWebsocket.js.map +1 -0
- package/dist/pluginManager.d.ts +238 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +238 -3
- package/dist/pluginManager.js.map +1 -0
- package/dist/storage/export.d.ts +2 -0
- package/dist/storage/export.d.ts.map +1 -0
- package/dist/storage/export.js +1 -0
- package/dist/storage/export.js.map +1 -0
- package/dist/utils/colorUtils.d.ts +61 -0
- package/dist/utils/colorUtils.d.ts.map +1 -0
- package/dist/utils/colorUtils.js +236 -89
- package/dist/utils/colorUtils.js.map +1 -0
- package/dist/utils/export.d.ts +3 -0
- package/dist/utils/export.d.ts.map +1 -0
- package/dist/utils/export.js +1 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/utils.d.ts +221 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/dist/utils/utils.js +252 -7
- package/dist/utils/utils.js.map +1 -0
- package/frontend/build/asset-manifest.json +3 -3
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/js/{main.565ff6ba.js → main.a742de4e.js} +9 -9
- package/frontend/build/static/js/{main.565ff6ba.js.map → main.a742de4e.js.map} +1 -1
- package/npm-shrinkwrap.json +161 -68
- package/package.json +4 -4
- /package/frontend/build/static/js/{main.565ff6ba.js.LICENSE.txt → main.a742de4e.js.LICENSE.txt} +0 -0
|
@@ -1,17 +1,44 @@
|
|
|
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, RadonConcentrationMeasurement, RadonConcentrationMeasurementCluster, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, SmokeCoAlarm, SmokeCoAlarmCluster, Switch, SwitchCluster, TemperatureMeasurement, TemperatureMeasurementCluster, Thermostat, ThermostatCluster, ThreadNetworkDiagnostics, ThreadNetworkDiagnosticsCluster, TimeSynchronization, TimeSynchronizationCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster, 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;
|
|
41
|
+
configUrl = undefined;
|
|
15
42
|
serialNumber = undefined;
|
|
16
43
|
deviceName = undefined;
|
|
17
44
|
uniqueId = undefined;
|
|
@@ -23,6 +50,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
23
50
|
softwareVersionString = undefined;
|
|
24
51
|
hardwareVersion = undefined;
|
|
25
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
|
+
*/
|
|
26
60
|
constructor(definition, options = {}, debug = false) {
|
|
27
61
|
let firstDefinition;
|
|
28
62
|
if (Array.isArray(definition))
|
|
@@ -30,7 +64,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
30
64
|
else
|
|
31
65
|
firstDefinition = definition;
|
|
32
66
|
super(firstDefinition, options);
|
|
33
|
-
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 });
|
|
34
68
|
this.log.debug(`new MatterbridgeDevice with deviceType: ${zb}${firstDefinition.code}${db}-${zb}${firstDefinition.name}${db}`);
|
|
35
69
|
if (Array.isArray(definition)) {
|
|
36
70
|
definition.forEach((deviceType) => {
|
|
@@ -40,12 +74,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
40
74
|
else
|
|
41
75
|
this.addDeviceType(firstDefinition);
|
|
42
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
|
+
*/
|
|
43
85
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
44
86
|
return new MatterbridgeDevice(definition, options, debug);
|
|
45
87
|
}
|
|
88
|
+
// Present in new API but not here
|
|
46
89
|
get maybeNumber() {
|
|
47
90
|
return this.number;
|
|
48
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
|
+
*/
|
|
49
99
|
addDeviceType(deviceType) {
|
|
50
100
|
const deviceTypes = this.getDeviceTypes();
|
|
51
101
|
if (!deviceTypes.includes(deviceType)) {
|
|
@@ -55,6 +105,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
55
105
|
}
|
|
56
106
|
return this;
|
|
57
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
|
+
*/
|
|
58
115
|
addDeviceTypeWithClusterServer(deviceTypes, includeServerList = []) {
|
|
59
116
|
this.log.debug('addDeviceTypeWithClusterServer:');
|
|
60
117
|
deviceTypes.forEach((deviceType) => {
|
|
@@ -76,6 +133,18 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
76
133
|
this.addClusterServerFromList(this, includeServerList);
|
|
77
134
|
return this;
|
|
78
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
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
79
148
|
addChildDeviceType(endpointName, deviceTypes, options = {}, debug = false) {
|
|
80
149
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
81
150
|
let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
@@ -100,6 +169,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
100
169
|
child.setDeviceTypes(childDeviceTypes);
|
|
101
170
|
return child;
|
|
102
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
174
|
+
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
175
|
+
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
176
|
+
*
|
|
177
|
+
* @param {string} endpointName - The name of the new enpoint to add.
|
|
178
|
+
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
179
|
+
* @param {ClusterId[]} [includeServerList=[]] - The list of cluster IDs to include.
|
|
180
|
+
* @param {EndpointOptions} [options={}] - The options for the device.
|
|
181
|
+
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
182
|
+
* @returns {MatterbridgeDevice} - The child endpoint that was found or added.
|
|
183
|
+
*/
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
103
185
|
addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
|
|
104
186
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
105
187
|
let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
@@ -132,6 +214,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
132
214
|
this.addClusterServerFromList(child, includeServerList);
|
|
133
215
|
return child;
|
|
134
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
219
|
+
*
|
|
220
|
+
* @param {Endpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
221
|
+
* @returns {Endpoint} The updated endpoint with the required cluster servers added.
|
|
222
|
+
*/
|
|
135
223
|
addRequiredClusterServers(endpoint) {
|
|
136
224
|
const requiredServerList = [];
|
|
137
225
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.name}${db}`);
|
|
@@ -148,6 +236,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
148
236
|
this.addClusterServerFromList(endpoint, requiredServerList);
|
|
149
237
|
return endpoint;
|
|
150
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
241
|
+
*
|
|
242
|
+
* @param {Endpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
243
|
+
* @returns {Endpoint} The updated endpoint with the required cluster servers added.
|
|
244
|
+
*/
|
|
151
245
|
addOptionalClusterServers(endpoint) {
|
|
152
246
|
const optionalServerList = [];
|
|
153
247
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.name}${db}`);
|
|
@@ -164,11 +258,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
164
258
|
this.addClusterServerFromList(endpoint, optionalServerList);
|
|
165
259
|
return endpoint;
|
|
166
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Adds cluster servers to the specified endpoint based on the provided server list.
|
|
263
|
+
*
|
|
264
|
+
* @param {Endpoint} endpoint - The endpoint to add cluster servers to.
|
|
265
|
+
* @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
|
|
266
|
+
* @returns {Endpoint} The updated endpoint with the cluster servers added.
|
|
267
|
+
*/
|
|
167
268
|
addClusterServerFromList(endpoint, includeServerList) {
|
|
168
269
|
if (includeServerList.includes(Identify.Cluster.id))
|
|
169
270
|
endpoint.addClusterServer(this.getDefaultIdentifyClusterServer());
|
|
170
271
|
if (includeServerList.includes(Groups.Cluster.id))
|
|
171
272
|
endpoint.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
273
|
+
// if (includeServerList.includes(ScenesManagement.Cluster.id)) endpoint.addClusterServer(this.getDefaultScenesClusterServer());
|
|
172
274
|
if (includeServerList.includes(OnOff.Cluster.id))
|
|
173
275
|
endpoint.addClusterServer(this.getDefaultOnOffClusterServer());
|
|
174
276
|
if (includeServerList.includes(LevelControl.Cluster.id))
|
|
@@ -241,9 +343,25 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
241
343
|
endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementModeClusterServer());
|
|
242
344
|
return endpoint;
|
|
243
345
|
}
|
|
346
|
+
/**
|
|
347
|
+
* Retrieves a child endpoint by its name.
|
|
348
|
+
*
|
|
349
|
+
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
350
|
+
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
351
|
+
*/
|
|
244
352
|
getChildEndpointByName(endpointName) {
|
|
245
353
|
return this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
246
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* Retrieves the value of the specified attribute from the given endpoint and cluster.
|
|
357
|
+
*
|
|
358
|
+
* @param {ClusterId} clusterId - The ID of the cluster to retrieve the attribute from.
|
|
359
|
+
* @param {string} attribute - The name of the attribute to retrieve.
|
|
360
|
+
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
361
|
+
* @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the attribute from.
|
|
362
|
+
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
363
|
+
*/
|
|
364
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
247
365
|
getAttribute(clusterId, attribute, log, endpoint) {
|
|
248
366
|
if (!endpoint)
|
|
249
367
|
endpoint = this;
|
|
@@ -257,15 +375,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
257
375
|
this.log.error(`getAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
258
376
|
return undefined;
|
|
259
377
|
}
|
|
378
|
+
// Find the getter method
|
|
379
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
260
380
|
if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
|
|
261
381
|
this.log.error(`getAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
262
382
|
return undefined;
|
|
263
383
|
}
|
|
384
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
264
385
|
const getter = clusterServer[`get${capitalizedAttributeName}Attribute`];
|
|
265
386
|
const value = getter();
|
|
266
387
|
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}`);
|
|
267
388
|
return value;
|
|
268
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* Sets the value of an attribute on a cluster server endpoint.
|
|
392
|
+
*
|
|
393
|
+
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
394
|
+
* @param {string} attribute - The name of the attribute.
|
|
395
|
+
* @param {any} value - The value to set for the attribute.
|
|
396
|
+
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
397
|
+
* @param {Endpoint} [endpoint] - (Optional) The endpoint to set the attribute on. If not provided, the attribute will be set on the current endpoint.
|
|
398
|
+
*/
|
|
399
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
269
400
|
setAttribute(clusterId, attribute, value, log, endpoint) {
|
|
270
401
|
if (!endpoint)
|
|
271
402
|
endpoint = this;
|
|
@@ -279,15 +410,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
279
410
|
this.log.error(`setAttribute error: Attribute ${attribute} not found on Cluster ${clusterId} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
280
411
|
return false;
|
|
281
412
|
}
|
|
413
|
+
// Find the getter method
|
|
414
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
282
415
|
if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
|
|
283
416
|
this.log.error(`setAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
284
417
|
return false;
|
|
285
418
|
}
|
|
419
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
286
420
|
const getter = clusterServer[`get${capitalizedAttributeName}Attribute`];
|
|
421
|
+
// Find the setter method
|
|
422
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
287
423
|
if (!clusterServer[`set${capitalizedAttributeName}Attribute`]) {
|
|
288
424
|
this.log.error(`setAttribute error: Setter set${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
289
425
|
return false;
|
|
290
426
|
}
|
|
427
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
291
428
|
const setter = clusterServer[`set${capitalizedAttributeName}Attribute`];
|
|
292
429
|
const oldValue = getter();
|
|
293
430
|
setter(value);
|
|
@@ -296,6 +433,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
296
433
|
`to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
297
434
|
return true;
|
|
298
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* Subscribes to an attribute on a cluster.
|
|
438
|
+
*
|
|
439
|
+
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
440
|
+
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
441
|
+
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
442
|
+
* @param {AnsiLogger} log - (Optional) An AnsiLogger instance for logging errors and information.
|
|
443
|
+
* @param {Endpoint} endpoint - (Optional) The endpoint to subscribe the attribute on. If not provided, the current endpoint will be used.
|
|
444
|
+
* @returns A boolean indicating whether the subscription was successful.
|
|
445
|
+
*/
|
|
446
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
299
447
|
subscribeAttribute(clusterId, attribute, listener, log, endpoint) {
|
|
300
448
|
if (!endpoint)
|
|
301
449
|
endpoint = this;
|
|
@@ -309,15 +457,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
309
457
|
this.log.error(`subscribeAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
310
458
|
return false;
|
|
311
459
|
}
|
|
460
|
+
// Find the subscribe method
|
|
461
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
312
462
|
if (!clusterServer[`subscribe${capitalizedAttributeName}Attribute`]) {
|
|
313
463
|
this.log.error(`subscribeAttribute error: subscribe${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
314
464
|
return false;
|
|
315
465
|
}
|
|
466
|
+
// Subscribe to the attribute
|
|
467
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
316
468
|
const subscribe = clusterServer[`subscribe${capitalizedAttributeName}Attribute`];
|
|
317
469
|
subscribe(listener);
|
|
318
470
|
log?.info(`${db}Subscribe endpoint ${or}${endpoint.name}:${endpoint.number}${db} attribute ${hk}${clusterServer.name}.${capitalizedAttributeName}${db}`);
|
|
319
471
|
return true;
|
|
320
472
|
}
|
|
473
|
+
/**
|
|
474
|
+
* Triggers the specified event of the specified cluster from the given endpoint and cluster.
|
|
475
|
+
*
|
|
476
|
+
* @param {ClusterId} clusterId - The ID of the cluster to retrieve the event from.
|
|
477
|
+
* @param {string} event - The name of the event to trigger.
|
|
478
|
+
* @param {Record<string, any>} payload - The payload of the event to trigger.
|
|
479
|
+
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
480
|
+
* @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the event from.
|
|
481
|
+
*/
|
|
321
482
|
triggerEvent(clusterId, event, payload, log, endpoint) {
|
|
322
483
|
if (!endpoint)
|
|
323
484
|
endpoint = this;
|
|
@@ -333,20 +494,43 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
333
494
|
this.log.error(`triggerEvent error: Event ${event} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
334
495
|
return;
|
|
335
496
|
}
|
|
497
|
+
// Find the getter method
|
|
498
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
336
499
|
if (!clusterServer[`trigger${capitalizedEventName}Event`]) {
|
|
337
500
|
this.log.error(`triggerEvent error: Trigger trigger${capitalizedEventName}Event not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
338
501
|
return;
|
|
339
502
|
}
|
|
503
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
340
504
|
const trigger = clusterServer[`trigger${capitalizedEventName}Event`];
|
|
341
505
|
trigger(payload);
|
|
342
506
|
log?.info(`${db}Trigger event ${hk}${clusterServer.name}.${capitalizedEventName}${db} on endpoint ${or}${endpoint.name}:${endpoint.number}${db}`);
|
|
343
507
|
}
|
|
508
|
+
/**
|
|
509
|
+
* Adds a tag to the tag list of the specified endpoint.
|
|
510
|
+
*
|
|
511
|
+
* @param {Endpoint} endpoint - The endpoint to add the tag to.
|
|
512
|
+
* @param {VendorId | null} mfgCode - The manufacturer code.
|
|
513
|
+
* @param {number} namespaceId - The namespace ID of the tag.
|
|
514
|
+
* @param {number} tag - The tag number.
|
|
515
|
+
* @param {string | null} [label=null] - The label for the tag.
|
|
516
|
+
*
|
|
517
|
+
* @remarks
|
|
518
|
+
* This method is used to add a tag to the tag list of a given endpoint.
|
|
519
|
+
* 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.
|
|
520
|
+
*
|
|
521
|
+
* Example usage:
|
|
522
|
+
* ```typescript
|
|
523
|
+
* this.addTagList(endpoint, null, NumberTag.One.namespaceId, NumberTag.One.tag, 'Label');
|
|
524
|
+
* this.addTagList(endpoint, null, SwitchesTag.Custom.namespaceId, SwitchesTag.Custom.tag, 'Label');
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
344
527
|
addTagList(endpoint, mfgCode, namespaceId, tag, label) {
|
|
345
528
|
const descriptor = endpoint.getClusterServer(DescriptorCluster.with(Descriptor.Feature.TagList));
|
|
346
529
|
if (!descriptor) {
|
|
347
530
|
this.log.error(`addTagList: descriptor cluster not found on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
348
531
|
return;
|
|
349
532
|
}
|
|
533
|
+
// tagList: { mfgCode: VendorId | null; namespaceId: number; tag: number; label?: string | null }[] = [];
|
|
350
534
|
if (descriptor.attributes.tagList) {
|
|
351
535
|
this.log.debug(`addTagList: adding ${CYAN}tagList${db} mfCode: ${mfgCode}, namespaceId: ${namespaceId}, tag: ${tag}, label: ${label} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
352
536
|
const tagList = descriptor.attributes.tagList.getLocal();
|
|
@@ -362,6 +546,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
362
546
|
partsList: [...descriptor.attributes.partsList.getLocal()],
|
|
363
547
|
}, {}, {}));
|
|
364
548
|
}
|
|
549
|
+
/**
|
|
550
|
+
* Serializes the Matterbridge device into a serialized object.
|
|
551
|
+
*
|
|
552
|
+
* @param pluginName - The name of the plugin.
|
|
553
|
+
* @returns The serialized Matterbridge device object.
|
|
554
|
+
*/
|
|
365
555
|
serialize() {
|
|
366
556
|
if (!this.serialNumber || !this.deviceName || !this.uniqueId)
|
|
367
557
|
return;
|
|
@@ -386,6 +576,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
386
576
|
});
|
|
387
577
|
return serialized;
|
|
388
578
|
}
|
|
579
|
+
/**
|
|
580
|
+
* Deserializes the device into a serialized object.
|
|
581
|
+
*
|
|
582
|
+
* @returns The deserialized MatterbridgeDevice.
|
|
583
|
+
*/
|
|
389
584
|
static deserialize(serializedDevice) {
|
|
390
585
|
const device = new MatterbridgeDevice(serializedDevice.deviceTypes);
|
|
391
586
|
device.serialNumber = serializedDevice.serialNumber;
|
|
@@ -401,6 +596,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
401
596
|
}
|
|
402
597
|
return device;
|
|
403
598
|
}
|
|
599
|
+
/**
|
|
600
|
+
* Get a default IdentifyCluster server.
|
|
601
|
+
*/
|
|
404
602
|
getDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
405
603
|
return ClusterServer(IdentifyCluster, {
|
|
406
604
|
identifyTime,
|
|
@@ -416,28 +614,88 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
416
614
|
},
|
|
417
615
|
});
|
|
418
616
|
}
|
|
617
|
+
/**
|
|
618
|
+
* Creates a default IdentifyCluster server.
|
|
619
|
+
*/
|
|
419
620
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
420
621
|
this.addClusterServer(this.getDefaultIdentifyClusterServer(identifyTime, identifyType));
|
|
421
622
|
}
|
|
623
|
+
/**
|
|
624
|
+
* Get a default IdentifyCluster server.
|
|
625
|
+
*/
|
|
422
626
|
getDefaultGroupsClusterServer() {
|
|
423
627
|
return ClusterServer(GroupsCluster, {
|
|
424
628
|
nameSupport: {
|
|
425
629
|
nameSupport: true,
|
|
426
630
|
},
|
|
427
631
|
}, GroupsClusterHandler());
|
|
632
|
+
// return createDefaultGroupsClusterServer();
|
|
428
633
|
}
|
|
634
|
+
/**
|
|
635
|
+
* Creates a default groups cluster server and adds it to the device.
|
|
636
|
+
*/
|
|
429
637
|
createDefaultGroupsClusterServer() {
|
|
430
638
|
this.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
431
639
|
}
|
|
640
|
+
/**
|
|
641
|
+
* Get a default scenes cluster server and adds it to the current instance.
|
|
642
|
+
* @deprecated This method is deprecated.
|
|
643
|
+
*
|
|
644
|
+
*/
|
|
432
645
|
getDefaultScenesClusterServer() {
|
|
433
|
-
|
|
646
|
+
/*
|
|
647
|
+
return ClusterServer(
|
|
648
|
+
ScenesCluster,
|
|
649
|
+
{
|
|
650
|
+
sceneCount: 0,
|
|
651
|
+
currentScene: 0,
|
|
652
|
+
currentGroup: GroupId(0),
|
|
653
|
+
sceneValid: false,
|
|
654
|
+
nameSupport: {
|
|
655
|
+
nameSupport: true,
|
|
656
|
+
},
|
|
657
|
+
lastConfiguredBy: null,
|
|
658
|
+
},
|
|
659
|
+
{},
|
|
660
|
+
);
|
|
661
|
+
*/
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Creates a default scenes cluster server and adds it to the current instance.
|
|
665
|
+
* @deprecated This method is deprecated.
|
|
666
|
+
*/
|
|
434
667
|
createDefaultScenesClusterServer() {
|
|
435
|
-
|
|
668
|
+
/*
|
|
669
|
+
this.addClusterServer(this.getDefaultScenesClusterServer());
|
|
670
|
+
*/
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Creates a unique identifier based on the provided parameters.
|
|
674
|
+
* @param param1 - The first parameter.
|
|
675
|
+
* @param param2 - The second parameter.
|
|
676
|
+
* @param param3 - The third parameter.
|
|
677
|
+
* @param param4 - The fourth parameter.
|
|
678
|
+
* @returns A unique identifier generated using the MD5 hash algorithm.
|
|
679
|
+
*/
|
|
436
680
|
createUniqueId(param1, param2, param3, param4) {
|
|
437
681
|
const hash = createHash('md5');
|
|
438
682
|
hash.update(param1 + param2 + param3 + param4);
|
|
439
683
|
return hash.digest('hex');
|
|
440
684
|
}
|
|
685
|
+
/**
|
|
686
|
+
* Get a default Basic Information Cluster Server.
|
|
687
|
+
*
|
|
688
|
+
* @param deviceName - The name of the device.
|
|
689
|
+
* @param serialNumber - The serial number of the device.
|
|
690
|
+
* @param vendorId - The vendor ID of the device.
|
|
691
|
+
* @param vendorName - The vendor name of the device.
|
|
692
|
+
* @param productId - The product ID of the device.
|
|
693
|
+
* @param productName - The product name of the device.
|
|
694
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
695
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
696
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
697
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
698
|
+
*/
|
|
441
699
|
getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
442
700
|
this.log.logName = deviceName;
|
|
443
701
|
this.deviceName = deviceName;
|
|
@@ -458,6 +716,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
458
716
|
vendorName: vendorName.slice(0, 32),
|
|
459
717
|
productId: productId,
|
|
460
718
|
productName: productName.slice(0, 32),
|
|
719
|
+
productUrl: 'https://www.npmjs.com/package/matterbridge',
|
|
461
720
|
productLabel: deviceName.slice(0, 64),
|
|
462
721
|
nodeLabel: deviceName.slice(0, 32),
|
|
463
722
|
serialNumber: serialNumber.slice(0, 32),
|
|
@@ -477,6 +736,20 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
477
736
|
reachableChanged: true,
|
|
478
737
|
});
|
|
479
738
|
}
|
|
739
|
+
/**
|
|
740
|
+
* Creates a default Basic Information Cluster Server.
|
|
741
|
+
*
|
|
742
|
+
* @param deviceName - The name of the device.
|
|
743
|
+
* @param serialNumber - The serial number of the device.
|
|
744
|
+
* @param vendorId - The vendor ID of the device.
|
|
745
|
+
* @param vendorName - The vendor name of the device.
|
|
746
|
+
* @param productId - The product ID of the device.
|
|
747
|
+
* @param productName - The product name of the device.
|
|
748
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
749
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
750
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
751
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
752
|
+
*/
|
|
480
753
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
481
754
|
if (MatterbridgeDevice.bridgeMode === 'bridge') {
|
|
482
755
|
this.addDeviceType(bridgedNode);
|
|
@@ -485,6 +758,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
485
758
|
}
|
|
486
759
|
this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
487
760
|
}
|
|
761
|
+
/**
|
|
762
|
+
* Get a default BridgedDeviceBasicInformationClusterServer.
|
|
763
|
+
*
|
|
764
|
+
* @param deviceName - The name of the device.
|
|
765
|
+
* @param serialNumber - The serial number of the device.
|
|
766
|
+
* @param vendorId - The vendor ID of the device.
|
|
767
|
+
* @param vendorName - The name of the vendor.
|
|
768
|
+
* @param productName - The name of the product.
|
|
769
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
770
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
771
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
772
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
773
|
+
*/
|
|
488
774
|
getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
489
775
|
this.log.logName = deviceName;
|
|
490
776
|
this.deviceName = deviceName;
|
|
@@ -499,9 +785,10 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
499
785
|
this.hardwareVersion = hardwareVersion;
|
|
500
786
|
this.hardwareVersionString = hardwareVersionString;
|
|
501
787
|
return ClusterServer(BridgedDeviceBasicInformationCluster, {
|
|
502
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
788
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
|
|
503
789
|
vendorName: vendorName.slice(0, 32),
|
|
504
790
|
productName: productName.slice(0, 32),
|
|
791
|
+
productUrl: 'https://www.npmjs.com/package/matterbridge',
|
|
505
792
|
productLabel: deviceName.slice(0, 64),
|
|
506
793
|
nodeLabel: deviceName.slice(0, 32),
|
|
507
794
|
serialNumber: serialNumber.slice(0, 32),
|
|
@@ -518,12 +805,36 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
518
805
|
reachableChanged: true,
|
|
519
806
|
});
|
|
520
807
|
}
|
|
808
|
+
/**
|
|
809
|
+
* Creates a default BridgedDeviceBasicInformationClusterServer.
|
|
810
|
+
*
|
|
811
|
+
* @param deviceName - The name of the device.
|
|
812
|
+
* @param serialNumber - The serial number of the device.
|
|
813
|
+
* @param vendorId - The vendor ID of the device.
|
|
814
|
+
* @param vendorName - The name of the vendor.
|
|
815
|
+
* @param productName - The name of the product.
|
|
816
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
817
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
818
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
819
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
820
|
+
*/
|
|
521
821
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
522
822
|
this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
523
823
|
}
|
|
824
|
+
/**
|
|
825
|
+
* Get a default Power Topology Cluster Server.
|
|
826
|
+
*
|
|
827
|
+
* @returns {ClusterServer} - The configured Power Topology Cluster Server.
|
|
828
|
+
*/
|
|
524
829
|
getDefaultPowerTopologyClusterServer() {
|
|
525
830
|
return ClusterServer(PowerTopologyCluster.with(PowerTopology.Feature.TreeTopology), {}, {}, {});
|
|
526
831
|
}
|
|
832
|
+
/**
|
|
833
|
+
* Get a default Electrical Energy Measurement Cluster Server.
|
|
834
|
+
*
|
|
835
|
+
* @param {number} energy - The total consumption value in mW/h.
|
|
836
|
+
* @returns {ClusterServer} - The configured Electrical Energy Measurement Cluster Server.
|
|
837
|
+
*/
|
|
527
838
|
getDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
528
839
|
return ClusterServer(ElectricalEnergyMeasurementCluster.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
529
840
|
accuracy: {
|
|
@@ -540,6 +851,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
540
851
|
cumulativeEnergyMeasured: true,
|
|
541
852
|
});
|
|
542
853
|
}
|
|
854
|
+
/**
|
|
855
|
+
* Get a default Electrical Power Measurement Cluster Server.
|
|
856
|
+
*
|
|
857
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
858
|
+
* @param {number} current - The current value in milliamperes.
|
|
859
|
+
* @param {number} power - The power value in milliwatts.
|
|
860
|
+
* @param {number} frequency - The frequency value in millihertz.
|
|
861
|
+
* @returns {ClusterServer} - The configured Electrical Power Measurement Cluster Server.
|
|
862
|
+
*/
|
|
543
863
|
getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
544
864
|
return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
545
865
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -580,6 +900,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
580
900
|
frequency: frequency,
|
|
581
901
|
}, {}, {});
|
|
582
902
|
}
|
|
903
|
+
/**
|
|
904
|
+
* Creates a default Dummy Thread Network Diagnostics Cluster server.
|
|
905
|
+
* @deprecated This method is deprecated and is only used for testing.
|
|
906
|
+
*
|
|
907
|
+
* @remarks
|
|
908
|
+
* This method adds a cluster server used only to give the networkName to Eve app.
|
|
909
|
+
*
|
|
910
|
+
* @returns void
|
|
911
|
+
*/
|
|
583
912
|
createDefaultDummyThreadNetworkDiagnosticsClusterServer() {
|
|
584
913
|
this.addClusterServer(ClusterServer(ThreadNetworkDiagnosticsCluster.with(ThreadNetworkDiagnostics.Feature.PacketCounts, ThreadNetworkDiagnostics.Feature.ErrorCounts), {
|
|
585
914
|
channel: 1,
|
|
@@ -607,6 +936,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
607
936
|
},
|
|
608
937
|
}, {}));
|
|
609
938
|
}
|
|
939
|
+
/**
|
|
940
|
+
* Get a default OnOff cluster server.
|
|
941
|
+
*
|
|
942
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
943
|
+
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
944
|
+
* @param {number} [onTime=0] - The on time value.
|
|
945
|
+
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
946
|
+
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
947
|
+
*
|
|
948
|
+
* @returns {ClusterServer} - The configured OnOff cluster server.
|
|
949
|
+
*/
|
|
610
950
|
getDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
611
951
|
return ClusterServer(OnOffCluster.with(OnOff.Feature.Lighting), {
|
|
612
952
|
onOff,
|
|
@@ -641,15 +981,35 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
641
981
|
},
|
|
642
982
|
}, {});
|
|
643
983
|
}
|
|
984
|
+
/**
|
|
985
|
+
* Creates a default OnOff cluster server.
|
|
986
|
+
*
|
|
987
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
988
|
+
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
989
|
+
* @param {number} [onTime=0] - The on time value.
|
|
990
|
+
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
991
|
+
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
992
|
+
*/
|
|
644
993
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
645
994
|
this.addClusterServer(this.getDefaultOnOffClusterServer(onOff, globalSceneControl, onTime, offWaitTime, startUpOnOff));
|
|
646
995
|
}
|
|
647
|
-
|
|
648
|
-
|
|
996
|
+
/**
|
|
997
|
+
* Get a default level control cluster server.
|
|
998
|
+
*
|
|
999
|
+
* @param currentLevel - The current level (default: 254).
|
|
1000
|
+
* @param minLevel - The minimum level (default: 1).
|
|
1001
|
+
* @param maxLevel - The maximum level (default: 254).
|
|
1002
|
+
* @param onLevel - The on level (default: null).
|
|
1003
|
+
* @param startUpCurrentLevel - The startUp on level (default: null).
|
|
1004
|
+
*/
|
|
1005
|
+
getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
1006
|
+
return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
649
1007
|
currentLevel,
|
|
650
1008
|
minLevel,
|
|
651
1009
|
maxLevel,
|
|
652
1010
|
onLevel,
|
|
1011
|
+
remainingTime: 0,
|
|
1012
|
+
startUpCurrentLevel,
|
|
653
1013
|
options: {
|
|
654
1014
|
executeIfOff: false,
|
|
655
1015
|
coupleColorTempToLevel: false,
|
|
@@ -683,9 +1043,29 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
683
1043
|
},
|
|
684
1044
|
});
|
|
685
1045
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
1046
|
+
/**
|
|
1047
|
+
* Creates a default level control cluster server.
|
|
1048
|
+
*
|
|
1049
|
+
* @param currentLevel - The current level (default: 254).
|
|
1050
|
+
* @param minLevel - The minimum level (default: 1).
|
|
1051
|
+
* @param maxLevel - The maximum level (default: 254).
|
|
1052
|
+
* @param onLevel - The on level (default: null).
|
|
1053
|
+
* @param startUpCurrentLevel - The startUp on level (default: null).
|
|
1054
|
+
*/
|
|
1055
|
+
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
1056
|
+
this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel, startUpCurrentLevel));
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* Get a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
1060
|
+
*
|
|
1061
|
+
* @param currentX - The current X value.
|
|
1062
|
+
* @param currentY - The current Y value.
|
|
1063
|
+
* @param currentHue - The current hue value.
|
|
1064
|
+
* @param currentSaturation - The current saturation value.
|
|
1065
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1066
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1067
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1068
|
+
*/
|
|
689
1069
|
getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
690
1070
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
691
1071
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -703,6 +1083,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
703
1083
|
colorTempPhysicalMinMireds,
|
|
704
1084
|
colorTempPhysicalMaxMireds,
|
|
705
1085
|
coupleColorTempToLevelMinMireds: colorTempPhysicalMinMireds,
|
|
1086
|
+
remainingTime: 0,
|
|
706
1087
|
startUpColorTemperatureMireds: null,
|
|
707
1088
|
}, {
|
|
708
1089
|
moveToColor: async (data) => {
|
|
@@ -754,20 +1135,46 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
754
1135
|
},
|
|
755
1136
|
}, {});
|
|
756
1137
|
}
|
|
1138
|
+
/**
|
|
1139
|
+
* Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
1140
|
+
*
|
|
1141
|
+
* @param currentX - The current X value.
|
|
1142
|
+
* @param currentY - The current Y value.
|
|
1143
|
+
* @param currentHue - The current hue value.
|
|
1144
|
+
* @param currentSaturation - The current saturation value.
|
|
1145
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1146
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1147
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1148
|
+
*/
|
|
757
1149
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
758
1150
|
this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
759
1151
|
}
|
|
760
|
-
|
|
761
|
-
|
|
1152
|
+
/**
|
|
1153
|
+
* Get a Xy color control cluster server with Xy and ColorTemperature.
|
|
1154
|
+
*
|
|
1155
|
+
* @param currentX - The current X value.
|
|
1156
|
+
* @param currentY - The current Y value.
|
|
1157
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1158
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1159
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1160
|
+
*/
|
|
1161
|
+
getXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1162
|
+
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
762
1163
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
763
1164
|
enhancedColorMode: ColorControl.EnhancedColorMode.CurrentXAndCurrentY,
|
|
764
|
-
colorCapabilities: { xy: true, hueSaturation: false, colorLoop: false, enhancedHue: false, colorTemperature:
|
|
1165
|
+
colorCapabilities: { xy: true, hueSaturation: false, colorLoop: false, enhancedHue: false, colorTemperature: true },
|
|
765
1166
|
options: {
|
|
766
1167
|
executeIfOff: false,
|
|
767
1168
|
},
|
|
768
1169
|
numberOfPrimaries: null,
|
|
769
1170
|
currentX,
|
|
770
1171
|
currentY,
|
|
1172
|
+
colorTemperatureMireds,
|
|
1173
|
+
colorTempPhysicalMinMireds,
|
|
1174
|
+
colorTempPhysicalMaxMireds,
|
|
1175
|
+
coupleColorTempToLevelMinMireds: colorTempPhysicalMinMireds,
|
|
1176
|
+
startUpColorTemperatureMireds: null,
|
|
1177
|
+
remainingTime: 0,
|
|
771
1178
|
}, {
|
|
772
1179
|
moveToColor: async (data) => {
|
|
773
1180
|
this.log.debug('Matter command: moveToColor request:', data.request, 'attributes.currentX:', data.attributes.currentX.getLocal(), 'attributes.currentY:', data.attributes.currentY.getLocal());
|
|
@@ -782,22 +1189,56 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
782
1189
|
stopMoveStep: async () => {
|
|
783
1190
|
this.log.error('Matter command: stopMoveStep not implemented');
|
|
784
1191
|
},
|
|
1192
|
+
moveToColorTemperature: async ({ request, attributes, endpoint }) => {
|
|
1193
|
+
this.log.debug('Matter command: moveToColorTemperature request:', request, 'attributes.colorTemperatureMireds:', attributes.colorTemperatureMireds.getLocal());
|
|
1194
|
+
this.commandHandler.executeHandler('moveToColorTemperature', { request, attributes, endpoint });
|
|
1195
|
+
},
|
|
1196
|
+
moveColorTemperature: async () => {
|
|
1197
|
+
this.log.error('Matter command: moveColorTemperature not implemented');
|
|
1198
|
+
},
|
|
1199
|
+
stepColorTemperature: async () => {
|
|
1200
|
+
this.log.error('Matter command: stepColorTemperature not implemented');
|
|
1201
|
+
},
|
|
785
1202
|
}, {});
|
|
786
1203
|
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
1204
|
+
/**
|
|
1205
|
+
* Creates a Xy color control cluster server with Xy and ColorTemperature.
|
|
1206
|
+
*
|
|
1207
|
+
* @param currentX - The current X value.
|
|
1208
|
+
* @param currentY - The current Y value.
|
|
1209
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1210
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1211
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1212
|
+
*/
|
|
1213
|
+
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1214
|
+
this.addClusterServer(this.getXyColorControlClusterServer(currentX, currentY, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Get a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
|
|
1218
|
+
*
|
|
1219
|
+
* @param currentHue - The current hue value.
|
|
1220
|
+
* @param currentSaturation - The current saturation value.
|
|
1221
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1222
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1223
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1224
|
+
*/
|
|
1225
|
+
getHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1226
|
+
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
792
1227
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
793
1228
|
enhancedColorMode: ColorControl.EnhancedColorMode.CurrentHueAndCurrentSaturation,
|
|
794
|
-
colorCapabilities: { xy: false, hueSaturation: true, colorLoop: false, enhancedHue: false, colorTemperature:
|
|
1229
|
+
colorCapabilities: { xy: false, hueSaturation: true, colorLoop: false, enhancedHue: false, colorTemperature: true },
|
|
795
1230
|
options: {
|
|
796
1231
|
executeIfOff: false,
|
|
797
1232
|
},
|
|
798
1233
|
numberOfPrimaries: null,
|
|
799
1234
|
currentHue,
|
|
800
1235
|
currentSaturation,
|
|
1236
|
+
colorTemperatureMireds,
|
|
1237
|
+
colorTempPhysicalMinMireds,
|
|
1238
|
+
colorTempPhysicalMaxMireds,
|
|
1239
|
+
coupleColorTempToLevelMinMireds: colorTempPhysicalMinMireds,
|
|
1240
|
+
startUpColorTemperatureMireds: null,
|
|
1241
|
+
remainingTime: 0,
|
|
801
1242
|
}, {
|
|
802
1243
|
moveToHue: async ({ request, attributes, endpoint }) => {
|
|
803
1244
|
this.log.debug('Matter command: moveToHue request:', request, 'attributes.currentHue:', attributes.currentHue.getLocal());
|
|
@@ -826,11 +1267,37 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
826
1267
|
stopMoveStep: async () => {
|
|
827
1268
|
this.log.error('Matter command: stopMoveStep not implemented');
|
|
828
1269
|
},
|
|
1270
|
+
moveToColorTemperature: async ({ request, attributes, endpoint }) => {
|
|
1271
|
+
this.log.debug('Matter command: moveToColorTemperature request:', request, 'attributes.colorTemperatureMireds:', attributes.colorTemperatureMireds.getLocal());
|
|
1272
|
+
this.commandHandler.executeHandler('moveToColorTemperature', { request, attributes, endpoint });
|
|
1273
|
+
},
|
|
1274
|
+
moveColorTemperature: async () => {
|
|
1275
|
+
this.log.error('Matter command: moveColorTemperature not implemented');
|
|
1276
|
+
},
|
|
1277
|
+
stepColorTemperature: async () => {
|
|
1278
|
+
this.log.error('Matter command: stepColorTemperature not implemented');
|
|
1279
|
+
},
|
|
829
1280
|
}, {});
|
|
830
1281
|
}
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
1282
|
+
/**
|
|
1283
|
+
* Creates a hue and saturation color control cluster server with HueSaturation and ColorTemperature.
|
|
1284
|
+
*
|
|
1285
|
+
* @param currentHue - The current hue value.
|
|
1286
|
+
* @param currentSaturation - The current saturation value.
|
|
1287
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1288
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1289
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1290
|
+
*/
|
|
1291
|
+
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1292
|
+
this.addClusterServer(this.getHsColorControlClusterServer(currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* Get a color temperature color control cluster server.
|
|
1296
|
+
*
|
|
1297
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1298
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1299
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1300
|
+
*/
|
|
834
1301
|
getCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
835
1302
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.ColorTemperature), {
|
|
836
1303
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -844,6 +1311,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
844
1311
|
colorTempPhysicalMinMireds,
|
|
845
1312
|
colorTempPhysicalMaxMireds,
|
|
846
1313
|
coupleColorTempToLevelMinMireds: colorTempPhysicalMinMireds,
|
|
1314
|
+
remainingTime: 0,
|
|
847
1315
|
startUpColorTemperatureMireds: null,
|
|
848
1316
|
}, {
|
|
849
1317
|
stopMoveStep: async () => {
|
|
@@ -861,9 +1329,30 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
861
1329
|
},
|
|
862
1330
|
}, {});
|
|
863
1331
|
}
|
|
1332
|
+
/**
|
|
1333
|
+
* Creates a color temperature color control cluster server.
|
|
1334
|
+
*
|
|
1335
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1336
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1337
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1338
|
+
*/
|
|
864
1339
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
865
1340
|
this.addClusterServer(this.getCtColorControlClusterServer(colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
866
1341
|
}
|
|
1342
|
+
/**
|
|
1343
|
+
* Configures the color control cluster for a device.
|
|
1344
|
+
*
|
|
1345
|
+
* @remark This method must be called only after creating the cluster with getDefaultCompleteColorControlClusterServer or createDefaultCompleteColorControlClusterServer
|
|
1346
|
+
* and before starting the matter server.
|
|
1347
|
+
*
|
|
1348
|
+
* @deprecated Use configureColorControlMode instead.
|
|
1349
|
+
*
|
|
1350
|
+
* @param {boolean} hueSaturation - A boolean indicating whether the device supports hue and saturation control.
|
|
1351
|
+
* @param {boolean} xy - A boolean indicating whether the device supports XY control.
|
|
1352
|
+
* @param {boolean} colorTemperature - A boolean indicating whether the device supports color temperature control.
|
|
1353
|
+
* @param {ColorControl.ColorMode} colorMode - An optional parameter specifying the color mode of the device.
|
|
1354
|
+
* @param {Endpoint} endpoint - An optional parameter specifying the endpoint to configure. If not provided, the device endpoint will be used.
|
|
1355
|
+
*/
|
|
867
1356
|
configureColorControlCluster(hueSaturation, xy, colorTemperature, colorMode, endpoint) {
|
|
868
1357
|
if (!endpoint)
|
|
869
1358
|
endpoint = this;
|
|
@@ -874,6 +1363,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
874
1363
|
endpoint.getClusterServer(ColorControlCluster)?.setEnhancedColorModeAttribute(colorMode);
|
|
875
1364
|
}
|
|
876
1365
|
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Configures the color control mode for the device.
|
|
1368
|
+
*
|
|
1369
|
+
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1370
|
+
* @param {Endpoint} endpoint - The optional endpoint to configure. If not provided, the method will configure the current endpoint.
|
|
1371
|
+
*/
|
|
877
1372
|
configureColorControlMode(colorMode, endpoint) {
|
|
878
1373
|
if (!endpoint)
|
|
879
1374
|
endpoint = this;
|
|
@@ -882,8 +1377,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
882
1377
|
endpoint.getClusterServer(ColorControlCluster)?.setEnhancedColorModeAttribute(colorMode);
|
|
883
1378
|
}
|
|
884
1379
|
}
|
|
1380
|
+
/**
|
|
1381
|
+
* Get a default window covering cluster server.
|
|
1382
|
+
*
|
|
1383
|
+
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
|
|
1384
|
+
*/
|
|
885
1385
|
getDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
886
|
-
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1386
|
+
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift /* , WindowCovering.Feature.AbsolutePosition*/), {
|
|
887
1387
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
888
1388
|
configStatus: {
|
|
889
1389
|
operational: true,
|
|
@@ -897,8 +1397,10 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
897
1397
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
898
1398
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
899
1399
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
900
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
901
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1400
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1401
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1402
|
+
// installedClosedLimitLift: 10000,
|
|
1403
|
+
// installedOpenLimitLift: 0,
|
|
902
1404
|
}, {
|
|
903
1405
|
upOrOpen: async (data) => {
|
|
904
1406
|
this.log.debug('Matter command: upOrOpen');
|
|
@@ -919,9 +1421,18 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
919
1421
|
},
|
|
920
1422
|
}, {});
|
|
921
1423
|
}
|
|
1424
|
+
/**
|
|
1425
|
+
* Creates a default window covering cluster server.
|
|
1426
|
+
*
|
|
1427
|
+
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
|
|
1428
|
+
*/
|
|
922
1429
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
923
1430
|
this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
|
|
924
1431
|
}
|
|
1432
|
+
/**
|
|
1433
|
+
* Sets the window covering target position as the current position and stops the movement.
|
|
1434
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1435
|
+
*/
|
|
925
1436
|
setWindowCoveringTargetAsCurrentAndStopped(endpoint) {
|
|
926
1437
|
if (!endpoint)
|
|
927
1438
|
endpoint = this;
|
|
@@ -939,6 +1450,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
939
1450
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
940
1451
|
}
|
|
941
1452
|
}
|
|
1453
|
+
/**
|
|
1454
|
+
* Sets the current and target status of a window covering.
|
|
1455
|
+
* @param {number} current - The current position of the window covering.
|
|
1456
|
+
* @param {number} target - The target position of the window covering.
|
|
1457
|
+
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1458
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1459
|
+
*/
|
|
942
1460
|
setWindowCoveringCurrentTargetStatus(current, target, status, endpoint) {
|
|
943
1461
|
if (!endpoint)
|
|
944
1462
|
endpoint = this;
|
|
@@ -954,6 +1472,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
954
1472
|
}
|
|
955
1473
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
956
1474
|
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Sets the status of the window covering.
|
|
1477
|
+
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1478
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1479
|
+
*/
|
|
957
1480
|
setWindowCoveringStatus(status, endpoint) {
|
|
958
1481
|
if (!endpoint)
|
|
959
1482
|
endpoint = this;
|
|
@@ -963,6 +1486,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
963
1486
|
windowCovering.setOperationalStatusAttribute({ global: status, lift: status, tilt: status });
|
|
964
1487
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
965
1488
|
}
|
|
1489
|
+
/**
|
|
1490
|
+
* Retrieves the status of the window covering.
|
|
1491
|
+
* @param {Endpoint} endpoint - The endpoint on which to get the window covering (default the device endpoint).
|
|
1492
|
+
*
|
|
1493
|
+
* @returns The global operational status of the window covering.
|
|
1494
|
+
*/
|
|
966
1495
|
getWindowCoveringStatus(endpoint) {
|
|
967
1496
|
if (!endpoint)
|
|
968
1497
|
endpoint = this;
|
|
@@ -973,6 +1502,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
973
1502
|
this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
|
|
974
1503
|
return status.global;
|
|
975
1504
|
}
|
|
1505
|
+
/**
|
|
1506
|
+
* Sets the target and current position of the window covering.
|
|
1507
|
+
*
|
|
1508
|
+
* @param position - The position to set, specified as a number.
|
|
1509
|
+
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1510
|
+
*/
|
|
976
1511
|
setWindowCoveringTargetAndCurrentPosition(position, endpoint) {
|
|
977
1512
|
if (!endpoint)
|
|
978
1513
|
endpoint = this;
|
|
@@ -983,6 +1518,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
983
1518
|
windowCovering.setTargetPositionLiftPercent100thsAttribute(position);
|
|
984
1519
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
985
1520
|
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Get a default door lock cluster server.
|
|
1523
|
+
*
|
|
1524
|
+
* @remarks
|
|
1525
|
+
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1526
|
+
*
|
|
1527
|
+
*/
|
|
986
1528
|
getDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
987
1529
|
return ClusterServer(DoorLockCluster, {
|
|
988
1530
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
@@ -1005,9 +1547,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1005
1547
|
lockOperationError: true,
|
|
1006
1548
|
});
|
|
1007
1549
|
}
|
|
1550
|
+
/**
|
|
1551
|
+
* Creates a default door lock cluster server.
|
|
1552
|
+
*
|
|
1553
|
+
* @remarks
|
|
1554
|
+
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1555
|
+
*
|
|
1556
|
+
*/
|
|
1008
1557
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1009
1558
|
this.addClusterServer(this.getDefaultDoorLockClusterServer(lockState, lockType));
|
|
1010
1559
|
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Get a default momentary switch cluster server.
|
|
1562
|
+
*
|
|
1563
|
+
* @remarks
|
|
1564
|
+
* This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
|
|
1565
|
+
*/
|
|
1011
1566
|
getDefaultSwitchClusterServer() {
|
|
1012
1567
|
return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
|
|
1013
1568
|
numberOfPositions: 2,
|
|
@@ -1022,9 +1577,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1022
1577
|
multiPressComplete: true,
|
|
1023
1578
|
});
|
|
1024
1579
|
}
|
|
1580
|
+
/**
|
|
1581
|
+
* Creates a default momentary switch cluster server.
|
|
1582
|
+
*
|
|
1583
|
+
* @remarks
|
|
1584
|
+
* This method adds a cluster server with default momentary switch features and configurations.
|
|
1585
|
+
*/
|
|
1025
1586
|
createDefaultSwitchClusterServer() {
|
|
1026
1587
|
this.addClusterServer(this.getDefaultSwitchClusterServer());
|
|
1027
1588
|
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Get a default latching switch cluster server.
|
|
1591
|
+
*
|
|
1592
|
+
* @remarks
|
|
1593
|
+
* This method adds a cluster server with default latching switch features and configuration.
|
|
1594
|
+
*/
|
|
1028
1595
|
getDefaultLatchingSwitchClusterServer() {
|
|
1029
1596
|
return ClusterServer(SwitchCluster.with(Switch.Feature.LatchingSwitch), {
|
|
1030
1597
|
numberOfPositions: 2,
|
|
@@ -1033,9 +1600,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1033
1600
|
switchLatched: true,
|
|
1034
1601
|
});
|
|
1035
1602
|
}
|
|
1603
|
+
/**
|
|
1604
|
+
* Creates a default latching switch cluster server.
|
|
1605
|
+
*
|
|
1606
|
+
* @remarks
|
|
1607
|
+
* This method adds a cluster server with default latching switch features and configuration.
|
|
1608
|
+
*/
|
|
1036
1609
|
createDefaultLatchingSwitchClusterServer() {
|
|
1037
1610
|
this.addClusterServer(this.getDefaultLatchingSwitchClusterServer());
|
|
1038
1611
|
}
|
|
1612
|
+
/**
|
|
1613
|
+
* Triggers a switch event on the specified endpoint.
|
|
1614
|
+
*
|
|
1615
|
+
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1616
|
+
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1617
|
+
* @returns {void}
|
|
1618
|
+
*/
|
|
1039
1619
|
triggerSwitchEvent(event, log, endpoint) {
|
|
1040
1620
|
if (!endpoint)
|
|
1041
1621
|
endpoint = this;
|
|
@@ -1107,6 +1687,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1107
1687
|
}
|
|
1108
1688
|
return true;
|
|
1109
1689
|
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Retrieves the default mode select cluster server.
|
|
1692
|
+
*
|
|
1693
|
+
* @param description - The description of the cluster server.
|
|
1694
|
+
* @param supportedModes - The supported modes for the cluster server.
|
|
1695
|
+
* @param currentMode - The current mode of the cluster server. Defaults to 0.
|
|
1696
|
+
* @param startUpMode - The startup mode of the cluster server. Defaults to 0.
|
|
1697
|
+
* @returns The default mode select cluster server.
|
|
1698
|
+
*/
|
|
1110
1699
|
getDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1111
1700
|
return ClusterServer(ModeSelectCluster, {
|
|
1112
1701
|
description: description,
|
|
@@ -1121,11 +1710,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1121
1710
|
},
|
|
1122
1711
|
});
|
|
1123
1712
|
}
|
|
1713
|
+
/**
|
|
1714
|
+
* Creates a default mode select cluster server.
|
|
1715
|
+
*
|
|
1716
|
+
* @remarks
|
|
1717
|
+
* This method adds a cluster server for a mode select cluster with default settings.
|
|
1718
|
+
*
|
|
1719
|
+
* @param endpoint - The endpoint to add the cluster server to. Defaults to `this` if not provided.
|
|
1720
|
+
*/
|
|
1124
1721
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
|
|
1125
1722
|
if (!endpoint)
|
|
1126
1723
|
endpoint = this;
|
|
1127
1724
|
endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
|
|
1128
1725
|
}
|
|
1726
|
+
/**
|
|
1727
|
+
* Get a default occupancy sensing cluster server.
|
|
1728
|
+
*
|
|
1729
|
+
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1730
|
+
*/
|
|
1129
1731
|
getDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1130
1732
|
return ClusterServer(OccupancySensingCluster, {
|
|
1131
1733
|
occupancy: { occupied },
|
|
@@ -1134,9 +1736,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1134
1736
|
pirOccupiedToUnoccupiedDelay: 30,
|
|
1135
1737
|
}, {});
|
|
1136
1738
|
}
|
|
1739
|
+
/**
|
|
1740
|
+
* Creates a default occupancy sensing cluster server.
|
|
1741
|
+
*
|
|
1742
|
+
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1743
|
+
*/
|
|
1137
1744
|
createDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1138
1745
|
this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
|
|
1139
1746
|
}
|
|
1747
|
+
/**
|
|
1748
|
+
* Get a default Illuminance Measurement Cluster Server.
|
|
1749
|
+
*
|
|
1750
|
+
* @param measuredValue - The measured value of illuminance.
|
|
1751
|
+
*/
|
|
1140
1752
|
getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1141
1753
|
return ClusterServer(IlluminanceMeasurementCluster, {
|
|
1142
1754
|
measuredValue,
|
|
@@ -1145,9 +1757,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1145
1757
|
tolerance: 0,
|
|
1146
1758
|
}, {}, {});
|
|
1147
1759
|
}
|
|
1760
|
+
/**
|
|
1761
|
+
* Creates a default Illuminance Measurement Cluster Server.
|
|
1762
|
+
*
|
|
1763
|
+
* @param measuredValue - The measured value of illuminance.
|
|
1764
|
+
*/
|
|
1148
1765
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1149
1766
|
this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
|
|
1150
1767
|
}
|
|
1768
|
+
/**
|
|
1769
|
+
* Get a default flow measurement cluster server.
|
|
1770
|
+
*
|
|
1771
|
+
* @param measuredValue - The measured value of the flow in 10 x m/h.
|
|
1772
|
+
*/
|
|
1151
1773
|
getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1152
1774
|
return ClusterServer(FlowMeasurementCluster, {
|
|
1153
1775
|
measuredValue,
|
|
@@ -1156,9 +1778,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1156
1778
|
tolerance: 0,
|
|
1157
1779
|
}, {}, {});
|
|
1158
1780
|
}
|
|
1781
|
+
/**
|
|
1782
|
+
* Creates a default flow measurement cluster server.
|
|
1783
|
+
*
|
|
1784
|
+
* @param measuredValue - The measured value of the of the flow in 10 x m/h.
|
|
1785
|
+
*/
|
|
1159
1786
|
createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1160
1787
|
this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
|
|
1161
1788
|
}
|
|
1789
|
+
/**
|
|
1790
|
+
* Get a default temperature measurement cluster server.
|
|
1791
|
+
*
|
|
1792
|
+
* @param measuredValue - The measured value of the temperature x 100.
|
|
1793
|
+
*/
|
|
1162
1794
|
getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1163
1795
|
return ClusterServer(TemperatureMeasurementCluster, {
|
|
1164
1796
|
measuredValue,
|
|
@@ -1167,9 +1799,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1167
1799
|
tolerance: 0,
|
|
1168
1800
|
}, {}, {});
|
|
1169
1801
|
}
|
|
1802
|
+
/**
|
|
1803
|
+
* Creates a default temperature measurement cluster server.
|
|
1804
|
+
*
|
|
1805
|
+
* @param measuredValue - The measured value of the temperature x 100.
|
|
1806
|
+
*/
|
|
1170
1807
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1171
1808
|
this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
|
|
1172
1809
|
}
|
|
1810
|
+
/**
|
|
1811
|
+
* Get a default RelativeHumidityMeasurementCluster server.
|
|
1812
|
+
*
|
|
1813
|
+
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
1814
|
+
*/
|
|
1173
1815
|
getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1174
1816
|
return ClusterServer(RelativeHumidityMeasurementCluster, {
|
|
1175
1817
|
measuredValue,
|
|
@@ -1178,9 +1820,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1178
1820
|
tolerance: 0,
|
|
1179
1821
|
}, {}, {});
|
|
1180
1822
|
}
|
|
1823
|
+
/**
|
|
1824
|
+
* Creates a default RelativeHumidityMeasurementCluster server.
|
|
1825
|
+
*
|
|
1826
|
+
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
1827
|
+
*/
|
|
1181
1828
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1182
1829
|
this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
|
|
1183
1830
|
}
|
|
1831
|
+
/**
|
|
1832
|
+
* Get a default Pressure Measurement Cluster Server.
|
|
1833
|
+
*
|
|
1834
|
+
* @param measuredValue - The measured value for the pressure.
|
|
1835
|
+
*/
|
|
1184
1836
|
getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1185
1837
|
return ClusterServer(PressureMeasurementCluster, {
|
|
1186
1838
|
measuredValue,
|
|
@@ -1189,19 +1841,39 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1189
1841
|
tolerance: 0,
|
|
1190
1842
|
}, {}, {});
|
|
1191
1843
|
}
|
|
1844
|
+
/**
|
|
1845
|
+
* Creates a default Pressure Measurement Cluster Server.
|
|
1846
|
+
*
|
|
1847
|
+
* @param measuredValue - The measured value for the pressure.
|
|
1848
|
+
*/
|
|
1192
1849
|
createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1193
1850
|
this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
|
|
1194
1851
|
}
|
|
1852
|
+
/**
|
|
1853
|
+
* Get a default boolean state cluster server.
|
|
1854
|
+
*
|
|
1855
|
+
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
1856
|
+
*/
|
|
1195
1857
|
getDefaultBooleanStateClusterServer(contact) {
|
|
1196
1858
|
return ClusterServer(BooleanStateCluster, {
|
|
1197
|
-
stateValue: contact ?? true,
|
|
1859
|
+
stateValue: contact ?? true, // true=contact false=no_contact
|
|
1198
1860
|
}, {}, {
|
|
1199
1861
|
stateChange: true,
|
|
1200
1862
|
});
|
|
1201
1863
|
}
|
|
1864
|
+
/**
|
|
1865
|
+
* Creates a default boolean state configuration cluster server.
|
|
1866
|
+
*
|
|
1867
|
+
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
1868
|
+
*/
|
|
1202
1869
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1203
1870
|
this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
|
|
1204
1871
|
}
|
|
1872
|
+
/**
|
|
1873
|
+
* Get a default boolean state configuration cluster server.
|
|
1874
|
+
*
|
|
1875
|
+
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1876
|
+
*/
|
|
1205
1877
|
getDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
1206
1878
|
return ClusterServer(BooleanStateConfigurationCluster.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel), {
|
|
1207
1879
|
currentSensitivityLevel: 0,
|
|
@@ -1210,6 +1882,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1210
1882
|
alarmsActive: { visual: false, audible: false },
|
|
1211
1883
|
alarmsEnabled: { visual: false, audible: false },
|
|
1212
1884
|
alarmsSupported: { visual: true, audible: true },
|
|
1885
|
+
// alarmsSuppressed: { visual: false, audible: false },
|
|
1213
1886
|
sensorFault: { generalFault: sensorFault },
|
|
1214
1887
|
}, {
|
|
1215
1888
|
enableDisableAlarm: async ({ request, attributes }) => {
|
|
@@ -1221,9 +1894,23 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1221
1894
|
sensorFault: true,
|
|
1222
1895
|
});
|
|
1223
1896
|
}
|
|
1897
|
+
/**
|
|
1898
|
+
* Creates a default boolean state configuration cluster server.
|
|
1899
|
+
*
|
|
1900
|
+
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1901
|
+
*/
|
|
1224
1902
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
1225
1903
|
this.addClusterServer(this.getDefaultBooleanStateConfigurationClusterServer(sensorFault));
|
|
1226
1904
|
}
|
|
1905
|
+
/**
|
|
1906
|
+
* Get a default power source replaceable battery cluster server.
|
|
1907
|
+
*
|
|
1908
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
1909
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
1910
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
1911
|
+
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
1912
|
+
* @param batQuantity - The battery quantity (default: 1).
|
|
1913
|
+
*/
|
|
1227
1914
|
getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
1228
1915
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
1229
1916
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -1240,9 +1927,25 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1240
1927
|
endpointList: [],
|
|
1241
1928
|
}, {}, {});
|
|
1242
1929
|
}
|
|
1930
|
+
/**
|
|
1931
|
+
* Creates a default power source replaceable battery cluster server.
|
|
1932
|
+
*
|
|
1933
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
1934
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
1935
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
1936
|
+
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
1937
|
+
* @param batQuantity - The battery quantity (default: 1).
|
|
1938
|
+
*/
|
|
1243
1939
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
1244
1940
|
this.addClusterServer(this.getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity));
|
|
1245
1941
|
}
|
|
1942
|
+
/**
|
|
1943
|
+
* Get a default power source rechargeable battery cluster server.
|
|
1944
|
+
*
|
|
1945
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
1946
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
1947
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
1948
|
+
*/
|
|
1246
1949
|
getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
1247
1950
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
1248
1951
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -1260,9 +1963,21 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1260
1963
|
endpointList: [],
|
|
1261
1964
|
}, {}, {});
|
|
1262
1965
|
}
|
|
1966
|
+
/**
|
|
1967
|
+
* Creates a default power source rechargeable battery cluster server.
|
|
1968
|
+
*
|
|
1969
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
1970
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
1971
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
1972
|
+
*/
|
|
1263
1973
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
1264
1974
|
this.addClusterServer(this.getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage));
|
|
1265
1975
|
}
|
|
1976
|
+
/**
|
|
1977
|
+
* Get a default power source wired cluster server.
|
|
1978
|
+
*
|
|
1979
|
+
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
1980
|
+
*/
|
|
1266
1981
|
getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
1267
1982
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Wired), {
|
|
1268
1983
|
wiredCurrentType,
|
|
@@ -1272,22 +1987,45 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1272
1987
|
endpointList: [],
|
|
1273
1988
|
}, {}, {});
|
|
1274
1989
|
}
|
|
1990
|
+
/**
|
|
1991
|
+
* Creates a default power source wired cluster server.
|
|
1992
|
+
*
|
|
1993
|
+
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
1994
|
+
*/
|
|
1275
1995
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
1276
1996
|
this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
|
|
1277
1997
|
}
|
|
1998
|
+
/**
|
|
1999
|
+
* @deprecated This function is deprecated by Matter 1.3 spec and will be removed in a future version.
|
|
2000
|
+
*/
|
|
1278
2001
|
createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
|
|
1279
2002
|
this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
|
|
1280
2003
|
sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
|
|
1281
2004
|
}, {}, {}));
|
|
1282
2005
|
}
|
|
2006
|
+
/**
|
|
2007
|
+
* Get a default air quality cluster server.
|
|
2008
|
+
*
|
|
2009
|
+
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2010
|
+
*/
|
|
1283
2011
|
getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1284
2012
|
return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1285
2013
|
airQuality,
|
|
1286
2014
|
}, {}, {});
|
|
1287
2015
|
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Creates a default air quality cluster server.
|
|
2018
|
+
*
|
|
2019
|
+
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2020
|
+
*/
|
|
1288
2021
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1289
2022
|
this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
|
|
1290
2023
|
}
|
|
2024
|
+
/**
|
|
2025
|
+
* Get a default TVOC measurement cluster server.
|
|
2026
|
+
*
|
|
2027
|
+
* @param measuredValue - The measured value for TVOC.
|
|
2028
|
+
*/
|
|
1291
2029
|
getDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1292
2030
|
return ClusterServer(TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1293
2031
|
measuredValue,
|
|
@@ -1298,14 +2036,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1298
2036
|
measurementMedium,
|
|
1299
2037
|
}, {}, {});
|
|
1300
2038
|
}
|
|
2039
|
+
/**
|
|
2040
|
+
* Creates a default TVOC measurement cluster server.
|
|
2041
|
+
*
|
|
2042
|
+
* @param measuredValue - The measured value for TVOC.
|
|
2043
|
+
*/
|
|
1301
2044
|
createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1302
2045
|
this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1303
2046
|
}
|
|
2047
|
+
/**
|
|
2048
|
+
* Get a default heating thermostat cluster server with the specified parameters.
|
|
2049
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2050
|
+
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2051
|
+
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2052
|
+
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2053
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2054
|
+
*/
|
|
1304
2055
|
getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1305
2056
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
|
|
1306
2057
|
localTemperature: localTemperature * 100,
|
|
1307
2058
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1308
2059
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
2060
|
+
// Thermostat.Feature.Heating
|
|
1309
2061
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1310
2062
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1311
2063
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1318,14 +2070,31 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1318
2070
|
},
|
|
1319
2071
|
}, {});
|
|
1320
2072
|
}
|
|
2073
|
+
/**
|
|
2074
|
+
* Creates and adds a default heating thermostat cluster server to the device.
|
|
2075
|
+
*
|
|
2076
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2077
|
+
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2078
|
+
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2079
|
+
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2080
|
+
*/
|
|
1321
2081
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1322
2082
|
this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
|
|
1323
2083
|
}
|
|
2084
|
+
/**
|
|
2085
|
+
* Get a default cooling thermostat cluster server with the specified parameters.
|
|
2086
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2087
|
+
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2088
|
+
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2089
|
+
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2090
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2091
|
+
*/
|
|
1324
2092
|
getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1325
2093
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
|
|
1326
2094
|
localTemperature: localTemperature * 100,
|
|
1327
2095
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1328
2096
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
2097
|
+
// Thermostat.Feature.Cooling
|
|
1329
2098
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1330
2099
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1331
2100
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -1338,24 +2107,48 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1338
2107
|
},
|
|
1339
2108
|
}, {});
|
|
1340
2109
|
}
|
|
2110
|
+
/**
|
|
2111
|
+
* Creates and adds a default cooling thermostat cluster server to the device.
|
|
2112
|
+
*
|
|
2113
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2114
|
+
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2115
|
+
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2116
|
+
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2117
|
+
*/
|
|
1341
2118
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1342
2119
|
this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
1343
2120
|
}
|
|
2121
|
+
/**
|
|
2122
|
+
* Get a default thermostat cluster server with the specified parameters.
|
|
2123
|
+
*
|
|
2124
|
+
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2125
|
+
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2126
|
+
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2127
|
+
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2128
|
+
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2129
|
+
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2130
|
+
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2131
|
+
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2132
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2133
|
+
*/
|
|
1344
2134
|
getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1345
2135
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1346
2136
|
localTemperature: localTemperature * 100,
|
|
1347
2137
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1348
2138
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
2139
|
+
// Thermostat.Feature.Heating
|
|
1349
2140
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1350
2141
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1351
2142
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1352
2143
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1353
2144
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2145
|
+
// Thermostat.Feature.Cooling
|
|
1354
2146
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1355
2147
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1356
2148
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1357
2149
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1358
2150
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2151
|
+
// Thermostat.Feature.AutoMode
|
|
1359
2152
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1360
2153
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1361
2154
|
}, {
|
|
@@ -1365,9 +2158,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1365
2158
|
},
|
|
1366
2159
|
}, {});
|
|
1367
2160
|
}
|
|
2161
|
+
/**
|
|
2162
|
+
* Creates and adds a default thermostat cluster server to the device.
|
|
2163
|
+
*
|
|
2164
|
+
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2165
|
+
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2166
|
+
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2167
|
+
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2168
|
+
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2169
|
+
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2170
|
+
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2171
|
+
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2172
|
+
*/
|
|
1368
2173
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1369
2174
|
this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
1370
2175
|
}
|
|
2176
|
+
/**
|
|
2177
|
+
* Get a default dummy time sync cluster server. Only needed to create a thermostat.
|
|
2178
|
+
*/
|
|
1371
2179
|
getDefaultTimeSyncClusterServer() {
|
|
1372
2180
|
return ClusterServer(TimeSynchronizationCluster.with(TimeSynchronization.Feature.TimeZone), {
|
|
1373
2181
|
utcTime: null,
|
|
@@ -1399,9 +2207,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1399
2207
|
timeFailure: true,
|
|
1400
2208
|
});
|
|
1401
2209
|
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Creates a default dummy time sync cluster server. Only needed to create a thermostat.
|
|
2212
|
+
*/
|
|
1402
2213
|
createDefaultTimeSyncClusterServer() {
|
|
1403
2214
|
this.addClusterServer(this.getDefaultTimeSyncClusterServer());
|
|
1404
2215
|
}
|
|
2216
|
+
/**
|
|
2217
|
+
* Returns the default SmokeCOAlarm Cluster Server.
|
|
2218
|
+
*
|
|
2219
|
+
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2220
|
+
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2221
|
+
* @returns The default SmokeCOAlarmClusterServer.
|
|
2222
|
+
*/
|
|
1405
2223
|
getDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1406
2224
|
return ClusterServer(SmokeCoAlarmCluster.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm), {
|
|
1407
2225
|
smokeState,
|
|
@@ -1433,9 +2251,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1433
2251
|
allClear: true,
|
|
1434
2252
|
});
|
|
1435
2253
|
}
|
|
2254
|
+
/**
|
|
2255
|
+
* Create the default SmokeCOAlarm Cluster Server.
|
|
2256
|
+
*
|
|
2257
|
+
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2258
|
+
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2259
|
+
* @returns The default SmokeCOAlarmClusterServer.
|
|
2260
|
+
*/
|
|
1436
2261
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1437
2262
|
this.addClusterServer(this.getDefaultSmokeCOAlarmClusterServer(smokeState, coState));
|
|
1438
2263
|
}
|
|
2264
|
+
/**
|
|
2265
|
+
* Returns the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2266
|
+
*
|
|
2267
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2268
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2269
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2270
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2271
|
+
*/
|
|
1439
2272
|
getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1440
2273
|
return ClusterServer(CarbonMonoxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1441
2274
|
measuredValue,
|
|
@@ -1446,9 +2279,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1446
2279
|
measurementMedium,
|
|
1447
2280
|
}, {}, {});
|
|
1448
2281
|
}
|
|
2282
|
+
/**
|
|
2283
|
+
* Create the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2284
|
+
*
|
|
2285
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2286
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2287
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2288
|
+
*/
|
|
1449
2289
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1450
2290
|
this.addClusterServer(this.getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1451
2291
|
}
|
|
2292
|
+
/**
|
|
2293
|
+
* Returns the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2294
|
+
*
|
|
2295
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2296
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2297
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2298
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2299
|
+
*/
|
|
1452
2300
|
getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1453
2301
|
return ClusterServer(CarbonDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1454
2302
|
measuredValue,
|
|
@@ -1459,9 +2307,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1459
2307
|
measurementMedium,
|
|
1460
2308
|
}, {}, {});
|
|
1461
2309
|
}
|
|
2310
|
+
/**
|
|
2311
|
+
* Create the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2312
|
+
*
|
|
2313
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2314
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2315
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2316
|
+
*/
|
|
1462
2317
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1463
2318
|
this.addClusterServer(this.getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1464
2319
|
}
|
|
2320
|
+
/**
|
|
2321
|
+
* Returns the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2322
|
+
*
|
|
2323
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2324
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2325
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2326
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2327
|
+
*/
|
|
1465
2328
|
getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1466
2329
|
return ClusterServer(FormaldehydeConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1467
2330
|
measuredValue,
|
|
@@ -1472,9 +2335,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1472
2335
|
measurementMedium,
|
|
1473
2336
|
}, {}, {});
|
|
1474
2337
|
}
|
|
2338
|
+
/**
|
|
2339
|
+
* Create the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2340
|
+
*
|
|
2341
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2342
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2343
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2344
|
+
*/
|
|
1475
2345
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1476
2346
|
this.addClusterServer(this.getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1477
2347
|
}
|
|
2348
|
+
/**
|
|
2349
|
+
* Returns the default Pm1 Concentration Measurement Cluster Server.
|
|
2350
|
+
*
|
|
2351
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2352
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2353
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2354
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2355
|
+
*/
|
|
1478
2356
|
getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1479
2357
|
return ClusterServer(Pm1ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1480
2358
|
measuredValue,
|
|
@@ -1485,9 +2363,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1485
2363
|
measurementMedium,
|
|
1486
2364
|
}, {}, {});
|
|
1487
2365
|
}
|
|
2366
|
+
/**
|
|
2367
|
+
* Create the default Pm1 Concentration Measurement Cluster Server.
|
|
2368
|
+
*
|
|
2369
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2370
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2371
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2372
|
+
*/
|
|
1488
2373
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1489
2374
|
this.addClusterServer(this.getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1490
2375
|
}
|
|
2376
|
+
/**
|
|
2377
|
+
* Returns the default Pm25 Concentration Measurement Cluster Server.
|
|
2378
|
+
*
|
|
2379
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2380
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2381
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2382
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2383
|
+
*/
|
|
1491
2384
|
getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1492
2385
|
return ClusterServer(Pm25ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1493
2386
|
measuredValue,
|
|
@@ -1498,9 +2391,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1498
2391
|
measurementMedium,
|
|
1499
2392
|
}, {}, {});
|
|
1500
2393
|
}
|
|
2394
|
+
/**
|
|
2395
|
+
* Create the default Pm25 Concentration Measurement Cluster Server.
|
|
2396
|
+
*
|
|
2397
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2398
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2399
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2400
|
+
*/
|
|
1501
2401
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1502
2402
|
this.addClusterServer(this.getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1503
2403
|
}
|
|
2404
|
+
/**
|
|
2405
|
+
* Returns the default Pm10 Concentration Measurement Cluster Server.
|
|
2406
|
+
*
|
|
2407
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2408
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2409
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2410
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2411
|
+
*/
|
|
1504
2412
|
getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1505
2413
|
return ClusterServer(Pm10ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1506
2414
|
measuredValue,
|
|
@@ -1511,9 +2419,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1511
2419
|
measurementMedium,
|
|
1512
2420
|
}, {}, {});
|
|
1513
2421
|
}
|
|
2422
|
+
/**
|
|
2423
|
+
* Create the default Pm10 Concentration Measurement Cluster Server.
|
|
2424
|
+
*
|
|
2425
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2426
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2427
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2428
|
+
*/
|
|
1514
2429
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1515
2430
|
this.addClusterServer(this.getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1516
2431
|
}
|
|
2432
|
+
/**
|
|
2433
|
+
* Returns the default Ozone Concentration Measurement Cluster Server.
|
|
2434
|
+
*
|
|
2435
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2436
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2437
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2438
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2439
|
+
*/
|
|
1517
2440
|
getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1518
2441
|
return ClusterServer(OzoneConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1519
2442
|
measuredValue,
|
|
@@ -1524,9 +2447,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1524
2447
|
measurementMedium,
|
|
1525
2448
|
}, {}, {});
|
|
1526
2449
|
}
|
|
2450
|
+
/**
|
|
2451
|
+
* Create the default Ozone Concentration Measurement Cluster Server.
|
|
2452
|
+
*
|
|
2453
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2454
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2455
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2456
|
+
*/
|
|
1527
2457
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1528
2458
|
this.addClusterServer(this.getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1529
2459
|
}
|
|
2460
|
+
/**
|
|
2461
|
+
* Returns the default Radon Concentration Measurement Cluster Server.
|
|
2462
|
+
*
|
|
2463
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2464
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2465
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2466
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2467
|
+
*/
|
|
1530
2468
|
getDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1531
2469
|
return ClusterServer(RadonConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1532
2470
|
measuredValue,
|
|
@@ -1537,9 +2475,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1537
2475
|
measurementMedium,
|
|
1538
2476
|
}, {}, {});
|
|
1539
2477
|
}
|
|
2478
|
+
/**
|
|
2479
|
+
* Create the default Radon Concentration Measurement Cluster Server.
|
|
2480
|
+
*
|
|
2481
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2482
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2483
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2484
|
+
*/
|
|
1540
2485
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1541
2486
|
this.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1542
2487
|
}
|
|
2488
|
+
/**
|
|
2489
|
+
* Returns the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2490
|
+
*
|
|
2491
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2492
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2493
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2494
|
+
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2495
|
+
*/
|
|
1543
2496
|
getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1544
2497
|
return ClusterServer(NitrogenDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1545
2498
|
measuredValue,
|
|
@@ -1550,9 +2503,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1550
2503
|
measurementMedium,
|
|
1551
2504
|
}, {}, {});
|
|
1552
2505
|
}
|
|
2506
|
+
/**
|
|
2507
|
+
* Create the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2508
|
+
*
|
|
2509
|
+
* @param {number} measuredValue - The measured value of the concentration.
|
|
2510
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2511
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2512
|
+
*/
|
|
1553
2513
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1554
2514
|
this.addClusterServer(this.getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1555
2515
|
}
|
|
2516
|
+
/**
|
|
2517
|
+
* Returns the default fan control cluster server rev 2.
|
|
2518
|
+
*
|
|
2519
|
+
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2520
|
+
* @returns The default fan control cluster server.
|
|
2521
|
+
*/
|
|
1556
2522
|
getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1557
2523
|
return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1558
2524
|
fanMode,
|
|
@@ -1569,9 +2535,16 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1569
2535
|
},
|
|
1570
2536
|
}, {});
|
|
1571
2537
|
}
|
|
2538
|
+
/**
|
|
2539
|
+
* Create the default fan control cluster server rev 2.
|
|
2540
|
+
*
|
|
2541
|
+
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2542
|
+
* @returns The default fan control cluster server.
|
|
2543
|
+
*/
|
|
1572
2544
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1573
2545
|
this.addClusterServer(this.getDefaultFanControlClusterServer(fanMode));
|
|
1574
2546
|
}
|
|
2547
|
+
// NOTE Support of Device Energy Management Cluster is provisional.
|
|
1575
2548
|
getDefaultDeviceEnergyManagementClusterServer() {
|
|
1576
2549
|
return ClusterServer(DeviceEnergyManagementCluster.with(DeviceEnergyManagement.Feature.Pausable, DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.StateForecastReporting), {
|
|
1577
2550
|
esaType: DeviceEnergyManagement.EsaType.Other,
|
|
@@ -1595,6 +2568,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1595
2568
|
resumed: true,
|
|
1596
2569
|
});
|
|
1597
2570
|
}
|
|
2571
|
+
// NOTE Support of Device Energy Management Mode Cluster is provisional.
|
|
1598
2572
|
getDefaultDeviceEnergyManagementModeClusterServer() {
|
|
1599
2573
|
return ClusterServer(DeviceEnergyManagementModeCluster, {
|
|
1600
2574
|
supportedModes: [
|
|
@@ -1611,3 +2585,4 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1611
2585
|
}, {});
|
|
1612
2586
|
}
|
|
1613
2587
|
}
|
|
2588
|
+
//# sourceMappingURL=matterbridgeDevice.js.map
|