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