matterbridge 1.6.5 → 1.6.6-dev.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/cli.js +0 -26
- package/dist/cluster/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -23
- package/dist/deviceManager.js +1 -26
- package/dist/index.js +0 -30
- package/dist/logger/export.js +0 -1
- package/dist/matter/export.js +0 -1
- package/dist/matterbridge.js +62 -702
- package/dist/matterbridgeAccessoryPlatform.js +0 -33
- package/dist/matterbridgeBehaviors.js +1 -29
- package/dist/matterbridgeDevice.js +39 -933
- package/dist/matterbridgeDeviceTypes.js +21 -41
- package/dist/matterbridgeDynamicPlatform.js +0 -33
- package/dist/matterbridgeEdge.js +0 -525
- package/dist/matterbridgeEndpoint.js +37 -1004
- package/dist/matterbridgePlatform.js +3 -74
- package/dist/matterbridgeTypes.js +0 -24
- package/dist/matterbridgeWebsocket.js +0 -45
- package/dist/pluginManager.js +3 -237
- package/dist/storage/export.js +0 -1
- package/dist/utils/colorUtils.js +2 -78
- package/dist/utils/export.js +0 -1
- package/dist/utils/utils.js +7 -252
- package/npm-shrinkwrap.json +9 -9
- package/package.json +2 -2
- package/dist/cli.d.ts +0 -25
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cluster/export.d.ts +0 -2
- package/dist/cluster/export.d.ts.map +0 -1
- package/dist/cluster/export.js.map +0 -1
- package/dist/defaultConfigSchema.d.ts +0 -27
- package/dist/defaultConfigSchema.d.ts.map +0 -1
- package/dist/defaultConfigSchema.js.map +0 -1
- package/dist/deviceManager.d.ts +0 -46
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/index.d.ts +0 -40
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger/export.d.ts +0 -2
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/export.d.ts +0 -5
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -466
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -39
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -934
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDevice.d.ts +0 -6504
- package/dist/matterbridgeDevice.d.ts.map +0 -1
- package/dist/matterbridgeDevice.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -65
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -39
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEdge.d.ts +0 -89
- package/dist/matterbridgeEdge.d.ts.map +0 -1
- package/dist/matterbridgeEdge.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -8529
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -96
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -147
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/matterbridgeWebsocket.d.ts +0 -49
- package/dist/matterbridgeWebsocket.d.ts.map +0 -1
- package/dist/matterbridgeWebsocket.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -238
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/storage/export.d.ts +0 -2
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -61
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/export.d.ts +0 -3
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/utils.d.ts +0 -221
- package/dist/utils/utils.d.ts.map +0 -1
- package/dist/utils/utils.js.map +0 -1
|
@@ -1,41 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the class MatterbridgeDevice.
|
|
3
|
-
*
|
|
4
|
-
* @file matterbridgeDevice.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2023-12-29
|
|
7
|
-
* @version 2.0.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2023, 2024, 2025 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License. *
|
|
22
|
-
*/
|
|
23
|
-
// @matter
|
|
24
1
|
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';
|
|
25
2
|
import { Specification } from '@matter/main/model';
|
|
26
3
|
import { EndpointNumber, extendPublicHandlerMethods, VendorId } from '@matter/main';
|
|
27
4
|
import { MeasurementType, getClusterNameById } from '@matter/main/types';
|
|
28
|
-
// @project-chip
|
|
29
5
|
import { Device } from '@project-chip/matter.js/device';
|
|
30
6
|
import { GroupsClusterHandler, ClusterServer } from '@project-chip/matter.js/cluster';
|
|
31
|
-
// AnsiLogger module
|
|
32
7
|
import { AnsiLogger, CYAN, YELLOW, db, hk, or, zb, debugStringify } from 'node-ansi-logger';
|
|
33
|
-
// Node.js modules
|
|
34
8
|
import { createHash } from 'crypto';
|
|
35
9
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
36
10
|
export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
37
11
|
static bridgeMode = '';
|
|
38
|
-
static logLevel = "info"
|
|
12
|
+
static logLevel = "info";
|
|
39
13
|
log;
|
|
40
14
|
plugin = undefined;
|
|
41
15
|
serialNumber = undefined;
|
|
@@ -49,13 +23,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
49
23
|
softwareVersionString = undefined;
|
|
50
24
|
hardwareVersion = undefined;
|
|
51
25
|
hardwareVersionString = undefined;
|
|
52
|
-
/**
|
|
53
|
-
* Create a Matterbridge device.
|
|
54
|
-
* @constructor
|
|
55
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition of the device.
|
|
56
|
-
* @param {EndpointOptions} [options={}] - The options for the device.
|
|
57
|
-
* @param {boolean} [debug=false] - The debug level for the device.
|
|
58
|
-
*/
|
|
59
26
|
constructor(definition, options = {}, debug = false) {
|
|
60
27
|
let firstDefinition;
|
|
61
28
|
if (Array.isArray(definition))
|
|
@@ -63,7 +30,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
63
30
|
else
|
|
64
31
|
firstDefinition = definition;
|
|
65
32
|
super(firstDefinition, options);
|
|
66
|
-
this.log = new AnsiLogger({ logName: 'MatterbridgeDevice', logTimestampFormat: 4
|
|
33
|
+
this.log = new AnsiLogger({ logName: 'MatterbridgeDevice', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeDevice.logLevel });
|
|
67
34
|
this.log.debug(`new MatterbridgeDevice with deviceType: ${zb}${firstDefinition.code}${db}-${zb}${firstDefinition.name}${db}`);
|
|
68
35
|
if (Array.isArray(definition)) {
|
|
69
36
|
definition.forEach((deviceType) => {
|
|
@@ -73,28 +40,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
73
40
|
else
|
|
74
41
|
this.addDeviceType(firstDefinition);
|
|
75
42
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Loads asyncronously an instance of the MatterbridgeDevice class.
|
|
78
|
-
*
|
|
79
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition of the device.
|
|
80
|
-
* @param {EndpointOptions} [options={}] - The options for the device.
|
|
81
|
-
* @param {boolean} [debug=false] - The debug level for the device.
|
|
82
|
-
* @returns {Promise<MatterbridgeDevice>} A Promise of MatterbridgeDevice instance.
|
|
83
|
-
*/
|
|
84
43
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
85
44
|
return new MatterbridgeDevice(definition, options, debug);
|
|
86
45
|
}
|
|
87
|
-
// Present in new API but not here
|
|
88
46
|
get maybeNumber() {
|
|
89
47
|
return this.number;
|
|
90
48
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Adds a device type to the list of device types of the MatterbridgeDevice endpoint.
|
|
93
|
-
* If the device type is not already present in the list, it will be added.
|
|
94
|
-
*
|
|
95
|
-
* @param {DeviceTypeDefinition} deviceType - The device type to add.
|
|
96
|
-
* @returns {MatterbridgeDevice} The MatterbridgeDevice instance.
|
|
97
|
-
*/
|
|
98
49
|
addDeviceType(deviceType) {
|
|
99
50
|
const deviceTypes = this.getDeviceTypes();
|
|
100
51
|
if (!deviceTypes.includes(deviceType)) {
|
|
@@ -104,13 +55,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
104
55
|
}
|
|
105
56
|
return this;
|
|
106
57
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Adds one or more device types with the required cluster servers and the specified cluster servers.
|
|
109
|
-
*
|
|
110
|
-
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
111
|
-
* @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
|
|
112
|
-
* @returns {MatterbridgeDevice} The MatterbridgeDevice instance.
|
|
113
|
-
*/
|
|
114
58
|
addDeviceTypeWithClusterServer(deviceTypes, includeServerList = []) {
|
|
115
59
|
this.log.debug('addDeviceTypeWithClusterServer:');
|
|
116
60
|
deviceTypes.forEach((deviceType) => {
|
|
@@ -132,18 +76,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
132
76
|
this.addClusterServerFromList(this, includeServerList);
|
|
133
77
|
return this;
|
|
134
78
|
}
|
|
135
|
-
/**
|
|
136
|
-
* Adds a child endpoint with the specified device types and options.
|
|
137
|
-
* If the child endpoint is not already present, it will be created and added.
|
|
138
|
-
* If the child endpoint is already present, the device types will be added to the existing child endpoint.
|
|
139
|
-
*
|
|
140
|
-
* @param {string} endpointName - The name of the new endpoint to add.
|
|
141
|
-
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
142
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
|
|
143
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
144
|
-
* @returns {MatterbridgeDevice} - The child endpoint that was found or added.
|
|
145
|
-
*/
|
|
146
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
147
79
|
addChildDeviceType(endpointName, deviceTypes, options = {}, debug = false) {
|
|
148
80
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
149
81
|
let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
@@ -168,19 +100,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
168
100
|
child.setDeviceTypes(childDeviceTypes);
|
|
169
101
|
return child;
|
|
170
102
|
}
|
|
171
|
-
/**
|
|
172
|
-
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
173
|
-
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
174
|
-
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
175
|
-
*
|
|
176
|
-
* @param {string} endpointName - The name of the new enpoint to add.
|
|
177
|
-
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
178
|
-
* @param {ClusterId[]} [includeServerList=[]] - The list of cluster IDs to include.
|
|
179
|
-
* @param {EndpointOptions} [options={}] - The options for the device.
|
|
180
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
181
|
-
* @returns {MatterbridgeDevice} - The child endpoint that was found or added.
|
|
182
|
-
*/
|
|
183
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
184
103
|
addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
|
|
185
104
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
186
105
|
let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
@@ -213,12 +132,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
213
132
|
this.addClusterServerFromList(child, includeServerList);
|
|
214
133
|
return child;
|
|
215
134
|
}
|
|
216
|
-
/**
|
|
217
|
-
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
218
|
-
*
|
|
219
|
-
* @param {Endpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
220
|
-
* @returns {Endpoint} The updated endpoint with the required cluster servers added.
|
|
221
|
-
*/
|
|
222
135
|
addRequiredClusterServers(endpoint) {
|
|
223
136
|
const requiredServerList = [];
|
|
224
137
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.name}${db}`);
|
|
@@ -235,12 +148,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
235
148
|
this.addClusterServerFromList(endpoint, requiredServerList);
|
|
236
149
|
return endpoint;
|
|
237
150
|
}
|
|
238
|
-
/**
|
|
239
|
-
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
240
|
-
*
|
|
241
|
-
* @param {Endpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
242
|
-
* @returns {Endpoint} The updated endpoint with the required cluster servers added.
|
|
243
|
-
*/
|
|
244
151
|
addOptionalClusterServers(endpoint) {
|
|
245
152
|
const optionalServerList = [];
|
|
246
153
|
this.log.debug(`addRequiredClusterServer for ${CYAN}${endpoint.name}${db}`);
|
|
@@ -257,19 +164,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
257
164
|
this.addClusterServerFromList(endpoint, optionalServerList);
|
|
258
165
|
return endpoint;
|
|
259
166
|
}
|
|
260
|
-
/**
|
|
261
|
-
* Adds cluster servers to the specified endpoint based on the provided server list.
|
|
262
|
-
*
|
|
263
|
-
* @param {Endpoint} endpoint - The endpoint to add cluster servers to.
|
|
264
|
-
* @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
|
|
265
|
-
* @returns {Endpoint} The updated endpoint with the cluster servers added.
|
|
266
|
-
*/
|
|
267
167
|
addClusterServerFromList(endpoint, includeServerList) {
|
|
268
168
|
if (includeServerList.includes(Identify.Cluster.id))
|
|
269
169
|
endpoint.addClusterServer(this.getDefaultIdentifyClusterServer());
|
|
270
170
|
if (includeServerList.includes(Groups.Cluster.id))
|
|
271
171
|
endpoint.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
272
|
-
// if (includeServerList.includes(ScenesManagement.Cluster.id)) endpoint.addClusterServer(this.getDefaultScenesClusterServer());
|
|
273
172
|
if (includeServerList.includes(OnOff.Cluster.id))
|
|
274
173
|
endpoint.addClusterServer(this.getDefaultOnOffClusterServer());
|
|
275
174
|
if (includeServerList.includes(LevelControl.Cluster.id))
|
|
@@ -342,25 +241,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
342
241
|
endpoint.addClusterServer(this.getDefaultDeviceEnergyManagementModeClusterServer());
|
|
343
242
|
return endpoint;
|
|
344
243
|
}
|
|
345
|
-
/**
|
|
346
|
-
* Retrieves a child endpoint by its name.
|
|
347
|
-
*
|
|
348
|
-
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
349
|
-
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
350
|
-
*/
|
|
351
244
|
getChildEndpointByName(endpointName) {
|
|
352
245
|
return this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
353
246
|
}
|
|
354
|
-
/**
|
|
355
|
-
* Retrieves the value of the specified attribute from the given endpoint and cluster.
|
|
356
|
-
*
|
|
357
|
-
* @param {ClusterId} clusterId - The ID of the cluster to retrieve the attribute from.
|
|
358
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
359
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
360
|
-
* @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the attribute from.
|
|
361
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
362
|
-
*/
|
|
363
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
364
247
|
getAttribute(clusterId, attribute, log, endpoint) {
|
|
365
248
|
if (!endpoint)
|
|
366
249
|
endpoint = this;
|
|
@@ -374,28 +257,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
374
257
|
this.log.error(`getAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
375
258
|
return undefined;
|
|
376
259
|
}
|
|
377
|
-
// Find the getter method
|
|
378
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
379
260
|
if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
|
|
380
261
|
this.log.error(`getAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
381
262
|
return undefined;
|
|
382
263
|
}
|
|
383
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
384
264
|
const getter = clusterServer[`get${capitalizedAttributeName}Attribute`];
|
|
385
265
|
const value = getter();
|
|
386
266
|
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}`);
|
|
387
267
|
return value;
|
|
388
268
|
}
|
|
389
|
-
/**
|
|
390
|
-
* Sets the value of an attribute on a cluster server endpoint.
|
|
391
|
-
*
|
|
392
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
393
|
-
* @param {string} attribute - The name of the attribute.
|
|
394
|
-
* @param {any} value - The value to set for the attribute.
|
|
395
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
396
|
-
* @param {Endpoint} [endpoint] - (Optional) The endpoint to set the attribute on. If not provided, the attribute will be set on the current endpoint.
|
|
397
|
-
*/
|
|
398
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
399
269
|
setAttribute(clusterId, attribute, value, log, endpoint) {
|
|
400
270
|
if (!endpoint)
|
|
401
271
|
endpoint = this;
|
|
@@ -409,21 +279,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
409
279
|
this.log.error(`setAttribute error: Attribute ${attribute} not found on Cluster ${clusterId} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
410
280
|
return false;
|
|
411
281
|
}
|
|
412
|
-
// Find the getter method
|
|
413
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
414
282
|
if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
|
|
415
283
|
this.log.error(`setAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
416
284
|
return false;
|
|
417
285
|
}
|
|
418
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
419
286
|
const getter = clusterServer[`get${capitalizedAttributeName}Attribute`];
|
|
420
|
-
// Find the setter method
|
|
421
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
422
287
|
if (!clusterServer[`set${capitalizedAttributeName}Attribute`]) {
|
|
423
288
|
this.log.error(`setAttribute error: Setter set${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
424
289
|
return false;
|
|
425
290
|
}
|
|
426
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
427
291
|
const setter = clusterServer[`set${capitalizedAttributeName}Attribute`];
|
|
428
292
|
const oldValue = getter();
|
|
429
293
|
setter(value);
|
|
@@ -432,17 +296,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
432
296
|
`to ${YELLOW}${typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
433
297
|
return true;
|
|
434
298
|
}
|
|
435
|
-
/**
|
|
436
|
-
* Subscribes to an attribute on a cluster.
|
|
437
|
-
*
|
|
438
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
439
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
440
|
-
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
441
|
-
* @param {AnsiLogger} log - (Optional) An AnsiLogger instance for logging errors and information.
|
|
442
|
-
* @param {Endpoint} endpoint - (Optional) The endpoint to subscribe the attribute on. If not provided, the current endpoint will be used.
|
|
443
|
-
* @returns A boolean indicating whether the subscription was successful.
|
|
444
|
-
*/
|
|
445
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
446
299
|
subscribeAttribute(clusterId, attribute, listener, log, endpoint) {
|
|
447
300
|
if (!endpoint)
|
|
448
301
|
endpoint = this;
|
|
@@ -456,28 +309,15 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
456
309
|
this.log.error(`subscribeAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
457
310
|
return false;
|
|
458
311
|
}
|
|
459
|
-
// Find the subscribe method
|
|
460
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
461
312
|
if (!clusterServer[`subscribe${capitalizedAttributeName}Attribute`]) {
|
|
462
313
|
this.log.error(`subscribeAttribute error: subscribe${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
463
314
|
return false;
|
|
464
315
|
}
|
|
465
|
-
// Subscribe to the attribute
|
|
466
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
467
316
|
const subscribe = clusterServer[`subscribe${capitalizedAttributeName}Attribute`];
|
|
468
317
|
subscribe(listener);
|
|
469
318
|
log?.info(`${db}Subscribe endpoint ${or}${endpoint.name}:${endpoint.number}${db} attribute ${hk}${clusterServer.name}.${capitalizedAttributeName}${db}`);
|
|
470
319
|
return true;
|
|
471
320
|
}
|
|
472
|
-
/**
|
|
473
|
-
* Triggers the specified event of the specified cluster from the given endpoint and cluster.
|
|
474
|
-
*
|
|
475
|
-
* @param {ClusterId} clusterId - The ID of the cluster to retrieve the event from.
|
|
476
|
-
* @param {string} event - The name of the event to trigger.
|
|
477
|
-
* @param {Record<string, any>} payload - The payload of the event to trigger.
|
|
478
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
479
|
-
* @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the event from.
|
|
480
|
-
*/
|
|
481
321
|
triggerEvent(clusterId, event, payload, log, endpoint) {
|
|
482
322
|
if (!endpoint)
|
|
483
323
|
endpoint = this;
|
|
@@ -493,43 +333,20 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
493
333
|
this.log.error(`triggerEvent error: Event ${event} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
494
334
|
return;
|
|
495
335
|
}
|
|
496
|
-
// Find the getter method
|
|
497
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
498
336
|
if (!clusterServer[`trigger${capitalizedEventName}Event`]) {
|
|
499
337
|
this.log.error(`triggerEvent error: Trigger trigger${capitalizedEventName}Event not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
500
338
|
return;
|
|
501
339
|
}
|
|
502
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
503
340
|
const trigger = clusterServer[`trigger${capitalizedEventName}Event`];
|
|
504
341
|
trigger(payload);
|
|
505
342
|
log?.info(`${db}Trigger event ${hk}${clusterServer.name}.${capitalizedEventName}${db} on endpoint ${or}${endpoint.name}:${endpoint.number}${db}`);
|
|
506
343
|
}
|
|
507
|
-
/**
|
|
508
|
-
* Adds a tag to the tag list of the specified endpoint.
|
|
509
|
-
*
|
|
510
|
-
* @param {Endpoint} endpoint - The endpoint to add the tag to.
|
|
511
|
-
* @param {VendorId | null} mfgCode - The manufacturer code.
|
|
512
|
-
* @param {number} namespaceId - The namespace ID of the tag.
|
|
513
|
-
* @param {number} tag - The tag number.
|
|
514
|
-
* @param {string | null} [label=null] - The label for the tag.
|
|
515
|
-
*
|
|
516
|
-
* @remarks
|
|
517
|
-
* This method is used to add a tag to the tag list of a given endpoint.
|
|
518
|
-
* 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.
|
|
519
|
-
*
|
|
520
|
-
* Example usage:
|
|
521
|
-
* ```typescript
|
|
522
|
-
* this.addTagList(endpoint, null, NumberTag.One.namespaceId, NumberTag.One.tag, 'Label');
|
|
523
|
-
* this.addTagList(endpoint, null, SwitchesTag.Custom.namespaceId, SwitchesTag.Custom.tag, 'Label');
|
|
524
|
-
* ```
|
|
525
|
-
*/
|
|
526
344
|
addTagList(endpoint, mfgCode, namespaceId, tag, label) {
|
|
527
345
|
const descriptor = endpoint.getClusterServer(DescriptorCluster.with(Descriptor.Feature.TagList));
|
|
528
346
|
if (!descriptor) {
|
|
529
347
|
this.log.error(`addTagList: descriptor cluster not found on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
530
348
|
return;
|
|
531
349
|
}
|
|
532
|
-
// tagList: { mfgCode: VendorId | null; namespaceId: number; tag: number; label?: string | null }[] = [];
|
|
533
350
|
if (descriptor.attributes.tagList) {
|
|
534
351
|
this.log.debug(`addTagList: adding ${CYAN}tagList${db} mfCode: ${mfgCode}, namespaceId: ${namespaceId}, tag: ${tag}, label: ${label} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
535
352
|
const tagList = descriptor.attributes.tagList.getLocal();
|
|
@@ -545,12 +362,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
545
362
|
partsList: [...descriptor.attributes.partsList.getLocal()],
|
|
546
363
|
}, {}, {}));
|
|
547
364
|
}
|
|
548
|
-
/**
|
|
549
|
-
* Serializes the Matterbridge device into a serialized object.
|
|
550
|
-
*
|
|
551
|
-
* @param pluginName - The name of the plugin.
|
|
552
|
-
* @returns The serialized Matterbridge device object.
|
|
553
|
-
*/
|
|
554
365
|
serialize() {
|
|
555
366
|
if (!this.serialNumber || !this.deviceName || !this.uniqueId)
|
|
556
367
|
return;
|
|
@@ -575,11 +386,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
575
386
|
});
|
|
576
387
|
return serialized;
|
|
577
388
|
}
|
|
578
|
-
/**
|
|
579
|
-
* Deserializes the device into a serialized object.
|
|
580
|
-
*
|
|
581
|
-
* @returns The deserialized MatterbridgeDevice.
|
|
582
|
-
*/
|
|
583
389
|
static deserialize(serializedDevice) {
|
|
584
390
|
const device = new MatterbridgeDevice(serializedDevice.deviceTypes);
|
|
585
391
|
device.serialNumber = serializedDevice.serialNumber;
|
|
@@ -595,9 +401,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
595
401
|
}
|
|
596
402
|
return device;
|
|
597
403
|
}
|
|
598
|
-
/**
|
|
599
|
-
* Get a default IdentifyCluster server.
|
|
600
|
-
*/
|
|
601
404
|
getDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
602
405
|
return ClusterServer(IdentifyCluster, {
|
|
603
406
|
identifyTime,
|
|
@@ -613,88 +416,28 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
613
416
|
},
|
|
614
417
|
});
|
|
615
418
|
}
|
|
616
|
-
/**
|
|
617
|
-
* Creates a default IdentifyCluster server.
|
|
618
|
-
*/
|
|
619
419
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
620
420
|
this.addClusterServer(this.getDefaultIdentifyClusterServer(identifyTime, identifyType));
|
|
621
421
|
}
|
|
622
|
-
/**
|
|
623
|
-
* Get a default IdentifyCluster server.
|
|
624
|
-
*/
|
|
625
422
|
getDefaultGroupsClusterServer() {
|
|
626
423
|
return ClusterServer(GroupsCluster, {
|
|
627
424
|
nameSupport: {
|
|
628
425
|
nameSupport: true,
|
|
629
426
|
},
|
|
630
427
|
}, GroupsClusterHandler());
|
|
631
|
-
// return createDefaultGroupsClusterServer();
|
|
632
428
|
}
|
|
633
|
-
/**
|
|
634
|
-
* Creates a default groups cluster server and adds it to the device.
|
|
635
|
-
*/
|
|
636
429
|
createDefaultGroupsClusterServer() {
|
|
637
430
|
this.addClusterServer(this.getDefaultGroupsClusterServer());
|
|
638
431
|
}
|
|
639
|
-
/**
|
|
640
|
-
* Get a default scenes cluster server and adds it to the current instance.
|
|
641
|
-
* @deprecated This method is deprecated.
|
|
642
|
-
*
|
|
643
|
-
*/
|
|
644
432
|
getDefaultScenesClusterServer() {
|
|
645
|
-
|
|
646
|
-
return ClusterServer(
|
|
647
|
-
ScenesCluster,
|
|
648
|
-
{
|
|
649
|
-
sceneCount: 0,
|
|
650
|
-
currentScene: 0,
|
|
651
|
-
currentGroup: GroupId(0),
|
|
652
|
-
sceneValid: false,
|
|
653
|
-
nameSupport: {
|
|
654
|
-
nameSupport: true,
|
|
655
|
-
},
|
|
656
|
-
lastConfiguredBy: null,
|
|
657
|
-
},
|
|
658
|
-
{},
|
|
659
|
-
);
|
|
660
|
-
*/
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Creates a default scenes cluster server and adds it to the current instance.
|
|
664
|
-
* @deprecated This method is deprecated.
|
|
665
|
-
*/
|
|
433
|
+
}
|
|
666
434
|
createDefaultScenesClusterServer() {
|
|
667
|
-
|
|
668
|
-
this.addClusterServer(this.getDefaultScenesClusterServer());
|
|
669
|
-
*/
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* Creates a unique identifier based on the provided parameters.
|
|
673
|
-
* @param param1 - The first parameter.
|
|
674
|
-
* @param param2 - The second parameter.
|
|
675
|
-
* @param param3 - The third parameter.
|
|
676
|
-
* @param param4 - The fourth parameter.
|
|
677
|
-
* @returns A unique identifier generated using the MD5 hash algorithm.
|
|
678
|
-
*/
|
|
435
|
+
}
|
|
679
436
|
createUniqueId(param1, param2, param3, param4) {
|
|
680
437
|
const hash = createHash('md5');
|
|
681
438
|
hash.update(param1 + param2 + param3 + param4);
|
|
682
439
|
return hash.digest('hex');
|
|
683
440
|
}
|
|
684
|
-
/**
|
|
685
|
-
* Get a default Basic Information Cluster Server.
|
|
686
|
-
*
|
|
687
|
-
* @param deviceName - The name of the device.
|
|
688
|
-
* @param serialNumber - The serial number of the device.
|
|
689
|
-
* @param vendorId - The vendor ID of the device.
|
|
690
|
-
* @param vendorName - The vendor name of the device.
|
|
691
|
-
* @param productId - The product ID of the device.
|
|
692
|
-
* @param productName - The product name of the device.
|
|
693
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
694
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
695
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
696
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
697
|
-
*/
|
|
698
441
|
getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
699
442
|
this.log.logName = deviceName;
|
|
700
443
|
this.deviceName = deviceName;
|
|
@@ -734,20 +477,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
734
477
|
reachableChanged: true,
|
|
735
478
|
});
|
|
736
479
|
}
|
|
737
|
-
/**
|
|
738
|
-
* Creates a default Basic Information Cluster Server.
|
|
739
|
-
*
|
|
740
|
-
* @param deviceName - The name of the device.
|
|
741
|
-
* @param serialNumber - The serial number of the device.
|
|
742
|
-
* @param vendorId - The vendor ID of the device.
|
|
743
|
-
* @param vendorName - The vendor name of the device.
|
|
744
|
-
* @param productId - The product ID of the device.
|
|
745
|
-
* @param productName - The product name of the device.
|
|
746
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
747
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
748
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
749
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
750
|
-
*/
|
|
751
480
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
752
481
|
if (MatterbridgeDevice.bridgeMode === 'bridge') {
|
|
753
482
|
this.addDeviceType(bridgedNode);
|
|
@@ -756,19 +485,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
756
485
|
}
|
|
757
486
|
this.addClusterServer(this.getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
758
487
|
}
|
|
759
|
-
/**
|
|
760
|
-
* Get a default BridgedDeviceBasicInformationClusterServer.
|
|
761
|
-
*
|
|
762
|
-
* @param deviceName - The name of the device.
|
|
763
|
-
* @param serialNumber - The serial number of the device.
|
|
764
|
-
* @param vendorId - The vendor ID of the device.
|
|
765
|
-
* @param vendorName - The name of the vendor.
|
|
766
|
-
* @param productName - The name of the product.
|
|
767
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
768
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
769
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
770
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
771
|
-
*/
|
|
772
488
|
getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
773
489
|
this.log.logName = deviceName;
|
|
774
490
|
this.deviceName = deviceName;
|
|
@@ -783,7 +499,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
783
499
|
this.hardwareVersion = hardwareVersion;
|
|
784
500
|
this.hardwareVersionString = hardwareVersionString;
|
|
785
501
|
return ClusterServer(BridgedDeviceBasicInformationCluster, {
|
|
786
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
502
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
787
503
|
vendorName: vendorName.slice(0, 32),
|
|
788
504
|
productName: productName.slice(0, 32),
|
|
789
505
|
productLabel: deviceName.slice(0, 64),
|
|
@@ -802,36 +518,12 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
802
518
|
reachableChanged: true,
|
|
803
519
|
});
|
|
804
520
|
}
|
|
805
|
-
/**
|
|
806
|
-
* Creates a default BridgedDeviceBasicInformationClusterServer.
|
|
807
|
-
*
|
|
808
|
-
* @param deviceName - The name of the device.
|
|
809
|
-
* @param serialNumber - The serial number of the device.
|
|
810
|
-
* @param vendorId - The vendor ID of the device.
|
|
811
|
-
* @param vendorName - The name of the vendor.
|
|
812
|
-
* @param productName - The name of the product.
|
|
813
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
814
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
815
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
816
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
817
|
-
*/
|
|
818
521
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
819
522
|
this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
820
523
|
}
|
|
821
|
-
/**
|
|
822
|
-
* Get a default Power Topology Cluster Server.
|
|
823
|
-
*
|
|
824
|
-
* @returns {ClusterServer} - The configured Power Topology Cluster Server.
|
|
825
|
-
*/
|
|
826
524
|
getDefaultPowerTopologyClusterServer() {
|
|
827
525
|
return ClusterServer(PowerTopologyCluster.with(PowerTopology.Feature.TreeTopology), {}, {}, {});
|
|
828
526
|
}
|
|
829
|
-
/**
|
|
830
|
-
* Get a default Electrical Energy Measurement Cluster Server.
|
|
831
|
-
*
|
|
832
|
-
* @param {number} energy - The total consumption value in mW/h.
|
|
833
|
-
* @returns {ClusterServer} - The configured Electrical Energy Measurement Cluster Server.
|
|
834
|
-
*/
|
|
835
527
|
getDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
836
528
|
return ClusterServer(ElectricalEnergyMeasurementCluster.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
837
529
|
accuracy: {
|
|
@@ -848,15 +540,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
848
540
|
cumulativeEnergyMeasured: true,
|
|
849
541
|
});
|
|
850
542
|
}
|
|
851
|
-
/**
|
|
852
|
-
* Get a default Electrical Power Measurement Cluster Server.
|
|
853
|
-
*
|
|
854
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
855
|
-
* @param {number} current - The current value in milliamperes.
|
|
856
|
-
* @param {number} power - The power value in milliwatts.
|
|
857
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
858
|
-
* @returns {ClusterServer} - The configured Electrical Power Measurement Cluster Server.
|
|
859
|
-
*/
|
|
860
543
|
getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
861
544
|
return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
862
545
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -897,15 +580,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
897
580
|
frequency: frequency,
|
|
898
581
|
}, {}, {});
|
|
899
582
|
}
|
|
900
|
-
/**
|
|
901
|
-
* Creates a default Dummy Thread Network Diagnostics Cluster server.
|
|
902
|
-
* @deprecated This method is deprecated and is only used for testing.
|
|
903
|
-
*
|
|
904
|
-
* @remarks
|
|
905
|
-
* This method adds a cluster server used only to give the networkName to Eve app.
|
|
906
|
-
*
|
|
907
|
-
* @returns void
|
|
908
|
-
*/
|
|
909
583
|
createDefaultDummyThreadNetworkDiagnosticsClusterServer() {
|
|
910
584
|
this.addClusterServer(ClusterServer(ThreadNetworkDiagnosticsCluster.with(ThreadNetworkDiagnostics.Feature.PacketCounts, ThreadNetworkDiagnostics.Feature.ErrorCounts), {
|
|
911
585
|
channel: 1,
|
|
@@ -933,45 +607,43 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
933
607
|
},
|
|
934
608
|
}, {}));
|
|
935
609
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
*
|
|
939
|
-
* @param onOff - The initial state of the OnOff cluster (default: false).
|
|
940
|
-
*/
|
|
941
|
-
getDefaultOnOffClusterServer(onOff = false) {
|
|
942
|
-
return ClusterServer(OnOffCluster, {
|
|
610
|
+
getDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
611
|
+
return ClusterServer(OnOffCluster.with(OnOff.Feature.Lighting), {
|
|
943
612
|
onOff,
|
|
613
|
+
globalSceneControl,
|
|
614
|
+
onTime,
|
|
615
|
+
offWaitTime,
|
|
616
|
+
startUpOnOff,
|
|
944
617
|
}, {
|
|
945
618
|
on: async (data) => {
|
|
946
|
-
this.log.debug('Matter command: on
|
|
619
|
+
this.log.debug('Matter command: on');
|
|
947
620
|
await this.commandHandler.executeHandler('on', data);
|
|
948
621
|
},
|
|
949
622
|
off: async (data) => {
|
|
950
|
-
this.log.debug('Matter command: off
|
|
623
|
+
this.log.debug('Matter command: off');
|
|
951
624
|
await this.commandHandler.executeHandler('off', data);
|
|
952
625
|
},
|
|
953
626
|
toggle: async (data) => {
|
|
954
|
-
this.log.debug('Matter command: toggle
|
|
627
|
+
this.log.debug('Matter command: toggle');
|
|
955
628
|
await this.commandHandler.executeHandler('toggle', data);
|
|
956
629
|
},
|
|
630
|
+
offWithEffect: async (data) => {
|
|
631
|
+
this.log.debug('Matter command: offWithEffect', data.request);
|
|
632
|
+
await this.commandHandler.executeHandler('offWithEffect', data);
|
|
633
|
+
},
|
|
634
|
+
onWithRecallGlobalScene: async (data) => {
|
|
635
|
+
this.log.debug('Matter command: onWithRecallGlobalScene', data.request);
|
|
636
|
+
await this.commandHandler.executeHandler('onWithRecallGlobalScene', data);
|
|
637
|
+
},
|
|
638
|
+
onWithTimedOff: async (data) => {
|
|
639
|
+
this.log.debug('Matter command: onWithTimedOff', data.request);
|
|
640
|
+
await this.commandHandler.executeHandler('onWithTimedOff', data);
|
|
641
|
+
},
|
|
957
642
|
}, {});
|
|
958
643
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
* @param onOff - The initial state of the OnOff cluster (default: false).
|
|
963
|
-
*/
|
|
964
|
-
createDefaultOnOffClusterServer(onOff = false) {
|
|
965
|
-
this.addClusterServer(this.getDefaultOnOffClusterServer(onOff));
|
|
966
|
-
}
|
|
967
|
-
/**
|
|
968
|
-
* Get a default level control cluster server.
|
|
969
|
-
*
|
|
970
|
-
* @param currentLevel - The current level (default: 254).
|
|
971
|
-
* @param minLevel - The minimum level (default: 0).
|
|
972
|
-
* @param maxLevel - The maximum level (default: 254).
|
|
973
|
-
* @param onLevel - The on level (default: null).
|
|
974
|
-
*/
|
|
644
|
+
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
645
|
+
this.addClusterServer(this.getDefaultOnOffClusterServer(onOff, globalSceneControl, onTime, offWaitTime, startUpOnOff));
|
|
646
|
+
}
|
|
975
647
|
getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 0, maxLevel = 254, onLevel = null) {
|
|
976
648
|
return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff), {
|
|
977
649
|
currentLevel,
|
|
@@ -1011,28 +683,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1011
683
|
},
|
|
1012
684
|
});
|
|
1013
685
|
}
|
|
1014
|
-
/**
|
|
1015
|
-
* Creates a default level control cluster server.
|
|
1016
|
-
*
|
|
1017
|
-
* @param currentLevel - The current level (default: 254).
|
|
1018
|
-
* @param minLevel - The minimum level (default: 0).
|
|
1019
|
-
* @param maxLevel - The maximum level (default: 254).
|
|
1020
|
-
* @param onLevel - The on level (default: null).
|
|
1021
|
-
*/
|
|
1022
686
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 0, maxLevel = 254, onLevel = null) {
|
|
1023
687
|
this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel));
|
|
1024
688
|
}
|
|
1025
|
-
/**
|
|
1026
|
-
* Get a default color control cluster server.
|
|
1027
|
-
*
|
|
1028
|
-
* @param currentX - The current X value.
|
|
1029
|
-
* @param currentY - The current Y value.
|
|
1030
|
-
* @param currentHue - The current hue value.
|
|
1031
|
-
* @param currentSaturation - The current saturation value.
|
|
1032
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1033
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1034
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1035
|
-
*/
|
|
1036
689
|
getDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1037
690
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1038
691
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1099,26 +752,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1099
752
|
},
|
|
1100
753
|
}, {});
|
|
1101
754
|
}
|
|
1102
|
-
/**
|
|
1103
|
-
* Creates a default color control cluster server.
|
|
1104
|
-
*
|
|
1105
|
-
* @param currentX - The current X value.
|
|
1106
|
-
* @param currentY - The current Y value.
|
|
1107
|
-
* @param currentHue - The current hue value.
|
|
1108
|
-
* @param currentSaturation - The current saturation value.
|
|
1109
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1110
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1111
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1112
|
-
*/
|
|
1113
755
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1114
756
|
this.addClusterServer(this.getDefaultColorControlClusterServer(currentX, currentY, currentHue, currentSaturation, colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1115
757
|
}
|
|
1116
|
-
/**
|
|
1117
|
-
* Get a Xy color control cluster server.
|
|
1118
|
-
*
|
|
1119
|
-
* @param currentX - The current X value.
|
|
1120
|
-
* @param currentY - The current Y value.
|
|
1121
|
-
*/
|
|
1122
758
|
getXyColorControlClusterServer(currentX = 0, currentY = 0) {
|
|
1123
759
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.Xy), {
|
|
1124
760
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -1146,21 +782,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1146
782
|
},
|
|
1147
783
|
}, {});
|
|
1148
784
|
}
|
|
1149
|
-
/**
|
|
1150
|
-
* Creates a Xy color control cluster server.
|
|
1151
|
-
*
|
|
1152
|
-
* @param currentX - The current X value.
|
|
1153
|
-
* @param currentY - The current Y value.
|
|
1154
|
-
*/
|
|
1155
785
|
createXyControlClusterServer(currentX = 0, currentY = 0) {
|
|
1156
786
|
this.addClusterServer(this.getXyColorControlClusterServer(currentX, currentY));
|
|
1157
787
|
}
|
|
1158
|
-
/**
|
|
1159
|
-
* Get a default hue and saturation control cluster server.
|
|
1160
|
-
*
|
|
1161
|
-
* @param currentHue - The current hue value.
|
|
1162
|
-
* @param currentSaturation - The current saturation value.
|
|
1163
|
-
*/
|
|
1164
788
|
getHsColorControlClusterServer(currentHue = 0, currentSaturation = 0) {
|
|
1165
789
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.HueSaturation), {
|
|
1166
790
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1202,22 +826,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1202
826
|
},
|
|
1203
827
|
}, {});
|
|
1204
828
|
}
|
|
1205
|
-
/**
|
|
1206
|
-
* Creates a hue and saturation color control cluster server.
|
|
1207
|
-
*
|
|
1208
|
-
* @param currentHue - The current hue value.
|
|
1209
|
-
* @param currentSaturation - The current saturation value.
|
|
1210
|
-
*/
|
|
1211
829
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0) {
|
|
1212
830
|
this.addClusterServer(this.getHsColorControlClusterServer(currentHue, currentSaturation));
|
|
1213
831
|
}
|
|
1214
|
-
/**
|
|
1215
|
-
* Get a color temperature color control cluster server.
|
|
1216
|
-
*
|
|
1217
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1218
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1219
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1220
|
-
*/
|
|
1221
832
|
getCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1222
833
|
return ClusterServer(ColorControlCluster.with(ColorControl.Feature.ColorTemperature), {
|
|
1223
834
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1246,28 +857,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1246
857
|
},
|
|
1247
858
|
}, {});
|
|
1248
859
|
}
|
|
1249
|
-
/**
|
|
1250
|
-
* Creates a color temperature color control cluster server.
|
|
1251
|
-
*
|
|
1252
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1253
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1254
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1255
|
-
*/
|
|
1256
860
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1257
861
|
this.addClusterServer(this.getCtColorControlClusterServer(colorTemperatureMireds, colorTempPhysicalMinMireds, colorTempPhysicalMaxMireds));
|
|
1258
862
|
}
|
|
1259
|
-
/**
|
|
1260
|
-
* Configures the color control cluster for a device.
|
|
1261
|
-
*
|
|
1262
|
-
* @remark This method must be called only after creating the cluster with getDefaultCompleteColorControlClusterServer or createDefaultCompleteColorControlClusterServer
|
|
1263
|
-
* and before starting the matter server.
|
|
1264
|
-
*
|
|
1265
|
-
* @param {boolean} hueSaturation - A boolean indicating whether the device supports hue and saturation control.
|
|
1266
|
-
* @param {boolean} xy - A boolean indicating whether the device supports XY control.
|
|
1267
|
-
* @param {boolean} colorTemperature - A boolean indicating whether the device supports color temperature control.
|
|
1268
|
-
* @param {ColorControl.ColorMode} colorMode - An optional parameter specifying the color mode of the device.
|
|
1269
|
-
* @param {Endpoint} endpoint - An optional parameter specifying the endpoint to configure. If not provided, the device endpoint will be used.
|
|
1270
|
-
*/
|
|
1271
863
|
configureColorControlCluster(hueSaturation, xy, colorTemperature, colorMode, endpoint) {
|
|
1272
864
|
if (!endpoint)
|
|
1273
865
|
endpoint = this;
|
|
@@ -1278,12 +870,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1278
870
|
endpoint.getClusterServer(ColorControlCluster)?.setEnhancedColorModeAttribute(colorMode);
|
|
1279
871
|
}
|
|
1280
872
|
}
|
|
1281
|
-
/**
|
|
1282
|
-
* Configures the color control mode for the device.
|
|
1283
|
-
*
|
|
1284
|
-
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1285
|
-
* @param {Endpoint} endpoint - The optional endpoint to configure. If not provided, the method will configure the current endpoint.
|
|
1286
|
-
*/
|
|
1287
873
|
configureColorControlMode(colorMode, endpoint) {
|
|
1288
874
|
if (!endpoint)
|
|
1289
875
|
endpoint = this;
|
|
@@ -1292,13 +878,8 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1292
878
|
endpoint.getClusterServer(ColorControlCluster)?.setEnhancedColorModeAttribute(colorMode);
|
|
1293
879
|
}
|
|
1294
880
|
}
|
|
1295
|
-
/**
|
|
1296
|
-
* Get a default window covering cluster server.
|
|
1297
|
-
*
|
|
1298
|
-
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
|
|
1299
|
-
*/
|
|
1300
881
|
getDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1301
|
-
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift
|
|
882
|
+
return ClusterServer(WindowCoveringCluster.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1302
883
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
1303
884
|
configStatus: {
|
|
1304
885
|
operational: true,
|
|
@@ -1312,10 +893,8 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1312
893
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1313
894
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
1314
895
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1315
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1316
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1317
|
-
// installedClosedLimitLift: 10000,
|
|
1318
|
-
// installedOpenLimitLift: 0,
|
|
896
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
897
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1319
898
|
}, {
|
|
1320
899
|
upOrOpen: async (data) => {
|
|
1321
900
|
this.log.debug('Matter command: upOrOpen');
|
|
@@ -1336,18 +915,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1336
915
|
},
|
|
1337
916
|
}, {});
|
|
1338
917
|
}
|
|
1339
|
-
/**
|
|
1340
|
-
* Creates a default window covering cluster server.
|
|
1341
|
-
*
|
|
1342
|
-
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0.
|
|
1343
|
-
*/
|
|
1344
918
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1345
919
|
this.addClusterServer(this.getDefaultWindowCoveringClusterServer(positionPercent100ths));
|
|
1346
920
|
}
|
|
1347
|
-
/**
|
|
1348
|
-
* Sets the window covering target position as the current position and stops the movement.
|
|
1349
|
-
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1350
|
-
*/
|
|
1351
921
|
setWindowCoveringTargetAsCurrentAndStopped(endpoint) {
|
|
1352
922
|
if (!endpoint)
|
|
1353
923
|
endpoint = this;
|
|
@@ -1365,13 +935,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1365
935
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1366
936
|
}
|
|
1367
937
|
}
|
|
1368
|
-
/**
|
|
1369
|
-
* Sets the current and target status of a window covering.
|
|
1370
|
-
* @param {number} current - The current position of the window covering.
|
|
1371
|
-
* @param {number} target - The target position of the window covering.
|
|
1372
|
-
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1373
|
-
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1374
|
-
*/
|
|
1375
938
|
setWindowCoveringCurrentTargetStatus(current, target, status, endpoint) {
|
|
1376
939
|
if (!endpoint)
|
|
1377
940
|
endpoint = this;
|
|
@@ -1387,11 +950,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1387
950
|
}
|
|
1388
951
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1389
952
|
}
|
|
1390
|
-
/**
|
|
1391
|
-
* Sets the status of the window covering.
|
|
1392
|
-
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1393
|
-
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1394
|
-
*/
|
|
1395
953
|
setWindowCoveringStatus(status, endpoint) {
|
|
1396
954
|
if (!endpoint)
|
|
1397
955
|
endpoint = this;
|
|
@@ -1401,12 +959,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1401
959
|
windowCovering.setOperationalStatusAttribute({ global: status, lift: status, tilt: status });
|
|
1402
960
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1403
961
|
}
|
|
1404
|
-
/**
|
|
1405
|
-
* Retrieves the status of the window covering.
|
|
1406
|
-
* @param {Endpoint} endpoint - The endpoint on which to get the window covering (default the device endpoint).
|
|
1407
|
-
*
|
|
1408
|
-
* @returns The global operational status of the window covering.
|
|
1409
|
-
*/
|
|
1410
962
|
getWindowCoveringStatus(endpoint) {
|
|
1411
963
|
if (!endpoint)
|
|
1412
964
|
endpoint = this;
|
|
@@ -1417,12 +969,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1417
969
|
this.log.debug(`Get WindowCovering operationalStatus: ${status.global}`);
|
|
1418
970
|
return status.global;
|
|
1419
971
|
}
|
|
1420
|
-
/**
|
|
1421
|
-
* Sets the target and current position of the window covering.
|
|
1422
|
-
*
|
|
1423
|
-
* @param position - The position to set, specified as a number.
|
|
1424
|
-
* @param {Endpoint} endpoint - The endpoint on which to set the window covering (default the device endpoint).
|
|
1425
|
-
*/
|
|
1426
972
|
setWindowCoveringTargetAndCurrentPosition(position, endpoint) {
|
|
1427
973
|
if (!endpoint)
|
|
1428
974
|
endpoint = this;
|
|
@@ -1433,13 +979,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1433
979
|
windowCovering.setTargetPositionLiftPercent100thsAttribute(position);
|
|
1434
980
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
1435
981
|
}
|
|
1436
|
-
/**
|
|
1437
|
-
* Get a default door lock cluster server.
|
|
1438
|
-
*
|
|
1439
|
-
* @remarks
|
|
1440
|
-
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1441
|
-
*
|
|
1442
|
-
*/
|
|
1443
982
|
getDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1444
983
|
return ClusterServer(DoorLockCluster, {
|
|
1445
984
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
@@ -1462,22 +1001,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1462
1001
|
lockOperationError: true,
|
|
1463
1002
|
});
|
|
1464
1003
|
}
|
|
1465
|
-
/**
|
|
1466
|
-
* Creates a default door lock cluster server.
|
|
1467
|
-
*
|
|
1468
|
-
* @remarks
|
|
1469
|
-
* This method adds a cluster server for a door lock cluster with default settings.
|
|
1470
|
-
*
|
|
1471
|
-
*/
|
|
1472
1004
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1473
1005
|
this.addClusterServer(this.getDefaultDoorLockClusterServer(lockState, lockType));
|
|
1474
1006
|
}
|
|
1475
|
-
/**
|
|
1476
|
-
* Get a default momentary switch cluster server.
|
|
1477
|
-
*
|
|
1478
|
-
* @remarks
|
|
1479
|
-
* This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
|
|
1480
|
-
*/
|
|
1481
1007
|
getDefaultSwitchClusterServer() {
|
|
1482
1008
|
return ClusterServer(SwitchCluster.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress), {
|
|
1483
1009
|
numberOfPositions: 2,
|
|
@@ -1492,21 +1018,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1492
1018
|
multiPressComplete: true,
|
|
1493
1019
|
});
|
|
1494
1020
|
}
|
|
1495
|
-
/**
|
|
1496
|
-
* Creates a default momentary switch cluster server.
|
|
1497
|
-
*
|
|
1498
|
-
* @remarks
|
|
1499
|
-
* This method adds a cluster server with default momentary switch features and configurations.
|
|
1500
|
-
*/
|
|
1501
1021
|
createDefaultSwitchClusterServer() {
|
|
1502
1022
|
this.addClusterServer(this.getDefaultSwitchClusterServer());
|
|
1503
1023
|
}
|
|
1504
|
-
/**
|
|
1505
|
-
* Get a default latching switch cluster server.
|
|
1506
|
-
*
|
|
1507
|
-
* @remarks
|
|
1508
|
-
* This method adds a cluster server with default latching switch features and configuration.
|
|
1509
|
-
*/
|
|
1510
1024
|
getDefaultLatchingSwitchClusterServer() {
|
|
1511
1025
|
return ClusterServer(SwitchCluster.with(Switch.Feature.LatchingSwitch), {
|
|
1512
1026
|
numberOfPositions: 2,
|
|
@@ -1515,22 +1029,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1515
1029
|
switchLatched: true,
|
|
1516
1030
|
});
|
|
1517
1031
|
}
|
|
1518
|
-
/**
|
|
1519
|
-
* Creates a default latching switch cluster server.
|
|
1520
|
-
*
|
|
1521
|
-
* @remarks
|
|
1522
|
-
* This method adds a cluster server with default latching switch features and configuration.
|
|
1523
|
-
*/
|
|
1524
1032
|
createDefaultLatchingSwitchClusterServer() {
|
|
1525
1033
|
this.addClusterServer(this.getDefaultLatchingSwitchClusterServer());
|
|
1526
1034
|
}
|
|
1527
|
-
/**
|
|
1528
|
-
* Triggers a switch event on the specified endpoint.
|
|
1529
|
-
*
|
|
1530
|
-
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1531
|
-
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1532
|
-
* @returns {void}
|
|
1533
|
-
*/
|
|
1534
1035
|
triggerSwitchEvent(event, log, endpoint) {
|
|
1535
1036
|
if (!endpoint)
|
|
1536
1037
|
endpoint = this;
|
|
@@ -1602,15 +1103,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1602
1103
|
}
|
|
1603
1104
|
return true;
|
|
1604
1105
|
}
|
|
1605
|
-
/**
|
|
1606
|
-
* Retrieves the default mode select cluster server.
|
|
1607
|
-
*
|
|
1608
|
-
* @param description - The description of the cluster server.
|
|
1609
|
-
* @param supportedModes - The supported modes for the cluster server.
|
|
1610
|
-
* @param currentMode - The current mode of the cluster server. Defaults to 0.
|
|
1611
|
-
* @param startUpMode - The startup mode of the cluster server. Defaults to 0.
|
|
1612
|
-
* @returns The default mode select cluster server.
|
|
1613
|
-
*/
|
|
1614
1106
|
getDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1615
1107
|
return ClusterServer(ModeSelectCluster, {
|
|
1616
1108
|
description: description,
|
|
@@ -1625,24 +1117,11 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1625
1117
|
},
|
|
1626
1118
|
});
|
|
1627
1119
|
}
|
|
1628
|
-
/**
|
|
1629
|
-
* Creates a default mode select cluster server.
|
|
1630
|
-
*
|
|
1631
|
-
* @remarks
|
|
1632
|
-
* This method adds a cluster server for a mode select cluster with default settings.
|
|
1633
|
-
*
|
|
1634
|
-
* @param endpoint - The endpoint to add the cluster server to. Defaults to `this` if not provided.
|
|
1635
|
-
*/
|
|
1636
1120
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0, endpoint) {
|
|
1637
1121
|
if (!endpoint)
|
|
1638
1122
|
endpoint = this;
|
|
1639
1123
|
endpoint.addClusterServer(this.getDefaultModeSelectClusterServer(description, supportedModes, currentMode, startUpMode));
|
|
1640
1124
|
}
|
|
1641
|
-
/**
|
|
1642
|
-
* Get a default occupancy sensing cluster server.
|
|
1643
|
-
*
|
|
1644
|
-
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1645
|
-
*/
|
|
1646
1125
|
getDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1647
1126
|
return ClusterServer(OccupancySensingCluster, {
|
|
1648
1127
|
occupancy: { occupied },
|
|
@@ -1651,19 +1130,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1651
1130
|
pirOccupiedToUnoccupiedDelay: 30,
|
|
1652
1131
|
}, {});
|
|
1653
1132
|
}
|
|
1654
|
-
/**
|
|
1655
|
-
* Creates a default occupancy sensing cluster server.
|
|
1656
|
-
*
|
|
1657
|
-
* @param occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1658
|
-
*/
|
|
1659
1133
|
createDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1660
1134
|
this.addClusterServer(this.getDefaultOccupancySensingClusterServer(occupied));
|
|
1661
1135
|
}
|
|
1662
|
-
/**
|
|
1663
|
-
* Get a default Illuminance Measurement Cluster Server.
|
|
1664
|
-
*
|
|
1665
|
-
* @param measuredValue - The measured value of illuminance.
|
|
1666
|
-
*/
|
|
1667
1136
|
getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1668
1137
|
return ClusterServer(IlluminanceMeasurementCluster, {
|
|
1669
1138
|
measuredValue,
|
|
@@ -1672,19 +1141,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1672
1141
|
tolerance: 0,
|
|
1673
1142
|
}, {}, {});
|
|
1674
1143
|
}
|
|
1675
|
-
/**
|
|
1676
|
-
* Creates a default Illuminance Measurement Cluster Server.
|
|
1677
|
-
*
|
|
1678
|
-
* @param measuredValue - The measured value of illuminance.
|
|
1679
|
-
*/
|
|
1680
1144
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1681
1145
|
this.addClusterServer(this.getDefaultIlluminanceMeasurementClusterServer(measuredValue));
|
|
1682
1146
|
}
|
|
1683
|
-
/**
|
|
1684
|
-
* Get a default flow measurement cluster server.
|
|
1685
|
-
*
|
|
1686
|
-
* @param measuredValue - The measured value of the flow in 10 x m/h.
|
|
1687
|
-
*/
|
|
1688
1147
|
getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1689
1148
|
return ClusterServer(FlowMeasurementCluster, {
|
|
1690
1149
|
measuredValue,
|
|
@@ -1693,19 +1152,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1693
1152
|
tolerance: 0,
|
|
1694
1153
|
}, {}, {});
|
|
1695
1154
|
}
|
|
1696
|
-
/**
|
|
1697
|
-
* Creates a default flow measurement cluster server.
|
|
1698
|
-
*
|
|
1699
|
-
* @param measuredValue - The measured value of the of the flow in 10 x m/h.
|
|
1700
|
-
*/
|
|
1701
1155
|
createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1702
1156
|
this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
|
|
1703
1157
|
}
|
|
1704
|
-
/**
|
|
1705
|
-
* Get a default temperature measurement cluster server.
|
|
1706
|
-
*
|
|
1707
|
-
* @param measuredValue - The measured value of the temperature x 100.
|
|
1708
|
-
*/
|
|
1709
1158
|
getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1710
1159
|
return ClusterServer(TemperatureMeasurementCluster, {
|
|
1711
1160
|
measuredValue,
|
|
@@ -1714,19 +1163,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1714
1163
|
tolerance: 0,
|
|
1715
1164
|
}, {}, {});
|
|
1716
1165
|
}
|
|
1717
|
-
/**
|
|
1718
|
-
* Creates a default temperature measurement cluster server.
|
|
1719
|
-
*
|
|
1720
|
-
* @param measuredValue - The measured value of the temperature x 100.
|
|
1721
|
-
*/
|
|
1722
1166
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1723
1167
|
this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
|
|
1724
1168
|
}
|
|
1725
|
-
/**
|
|
1726
|
-
* Get a default RelativeHumidityMeasurementCluster server.
|
|
1727
|
-
*
|
|
1728
|
-
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
1729
|
-
*/
|
|
1730
1169
|
getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1731
1170
|
return ClusterServer(RelativeHumidityMeasurementCluster, {
|
|
1732
1171
|
measuredValue,
|
|
@@ -1735,19 +1174,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1735
1174
|
tolerance: 0,
|
|
1736
1175
|
}, {}, {});
|
|
1737
1176
|
}
|
|
1738
|
-
/**
|
|
1739
|
-
* Creates a default RelativeHumidityMeasurementCluster server.
|
|
1740
|
-
*
|
|
1741
|
-
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
1742
|
-
*/
|
|
1743
1177
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1744
1178
|
this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
|
|
1745
1179
|
}
|
|
1746
|
-
/**
|
|
1747
|
-
* Get a default Pressure Measurement Cluster Server.
|
|
1748
|
-
*
|
|
1749
|
-
* @param measuredValue - The measured value for the pressure.
|
|
1750
|
-
*/
|
|
1751
1180
|
getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1752
1181
|
return ClusterServer(PressureMeasurementCluster, {
|
|
1753
1182
|
measuredValue,
|
|
@@ -1756,39 +1185,19 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1756
1185
|
tolerance: 0,
|
|
1757
1186
|
}, {}, {});
|
|
1758
1187
|
}
|
|
1759
|
-
/**
|
|
1760
|
-
* Creates a default Pressure Measurement Cluster Server.
|
|
1761
|
-
*
|
|
1762
|
-
* @param measuredValue - The measured value for the pressure.
|
|
1763
|
-
*/
|
|
1764
1188
|
createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1765
1189
|
this.addClusterServer(this.getDefaultPressureMeasurementClusterServer(measuredValue));
|
|
1766
1190
|
}
|
|
1767
|
-
/**
|
|
1768
|
-
* Get a default boolean state cluster server.
|
|
1769
|
-
*
|
|
1770
|
-
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
1771
|
-
*/
|
|
1772
1191
|
getDefaultBooleanStateClusterServer(contact) {
|
|
1773
1192
|
return ClusterServer(BooleanStateCluster, {
|
|
1774
|
-
stateValue: contact ?? true,
|
|
1193
|
+
stateValue: contact ?? true,
|
|
1775
1194
|
}, {}, {
|
|
1776
1195
|
stateChange: true,
|
|
1777
1196
|
});
|
|
1778
1197
|
}
|
|
1779
|
-
/**
|
|
1780
|
-
* Creates a default boolean state configuration cluster server.
|
|
1781
|
-
*
|
|
1782
|
-
* @param contact - Optional boolean value indicating the contact state. Defaults to `true` if not provided.
|
|
1783
|
-
*/
|
|
1784
1198
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1785
1199
|
this.addClusterServer(this.getDefaultBooleanStateClusterServer(contact));
|
|
1786
1200
|
}
|
|
1787
|
-
/**
|
|
1788
|
-
* Get a default boolean state configuration cluster server.
|
|
1789
|
-
*
|
|
1790
|
-
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1791
|
-
*/
|
|
1792
1201
|
getDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
1793
1202
|
return ClusterServer(BooleanStateConfigurationCluster.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel), {
|
|
1794
1203
|
currentSensitivityLevel: 0,
|
|
@@ -1797,7 +1206,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1797
1206
|
alarmsActive: { visual: false, audible: false },
|
|
1798
1207
|
alarmsEnabled: { visual: false, audible: false },
|
|
1799
1208
|
alarmsSupported: { visual: true, audible: true },
|
|
1800
|
-
// alarmsSuppressed: { visual: false, audible: false },
|
|
1801
1209
|
sensorFault: { generalFault: sensorFault },
|
|
1802
1210
|
}, {
|
|
1803
1211
|
enableDisableAlarm: async ({ request, attributes }) => {
|
|
@@ -1809,23 +1217,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1809
1217
|
sensorFault: true,
|
|
1810
1218
|
});
|
|
1811
1219
|
}
|
|
1812
|
-
/**
|
|
1813
|
-
* Creates a default boolean state configuration cluster server.
|
|
1814
|
-
*
|
|
1815
|
-
* @param contact - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1816
|
-
*/
|
|
1817
1220
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false) {
|
|
1818
1221
|
this.addClusterServer(this.getDefaultBooleanStateConfigurationClusterServer(sensorFault));
|
|
1819
1222
|
}
|
|
1820
|
-
/**
|
|
1821
|
-
* Get a default power source replaceable battery cluster server.
|
|
1822
|
-
*
|
|
1823
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
1824
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
1825
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
1826
|
-
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
1827
|
-
* @param batQuantity - The battery quantity (default: 1).
|
|
1828
|
-
*/
|
|
1829
1223
|
getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
1830
1224
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
1831
1225
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -1842,25 +1236,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1842
1236
|
endpointList: [],
|
|
1843
1237
|
}, {}, {});
|
|
1844
1238
|
}
|
|
1845
|
-
/**
|
|
1846
|
-
* Creates a default power source replaceable battery cluster server.
|
|
1847
|
-
*
|
|
1848
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
1849
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
1850
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
1851
|
-
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
1852
|
-
* @param batQuantity - The battery quantity (default: 1).
|
|
1853
|
-
*/
|
|
1854
1239
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
1855
1240
|
this.addClusterServer(this.getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity));
|
|
1856
1241
|
}
|
|
1857
|
-
/**
|
|
1858
|
-
* Get a default power source rechargeable battery cluster server.
|
|
1859
|
-
*
|
|
1860
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
1861
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
1862
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
1863
|
-
*/
|
|
1864
1242
|
getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
1865
1243
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
1866
1244
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -1878,21 +1256,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1878
1256
|
endpointList: [],
|
|
1879
1257
|
}, {}, {});
|
|
1880
1258
|
}
|
|
1881
|
-
/**
|
|
1882
|
-
* Creates a default power source rechargeable battery cluster server.
|
|
1883
|
-
*
|
|
1884
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
1885
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
1886
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
1887
|
-
*/
|
|
1888
1259
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
1889
1260
|
this.addClusterServer(this.getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage));
|
|
1890
1261
|
}
|
|
1891
|
-
/**
|
|
1892
|
-
* Get a default power source wired cluster server.
|
|
1893
|
-
*
|
|
1894
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
1895
|
-
*/
|
|
1896
1262
|
getDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
1897
1263
|
return ClusterServer(PowerSourceCluster.with(PowerSource.Feature.Wired), {
|
|
1898
1264
|
wiredCurrentType,
|
|
@@ -1902,45 +1268,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1902
1268
|
endpointList: [],
|
|
1903
1269
|
}, {}, {});
|
|
1904
1270
|
}
|
|
1905
|
-
/**
|
|
1906
|
-
* Creates a default power source wired cluster server.
|
|
1907
|
-
*
|
|
1908
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
1909
|
-
*/
|
|
1910
1271
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
1911
1272
|
this.addClusterServer(this.getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
|
|
1912
1273
|
}
|
|
1913
|
-
/**
|
|
1914
|
-
* @deprecated This function is deprecated by Matter 1.3 spec and will be removed in a future version.
|
|
1915
|
-
*/
|
|
1916
1274
|
createDefaultPowerSourceConfigurationClusterServer(endpointNumber) {
|
|
1917
1275
|
this.addClusterServer(ClusterServer(PowerSourceConfigurationCluster, {
|
|
1918
1276
|
sources: endpointNumber ? [EndpointNumber(endpointNumber)] : [],
|
|
1919
1277
|
}, {}, {}));
|
|
1920
1278
|
}
|
|
1921
|
-
/**
|
|
1922
|
-
* Get a default air quality cluster server.
|
|
1923
|
-
*
|
|
1924
|
-
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
1925
|
-
*/
|
|
1926
1279
|
getDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1927
1280
|
return ClusterServer(AirQualityCluster.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1928
1281
|
airQuality,
|
|
1929
1282
|
}, {}, {});
|
|
1930
1283
|
}
|
|
1931
|
-
/**
|
|
1932
|
-
* Creates a default air quality cluster server.
|
|
1933
|
-
*
|
|
1934
|
-
* @param airQuality The air quality type. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
1935
|
-
*/
|
|
1936
1284
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1937
1285
|
this.addClusterServer(this.getDefaultAirQualityClusterServer(airQuality));
|
|
1938
1286
|
}
|
|
1939
|
-
/**
|
|
1940
|
-
* Get a default TVOC measurement cluster server.
|
|
1941
|
-
*
|
|
1942
|
-
* @param measuredValue - The measured value for TVOC.
|
|
1943
|
-
*/
|
|
1944
1287
|
getDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1945
1288
|
return ClusterServer(TotalVolatileOrganicCompoundsConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
1946
1289
|
measuredValue,
|
|
@@ -1951,28 +1294,14 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1951
1294
|
measurementMedium,
|
|
1952
1295
|
}, {}, {});
|
|
1953
1296
|
}
|
|
1954
|
-
/**
|
|
1955
|
-
* Creates a default TVOC measurement cluster server.
|
|
1956
|
-
*
|
|
1957
|
-
* @param measuredValue - The measured value for TVOC.
|
|
1958
|
-
*/
|
|
1959
1297
|
createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1960
1298
|
this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1961
1299
|
}
|
|
1962
|
-
/**
|
|
1963
|
-
* Get a default heating thermostat cluster server with the specified parameters.
|
|
1964
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1965
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1966
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1967
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1968
|
-
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
1969
|
-
*/
|
|
1970
1300
|
getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1971
1301
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
|
|
1972
1302
|
localTemperature: localTemperature * 100,
|
|
1973
1303
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1974
1304
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1975
|
-
// Thermostat.Feature.Heating
|
|
1976
1305
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1977
1306
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1978
1307
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1985,31 +1314,14 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1985
1314
|
},
|
|
1986
1315
|
}, {});
|
|
1987
1316
|
}
|
|
1988
|
-
/**
|
|
1989
|
-
* Creates and adds a default heating thermostat cluster server to the device.
|
|
1990
|
-
*
|
|
1991
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1992
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1993
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1994
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1995
|
-
*/
|
|
1996
1317
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1997
1318
|
this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
|
|
1998
1319
|
}
|
|
1999
|
-
/**
|
|
2000
|
-
* Get a default cooling thermostat cluster server with the specified parameters.
|
|
2001
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2002
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2003
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2004
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2005
|
-
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2006
|
-
*/
|
|
2007
1320
|
getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2008
1321
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
|
|
2009
1322
|
localTemperature: localTemperature * 100,
|
|
2010
1323
|
systemMode: Thermostat.SystemMode.Cool,
|
|
2011
1324
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
2012
|
-
// Thermostat.Feature.Cooling
|
|
2013
1325
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
2014
1326
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
2015
1327
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -2022,48 +1334,24 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2022
1334
|
},
|
|
2023
1335
|
}, {});
|
|
2024
1336
|
}
|
|
2025
|
-
/**
|
|
2026
|
-
* Creates and adds a default cooling thermostat cluster server to the device.
|
|
2027
|
-
*
|
|
2028
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2029
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2030
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2031
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2032
|
-
*/
|
|
2033
1337
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2034
1338
|
this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
2035
1339
|
}
|
|
2036
|
-
/**
|
|
2037
|
-
* Get a default thermostat cluster server with the specified parameters.
|
|
2038
|
-
*
|
|
2039
|
-
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2040
|
-
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2041
|
-
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2042
|
-
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2043
|
-
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2044
|
-
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2045
|
-
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2046
|
-
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2047
|
-
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
2048
|
-
*/
|
|
2049
1340
|
getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2050
1341
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
2051
1342
|
localTemperature: localTemperature * 100,
|
|
2052
1343
|
systemMode: Thermostat.SystemMode.Auto,
|
|
2053
1344
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
2054
|
-
// Thermostat.Feature.Heating
|
|
2055
1345
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
2056
1346
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
2057
1347
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2058
1348
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
2059
1349
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
2060
|
-
// Thermostat.Feature.Cooling
|
|
2061
1350
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
2062
1351
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
2063
1352
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2064
1353
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
2065
1354
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
2066
|
-
// Thermostat.Feature.AutoMode
|
|
2067
1355
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
2068
1356
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
2069
1357
|
}, {
|
|
@@ -2073,24 +1361,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2073
1361
|
},
|
|
2074
1362
|
}, {});
|
|
2075
1363
|
}
|
|
2076
|
-
/**
|
|
2077
|
-
* Creates and adds a default thermostat cluster server to the device.
|
|
2078
|
-
*
|
|
2079
|
-
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
2080
|
-
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
2081
|
-
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
2082
|
-
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
2083
|
-
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
2084
|
-
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
2085
|
-
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
2086
|
-
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
2087
|
-
*/
|
|
2088
1364
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
2089
1365
|
this.addClusterServer(this.getDefaultThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, occupiedCoolingSetpoint, minSetpointDeadBand, minHeatSetpointLimit, maxHeatSetpointLimit, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
2090
1366
|
}
|
|
2091
|
-
/**
|
|
2092
|
-
* Get a default dummy time sync cluster server. Only needed to create a thermostat.
|
|
2093
|
-
*/
|
|
2094
1367
|
getDefaultTimeSyncClusterServer() {
|
|
2095
1368
|
return ClusterServer(TimeSynchronizationCluster.with(TimeSynchronization.Feature.TimeZone), {
|
|
2096
1369
|
utcTime: null,
|
|
@@ -2122,19 +1395,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2122
1395
|
timeFailure: true,
|
|
2123
1396
|
});
|
|
2124
1397
|
}
|
|
2125
|
-
/**
|
|
2126
|
-
* Creates a default dummy time sync cluster server. Only needed to create a thermostat.
|
|
2127
|
-
*/
|
|
2128
1398
|
createDefaultTimeSyncClusterServer() {
|
|
2129
1399
|
this.addClusterServer(this.getDefaultTimeSyncClusterServer());
|
|
2130
1400
|
}
|
|
2131
|
-
/**
|
|
2132
|
-
* Returns the default SmokeCOAlarm Cluster Server.
|
|
2133
|
-
*
|
|
2134
|
-
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2135
|
-
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2136
|
-
* @returns The default SmokeCOAlarmClusterServer.
|
|
2137
|
-
*/
|
|
2138
1401
|
getDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
2139
1402
|
return ClusterServer(SmokeCoAlarmCluster.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm), {
|
|
2140
1403
|
smokeState,
|
|
@@ -2166,24 +1429,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2166
1429
|
allClear: true,
|
|
2167
1430
|
});
|
|
2168
1431
|
}
|
|
2169
|
-
/**
|
|
2170
|
-
* Create the default SmokeCOAlarm Cluster Server.
|
|
2171
|
-
*
|
|
2172
|
-
* @param smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2173
|
-
* @param coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2174
|
-
* @returns The default SmokeCOAlarmClusterServer.
|
|
2175
|
-
*/
|
|
2176
1432
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
2177
1433
|
this.addClusterServer(this.getDefaultSmokeCOAlarmClusterServer(smokeState, coState));
|
|
2178
1434
|
}
|
|
2179
|
-
/**
|
|
2180
|
-
* Returns the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2181
|
-
*
|
|
2182
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2183
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2184
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2185
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2186
|
-
*/
|
|
2187
1435
|
getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2188
1436
|
return ClusterServer(CarbonMonoxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2189
1437
|
measuredValue,
|
|
@@ -2194,24 +1442,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2194
1442
|
measurementMedium,
|
|
2195
1443
|
}, {}, {});
|
|
2196
1444
|
}
|
|
2197
|
-
/**
|
|
2198
|
-
* Create the default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2199
|
-
*
|
|
2200
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2201
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2202
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2203
|
-
*/
|
|
2204
1445
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2205
1446
|
this.addClusterServer(this.getDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2206
1447
|
}
|
|
2207
|
-
/**
|
|
2208
|
-
* Returns the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2209
|
-
*
|
|
2210
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2211
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2212
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2213
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2214
|
-
*/
|
|
2215
1448
|
getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2216
1449
|
return ClusterServer(CarbonDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2217
1450
|
measuredValue,
|
|
@@ -2222,24 +1455,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2222
1455
|
measurementMedium,
|
|
2223
1456
|
}, {}, {});
|
|
2224
1457
|
}
|
|
2225
|
-
/**
|
|
2226
|
-
* Create the default Carbon Dioxide Concentration Measurement Cluster Server.
|
|
2227
|
-
*
|
|
2228
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2229
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2230
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2231
|
-
*/
|
|
2232
1458
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2233
1459
|
this.addClusterServer(this.getDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2234
1460
|
}
|
|
2235
|
-
/**
|
|
2236
|
-
* Returns the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2237
|
-
*
|
|
2238
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2239
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2240
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2241
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2242
|
-
*/
|
|
2243
1461
|
getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2244
1462
|
return ClusterServer(FormaldehydeConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2245
1463
|
measuredValue,
|
|
@@ -2250,24 +1468,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2250
1468
|
measurementMedium,
|
|
2251
1469
|
}, {}, {});
|
|
2252
1470
|
}
|
|
2253
|
-
/**
|
|
2254
|
-
* Create the default Formaldehyde Concentration Measurement Cluster Server.
|
|
2255
|
-
*
|
|
2256
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2257
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2258
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2259
|
-
*/
|
|
2260
1471
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2261
1472
|
this.addClusterServer(this.getDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2262
1473
|
}
|
|
2263
|
-
/**
|
|
2264
|
-
* Returns the default Pm1 Concentration Measurement Cluster Server.
|
|
2265
|
-
*
|
|
2266
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2267
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2268
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2269
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2270
|
-
*/
|
|
2271
1474
|
getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2272
1475
|
return ClusterServer(Pm1ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2273
1476
|
measuredValue,
|
|
@@ -2278,24 +1481,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2278
1481
|
measurementMedium,
|
|
2279
1482
|
}, {}, {});
|
|
2280
1483
|
}
|
|
2281
|
-
|
|
2282
|
-
* Create the default Pm1 Concentration Measurement Cluster Server.
|
|
2283
|
-
*
|
|
2284
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2285
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2286
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2287
|
-
*/
|
|
2288
|
-
createDefaulPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1484
|
+
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2289
1485
|
this.addClusterServer(this.getDefaultPm1ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2290
1486
|
}
|
|
2291
|
-
/**
|
|
2292
|
-
* Returns the default Pm25 Concentration Measurement Cluster Server.
|
|
2293
|
-
*
|
|
2294
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2295
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2296
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2297
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2298
|
-
*/
|
|
2299
1487
|
getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2300
1488
|
return ClusterServer(Pm25ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2301
1489
|
measuredValue,
|
|
@@ -2306,24 +1494,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2306
1494
|
measurementMedium,
|
|
2307
1495
|
}, {}, {});
|
|
2308
1496
|
}
|
|
2309
|
-
|
|
2310
|
-
* Create the default Pm25 Concentration Measurement Cluster Server.
|
|
2311
|
-
*
|
|
2312
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2313
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2314
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2315
|
-
*/
|
|
2316
|
-
createDefaulPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1497
|
+
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2317
1498
|
this.addClusterServer(this.getDefaultPm25ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2318
1499
|
}
|
|
2319
|
-
/**
|
|
2320
|
-
* Returns the default Pm10 Concentration Measurement Cluster Server.
|
|
2321
|
-
*
|
|
2322
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2323
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2324
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2325
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2326
|
-
*/
|
|
2327
1500
|
getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2328
1501
|
return ClusterServer(Pm10ConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2329
1502
|
measuredValue,
|
|
@@ -2334,24 +1507,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2334
1507
|
measurementMedium,
|
|
2335
1508
|
}, {}, {});
|
|
2336
1509
|
}
|
|
2337
|
-
|
|
2338
|
-
* Create the default Pm10 Concentration Measurement Cluster Server.
|
|
2339
|
-
*
|
|
2340
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2341
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2342
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2343
|
-
*/
|
|
2344
|
-
createDefaulPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1510
|
+
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2345
1511
|
this.addClusterServer(this.getDefaultPm10ConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2346
1512
|
}
|
|
2347
|
-
/**
|
|
2348
|
-
* Returns the default Ozone Concentration Measurement Cluster Server.
|
|
2349
|
-
*
|
|
2350
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2351
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2352
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2353
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2354
|
-
*/
|
|
2355
1513
|
getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2356
1514
|
return ClusterServer(OzoneConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2357
1515
|
measuredValue,
|
|
@@ -2362,24 +1520,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2362
1520
|
measurementMedium,
|
|
2363
1521
|
}, {}, {});
|
|
2364
1522
|
}
|
|
2365
|
-
|
|
2366
|
-
* Create the default Ozone Concentration Measurement Cluster Server.
|
|
2367
|
-
*
|
|
2368
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2369
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2370
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2371
|
-
*/
|
|
2372
|
-
createDefaulOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1523
|
+
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2373
1524
|
this.addClusterServer(this.getDefaultOzoneConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2374
1525
|
}
|
|
2375
|
-
/**
|
|
2376
|
-
* Returns the default Radon Concentration Measurement Cluster Server.
|
|
2377
|
-
*
|
|
2378
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2379
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2380
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2381
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2382
|
-
*/
|
|
2383
1526
|
getDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2384
1527
|
return ClusterServer(RadonConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2385
1528
|
measuredValue,
|
|
@@ -2390,24 +1533,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2390
1533
|
measurementMedium,
|
|
2391
1534
|
}, {}, {});
|
|
2392
1535
|
}
|
|
2393
|
-
|
|
2394
|
-
* Create the default Radon Concentration Measurement Cluster Server.
|
|
2395
|
-
*
|
|
2396
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2397
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2398
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2399
|
-
*/
|
|
2400
|
-
createDefaulRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1536
|
+
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2401
1537
|
this.addClusterServer(this.getDefaultRadonConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2402
1538
|
}
|
|
2403
|
-
/**
|
|
2404
|
-
* Returns the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2405
|
-
*
|
|
2406
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2407
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2408
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2409
|
-
* @returns {ClusterServer} - The default Carbon Monoxide Concentration Measurement Cluster Server.
|
|
2410
|
-
*/
|
|
2411
1539
|
getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2412
1540
|
return ClusterServer(NitrogenDioxideConcentrationMeasurementCluster.with('NumericMeasurement'), {
|
|
2413
1541
|
measuredValue,
|
|
@@ -2418,22 +1546,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2418
1546
|
measurementMedium,
|
|
2419
1547
|
}, {}, {});
|
|
2420
1548
|
}
|
|
2421
|
-
|
|
2422
|
-
* Create the default Nitrogen Dioxide Concentration Measurement Cluster Server.
|
|
2423
|
-
*
|
|
2424
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
2425
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement.
|
|
2426
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The medium of measurement.
|
|
2427
|
-
*/
|
|
2428
|
-
createDefaulNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1549
|
+
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2429
1550
|
this.addClusterServer(this.getDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
2430
1551
|
}
|
|
2431
|
-
/**
|
|
2432
|
-
* Returns the default fan control cluster server rev 2.
|
|
2433
|
-
*
|
|
2434
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2435
|
-
* @returns The default fan control cluster server.
|
|
2436
|
-
*/
|
|
2437
1552
|
getDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
2438
1553
|
return ClusterServer(FanControlCluster.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
2439
1554
|
fanMode,
|
|
@@ -2450,16 +1565,9 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2450
1565
|
},
|
|
2451
1566
|
}, {});
|
|
2452
1567
|
}
|
|
2453
|
-
/**
|
|
2454
|
-
* Create the default fan control cluster server rev 2.
|
|
2455
|
-
*
|
|
2456
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2457
|
-
* @returns The default fan control cluster server.
|
|
2458
|
-
*/
|
|
2459
1568
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
2460
1569
|
this.addClusterServer(this.getDefaultFanControlClusterServer(fanMode));
|
|
2461
1570
|
}
|
|
2462
|
-
// NOTE Support of Device Energy Management Cluster is provisional.
|
|
2463
1571
|
getDefaultDeviceEnergyManagementClusterServer() {
|
|
2464
1572
|
return ClusterServer(DeviceEnergyManagementCluster.with(DeviceEnergyManagement.Feature.Pausable, DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.StateForecastReporting), {
|
|
2465
1573
|
esaType: DeviceEnergyManagement.EsaType.Other,
|
|
@@ -2483,7 +1591,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2483
1591
|
resumed: true,
|
|
2484
1592
|
});
|
|
2485
1593
|
}
|
|
2486
|
-
// NOTE Support of Device Energy Management Mode Cluster is provisional.
|
|
2487
1594
|
getDefaultDeviceEnergyManagementModeClusterServer() {
|
|
2488
1595
|
return ClusterServer(DeviceEnergyManagementModeCluster, {
|
|
2489
1596
|
supportedModes: [
|
|
@@ -2500,4 +1607,3 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
2500
1607
|
}, {});
|
|
2501
1608
|
}
|
|
2502
1609
|
}
|
|
2503
|
-
//# sourceMappingURL=matterbridgeDevice.js.map
|