matterbridge 3.0.0 → 3.0.1-dev-20250501-4f463f9
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 +2 -0
- package/README.md +22 -4
- package/dist/cli.js +2 -37
- package/dist/cluster/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -23
- package/dist/deviceManager.js +1 -94
- package/dist/frontend.js +19 -352
- package/dist/index.js +1 -28
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.js +0 -2
- package/dist/matter/types.js +0 -2
- package/dist/matterbridge.js +46 -747
- package/dist/matterbridgeAccessoryPlatform.js +0 -34
- package/dist/matterbridgeBehaviors.js +1 -33
- package/dist/matterbridgeDeviceTypes.js +12 -431
- package/dist/matterbridgeDynamicPlatform.js +0 -34
- package/dist/matterbridgeEndpoint.js +11 -794
- package/dist/matterbridgeEndpointHelpers.js +9 -142
- package/dist/matterbridgePlatform.js +7 -225
- package/dist/matterbridgeTypes.js +0 -24
- package/dist/pluginManager.js +3 -262
- package/dist/shelly.js +6 -146
- package/dist/storage/export.js +0 -1
- package/dist/update.js +0 -52
- package/dist/utils/colorUtils.js +2 -205
- package/dist/utils/copyDirectory.js +1 -37
- package/dist/utils/createZip.js +2 -42
- package/dist/utils/deepCopy.js +0 -40
- package/dist/utils/deepEqual.js +1 -65
- package/dist/utils/export.js +0 -1
- package/dist/utils/isvalid.js +0 -86
- package/dist/utils/network.js +5 -76
- package/dist/utils/parameter.js +0 -53
- package/dist/utils/wait.js +5 -48
- package/frontend/build/asset-manifest.json +3 -3
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/js/{main.1d983660.js → main.356788d7.js} +3 -3
- package/frontend/build/static/js/{main.1d983660.js.map → main.356788d7.js.map} +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -2
- package/dist/cli.d.ts +0 -29
- 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 -114
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/frontend.d.ts +0 -222
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/index.d.ts +0 -35
- 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/behaviors.d.ts +0 -2
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts +0 -2
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts +0 -2
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts +0 -2
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts +0 -5
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts +0 -3
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -431
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -40
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -1514
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -494
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -40
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -943
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -2706
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -294
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -187
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -271
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/shelly.d.ts +0 -92
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.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/update.d.ts +0 -32
- package/dist/update.d.ts.map +0 -1
- package/dist/update.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/copyDirectory.d.ts +0 -32
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -38
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -31
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -53
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/export.d.ts +0 -10
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/isvalid.d.ts +0 -87
- package/dist/utils/isvalid.d.ts.map +0 -1
- package/dist/utils/isvalid.js.map +0 -1
- package/dist/utils/network.d.ts +0 -69
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/parameter.d.ts +0 -58
- package/dist/utils/parameter.d.ts.map +0 -1
- package/dist/utils/parameter.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -43
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
- /package/frontend/build/static/js/{main.1d983660.js.LICENSE.txt → main.356788d7.js.LICENSE.txt} +0 -0
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
|
|
3
|
-
*
|
|
4
|
-
* @file matterbridgeEndpoint.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2024-10-01
|
|
7
|
-
* @version 2.0.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2024, 2025, 2026 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
|
-
// AnsiLogger module
|
|
24
1
|
import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, zb } from './logger/export.js';
|
|
25
|
-
// Matterbridge
|
|
26
2
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
27
3
|
import { isValidNumber, isValidObject } from './utils/export.js';
|
|
28
4
|
import { MatterbridgeServer, MatterbridgeServerDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, } from './matterbridgeBehaviors.js';
|
|
29
5
|
import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, capitalizeFirstLetter, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, } from './matterbridgeEndpointHelpers.js';
|
|
30
|
-
// @matter
|
|
31
6
|
import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, VendorId } from '@matter/main';
|
|
32
7
|
import { getClusterNameById, MeasurementType } from '@matter/main/types';
|
|
33
|
-
// @matter clusters
|
|
34
8
|
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
35
9
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
36
10
|
import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
|
|
@@ -54,7 +28,6 @@ import { AirQuality } from '@matter/main/clusters/air-quality';
|
|
|
54
28
|
import { ConcentrationMeasurement } from '@matter/main/clusters/concentration-measurement';
|
|
55
29
|
import { OccupancySensing } from '@matter/main/clusters/occupancy-sensing';
|
|
56
30
|
import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/thermostat-user-interface-configuration';
|
|
57
|
-
// @matter behaviors
|
|
58
31
|
import { DescriptorServer } from '@matter/main/behaviors/descriptor';
|
|
59
32
|
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
60
33
|
import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
|
|
@@ -90,7 +63,7 @@ import { ActivatedCarbonFilterMonitoringServer } from '@matter/main/behaviors/ac
|
|
|
90
63
|
import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behaviors/thermostat-user-interface-configuration';
|
|
91
64
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
92
65
|
static bridgeMode = '';
|
|
93
|
-
static logLevel = "info"
|
|
66
|
+
static logLevel = "info";
|
|
94
67
|
log;
|
|
95
68
|
plugin = undefined;
|
|
96
69
|
configUrl = undefined;
|
|
@@ -106,25 +79,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
106
79
|
hardwareVersion = undefined;
|
|
107
80
|
hardwareVersionString = undefined;
|
|
108
81
|
productUrl = 'https://www.npmjs.com/package/matterbridge';
|
|
109
|
-
// The first device type of the endpoint
|
|
110
82
|
name = undefined;
|
|
111
83
|
deviceType;
|
|
112
84
|
uniqueStorageKey = undefined;
|
|
113
85
|
tagList = undefined;
|
|
114
|
-
// Maps matter deviceTypes
|
|
115
86
|
deviceTypes = new Map();
|
|
116
|
-
// Command handler
|
|
117
87
|
commandHandler = new NamedHandler();
|
|
118
|
-
/**
|
|
119
|
-
* Represents a MatterbridgeEndpoint.
|
|
120
|
-
* @constructor
|
|
121
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
|
|
122
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
123
|
-
* @param {boolean} [debug=false] - Debug flag.
|
|
124
|
-
*/
|
|
125
88
|
constructor(definition, options = {}, debug = false) {
|
|
126
89
|
let deviceTypeList = [];
|
|
127
|
-
// Get the first DeviceTypeDefinition
|
|
128
90
|
let firstDefinition;
|
|
129
91
|
if (Array.isArray(definition)) {
|
|
130
92
|
firstDefinition = definition[0];
|
|
@@ -137,7 +99,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
137
99
|
firstDefinition = definition;
|
|
138
100
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
139
101
|
}
|
|
140
|
-
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
141
102
|
const deviceTypeDefinitionV8 = {
|
|
142
103
|
name: firstDefinition.name.replace('-', '_'),
|
|
143
104
|
deviceType: firstDefinition.code,
|
|
@@ -156,11 +117,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
156
117
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
157
118
|
};
|
|
158
119
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
159
|
-
// Check if the uniqueStorageKey is valid
|
|
160
120
|
if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
|
|
161
121
|
options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
|
|
162
122
|
}
|
|
163
|
-
// Convert the options to an Endpoint.Options
|
|
164
123
|
const optionsV8 = {
|
|
165
124
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
166
125
|
number: options.endpointId,
|
|
@@ -178,41 +137,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
178
137
|
}
|
|
179
138
|
else
|
|
180
139
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
181
|
-
|
|
182
|
-
// console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
|
|
183
|
-
// console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
|
|
184
|
-
// Create the logger
|
|
185
|
-
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
|
|
140
|
+
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
|
|
186
141
|
this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
|
|
187
142
|
`id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
|
|
188
|
-
// Add MatterbridgeBehavior with MatterbridgeBehaviorDevice
|
|
189
143
|
this.behaviors.require(MatterbridgeServer, { deviceCommand: new MatterbridgeServerDevice(this.log, this.commandHandler, undefined) });
|
|
190
144
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Loads an instance of the MatterbridgeEndpoint class.
|
|
193
|
-
*
|
|
194
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
|
|
195
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
196
|
-
* @param {boolean} [debug=false] - Debug flag.
|
|
197
|
-
* @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
|
|
198
|
-
*/
|
|
199
145
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
200
146
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
201
147
|
}
|
|
202
|
-
/**
|
|
203
|
-
* Get all the device types of this endpoint.
|
|
204
|
-
*
|
|
205
|
-
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
|
|
206
|
-
*/
|
|
207
148
|
getDeviceTypes() {
|
|
208
149
|
return Array.from(this.deviceTypes.values());
|
|
209
150
|
}
|
|
210
|
-
/**
|
|
211
|
-
* Checks if the provided cluster server is supported by this endpoint.
|
|
212
|
-
*
|
|
213
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
214
|
-
* @returns {boolean} True if the cluster server is supported, false otherwise.
|
|
215
|
-
*/
|
|
216
151
|
hasClusterServer(cluster) {
|
|
217
152
|
const behavior = getBehavior(this, cluster);
|
|
218
153
|
if (behavior)
|
|
@@ -220,13 +155,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
220
155
|
else
|
|
221
156
|
return false;
|
|
222
157
|
}
|
|
223
|
-
/**
|
|
224
|
-
* Checks if the provided attribute server is supported for a given cluster of this endpoint.
|
|
225
|
-
*
|
|
226
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
227
|
-
* @param {string} attribute - The attribute name to check.
|
|
228
|
-
* @returns {boolean} True if the attribute server is supported, false otherwise.
|
|
229
|
-
*/
|
|
230
158
|
hasAttributeServer(cluster, attribute) {
|
|
231
159
|
const behavior = getBehavior(this, cluster);
|
|
232
160
|
if (!behavior || !this.behaviors.supported[behavior.id])
|
|
@@ -235,186 +163,72 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
235
163
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
236
164
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
237
165
|
}
|
|
238
|
-
/**
|
|
239
|
-
* Retrieves the initial options for the provided cluster server.
|
|
240
|
-
*
|
|
241
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
|
|
242
|
-
* @returns {Record<string, boolean | number | bigint | string | object | null> | undefined} The options for the provided cluster server, or undefined if the cluster is not supported.
|
|
243
|
-
*/
|
|
244
166
|
getClusterServerOptions(cluster) {
|
|
245
167
|
const behavior = getBehavior(this, cluster);
|
|
246
168
|
if (!behavior)
|
|
247
169
|
return undefined;
|
|
248
170
|
return this.behaviors.optionsFor(behavior);
|
|
249
171
|
}
|
|
250
|
-
/**
|
|
251
|
-
* Retrieves the value of the provided attribute from the given cluster.
|
|
252
|
-
*
|
|
253
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
254
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
255
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
256
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
257
|
-
*/
|
|
258
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
259
172
|
getAttribute(cluster, attribute, log) {
|
|
260
173
|
return getAttribute(this, cluster, attribute, log);
|
|
261
174
|
}
|
|
262
|
-
/**
|
|
263
|
-
* Sets the value of an attribute on a cluster server.
|
|
264
|
-
*
|
|
265
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
|
|
266
|
-
* @param {string} attribute - The name of the attribute.
|
|
267
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
268
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
269
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
270
|
-
*/
|
|
271
175
|
async setAttribute(clusterId, attribute, value, log) {
|
|
272
176
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
273
177
|
}
|
|
274
|
-
/**
|
|
275
|
-
* Update the value of an attribute on a cluster server only if the value is different.
|
|
276
|
-
*
|
|
277
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
278
|
-
* @param {string} attribute - The name of the attribute.
|
|
279
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
280
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
|
|
281
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
282
|
-
*/
|
|
283
178
|
async updateAttribute(cluster, attribute, value, log) {
|
|
284
179
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
285
180
|
}
|
|
286
|
-
/**
|
|
287
|
-
* Subscribes to the provided attribute on a cluster.
|
|
288
|
-
*
|
|
289
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
|
|
290
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
291
|
-
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
292
|
-
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
293
|
-
* @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
|
|
294
|
-
*/
|
|
295
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
296
181
|
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
297
182
|
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
298
183
|
}
|
|
299
|
-
/**
|
|
300
|
-
* Triggers an event on the specified cluster.
|
|
301
|
-
*
|
|
302
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
303
|
-
* @param {string} event - The name of the event to trigger.
|
|
304
|
-
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
305
|
-
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
306
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
307
|
-
*/
|
|
308
184
|
async triggerEvent(clusterId, event, payload, log) {
|
|
309
185
|
const clusterName = lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
310
186
|
if (this.construction.status !== Lifecycle.Status.Active) {
|
|
311
187
|
this.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${this.maybeId}${er}:${or}${this.maybeNumber}${er} is in the ${BLUE}${this.construction.status}${er} state`);
|
|
312
188
|
return false;
|
|
313
189
|
}
|
|
314
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
315
190
|
const events = this.events;
|
|
316
191
|
if (!(clusterName in events) || !(event in events[clusterName])) {
|
|
317
192
|
this.log.error(`triggerEvent ${hk}${event}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${this.id}${er}:${or}${this.number}${er}`);
|
|
318
193
|
return false;
|
|
319
194
|
}
|
|
320
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
321
|
-
// @ts-ignore
|
|
322
195
|
await this.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
|
|
323
196
|
log?.info(`${db}Trigger event ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${event}${db} with ${debugStringify(payload)}${db} on endpoint ${or}${this.id}${db}:${or}${this.number}${db} `);
|
|
324
197
|
return true;
|
|
325
198
|
}
|
|
326
|
-
/**
|
|
327
|
-
* Adds cluster servers from the provided server list.
|
|
328
|
-
*
|
|
329
|
-
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
330
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
331
|
-
*/
|
|
332
199
|
addClusterServers(serverList) {
|
|
333
200
|
addClusterServers(this, serverList);
|
|
334
201
|
return this;
|
|
335
202
|
}
|
|
336
|
-
/**
|
|
337
|
-
* Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
|
|
338
|
-
*
|
|
339
|
-
* @param {string} label - The label to add.
|
|
340
|
-
* @param {string} value - The value of the label.
|
|
341
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
342
|
-
*/
|
|
343
203
|
async addFixedLabel(label, value) {
|
|
344
204
|
await addFixedLabel(this, label, value);
|
|
345
205
|
return this;
|
|
346
206
|
}
|
|
347
|
-
/**
|
|
348
|
-
* Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
|
|
349
|
-
*
|
|
350
|
-
* @param {string} label - The label to add.
|
|
351
|
-
* @param {string} value - The value of the label.
|
|
352
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
353
|
-
*/
|
|
354
207
|
async addUserLabel(label, value) {
|
|
355
208
|
await addUserLabel(this, label, value);
|
|
356
209
|
return this;
|
|
357
210
|
}
|
|
358
|
-
/**
|
|
359
|
-
* Adds a command handler for the specified command.
|
|
360
|
-
*
|
|
361
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
362
|
-
* @param {HandlerFunction} handler - The handler function to execute when the command is received.
|
|
363
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
364
|
-
*/
|
|
365
211
|
addCommandHandler(command, handler) {
|
|
366
212
|
this.commandHandler.addHandler(command, handler);
|
|
367
213
|
return this;
|
|
368
214
|
}
|
|
369
|
-
/**
|
|
370
|
-
* Execute the command handler for the specified command. Mainly used in Jest tests.
|
|
371
|
-
*
|
|
372
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
|
|
373
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} request - The optional request to pass to the handler function.
|
|
374
|
-
* @returns {Promise<void>} A promise that resolves when the command handler has been executed
|
|
375
|
-
*/
|
|
376
215
|
async executeCommandHandler(command, request) {
|
|
377
216
|
await this.commandHandler.executeHandler(command, { request });
|
|
378
217
|
}
|
|
379
|
-
/**
|
|
380
|
-
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
381
|
-
*
|
|
382
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
383
|
-
*/
|
|
384
218
|
addRequiredClusterServers() {
|
|
385
219
|
addRequiredClusterServers(this);
|
|
386
220
|
return this;
|
|
387
221
|
}
|
|
388
|
-
/**
|
|
389
|
-
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
390
|
-
*
|
|
391
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
392
|
-
*/
|
|
393
222
|
addOptionalClusterServers() {
|
|
394
223
|
addOptionalClusterServers(this);
|
|
395
224
|
return this;
|
|
396
225
|
}
|
|
397
|
-
/**
|
|
398
|
-
* Retrieves all cluster servers.
|
|
399
|
-
*
|
|
400
|
-
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
401
|
-
*/
|
|
402
226
|
getAllClusterServers() {
|
|
403
227
|
return Object.values(this.behaviors.supported);
|
|
404
228
|
}
|
|
405
|
-
/**
|
|
406
|
-
* Retrieves the names of all cluster servers.
|
|
407
|
-
*
|
|
408
|
-
* @returns {string[]} An array of all cluster server names.
|
|
409
|
-
*/
|
|
410
229
|
getAllClusterServerNames() {
|
|
411
230
|
return Object.keys(this.behaviors.supported);
|
|
412
231
|
}
|
|
413
|
-
/**
|
|
414
|
-
* Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
|
|
415
|
-
*
|
|
416
|
-
* @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
|
|
417
|
-
*/
|
|
418
232
|
forEachAttribute(callback) {
|
|
419
233
|
if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
|
|
420
234
|
return;
|
|
@@ -422,34 +236,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
422
236
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
423
237
|
const clusterId = getClusterId(this, clusterName);
|
|
424
238
|
if (clusterId === undefined) {
|
|
425
|
-
// this.log.error(`forEachAttribute error: cluster ${clusterName} not found`);
|
|
426
239
|
continue;
|
|
427
240
|
}
|
|
428
241
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
429
242
|
if (attributeId === undefined) {
|
|
430
|
-
// this.log.error(`forEachAttribute error: attribute ${clusterName}.${attributeName} not found`);
|
|
431
243
|
continue;
|
|
432
244
|
}
|
|
433
245
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
434
246
|
}
|
|
435
247
|
}
|
|
436
248
|
}
|
|
437
|
-
/**
|
|
438
|
-
* Adds a child endpoint with the specified device types and options.
|
|
439
|
-
* If the child endpoint is not already present, it will be created and added.
|
|
440
|
-
* If the child endpoint is already present, the existing child endpoint will be returned.
|
|
441
|
-
*
|
|
442
|
-
* @param {string} endpointName - The name of the new endpoint to add.
|
|
443
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
444
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
|
|
445
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
446
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
447
|
-
*
|
|
448
|
-
* @example
|
|
449
|
-
* ```typescript
|
|
450
|
-
* const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
451
|
-
* ```
|
|
452
|
-
*/
|
|
453
249
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
454
250
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
455
251
|
let alreadyAdded = false;
|
|
@@ -489,23 +285,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
489
285
|
}
|
|
490
286
|
return child;
|
|
491
287
|
}
|
|
492
|
-
/**
|
|
493
|
-
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
494
|
-
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
495
|
-
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
496
|
-
*
|
|
497
|
-
* @param {string} endpointName - The name of the new enpoint to add.
|
|
498
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
499
|
-
* @param {ClusterId[]} [serverList=[]] - The list of cluster IDs to include.
|
|
500
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
501
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
502
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
503
|
-
*
|
|
504
|
-
* @example
|
|
505
|
-
* ```typescript
|
|
506
|
-
* const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
507
|
-
* ```
|
|
508
|
-
*/
|
|
509
288
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
510
289
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
511
290
|
let alreadyAdded = false;
|
|
@@ -568,38 +347,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
568
347
|
}
|
|
569
348
|
return child;
|
|
570
349
|
}
|
|
571
|
-
/**
|
|
572
|
-
* Retrieves a child endpoint by its name.
|
|
573
|
-
*
|
|
574
|
-
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
575
|
-
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
576
|
-
*/
|
|
577
350
|
getChildEndpointByName(endpointName) {
|
|
578
351
|
return this.parts.find((part) => part.id === endpointName);
|
|
579
352
|
}
|
|
580
|
-
/**
|
|
581
|
-
* Retrieves a child endpoint by its EndpointNumber.
|
|
582
|
-
*
|
|
583
|
-
* @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
|
|
584
|
-
* @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
|
|
585
|
-
*/
|
|
586
353
|
getChildEndpoint(endpointNumber) {
|
|
587
354
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
588
355
|
}
|
|
589
|
-
/**
|
|
590
|
-
* Get all the child endpoints of this endpoint.
|
|
591
|
-
*
|
|
592
|
-
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
593
|
-
*/
|
|
594
356
|
getChildEndpoints() {
|
|
595
357
|
return Array.from(this.parts);
|
|
596
358
|
}
|
|
597
|
-
/**
|
|
598
|
-
* Serializes the Matterbridge device into a serialized object.
|
|
599
|
-
*
|
|
600
|
-
* @param pluginName - The name of the plugin.
|
|
601
|
-
* @returns The serialized Matterbridge device object.
|
|
602
|
-
*/
|
|
603
359
|
static serialize(device) {
|
|
604
360
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId)
|
|
605
361
|
return;
|
|
@@ -622,15 +378,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
622
378
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
623
379
|
if (behaviorName === 'powerSource')
|
|
624
380
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
625
|
-
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
626
381
|
});
|
|
627
382
|
return serialized;
|
|
628
383
|
}
|
|
629
|
-
/**
|
|
630
|
-
* Deserializes the device into a serialized object.
|
|
631
|
-
*
|
|
632
|
-
* @returns The deserialized MatterbridgeDevice.
|
|
633
|
-
*/
|
|
634
384
|
static deserialize(serializedDevice) {
|
|
635
385
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
|
|
636
386
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -646,16 +396,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
646
396
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
647
397
|
else if (clusterId === PowerSource.Cluster.id)
|
|
648
398
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
649
|
-
// else addClusterServerFromList(device, [clusterId]);
|
|
650
399
|
}
|
|
651
400
|
return device;
|
|
652
401
|
}
|
|
653
|
-
/**
|
|
654
|
-
* Creates a default power source wired cluster server.
|
|
655
|
-
*
|
|
656
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
657
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
658
|
-
*/
|
|
659
402
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
660
403
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
|
|
661
404
|
wiredCurrentType,
|
|
@@ -666,16 +409,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
666
409
|
});
|
|
667
410
|
return this;
|
|
668
411
|
}
|
|
669
|
-
/**
|
|
670
|
-
* Creates a default power source replaceable battery cluster server.
|
|
671
|
-
*
|
|
672
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
673
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
674
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
675
|
-
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
676
|
-
* @param batQuantity - The battery quantity (default: 1).
|
|
677
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
678
|
-
*/
|
|
679
412
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
680
413
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
681
414
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -693,14 +426,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
693
426
|
});
|
|
694
427
|
return this;
|
|
695
428
|
}
|
|
696
|
-
/**
|
|
697
|
-
* Creates a default power source rechargeable battery cluster server.
|
|
698
|
-
*
|
|
699
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
700
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
701
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
702
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
703
|
-
*/
|
|
704
429
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
705
430
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
706
431
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -719,21 +444,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
719
444
|
});
|
|
720
445
|
return this;
|
|
721
446
|
}
|
|
722
|
-
/**
|
|
723
|
-
* Creates a default Basic Information Cluster Server for the server node.
|
|
724
|
-
*
|
|
725
|
-
* @param deviceName - The name of the device.
|
|
726
|
-
* @param serialNumber - The serial number of the device.
|
|
727
|
-
* @param vendorId - The vendor ID of the device.
|
|
728
|
-
* @param vendorName - The vendor name of the device.
|
|
729
|
-
* @param productId - The product ID of the device.
|
|
730
|
-
* @param productName - The product name of the device.
|
|
731
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
732
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
733
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
734
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
735
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
736
|
-
*/
|
|
737
447
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
738
448
|
this.log.logName = deviceName;
|
|
739
449
|
this.deviceName = deviceName;
|
|
@@ -757,20 +467,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
757
467
|
}
|
|
758
468
|
return this;
|
|
759
469
|
}
|
|
760
|
-
/**
|
|
761
|
-
* Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
|
|
762
|
-
*
|
|
763
|
-
* @param deviceName - The name of the device.
|
|
764
|
-
* @param serialNumber - The serial number of the device.
|
|
765
|
-
* @param vendorId - The vendor ID of the device.
|
|
766
|
-
* @param vendorName - The name of the vendor.
|
|
767
|
-
* @param productName - The name of the product.
|
|
768
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
769
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
770
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
771
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
772
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
773
|
-
*/
|
|
774
470
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
775
471
|
this.log.logName = deviceName;
|
|
776
472
|
this.deviceName = deviceName;
|
|
@@ -787,7 +483,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
787
483
|
this.behaviors.require(BridgedDeviceBasicInformationServer.enable({
|
|
788
484
|
events: { leave: true, reachableChanged: true },
|
|
789
485
|
}), {
|
|
790
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
486
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
791
487
|
vendorName: vendorName.slice(0, 32),
|
|
792
488
|
productName: productName.slice(0, 32),
|
|
793
489
|
productUrl: this.productUrl,
|
|
@@ -803,13 +499,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
803
499
|
});
|
|
804
500
|
return this;
|
|
805
501
|
}
|
|
806
|
-
/**
|
|
807
|
-
* Creates a default identify cluster server with the specified identify time and type.
|
|
808
|
-
*
|
|
809
|
-
* @param {number} [identifyTime=0] - The time to identify the server. Defaults to 0.
|
|
810
|
-
* @param {Identify.IdentifyType} [identifyType=Identify.IdentifyType.None] - The type of identification. Defaults to Identify.IdentifyType.None.
|
|
811
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
812
|
-
*/
|
|
813
502
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
814
503
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
815
504
|
identifyTime,
|
|
@@ -817,32 +506,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
817
506
|
});
|
|
818
507
|
return this;
|
|
819
508
|
}
|
|
820
|
-
/**
|
|
821
|
-
* Creates a default groups cluster server.
|
|
822
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
823
|
-
*/
|
|
824
509
|
createDefaultGroupsClusterServer() {
|
|
825
510
|
this.behaviors.require(GroupsServer);
|
|
826
511
|
return this;
|
|
827
512
|
}
|
|
828
|
-
/**
|
|
829
|
-
* Creates a default scenes management cluster server.
|
|
830
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
831
|
-
*/
|
|
832
513
|
createDefaultScenesClusterServer() {
|
|
833
514
|
this.behaviors.require(ScenesManagementServer);
|
|
834
515
|
return this;
|
|
835
516
|
}
|
|
836
|
-
/**
|
|
837
|
-
* Creates a default OnOff cluster server for light devices.
|
|
838
|
-
*
|
|
839
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
840
|
-
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
841
|
-
* @param {number} [onTime=0] - The on time value.
|
|
842
|
-
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
843
|
-
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
844
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
845
|
-
*/
|
|
846
517
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
847
518
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
848
519
|
onOff,
|
|
@@ -853,52 +524,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
853
524
|
});
|
|
854
525
|
return this;
|
|
855
526
|
}
|
|
856
|
-
/**
|
|
857
|
-
* Creates an OnOff cluster server without features.
|
|
858
|
-
*
|
|
859
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
860
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
861
|
-
*/
|
|
862
527
|
createOnOffClusterServer(onOff = false) {
|
|
863
528
|
this.behaviors.require(MatterbridgeOnOffServer, {
|
|
864
529
|
onOff,
|
|
865
530
|
});
|
|
866
531
|
return this;
|
|
867
532
|
}
|
|
868
|
-
/**
|
|
869
|
-
* Creates a DeadFront OnOff cluster server.
|
|
870
|
-
*
|
|
871
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
872
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
873
|
-
*/
|
|
874
533
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
875
534
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
876
535
|
onOff,
|
|
877
536
|
});
|
|
878
537
|
return this;
|
|
879
538
|
}
|
|
880
|
-
/**
|
|
881
|
-
* Creates an OffOnly OnOff cluster server.
|
|
882
|
-
*
|
|
883
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
884
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
885
|
-
*/
|
|
886
539
|
createOffOnlyOnOffClusterServer(onOff = false) {
|
|
887
540
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
|
|
888
541
|
onOff,
|
|
889
542
|
});
|
|
890
543
|
return this;
|
|
891
544
|
}
|
|
892
|
-
/**
|
|
893
|
-
* Creates a default level control cluster server for light devices.
|
|
894
|
-
*
|
|
895
|
-
* @param {number} [currentLevel=254] - The current level (default: 254).
|
|
896
|
-
* @param {number} [minLevel=1] - The minimum level (default: 1).
|
|
897
|
-
* @param {number} [maxLevel=254] - The maximum level (default: 254).
|
|
898
|
-
* @param {number | null} [onLevel=null] - The on level (default: null).
|
|
899
|
-
* @param {number | null} [startUpCurrentLevel=null] - The startUp on level (default: null).
|
|
900
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
901
|
-
*/
|
|
902
545
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
903
546
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
904
547
|
currentLevel,
|
|
@@ -914,13 +557,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
914
557
|
});
|
|
915
558
|
return this;
|
|
916
559
|
}
|
|
917
|
-
/**
|
|
918
|
-
* Creates a level control cluster server without features.
|
|
919
|
-
*
|
|
920
|
-
* @param {number} [currentLevel=254] - The current level (default: 254).
|
|
921
|
-
* @param {number | null} [onLevel=null] - The on level (default: null).
|
|
922
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
923
|
-
*/
|
|
924
560
|
createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
|
|
925
561
|
this.behaviors.require(MatterbridgeLevelControlServer, {
|
|
926
562
|
currentLevel,
|
|
@@ -932,18 +568,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
932
568
|
});
|
|
933
569
|
return this;
|
|
934
570
|
}
|
|
935
|
-
/**
|
|
936
|
-
* Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
937
|
-
*
|
|
938
|
-
* @param currentX - The current X value.
|
|
939
|
-
* @param currentY - The current Y value.
|
|
940
|
-
* @param currentHue - The current hue value.
|
|
941
|
-
* @param currentSaturation - The current saturation value.
|
|
942
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
943
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
944
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
945
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
946
|
-
*/
|
|
947
571
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
948
572
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
949
573
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -966,19 +590,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
966
590
|
});
|
|
967
591
|
return this;
|
|
968
592
|
}
|
|
969
|
-
/**
|
|
970
|
-
* Creates a Xy color control cluster server with Xy and ColorTemperature.
|
|
971
|
-
*
|
|
972
|
-
* @param currentX - The current X value.
|
|
973
|
-
* @param currentY - The current Y value.
|
|
974
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
975
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
976
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
977
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
978
|
-
*
|
|
979
|
-
* @remarks
|
|
980
|
-
* From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
|
|
981
|
-
*/
|
|
982
593
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
983
594
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
984
595
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -999,16 +610,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
999
610
|
});
|
|
1000
611
|
return this;
|
|
1001
612
|
}
|
|
1002
|
-
/**
|
|
1003
|
-
* Creates a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
|
|
1004
|
-
*
|
|
1005
|
-
* @param currentHue - The current hue value.
|
|
1006
|
-
* @param currentSaturation - The current saturation value.
|
|
1007
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1008
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1009
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1010
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1011
|
-
*/
|
|
1012
613
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1013
614
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1014
615
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1029,14 +630,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1029
630
|
});
|
|
1030
631
|
return this;
|
|
1031
632
|
}
|
|
1032
|
-
/**
|
|
1033
|
-
* Creates a color temperature color control cluster server.
|
|
1034
|
-
*
|
|
1035
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1036
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1037
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1038
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1039
|
-
*/
|
|
1040
633
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1041
634
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
1042
635
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1055,23 +648,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1055
648
|
});
|
|
1056
649
|
return this;
|
|
1057
650
|
}
|
|
1058
|
-
/**
|
|
1059
|
-
* Configures the color control mode for the device.
|
|
1060
|
-
*
|
|
1061
|
-
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1062
|
-
*/
|
|
1063
651
|
async configureColorControlMode(colorMode) {
|
|
1064
652
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
1065
653
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
1066
654
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
1067
655
|
}
|
|
1068
656
|
}
|
|
1069
|
-
/**
|
|
1070
|
-
* Creates a default window covering cluster server (Lift and PositionAwareLift).
|
|
1071
|
-
*
|
|
1072
|
-
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1073
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1074
|
-
*/
|
|
1075
657
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1076
658
|
this.behaviors.require(MatterbridgeWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1077
659
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
@@ -1087,15 +669,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1087
669
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1088
670
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
1089
671
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1090
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1091
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
672
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
673
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1092
674
|
});
|
|
1093
675
|
return this;
|
|
1094
676
|
}
|
|
1095
|
-
/**
|
|
1096
|
-
* Sets the window covering target position as the current position and stops the movement.
|
|
1097
|
-
*
|
|
1098
|
-
*/
|
|
1099
677
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
1100
678
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
1101
679
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -1108,12 +686,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1108
686
|
}
|
|
1109
687
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1110
688
|
}
|
|
1111
|
-
/**
|
|
1112
|
-
* Sets the current and target status of a window covering.
|
|
1113
|
-
* @param {number} current - The current position of the window covering.
|
|
1114
|
-
* @param {number} target - The target position of the window covering.
|
|
1115
|
-
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1116
|
-
*/
|
|
1117
689
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
1118
690
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
1119
691
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -1124,10 +696,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1124
696
|
}, this.log);
|
|
1125
697
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1126
698
|
}
|
|
1127
|
-
/**
|
|
1128
|
-
* Sets the status of the window covering.
|
|
1129
|
-
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1130
|
-
*/
|
|
1131
699
|
async setWindowCoveringStatus(status) {
|
|
1132
700
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
1133
701
|
global: status,
|
|
@@ -1136,11 +704,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1136
704
|
}, this.log);
|
|
1137
705
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1138
706
|
}
|
|
1139
|
-
/**
|
|
1140
|
-
* Retrieves the status of the window covering.
|
|
1141
|
-
*
|
|
1142
|
-
* @returns The global operational status of the window covering or undefined.
|
|
1143
|
-
*/
|
|
1144
707
|
getWindowCoveringStatus() {
|
|
1145
708
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
1146
709
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -1148,66 +711,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1148
711
|
return status.global;
|
|
1149
712
|
}
|
|
1150
713
|
}
|
|
1151
|
-
/**
|
|
1152
|
-
* Sets the target and current position of the window covering.
|
|
1153
|
-
*
|
|
1154
|
-
* @param position - The position to set, specified as a number.
|
|
1155
|
-
*/
|
|
1156
714
|
async setWindowCoveringTargetAndCurrentPosition(position) {
|
|
1157
715
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', position, this.log);
|
|
1158
716
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', position, this.log);
|
|
1159
717
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
1160
718
|
}
|
|
1161
|
-
/**
|
|
1162
|
-
* Creates a default thermostat cluster server with Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode.
|
|
1163
|
-
*
|
|
1164
|
-
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1165
|
-
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1166
|
-
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1167
|
-
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
1168
|
-
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1169
|
-
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1170
|
-
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1171
|
-
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1172
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1173
|
-
*/
|
|
1174
719
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1175
720
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1176
721
|
localTemperature: localTemperature * 100,
|
|
1177
722
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1178
723
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1179
|
-
// Thermostat.Feature.Heating
|
|
1180
724
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1181
725
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1182
726
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1183
727
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1184
728
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1185
|
-
// Thermostat.Feature.Cooling
|
|
1186
729
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1187
730
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1188
731
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1189
732
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1190
733
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1191
|
-
// Thermostat.Feature.AutoMode
|
|
1192
734
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1193
735
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1194
736
|
});
|
|
1195
737
|
return this;
|
|
1196
738
|
}
|
|
1197
|
-
/**
|
|
1198
|
-
* Creates a default heating thermostat cluster server with Thermostat.Feature.Heating.
|
|
1199
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1200
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1201
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1202
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1203
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1204
|
-
*/
|
|
1205
739
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1206
740
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
|
|
1207
741
|
localTemperature: localTemperature * 100,
|
|
1208
742
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1209
743
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1210
|
-
// Thermostat.Feature.Heating
|
|
1211
744
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1212
745
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1213
746
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1216,20 +749,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1216
749
|
});
|
|
1217
750
|
return this;
|
|
1218
751
|
}
|
|
1219
|
-
/**
|
|
1220
|
-
* Creates a default cooling thermostat cluster server with Thermostat.Feature.Cooling.
|
|
1221
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1222
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1223
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1224
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1225
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1226
|
-
*/
|
|
1227
752
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1228
753
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
|
|
1229
754
|
localTemperature: localTemperature * 100,
|
|
1230
755
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1231
756
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1232
|
-
// Thermostat.Feature.Cooling
|
|
1233
757
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1234
758
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1235
759
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -1238,15 +762,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1238
762
|
});
|
|
1239
763
|
return this;
|
|
1240
764
|
}
|
|
1241
|
-
/**
|
|
1242
|
-
* Creates a default thermostat user interface configuration cluster server.
|
|
1243
|
-
*
|
|
1244
|
-
* @remarks
|
|
1245
|
-
* The default values are:
|
|
1246
|
-
* - temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius (writeble).
|
|
1247
|
-
* - keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout (writeble).
|
|
1248
|
-
* - scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted (writeble).
|
|
1249
|
-
*/
|
|
1250
765
|
createDefaultThermostatUserInterfaceConfigurationClusterServer() {
|
|
1251
766
|
this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
|
|
1252
767
|
temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
|
|
@@ -1255,12 +770,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1255
770
|
});
|
|
1256
771
|
return this;
|
|
1257
772
|
}
|
|
1258
|
-
/**
|
|
1259
|
-
* Creates a default fan control cluster server.
|
|
1260
|
-
*
|
|
1261
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1262
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1263
|
-
*/
|
|
1264
773
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1265
774
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1266
775
|
fanMode,
|
|
@@ -1273,12 +782,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1273
782
|
});
|
|
1274
783
|
return this;
|
|
1275
784
|
}
|
|
1276
|
-
/**
|
|
1277
|
-
* Creates a base fan control cluster server.
|
|
1278
|
-
*
|
|
1279
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1280
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1281
|
-
*/
|
|
1282
785
|
createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1283
786
|
this.behaviors.require(FanControlServer, {
|
|
1284
787
|
fanMode,
|
|
@@ -1288,82 +791,39 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1288
791
|
});
|
|
1289
792
|
return this;
|
|
1290
793
|
}
|
|
1291
|
-
/**
|
|
1292
|
-
* Creates a default HEPA Filter Monitoring Cluster Server.
|
|
1293
|
-
* It supports ResourceMonitoring.Feature.Condition and ResourceMonitoring.Feature.ReplacementProductList.
|
|
1294
|
-
*
|
|
1295
|
-
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
1296
|
-
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
|
|
1297
|
-
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
|
|
1298
|
-
*
|
|
1299
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1300
|
-
*/
|
|
1301
794
|
createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
1302
795
|
this.behaviors.require(HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1303
|
-
condition: 100,
|
|
1304
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
796
|
+
condition: 100,
|
|
797
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1305
798
|
changeIndication,
|
|
1306
799
|
inPlaceIndicator,
|
|
1307
800
|
lastChangedTime,
|
|
1308
|
-
replacementProductList: [],
|
|
801
|
+
replacementProductList: [],
|
|
1309
802
|
});
|
|
1310
803
|
return this;
|
|
1311
804
|
}
|
|
1312
|
-
/**
|
|
1313
|
-
* Creates a default Activated Carbon Filter Monitoring Cluster Server.
|
|
1314
|
-
* It supports ResourceMonitoring.Feature.Condition and ResourceMonitoring.Feature.ReplacementProductList.
|
|
1315
|
-
*
|
|
1316
|
-
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
1317
|
-
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
|
|
1318
|
-
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
|
|
1319
|
-
*
|
|
1320
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1321
|
-
*/
|
|
1322
805
|
createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
1323
806
|
this.behaviors.require(ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1324
|
-
condition: 100,
|
|
1325
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
807
|
+
condition: 100,
|
|
808
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1326
809
|
changeIndication,
|
|
1327
810
|
inPlaceIndicator,
|
|
1328
811
|
lastChangedTime,
|
|
1329
|
-
replacementProductList: [],
|
|
812
|
+
replacementProductList: [],
|
|
1330
813
|
});
|
|
1331
814
|
return this;
|
|
1332
815
|
}
|
|
1333
|
-
/**
|
|
1334
|
-
* Creates a default door lock cluster server.
|
|
1335
|
-
*
|
|
1336
|
-
* @param {DoorLock.LockState} [lockState=DoorLock.LockState.Locked] - The initial state of the lock (default: Locked).
|
|
1337
|
-
* @param {DoorLock.LockType} [lockType=DoorLock.LockType.DeadBolt] - The type of the lock (default: DeadBolt).
|
|
1338
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1339
|
-
*
|
|
1340
|
-
* @remarks
|
|
1341
|
-
* All operating modes NOT supported by a lock SHALL be set to one. The value of the OperatingMode enumeration defines the related bit to be set.
|
|
1342
|
-
*/
|
|
1343
816
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1344
817
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
1345
818
|
lockState,
|
|
1346
819
|
lockType,
|
|
1347
820
|
actuatorEnabled: false,
|
|
1348
821
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
1349
|
-
// Special case of inverted bitmap: add also alwaysSet = 2047
|
|
1350
822
|
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
|
|
1351
823
|
alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
|
|
1352
824
|
});
|
|
1353
825
|
return this;
|
|
1354
826
|
}
|
|
1355
|
-
/**
|
|
1356
|
-
* Creates a default Mode Select cluster server.
|
|
1357
|
-
*
|
|
1358
|
-
* @param {string} description - The description of the mode select cluster.
|
|
1359
|
-
* @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
|
|
1360
|
-
* @param {number} [currentMode=0] - The current mode (default: 0).
|
|
1361
|
-
* @param {number} [startUpMode=0] - The startup mode (default: 0).
|
|
1362
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1363
|
-
*
|
|
1364
|
-
* @remarks
|
|
1365
|
-
* endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
|
|
1366
|
-
*/
|
|
1367
827
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1368
828
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
1369
829
|
description: description,
|
|
@@ -1374,13 +834,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1374
834
|
});
|
|
1375
835
|
return this;
|
|
1376
836
|
}
|
|
1377
|
-
/**
|
|
1378
|
-
* Creates the default Valve Configuration And Control cluster server.
|
|
1379
|
-
*
|
|
1380
|
-
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
1381
|
-
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
1382
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1383
|
-
*/
|
|
1384
837
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
1385
838
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
1386
839
|
currentState: valveState,
|
|
@@ -1396,12 +849,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1396
849
|
});
|
|
1397
850
|
return this;
|
|
1398
851
|
}
|
|
1399
|
-
/**
|
|
1400
|
-
* Creates the default PumpConfigurationAndControl cluster server.
|
|
1401
|
-
*
|
|
1402
|
-
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
1403
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1404
|
-
*/
|
|
1405
852
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1406
853
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
1407
854
|
minConstSpeed: null,
|
|
@@ -1416,13 +863,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1416
863
|
});
|
|
1417
864
|
return this;
|
|
1418
865
|
}
|
|
1419
|
-
/**
|
|
1420
|
-
* Creates the default SmokeCOAlarm Cluster Server.
|
|
1421
|
-
*
|
|
1422
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1423
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1424
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1425
|
-
*/
|
|
1426
866
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1427
867
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1428
868
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1438,12 +878,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1438
878
|
});
|
|
1439
879
|
return this;
|
|
1440
880
|
}
|
|
1441
|
-
/**
|
|
1442
|
-
* Creates a smoke only SmokeCOAlarm Cluster Server.
|
|
1443
|
-
*
|
|
1444
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1445
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1446
|
-
*/
|
|
1447
881
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1448
882
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
1449
883
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1458,12 +892,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1458
892
|
});
|
|
1459
893
|
return this;
|
|
1460
894
|
}
|
|
1461
|
-
/**
|
|
1462
|
-
* Creates a co only SmokeCOAlarm Cluster Server.
|
|
1463
|
-
*
|
|
1464
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1465
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1466
|
-
*/
|
|
1467
895
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1468
896
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1469
897
|
events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1478,13 +906,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1478
906
|
});
|
|
1479
907
|
return this;
|
|
1480
908
|
}
|
|
1481
|
-
/**
|
|
1482
|
-
* Creates a default momentary switch cluster server.
|
|
1483
|
-
*
|
|
1484
|
-
* @remarks
|
|
1485
|
-
* This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
|
|
1486
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1487
|
-
*/
|
|
1488
909
|
createDefaultSwitchClusterServer() {
|
|
1489
910
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
1490
911
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -1495,13 +916,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1495
916
|
});
|
|
1496
917
|
return this;
|
|
1497
918
|
}
|
|
1498
|
-
/**
|
|
1499
|
-
* Creates a default latching switch cluster server.
|
|
1500
|
-
*
|
|
1501
|
-
* @remarks
|
|
1502
|
-
* This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
|
|
1503
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1504
|
-
*/
|
|
1505
919
|
createDefaultLatchingSwitchClusterServer() {
|
|
1506
920
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
1507
921
|
events: { switchLatched: true },
|
|
@@ -1511,13 +925,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1511
925
|
});
|
|
1512
926
|
return this;
|
|
1513
927
|
}
|
|
1514
|
-
/**
|
|
1515
|
-
* Triggers a switch event on the specified endpoint.
|
|
1516
|
-
*
|
|
1517
|
-
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1518
|
-
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1519
|
-
* @returns {boolean} - A boolean indicating whether the event was successfully triggered.
|
|
1520
|
-
*/
|
|
1521
928
|
async triggerSwitchEvent(event, log) {
|
|
1522
929
|
if (this.maybeNumber === undefined) {
|
|
1523
930
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1577,18 +984,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1577
984
|
}
|
|
1578
985
|
return true;
|
|
1579
986
|
}
|
|
1580
|
-
/**
|
|
1581
|
-
* Creates a default boolean state cluster server.
|
|
1582
|
-
*
|
|
1583
|
-
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
|
|
1584
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1585
|
-
*
|
|
1586
|
-
* @remarks
|
|
1587
|
-
* Water Leak Detector: true = leak, false = no leak
|
|
1588
|
-
* Water Freeze Detector: true = freeze, false = no freeze
|
|
1589
|
-
* Rain Sensor: true = rain, false = no rain
|
|
1590
|
-
* Contact Sensor: true = closed or contact, false = open or no contact
|
|
1591
|
-
*/
|
|
1592
987
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1593
988
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1594
989
|
events: { stateChange: true },
|
|
@@ -1597,18 +992,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1597
992
|
});
|
|
1598
993
|
return this;
|
|
1599
994
|
}
|
|
1600
|
-
/**
|
|
1601
|
-
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
|
|
1602
|
-
*
|
|
1603
|
-
* @remarks Supports the enableDisableAlarm command.
|
|
1604
|
-
*
|
|
1605
|
-
* @param {boolean} [sensorFault=false] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1606
|
-
* @param {number} [currentSensitivityLevel=0] - The current sensitivity level. Defaults to `0` if not provided.
|
|
1607
|
-
* @param {number} [supportedSensitivityLevels=2] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
|
|
1608
|
-
* @param {number} [defaultSensitivityLevel=0] - The default sensitivity level. Defaults to `0` if not provided.
|
|
1609
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1610
|
-
*
|
|
1611
|
-
*/
|
|
1612
995
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1613
996
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1614
997
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -1623,21 +1006,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1623
1006
|
});
|
|
1624
1007
|
return this;
|
|
1625
1008
|
}
|
|
1626
|
-
/**
|
|
1627
|
-
* Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
|
|
1628
|
-
*
|
|
1629
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1630
|
-
*/
|
|
1631
1009
|
createDefaultPowerTopologyClusterServer() {
|
|
1632
1010
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1633
1011
|
return this;
|
|
1634
1012
|
}
|
|
1635
|
-
/**
|
|
1636
|
-
* Creates a default Electrical Energy Measurement Cluster Server.
|
|
1637
|
-
*
|
|
1638
|
-
* @param {number} energy - The total consumption value in mW/h.
|
|
1639
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1640
|
-
*/
|
|
1641
1013
|
createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
1642
1014
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1643
1015
|
accuracy: {
|
|
@@ -1653,15 +1025,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1653
1025
|
});
|
|
1654
1026
|
return this;
|
|
1655
1027
|
}
|
|
1656
|
-
/**
|
|
1657
|
-
* Creates a default Electrical Power Measurement Cluster Server.
|
|
1658
|
-
*
|
|
1659
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
1660
|
-
* @param {number} current - The current value in milliamperes.
|
|
1661
|
-
* @param {number} power - The power value in milliwatts.
|
|
1662
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
1663
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1664
|
-
*/
|
|
1665
1028
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1666
1029
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1667
1030
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1703,113 +1066,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1703
1066
|
});
|
|
1704
1067
|
return this;
|
|
1705
1068
|
}
|
|
1706
|
-
/**
|
|
1707
|
-
* Creates a default TemperatureMeasurement cluster server.
|
|
1708
|
-
*
|
|
1709
|
-
* @param {number | null} measuredValue - The measured value of the temperature x 100.
|
|
1710
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
|
|
1711
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
|
|
1712
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1713
|
-
*/
|
|
1714
1069
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1715
1070
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1716
1071
|
return this;
|
|
1717
1072
|
}
|
|
1718
|
-
/**
|
|
1719
|
-
* Creates a default RelativeHumidityMeasurement cluster server.
|
|
1720
|
-
*
|
|
1721
|
-
* @param {number | null} measuredValue - The measured value of the relative humidity x 100.
|
|
1722
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
|
|
1723
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
|
|
1724
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1725
|
-
*/
|
|
1726
1073
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1727
1074
|
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1728
1075
|
return this;
|
|
1729
1076
|
}
|
|
1730
|
-
/**
|
|
1731
|
-
* Creates a default PressureMeasurement cluster server.
|
|
1732
|
-
*
|
|
1733
|
-
* @param {number | null} measuredValue - The measured value for the pressure.
|
|
1734
|
-
* @param {number | null} minMeasuredValue - The minimum measured value for the pressure.
|
|
1735
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value for the pressure.
|
|
1736
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1737
|
-
*/
|
|
1738
1077
|
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1739
1078
|
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1740
1079
|
return this;
|
|
1741
1080
|
}
|
|
1742
|
-
/**
|
|
1743
|
-
* Creates a default IlluminanceMeasurement cluster server.
|
|
1744
|
-
*
|
|
1745
|
-
* @param {number | null} measuredValue - The measured value of illuminance.
|
|
1746
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
|
|
1747
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
|
|
1748
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1749
|
-
*
|
|
1750
|
-
* @remark The default value for the illuminance measurement is null.
|
|
1751
|
-
* This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
|
|
1752
|
-
* • MeasuredValue = 10,000 x log10(illuminance) + 1,
|
|
1753
|
-
* where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
|
|
1754
|
-
* • 0 indicates a value of illuminance that is too low to be measured
|
|
1755
|
-
* • null indicates that the illuminance measurement is invalid.
|
|
1756
|
-
*
|
|
1757
|
-
* @remarks
|
|
1758
|
-
* Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
|
|
1759
|
-
* Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
|
|
1760
|
-
*/
|
|
1761
1081
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1762
1082
|
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1763
1083
|
return this;
|
|
1764
1084
|
}
|
|
1765
|
-
/**
|
|
1766
|
-
* Creates a default FlowMeasurement cluster server.
|
|
1767
|
-
*
|
|
1768
|
-
* @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
|
|
1769
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
|
|
1770
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
|
|
1771
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1772
|
-
*/
|
|
1773
1085
|
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1774
1086
|
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1775
1087
|
return this;
|
|
1776
1088
|
}
|
|
1777
|
-
/**
|
|
1778
|
-
* Creates a default OccupancySensing cluster server.
|
|
1779
|
-
*
|
|
1780
|
-
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1781
|
-
* @param {number} holdTime - The hold time in seconds. Default is 30.
|
|
1782
|
-
* @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
|
|
1783
|
-
* @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
|
|
1784
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1785
|
-
*
|
|
1786
|
-
* @remark The default value for the occupancy sensor type is PIR.
|
|
1787
|
-
*/
|
|
1788
1089
|
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
1789
1090
|
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
1790
1091
|
return this;
|
|
1791
1092
|
}
|
|
1792
|
-
/**
|
|
1793
|
-
* Creates a default AirQuality cluster server.
|
|
1794
|
-
*
|
|
1795
|
-
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
1796
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1797
|
-
*/
|
|
1798
1093
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1799
1094
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1800
1095
|
airQuality,
|
|
1801
1096
|
});
|
|
1802
1097
|
return this;
|
|
1803
1098
|
}
|
|
1804
|
-
/**
|
|
1805
|
-
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server.
|
|
1806
|
-
*
|
|
1807
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1808
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1809
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1810
|
-
* @param {number} [uncertainty] - The uncertainty value (optional).
|
|
1811
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1812
|
-
*/
|
|
1813
1099
|
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
1814
1100
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1815
1101
|
measuredValue,
|
|
@@ -1821,11 +1107,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1821
1107
|
});
|
|
1822
1108
|
return this;
|
|
1823
1109
|
}
|
|
1824
|
-
/**
|
|
1825
|
-
* @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
|
|
1826
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1827
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1828
|
-
*/
|
|
1829
1110
|
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1830
1111
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
1831
1112
|
levelValue,
|
|
@@ -1833,13 +1114,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1833
1114
|
});
|
|
1834
1115
|
return this;
|
|
1835
1116
|
}
|
|
1836
|
-
/**
|
|
1837
|
-
* Create a default CarbonMonoxideConcentrationMeasurement cluster server.
|
|
1838
|
-
*
|
|
1839
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1840
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1841
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1842
|
-
*/
|
|
1843
1117
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1844
1118
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1845
1119
|
measuredValue,
|
|
@@ -1851,13 +1125,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1851
1125
|
});
|
|
1852
1126
|
return this;
|
|
1853
1127
|
}
|
|
1854
|
-
/**
|
|
1855
|
-
* Create a default CarbonDioxideConcentrationMeasurement cluster server.
|
|
1856
|
-
*
|
|
1857
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1858
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1859
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1860
|
-
*/
|
|
1861
1128
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1862
1129
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1863
1130
|
measuredValue,
|
|
@@ -1869,13 +1136,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1869
1136
|
});
|
|
1870
1137
|
return this;
|
|
1871
1138
|
}
|
|
1872
|
-
/**
|
|
1873
|
-
* Create a default FormaldehydeConcentrationMeasurement cluster server.
|
|
1874
|
-
*
|
|
1875
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1876
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1877
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1878
|
-
*/
|
|
1879
1139
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1880
1140
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1881
1141
|
measuredValue,
|
|
@@ -1887,13 +1147,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1887
1147
|
});
|
|
1888
1148
|
return this;
|
|
1889
1149
|
}
|
|
1890
|
-
/**
|
|
1891
|
-
* Create a default Pm1ConcentrationMeasurement cluster server.
|
|
1892
|
-
*
|
|
1893
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1894
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1895
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1896
|
-
*/
|
|
1897
1150
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1898
1151
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1899
1152
|
measuredValue,
|
|
@@ -1905,13 +1158,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1905
1158
|
});
|
|
1906
1159
|
return this;
|
|
1907
1160
|
}
|
|
1908
|
-
/**
|
|
1909
|
-
* Create a default Pm25ConcentrationMeasurement cluster server.
|
|
1910
|
-
*
|
|
1911
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1912
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1913
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1914
|
-
*/
|
|
1915
1161
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1916
1162
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1917
1163
|
measuredValue,
|
|
@@ -1923,13 +1169,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1923
1169
|
});
|
|
1924
1170
|
return this;
|
|
1925
1171
|
}
|
|
1926
|
-
/**
|
|
1927
|
-
* Create a default Pm10ConcentrationMeasurement cluster server.
|
|
1928
|
-
*
|
|
1929
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1930
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1931
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1932
|
-
*/
|
|
1933
1172
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1934
1173
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1935
1174
|
measuredValue,
|
|
@@ -1941,13 +1180,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1941
1180
|
});
|
|
1942
1181
|
return this;
|
|
1943
1182
|
}
|
|
1944
|
-
/**
|
|
1945
|
-
* Create a default OzoneConcentrationMeasurement cluster server.
|
|
1946
|
-
*
|
|
1947
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1948
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
1949
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1950
|
-
*/
|
|
1951
1183
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1952
1184
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1953
1185
|
measuredValue,
|
|
@@ -1959,13 +1191,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1959
1191
|
});
|
|
1960
1192
|
return this;
|
|
1961
1193
|
}
|
|
1962
|
-
/**
|
|
1963
|
-
* Create a default RadonConcentrationMeasurement cluster server.
|
|
1964
|
-
*
|
|
1965
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1966
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1967
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1968
|
-
*/
|
|
1969
1194
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1970
1195
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1971
1196
|
measuredValue,
|
|
@@ -1977,13 +1202,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1977
1202
|
});
|
|
1978
1203
|
return this;
|
|
1979
1204
|
}
|
|
1980
|
-
/**
|
|
1981
|
-
* Create a default NitrogenDioxideConcentrationMeasurement cluster server.
|
|
1982
|
-
*
|
|
1983
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1984
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
1985
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1986
|
-
*/
|
|
1987
1205
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1988
1206
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1989
1207
|
measuredValue,
|
|
@@ -1996,4 +1214,3 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1996
1214
|
return this;
|
|
1997
1215
|
}
|
|
1998
1216
|
}
|
|
1999
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|