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