matterbridge 2.2.9 → 3.0.0-edge.10
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 +44 -0
- package/dist/cli.js +6 -38
- package/dist/cluster/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -23
- package/dist/deviceManager.js +1 -94
- package/dist/frontend.js +20 -328
- package/dist/index.js +1 -28
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.js +0 -2
- package/dist/matter/types.js +0 -2
- package/dist/matterbridge.js +104 -761
- package/dist/matterbridgeAccessoryPlatform.js +0 -33
- package/dist/matterbridgeBehaviors.js +46 -72
- package/dist/matterbridgeDeviceTypes.js +249 -233
- package/dist/matterbridgeDynamicPlatform.js +0 -33
- package/dist/matterbridgeEndpoint.js +85 -759
- package/dist/matterbridgeEndpointHelpers.js +30 -136
- package/dist/matterbridgePlatform.js +9 -218
- package/dist/matterbridgeTypes.js +0 -24
- package/dist/pluginManager.js +3 -262
- package/dist/shelly.js +6 -146
- package/dist/storage/export.js +0 -1
- package/dist/update.js +0 -45
- package/dist/utils/colorUtils.js +2 -205
- package/dist/utils/copyDirectory.js +1 -37
- package/dist/utils/createZip.js +2 -42
- package/dist/utils/deepCopy.js +0 -40
- package/dist/utils/deepEqual.js +1 -65
- package/dist/utils/export.js +0 -1
- package/dist/utils/isvalid.js +0 -86
- package/dist/utils/network.js +5 -76
- package/dist/utils/parameter.js +0 -41
- package/dist/utils/wait.js +5 -48
- package/npm-shrinkwrap.json +289 -351
- package/package.json +3 -4
- package/dist/cli.d.ts +0 -29
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cluster/export.d.ts +0 -2
- package/dist/cluster/export.d.ts.map +0 -1
- package/dist/cluster/export.js.map +0 -1
- package/dist/defaultConfigSchema.d.ts +0 -27
- package/dist/defaultConfigSchema.d.ts.map +0 -1
- package/dist/defaultConfigSchema.js.map +0 -1
- package/dist/deviceManager.d.ts +0 -114
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/frontend.d.ts +0 -221
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/index.d.ts +0 -35
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger/export.d.ts +0 -2
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/behaviors.d.ts +0 -2
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts +0 -2
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts +0 -2
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts +0 -2
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts +0 -5
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts +0 -3
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -425
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -39
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -1056
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -178
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -39
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -867
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -2275
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -285
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -183
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -271
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/shelly.d.ts +0 -92
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.js.map +0 -1
- package/dist/storage/export.d.ts +0 -2
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/update.d.ts +0 -32
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -61
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -32
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -38
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -31
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -53
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/export.d.ts +0 -10
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/isvalid.d.ts +0 -87
- package/dist/utils/isvalid.d.ts.map +0 -1
- package/dist/utils/isvalid.js.map +0 -1
- package/dist/utils/network.d.ts +0 -69
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/parameter.d.ts +0 -44
- package/dist/utils/parameter.d.ts.map +0 -1
- package/dist/utils/parameter.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -43
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
|
|
3
|
-
*
|
|
4
|
-
* @file matterbridgeEndpoint.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2024-10-01
|
|
7
|
-
* @version 2.0.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2024, 2025, 2026 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License. *
|
|
22
|
-
*/
|
|
23
|
-
// AnsiLogger module
|
|
24
1
|
import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, zb } from './logger/export.js';
|
|
25
|
-
// Matterbridge
|
|
26
2
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
27
3
|
import { isValidNumber, isValidObject } from './utils/export.js';
|
|
28
|
-
import {
|
|
4
|
+
import { MatterbridgeServer, MatterbridgeServerDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, } from './matterbridgeBehaviors.js';
|
|
29
5
|
import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, capitalizeFirstLetter, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, } from './matterbridgeEndpointHelpers.js';
|
|
30
|
-
// @matter
|
|
31
6
|
import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, VendorId } from '@matter/main';
|
|
32
7
|
import { getClusterNameById, MeasurementType } from '@matter/main/types';
|
|
33
|
-
// @matter clusters
|
|
34
8
|
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
35
9
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
36
10
|
import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
|
|
@@ -52,7 +26,7 @@ import { ElectricalPowerMeasurement } from '@matter/main/clusters/electrical-pow
|
|
|
52
26
|
import { ElectricalEnergyMeasurement } from '@matter/main/clusters/electrical-energy-measurement';
|
|
53
27
|
import { AirQuality } from '@matter/main/clusters/air-quality';
|
|
54
28
|
import { ConcentrationMeasurement } from '@matter/main/clusters/concentration-measurement';
|
|
55
|
-
|
|
29
|
+
import { OccupancySensing } from '@matter/main/clusters/occupancy-sensing';
|
|
56
30
|
import { DescriptorServer } from '@matter/main/behaviors/descriptor';
|
|
57
31
|
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
58
32
|
import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
|
|
@@ -81,9 +55,13 @@ import { Pm25ConcentrationMeasurementServer } from '@matter/main/behaviors/pm25-
|
|
|
81
55
|
import { Pm10ConcentrationMeasurementServer } from '@matter/main/behaviors/pm10-concentration-measurement';
|
|
82
56
|
import { RadonConcentrationMeasurementServer } from '@matter/main/behaviors/radon-concentration-measurement';
|
|
83
57
|
import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/main/behaviors/total-volatile-organic-compounds-concentration-measurement';
|
|
58
|
+
import { FanControlServer } from '@matter/main/behaviors/fan-control';
|
|
59
|
+
import { ResourceMonitoring } from '@matter/main/clusters/resource-monitoring';
|
|
60
|
+
import { HepaFilterMonitoringServer } from '@matter/main/behaviors/hepa-filter-monitoring';
|
|
61
|
+
import { ActivatedCarbonFilterMonitoringServer } from '@matter/main/behaviors/activated-carbon-filter-monitoring';
|
|
84
62
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
85
63
|
static bridgeMode = '';
|
|
86
|
-
static logLevel = "info"
|
|
64
|
+
static logLevel = "info";
|
|
87
65
|
log;
|
|
88
66
|
plugin = undefined;
|
|
89
67
|
configUrl = undefined;
|
|
@@ -99,25 +77,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
99
77
|
hardwareVersion = undefined;
|
|
100
78
|
hardwareVersionString = undefined;
|
|
101
79
|
productUrl = 'https://www.npmjs.com/package/matterbridge';
|
|
102
|
-
// The first device type of the endpoint
|
|
103
80
|
name = undefined;
|
|
104
81
|
deviceType;
|
|
105
82
|
uniqueStorageKey = undefined;
|
|
106
83
|
tagList = undefined;
|
|
107
|
-
// Maps matter deviceTypes
|
|
108
84
|
deviceTypes = new Map();
|
|
109
|
-
// Command handler
|
|
110
85
|
commandHandler = new NamedHandler();
|
|
111
|
-
/**
|
|
112
|
-
* Represents a MatterbridgeEndpoint.
|
|
113
|
-
* @constructor
|
|
114
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
|
|
115
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
116
|
-
* @param {boolean} [debug=false] - Debug flag.
|
|
117
|
-
*/
|
|
118
86
|
constructor(definition, options = {}, debug = false) {
|
|
119
87
|
let deviceTypeList = [];
|
|
120
|
-
// Get the first DeviceTypeDefinition
|
|
121
88
|
let firstDefinition;
|
|
122
89
|
if (Array.isArray(definition)) {
|
|
123
90
|
firstDefinition = definition[0];
|
|
@@ -130,7 +97,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
130
97
|
firstDefinition = definition;
|
|
131
98
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
132
99
|
}
|
|
133
|
-
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
134
100
|
const deviceTypeDefinitionV8 = {
|
|
135
101
|
name: firstDefinition.name.replace('-', '_'),
|
|
136
102
|
deviceType: firstDefinition.code,
|
|
@@ -149,11 +115,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
149
115
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
150
116
|
};
|
|
151
117
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
152
|
-
// Check if the uniqueStorageKey is valid
|
|
153
118
|
if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
|
|
154
119
|
options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
|
|
155
120
|
}
|
|
156
|
-
// Convert the options to an Endpoint.Options
|
|
157
121
|
const optionsV8 = {
|
|
158
122
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
159
123
|
number: options.endpointId,
|
|
@@ -171,41 +135,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
171
135
|
}
|
|
172
136
|
else
|
|
173
137
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
174
|
-
|
|
175
|
-
// console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
|
|
176
|
-
// console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
|
|
177
|
-
// Create the logger
|
|
178
|
-
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
|
|
138
|
+
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
|
|
179
139
|
this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
|
|
180
140
|
`id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Loads an instance of the MatterbridgeEndpoint class.
|
|
186
|
-
*
|
|
187
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
|
|
188
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
189
|
-
* @param {boolean} [debug=false] - Debug flag.
|
|
190
|
-
* @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
|
|
191
|
-
*/
|
|
141
|
+
this.behaviors.require(MatterbridgeServer, { deviceCommand: new MatterbridgeServerDevice(this.log, this.commandHandler, undefined) });
|
|
142
|
+
}
|
|
192
143
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
193
144
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
194
145
|
}
|
|
195
|
-
/**
|
|
196
|
-
* Get all the device types of this endpoint.
|
|
197
|
-
*
|
|
198
|
-
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
|
|
199
|
-
*/
|
|
200
146
|
getDeviceTypes() {
|
|
201
147
|
return Array.from(this.deviceTypes.values());
|
|
202
148
|
}
|
|
203
|
-
/**
|
|
204
|
-
* Checks if the provided cluster server is supported by this endpoint.
|
|
205
|
-
*
|
|
206
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
207
|
-
* @returns {boolean} True if the cluster server is supported, false otherwise.
|
|
208
|
-
*/
|
|
209
149
|
hasClusterServer(cluster) {
|
|
210
150
|
const behavior = getBehavior(this, cluster);
|
|
211
151
|
if (behavior)
|
|
@@ -213,13 +153,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
213
153
|
else
|
|
214
154
|
return false;
|
|
215
155
|
}
|
|
216
|
-
/**
|
|
217
|
-
* Checks if the provided attribute server is supported for a given cluster of this endpoint.
|
|
218
|
-
*
|
|
219
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
220
|
-
* @param {string} attribute - The attribute name to check.
|
|
221
|
-
* @returns {boolean} True if the attribute server is supported, false otherwise.
|
|
222
|
-
*/
|
|
223
156
|
hasAttributeServer(cluster, attribute) {
|
|
224
157
|
const behavior = getBehavior(this, cluster);
|
|
225
158
|
if (!behavior || !this.behaviors.supported[behavior.id])
|
|
@@ -228,186 +161,72 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
228
161
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
229
162
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
230
163
|
}
|
|
231
|
-
/**
|
|
232
|
-
* Retrieves the initial options for the provided cluster server.
|
|
233
|
-
*
|
|
234
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
|
|
235
|
-
* @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.
|
|
236
|
-
*/
|
|
237
164
|
getClusterServerOptions(cluster) {
|
|
238
165
|
const behavior = getBehavior(this, cluster);
|
|
239
166
|
if (!behavior)
|
|
240
167
|
return undefined;
|
|
241
168
|
return this.behaviors.optionsFor(behavior);
|
|
242
169
|
}
|
|
243
|
-
/**
|
|
244
|
-
* Retrieves the value of the provided attribute from the given cluster.
|
|
245
|
-
*
|
|
246
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
247
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
248
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
249
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
250
|
-
*/
|
|
251
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
252
170
|
getAttribute(cluster, attribute, log) {
|
|
253
171
|
return getAttribute(this, cluster, attribute, log);
|
|
254
172
|
}
|
|
255
|
-
/**
|
|
256
|
-
* Sets the value of an attribute on a cluster server.
|
|
257
|
-
*
|
|
258
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
|
|
259
|
-
* @param {string} attribute - The name of the attribute.
|
|
260
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
261
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
262
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
263
|
-
*/
|
|
264
173
|
async setAttribute(clusterId, attribute, value, log) {
|
|
265
174
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
266
175
|
}
|
|
267
|
-
/**
|
|
268
|
-
* Update the value of an attribute on a cluster server only if the value is different.
|
|
269
|
-
*
|
|
270
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
271
|
-
* @param {string} attribute - The name of the attribute.
|
|
272
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
273
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
|
|
274
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
275
|
-
*/
|
|
276
176
|
async updateAttribute(cluster, attribute, value, log) {
|
|
277
177
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
278
178
|
}
|
|
279
|
-
/**
|
|
280
|
-
* Subscribes to the provided attribute on a cluster.
|
|
281
|
-
*
|
|
282
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
|
|
283
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
284
|
-
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
285
|
-
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
286
|
-
* @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
|
|
287
|
-
*/
|
|
288
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
289
179
|
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
290
180
|
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
291
181
|
}
|
|
292
|
-
/**
|
|
293
|
-
* Triggers an event on the specified cluster.
|
|
294
|
-
*
|
|
295
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
296
|
-
* @param {string} event - The name of the event to trigger.
|
|
297
|
-
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
298
|
-
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
299
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
300
|
-
*/
|
|
301
182
|
async triggerEvent(clusterId, event, payload, log) {
|
|
302
183
|
const clusterName = lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
303
184
|
if (this.construction.status !== Lifecycle.Status.Active) {
|
|
304
185
|
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`);
|
|
305
186
|
return false;
|
|
306
187
|
}
|
|
307
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
308
188
|
const events = this.events;
|
|
309
189
|
if (!(clusterName in events) || !(event in events[clusterName])) {
|
|
310
190
|
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}`);
|
|
311
191
|
return false;
|
|
312
192
|
}
|
|
313
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
314
|
-
// @ts-ignore
|
|
315
193
|
await this.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
|
|
316
194
|
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} `);
|
|
317
195
|
return true;
|
|
318
196
|
}
|
|
319
|
-
/**
|
|
320
|
-
* Adds cluster servers from the provided server list.
|
|
321
|
-
*
|
|
322
|
-
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
323
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
324
|
-
*/
|
|
325
197
|
addClusterServers(serverList) {
|
|
326
198
|
addClusterServers(this, serverList);
|
|
327
199
|
return this;
|
|
328
200
|
}
|
|
329
|
-
/**
|
|
330
|
-
* Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
|
|
331
|
-
*
|
|
332
|
-
* @param {string} label - The label to add.
|
|
333
|
-
* @param {string} value - The value of the label.
|
|
334
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
335
|
-
*/
|
|
336
201
|
async addFixedLabel(label, value) {
|
|
337
202
|
await addFixedLabel(this, label, value);
|
|
338
203
|
return this;
|
|
339
204
|
}
|
|
340
|
-
/**
|
|
341
|
-
* Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
|
|
342
|
-
*
|
|
343
|
-
* @param {string} label - The label to add.
|
|
344
|
-
* @param {string} value - The value of the label.
|
|
345
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
346
|
-
*/
|
|
347
205
|
async addUserLabel(label, value) {
|
|
348
206
|
await addUserLabel(this, label, value);
|
|
349
207
|
return this;
|
|
350
208
|
}
|
|
351
|
-
/**
|
|
352
|
-
* Adds a command handler for the specified command.
|
|
353
|
-
*
|
|
354
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
355
|
-
* @param {HandlerFunction} handler - The handler function to execute when the command is received.
|
|
356
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
357
|
-
*/
|
|
358
209
|
addCommandHandler(command, handler) {
|
|
359
210
|
this.commandHandler.addHandler(command, handler);
|
|
360
211
|
return this;
|
|
361
212
|
}
|
|
362
|
-
/**
|
|
363
|
-
* Execute the command handler for the specified command. Mainly used in Jest tests.
|
|
364
|
-
*
|
|
365
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
|
|
366
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} request - The optional request to pass to the handler function.
|
|
367
|
-
* @returns {Promise<void>} A promise that resolves when the command handler has been executed
|
|
368
|
-
*/
|
|
369
213
|
async executeCommandHandler(command, request) {
|
|
370
214
|
await this.commandHandler.executeHandler(command, { request });
|
|
371
215
|
}
|
|
372
|
-
/**
|
|
373
|
-
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
374
|
-
*
|
|
375
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
376
|
-
*/
|
|
377
216
|
addRequiredClusterServers() {
|
|
378
217
|
addRequiredClusterServers(this);
|
|
379
218
|
return this;
|
|
380
219
|
}
|
|
381
|
-
/**
|
|
382
|
-
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
383
|
-
*
|
|
384
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
385
|
-
*/
|
|
386
220
|
addOptionalClusterServers() {
|
|
387
221
|
addOptionalClusterServers(this);
|
|
388
222
|
return this;
|
|
389
223
|
}
|
|
390
|
-
/**
|
|
391
|
-
* Retrieves all cluster servers.
|
|
392
|
-
*
|
|
393
|
-
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
394
|
-
*/
|
|
395
224
|
getAllClusterServers() {
|
|
396
225
|
return Object.values(this.behaviors.supported);
|
|
397
226
|
}
|
|
398
|
-
/**
|
|
399
|
-
* Retrieves the names of all cluster servers.
|
|
400
|
-
*
|
|
401
|
-
* @returns {string[]} An array of all cluster server names.
|
|
402
|
-
*/
|
|
403
227
|
getAllClusterServerNames() {
|
|
404
228
|
return Object.keys(this.behaviors.supported);
|
|
405
229
|
}
|
|
406
|
-
/**
|
|
407
|
-
* Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
|
|
408
|
-
*
|
|
409
|
-
* @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
|
|
410
|
-
*/
|
|
411
230
|
forEachAttribute(callback) {
|
|
412
231
|
if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
|
|
413
232
|
return;
|
|
@@ -415,34 +234,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
415
234
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
416
235
|
const clusterId = getClusterId(this, clusterName);
|
|
417
236
|
if (clusterId === undefined) {
|
|
418
|
-
// this.log.error(`forEachAttribute error: cluster ${clusterName} not found`);
|
|
419
237
|
continue;
|
|
420
238
|
}
|
|
421
239
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
422
240
|
if (attributeId === undefined) {
|
|
423
|
-
// this.log.error(`forEachAttribute error: attribute ${clusterName}.${attributeName} not found`);
|
|
424
241
|
continue;
|
|
425
242
|
}
|
|
426
243
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
427
244
|
}
|
|
428
245
|
}
|
|
429
246
|
}
|
|
430
|
-
/**
|
|
431
|
-
* Adds a child endpoint with the specified device types and options.
|
|
432
|
-
* If the child endpoint is not already present, it will be created and added.
|
|
433
|
-
* If the child endpoint is already present, the existing child endpoint will be returned.
|
|
434
|
-
*
|
|
435
|
-
* @param {string} endpointName - The name of the new endpoint to add.
|
|
436
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
437
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
|
|
438
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
439
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
440
|
-
*
|
|
441
|
-
* @example
|
|
442
|
-
* ```typescript
|
|
443
|
-
* const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
444
|
-
* ```
|
|
445
|
-
*/
|
|
446
247
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
447
248
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
448
249
|
let alreadyAdded = false;
|
|
@@ -482,23 +283,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
482
283
|
}
|
|
483
284
|
return child;
|
|
484
285
|
}
|
|
485
|
-
/**
|
|
486
|
-
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
487
|
-
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
488
|
-
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
489
|
-
*
|
|
490
|
-
* @param {string} endpointName - The name of the new enpoint to add.
|
|
491
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
492
|
-
* @param {ClusterId[]} [serverList=[]] - The list of cluster IDs to include.
|
|
493
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
494
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
495
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
496
|
-
*
|
|
497
|
-
* @example
|
|
498
|
-
* ```typescript
|
|
499
|
-
* const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
500
|
-
* ```
|
|
501
|
-
*/
|
|
502
286
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
503
287
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
504
288
|
let alreadyAdded = false;
|
|
@@ -561,38 +345,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
561
345
|
}
|
|
562
346
|
return child;
|
|
563
347
|
}
|
|
564
|
-
/**
|
|
565
|
-
* Retrieves a child endpoint by its name.
|
|
566
|
-
*
|
|
567
|
-
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
568
|
-
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
569
|
-
*/
|
|
570
348
|
getChildEndpointByName(endpointName) {
|
|
571
349
|
return this.parts.find((part) => part.id === endpointName);
|
|
572
350
|
}
|
|
573
|
-
/**
|
|
574
|
-
* Retrieves a child endpoint by its EndpointNumber.
|
|
575
|
-
*
|
|
576
|
-
* @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
|
|
577
|
-
* @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
|
|
578
|
-
*/
|
|
579
351
|
getChildEndpoint(endpointNumber) {
|
|
580
352
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
581
353
|
}
|
|
582
|
-
/**
|
|
583
|
-
* Get all the child endpoints of this endpoint.
|
|
584
|
-
*
|
|
585
|
-
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
586
|
-
*/
|
|
587
354
|
getChildEndpoints() {
|
|
588
355
|
return Array.from(this.parts);
|
|
589
356
|
}
|
|
590
|
-
/**
|
|
591
|
-
* Serializes the Matterbridge device into a serialized object.
|
|
592
|
-
*
|
|
593
|
-
* @param pluginName - The name of the plugin.
|
|
594
|
-
* @returns The serialized Matterbridge device object.
|
|
595
|
-
*/
|
|
596
357
|
static serialize(device) {
|
|
597
358
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId)
|
|
598
359
|
return;
|
|
@@ -615,15 +376,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
615
376
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
616
377
|
if (behaviorName === 'powerSource')
|
|
617
378
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
618
|
-
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
619
379
|
});
|
|
620
380
|
return serialized;
|
|
621
381
|
}
|
|
622
|
-
/**
|
|
623
|
-
* Deserializes the device into a serialized object.
|
|
624
|
-
*
|
|
625
|
-
* @returns The deserialized MatterbridgeDevice.
|
|
626
|
-
*/
|
|
627
382
|
static deserialize(serializedDevice) {
|
|
628
383
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
|
|
629
384
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -639,16 +394,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
639
394
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
640
395
|
else if (clusterId === PowerSource.Cluster.id)
|
|
641
396
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
642
|
-
// else addClusterServerFromList(device, [clusterId]);
|
|
643
397
|
}
|
|
644
398
|
return device;
|
|
645
399
|
}
|
|
646
|
-
/**
|
|
647
|
-
* Creates a default power source wired cluster server.
|
|
648
|
-
*
|
|
649
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
650
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
651
|
-
*/
|
|
652
400
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
653
401
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
|
|
654
402
|
wiredCurrentType,
|
|
@@ -659,16 +407,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
659
407
|
});
|
|
660
408
|
return this;
|
|
661
409
|
}
|
|
662
|
-
/**
|
|
663
|
-
* Creates a default power source replaceable battery cluster server.
|
|
664
|
-
*
|
|
665
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
666
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
667
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
668
|
-
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
669
|
-
* @param batQuantity - The battery quantity (default: 1).
|
|
670
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
671
|
-
*/
|
|
672
410
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
673
411
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
674
412
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -686,14 +424,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
686
424
|
});
|
|
687
425
|
return this;
|
|
688
426
|
}
|
|
689
|
-
/**
|
|
690
|
-
* Creates a default power source rechargeable battery cluster server.
|
|
691
|
-
*
|
|
692
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
693
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
694
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
695
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
696
|
-
*/
|
|
697
427
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
698
428
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
699
429
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -712,21 +442,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
712
442
|
});
|
|
713
443
|
return this;
|
|
714
444
|
}
|
|
715
|
-
/**
|
|
716
|
-
* Creates a default Basic Information Cluster Server for the server node.
|
|
717
|
-
*
|
|
718
|
-
* @param deviceName - The name of the device.
|
|
719
|
-
* @param serialNumber - The serial number of the device.
|
|
720
|
-
* @param vendorId - The vendor ID of the device.
|
|
721
|
-
* @param vendorName - The vendor name of the device.
|
|
722
|
-
* @param productId - The product ID of the device.
|
|
723
|
-
* @param productName - The product name of the device.
|
|
724
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
725
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
726
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
727
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
728
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
729
|
-
*/
|
|
730
445
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
731
446
|
this.log.logName = deviceName;
|
|
732
447
|
this.deviceName = deviceName;
|
|
@@ -750,20 +465,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
750
465
|
}
|
|
751
466
|
return this;
|
|
752
467
|
}
|
|
753
|
-
/**
|
|
754
|
-
* Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
|
|
755
|
-
*
|
|
756
|
-
* @param deviceName - The name of the device.
|
|
757
|
-
* @param serialNumber - The serial number of the device.
|
|
758
|
-
* @param vendorId - The vendor ID of the device.
|
|
759
|
-
* @param vendorName - The name of the vendor.
|
|
760
|
-
* @param productName - The name of the product.
|
|
761
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
762
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
763
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
764
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
765
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
766
|
-
*/
|
|
767
468
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
768
469
|
this.log.logName = deviceName;
|
|
769
470
|
this.deviceName = deviceName;
|
|
@@ -780,7 +481,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
780
481
|
this.behaviors.require(BridgedDeviceBasicInformationServer.enable({
|
|
781
482
|
events: { leave: true, reachableChanged: true },
|
|
782
483
|
}), {
|
|
783
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
484
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
784
485
|
vendorName: vendorName.slice(0, 32),
|
|
785
486
|
productName: productName.slice(0, 32),
|
|
786
487
|
productUrl: this.productUrl,
|
|
@@ -796,13 +497,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
796
497
|
});
|
|
797
498
|
return this;
|
|
798
499
|
}
|
|
799
|
-
/**
|
|
800
|
-
* Creates a default identify cluster server with the specified identify time and type.
|
|
801
|
-
*
|
|
802
|
-
* @param {number} [identifyTime=0] - The time to identify the server. Defaults to 0.
|
|
803
|
-
* @param {Identify.IdentifyType} [identifyType=Identify.IdentifyType.None] - The type of identification. Defaults to Identify.IdentifyType.None.
|
|
804
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
805
|
-
*/
|
|
806
500
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
807
501
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
808
502
|
identifyTime,
|
|
@@ -810,32 +504,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
810
504
|
});
|
|
811
505
|
return this;
|
|
812
506
|
}
|
|
813
|
-
/**
|
|
814
|
-
* Creates a default groups cluster server.
|
|
815
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
816
|
-
*/
|
|
817
507
|
createDefaultGroupsClusterServer() {
|
|
818
508
|
this.behaviors.require(GroupsServer);
|
|
819
509
|
return this;
|
|
820
510
|
}
|
|
821
|
-
/**
|
|
822
|
-
* Creates a default scenes management cluster server.
|
|
823
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
824
|
-
*/
|
|
825
511
|
createDefaultScenesClusterServer() {
|
|
826
512
|
this.behaviors.require(ScenesManagementServer);
|
|
827
513
|
return this;
|
|
828
514
|
}
|
|
829
|
-
/**
|
|
830
|
-
* Creates a default OnOff cluster server for light devices.
|
|
831
|
-
*
|
|
832
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
833
|
-
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
834
|
-
* @param {number} [onTime=0] - The on time value.
|
|
835
|
-
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
836
|
-
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
837
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
838
|
-
*/
|
|
839
515
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
840
516
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
841
517
|
onOff,
|
|
@@ -846,40 +522,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
846
522
|
});
|
|
847
523
|
return this;
|
|
848
524
|
}
|
|
849
|
-
/**
|
|
850
|
-
* Creates an OnOff cluster server without features.
|
|
851
|
-
*
|
|
852
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
853
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
854
|
-
*/
|
|
855
525
|
createOnOffClusterServer(onOff = false) {
|
|
856
526
|
this.behaviors.require(MatterbridgeOnOffServer, {
|
|
857
527
|
onOff,
|
|
858
528
|
});
|
|
859
529
|
return this;
|
|
860
530
|
}
|
|
861
|
-
/**
|
|
862
|
-
* Creates a DeadFront OnOff cluster server.
|
|
863
|
-
*
|
|
864
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
865
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
866
|
-
*/
|
|
867
531
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
868
532
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
869
533
|
onOff,
|
|
870
534
|
});
|
|
871
535
|
return this;
|
|
872
536
|
}
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
* @param {number | null} [onLevel=null] - The on level (default: null).
|
|
880
|
-
* @param {number | null} [startUpCurrentLevel=null] - The startUp on level (default: null).
|
|
881
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
882
|
-
*/
|
|
537
|
+
createOffOnlyOnOffClusterServer(onOff = false) {
|
|
538
|
+
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
|
|
539
|
+
onOff,
|
|
540
|
+
});
|
|
541
|
+
return this;
|
|
542
|
+
}
|
|
883
543
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
884
544
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
885
545
|
currentLevel,
|
|
@@ -895,13 +555,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
895
555
|
});
|
|
896
556
|
return this;
|
|
897
557
|
}
|
|
898
|
-
/**
|
|
899
|
-
* Creates a level control cluster server without features.
|
|
900
|
-
*
|
|
901
|
-
* @param {number} [currentLevel=254] - The current level (default: 254).
|
|
902
|
-
* @param {number | null} [onLevel=null] - The on level (default: null).
|
|
903
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
904
|
-
*/
|
|
905
558
|
createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
|
|
906
559
|
this.behaviors.require(MatterbridgeLevelControlServer, {
|
|
907
560
|
currentLevel,
|
|
@@ -913,18 +566,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
913
566
|
});
|
|
914
567
|
return this;
|
|
915
568
|
}
|
|
916
|
-
/**
|
|
917
|
-
* Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
918
|
-
*
|
|
919
|
-
* @param currentX - The current X value.
|
|
920
|
-
* @param currentY - The current Y value.
|
|
921
|
-
* @param currentHue - The current hue value.
|
|
922
|
-
* @param currentSaturation - The current saturation value.
|
|
923
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
924
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
925
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
926
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
927
|
-
*/
|
|
928
569
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
929
570
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
930
571
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -947,19 +588,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
947
588
|
});
|
|
948
589
|
return this;
|
|
949
590
|
}
|
|
950
|
-
/**
|
|
951
|
-
* Creates a Xy color control cluster server with Xy and ColorTemperature.
|
|
952
|
-
*
|
|
953
|
-
* @param currentX - The current X value.
|
|
954
|
-
* @param currentY - The current Y value.
|
|
955
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
956
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
957
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
958
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
959
|
-
*
|
|
960
|
-
* @remarks
|
|
961
|
-
* From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
|
|
962
|
-
*/
|
|
963
591
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
964
592
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
965
593
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -980,16 +608,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
980
608
|
});
|
|
981
609
|
return this;
|
|
982
610
|
}
|
|
983
|
-
/**
|
|
984
|
-
* Creates a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
|
|
985
|
-
*
|
|
986
|
-
* @param currentHue - The current hue value.
|
|
987
|
-
* @param currentSaturation - The current saturation value.
|
|
988
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
989
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
990
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
991
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
992
|
-
*/
|
|
993
611
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
994
612
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
995
613
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1010,14 +628,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1010
628
|
});
|
|
1011
629
|
return this;
|
|
1012
630
|
}
|
|
1013
|
-
/**
|
|
1014
|
-
* Creates a color temperature color control cluster server.
|
|
1015
|
-
*
|
|
1016
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1017
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1018
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1019
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1020
|
-
*/
|
|
1021
631
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1022
632
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
1023
633
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1036,23 +646,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1036
646
|
});
|
|
1037
647
|
return this;
|
|
1038
648
|
}
|
|
1039
|
-
/**
|
|
1040
|
-
* Configures the color control mode for the device.
|
|
1041
|
-
*
|
|
1042
|
-
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1043
|
-
*/
|
|
1044
649
|
async configureColorControlMode(colorMode) {
|
|
1045
650
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
1046
651
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
1047
652
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
1048
653
|
}
|
|
1049
654
|
}
|
|
1050
|
-
/**
|
|
1051
|
-
* Creates a default window covering cluster server (Lift and PositionAwareLift).
|
|
1052
|
-
*
|
|
1053
|
-
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1054
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1055
|
-
*/
|
|
1056
655
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1057
656
|
this.behaviors.require(MatterbridgeWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1058
657
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
@@ -1068,15 +667,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1068
667
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1069
668
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
1070
669
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1071
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1072
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
670
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
671
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1073
672
|
});
|
|
1074
673
|
return this;
|
|
1075
674
|
}
|
|
1076
|
-
/**
|
|
1077
|
-
* Sets the window covering target position as the current position and stops the movement.
|
|
1078
|
-
*
|
|
1079
|
-
*/
|
|
1080
675
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
1081
676
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
1082
677
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -1089,12 +684,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1089
684
|
}
|
|
1090
685
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1091
686
|
}
|
|
1092
|
-
/**
|
|
1093
|
-
* Sets the current and target status of a window covering.
|
|
1094
|
-
* @param {number} current - The current position of the window covering.
|
|
1095
|
-
* @param {number} target - The target position of the window covering.
|
|
1096
|
-
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1097
|
-
*/
|
|
1098
687
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
1099
688
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
1100
689
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -1105,10 +694,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1105
694
|
}, this.log);
|
|
1106
695
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1107
696
|
}
|
|
1108
|
-
/**
|
|
1109
|
-
* Sets the status of the window covering.
|
|
1110
|
-
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1111
|
-
*/
|
|
1112
697
|
async setWindowCoveringStatus(status) {
|
|
1113
698
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
1114
699
|
global: status,
|
|
@@ -1117,11 +702,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1117
702
|
}, this.log);
|
|
1118
703
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1119
704
|
}
|
|
1120
|
-
/**
|
|
1121
|
-
* Retrieves the status of the window covering.
|
|
1122
|
-
*
|
|
1123
|
-
* @returns The global operational status of the window covering or undefined.
|
|
1124
|
-
*/
|
|
1125
705
|
getWindowCoveringStatus() {
|
|
1126
706
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
1127
707
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -1129,66 +709,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1129
709
|
return status.global;
|
|
1130
710
|
}
|
|
1131
711
|
}
|
|
1132
|
-
/**
|
|
1133
|
-
* Sets the target and current position of the window covering.
|
|
1134
|
-
*
|
|
1135
|
-
* @param position - The position to set, specified as a number.
|
|
1136
|
-
*/
|
|
1137
712
|
async setWindowCoveringTargetAndCurrentPosition(position) {
|
|
1138
713
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', position, this.log);
|
|
1139
714
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', position, this.log);
|
|
1140
715
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
1141
716
|
}
|
|
1142
|
-
/**
|
|
1143
|
-
* Creates a default thermostat cluster server with Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode.
|
|
1144
|
-
*
|
|
1145
|
-
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1146
|
-
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1147
|
-
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1148
|
-
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
1149
|
-
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1150
|
-
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1151
|
-
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1152
|
-
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1153
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1154
|
-
*/
|
|
1155
717
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1156
718
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1157
719
|
localTemperature: localTemperature * 100,
|
|
1158
720
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1159
721
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1160
|
-
// Thermostat.Feature.Heating
|
|
1161
722
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1162
723
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1163
724
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1164
725
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1165
726
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1166
|
-
// Thermostat.Feature.Cooling
|
|
1167
727
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1168
728
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1169
729
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1170
730
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1171
731
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1172
|
-
// Thermostat.Feature.AutoMode
|
|
1173
732
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1174
733
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1175
734
|
});
|
|
1176
735
|
return this;
|
|
1177
736
|
}
|
|
1178
|
-
/**
|
|
1179
|
-
* Creates a default heating thermostat cluster server with Thermostat.Feature.Heating.
|
|
1180
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1181
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1182
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1183
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1184
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1185
|
-
*/
|
|
1186
737
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1187
738
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
|
|
1188
739
|
localTemperature: localTemperature * 100,
|
|
1189
740
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1190
741
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1191
|
-
// Thermostat.Feature.Heating
|
|
1192
742
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1193
743
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1194
744
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1197,20 +747,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1197
747
|
});
|
|
1198
748
|
return this;
|
|
1199
749
|
}
|
|
1200
|
-
/**
|
|
1201
|
-
* Creates a default cooling thermostat cluster server with Thermostat.Feature.Cooling.
|
|
1202
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1203
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1204
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1205
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1206
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1207
|
-
*/
|
|
1208
750
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1209
751
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
|
|
1210
752
|
localTemperature: localTemperature * 100,
|
|
1211
753
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1212
754
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1213
|
-
// Thermostat.Feature.Cooling
|
|
1214
755
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1215
756
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1216
757
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -1219,12 +760,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1219
760
|
});
|
|
1220
761
|
return this;
|
|
1221
762
|
}
|
|
1222
|
-
/**
|
|
1223
|
-
* Creates a default fan control cluster server.
|
|
1224
|
-
*
|
|
1225
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1226
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1227
|
-
*/
|
|
1228
763
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1229
764
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1230
765
|
fanMode,
|
|
@@ -1237,38 +772,42 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1237
772
|
});
|
|
1238
773
|
return this;
|
|
1239
774
|
}
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
775
|
+
createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
776
|
+
this.behaviors.require(FanControlServer, {
|
|
777
|
+
fanMode,
|
|
778
|
+
fanModeSequence: FanControl.FanModeSequence.OffLowMedHigh,
|
|
779
|
+
percentSetting: 0,
|
|
780
|
+
percentCurrent: 0,
|
|
781
|
+
});
|
|
782
|
+
return this;
|
|
783
|
+
}
|
|
784
|
+
createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
785
|
+
this.behaviors.require(HepaFilterMonitoringServer, {
|
|
786
|
+
changeIndication,
|
|
787
|
+
inPlaceIndicator,
|
|
788
|
+
lastChangedTime,
|
|
789
|
+
});
|
|
790
|
+
return this;
|
|
791
|
+
}
|
|
792
|
+
createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
793
|
+
this.behaviors.require(ActivatedCarbonFilterMonitoringServer, {
|
|
794
|
+
changeIndication,
|
|
795
|
+
inPlaceIndicator,
|
|
796
|
+
lastChangedTime,
|
|
797
|
+
});
|
|
798
|
+
return this;
|
|
799
|
+
}
|
|
1250
800
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1251
801
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
1252
|
-
operatingMode: DoorLock.OperatingMode.Normal,
|
|
1253
802
|
lockState,
|
|
1254
803
|
lockType,
|
|
1255
804
|
actuatorEnabled: false,
|
|
1256
|
-
|
|
805
|
+
operatingMode: DoorLock.OperatingMode.Normal,
|
|
806
|
+
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
|
|
807
|
+
alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
|
|
1257
808
|
});
|
|
1258
809
|
return this;
|
|
1259
810
|
}
|
|
1260
|
-
/**
|
|
1261
|
-
* Creates a default Mode Select cluster server.
|
|
1262
|
-
*
|
|
1263
|
-
* @param {string} description - The description of the mode select cluster.
|
|
1264
|
-
* @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
|
|
1265
|
-
* @param {number} [currentMode=0] - The current mode (default: 0).
|
|
1266
|
-
* @param {number} [startUpMode=0] - The startup mode (default: 0).
|
|
1267
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1268
|
-
*
|
|
1269
|
-
* @remarks
|
|
1270
|
-
* endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
|
|
1271
|
-
*/
|
|
1272
811
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1273
812
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
1274
813
|
description: description,
|
|
@@ -1279,13 +818,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1279
818
|
});
|
|
1280
819
|
return this;
|
|
1281
820
|
}
|
|
1282
|
-
/**
|
|
1283
|
-
* Creates the default Valve Configuration And Control cluster server.
|
|
1284
|
-
*
|
|
1285
|
-
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
1286
|
-
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
1287
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1288
|
-
*/
|
|
1289
821
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
1290
822
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
1291
823
|
currentState: valveState,
|
|
@@ -1295,15 +827,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1295
827
|
openDuration: null,
|
|
1296
828
|
defaultOpenDuration: null,
|
|
1297
829
|
remainingDuration: null,
|
|
830
|
+
defaultOpenLevel: 100,
|
|
831
|
+
valveFault: { generalFault: false, blocked: false, leaking: false, notConnected: false, shortCircuit: false, currentExceeded: false },
|
|
832
|
+
levelStep: 1,
|
|
1298
833
|
});
|
|
1299
834
|
return this;
|
|
1300
835
|
}
|
|
1301
|
-
/**
|
|
1302
|
-
* Creates the default PumpConfigurationAndControl cluster server.
|
|
1303
|
-
*
|
|
1304
|
-
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
1305
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1306
|
-
*/
|
|
1307
836
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1308
837
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
1309
838
|
minConstSpeed: null,
|
|
@@ -1318,13 +847,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1318
847
|
});
|
|
1319
848
|
return this;
|
|
1320
849
|
}
|
|
1321
|
-
/**
|
|
1322
|
-
* Creates the default SmokeCOAlarm Cluster Server.
|
|
1323
|
-
*
|
|
1324
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1325
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1326
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1327
|
-
*/
|
|
1328
850
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1329
851
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1330
852
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1337,17 +859,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1337
859
|
testInProgress: false,
|
|
1338
860
|
hardwareFaultAlert: false,
|
|
1339
861
|
endOfServiceAlert: SmokeCoAlarm.EndOfService.Normal,
|
|
1340
|
-
// interconnectSmokeAlarm: SmokeCoAlarm.AlarmState.Normal,
|
|
1341
|
-
// interconnectCoAlarm: SmokeCoAlarm.AlarmState.Normal,
|
|
1342
862
|
});
|
|
1343
863
|
return this;
|
|
1344
864
|
}
|
|
1345
|
-
/**
|
|
1346
|
-
* Creates a smoke only SmokeCOAlarm Cluster Server.
|
|
1347
|
-
*
|
|
1348
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1349
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1350
|
-
*/
|
|
1351
865
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1352
866
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
1353
867
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1362,12 +876,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1362
876
|
});
|
|
1363
877
|
return this;
|
|
1364
878
|
}
|
|
1365
|
-
/**
|
|
1366
|
-
* Creates a co only SmokeCOAlarm Cluster Server.
|
|
1367
|
-
*
|
|
1368
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1369
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1370
|
-
*/
|
|
1371
879
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1372
880
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1373
881
|
events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1382,13 +890,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1382
890
|
});
|
|
1383
891
|
return this;
|
|
1384
892
|
}
|
|
1385
|
-
/**
|
|
1386
|
-
* Creates a default momentary switch cluster server.
|
|
1387
|
-
*
|
|
1388
|
-
* @remarks
|
|
1389
|
-
* This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
|
|
1390
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1391
|
-
*/
|
|
1392
893
|
createDefaultSwitchClusterServer() {
|
|
1393
894
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
1394
895
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -1399,13 +900,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1399
900
|
});
|
|
1400
901
|
return this;
|
|
1401
902
|
}
|
|
1402
|
-
/**
|
|
1403
|
-
* Creates a default latching switch cluster server.
|
|
1404
|
-
*
|
|
1405
|
-
* @remarks
|
|
1406
|
-
* This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
|
|
1407
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1408
|
-
*/
|
|
1409
903
|
createDefaultLatchingSwitchClusterServer() {
|
|
1410
904
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
1411
905
|
events: { switchLatched: true },
|
|
@@ -1415,13 +909,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1415
909
|
});
|
|
1416
910
|
return this;
|
|
1417
911
|
}
|
|
1418
|
-
/**
|
|
1419
|
-
* Triggers a switch event on the specified endpoint.
|
|
1420
|
-
*
|
|
1421
|
-
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1422
|
-
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1423
|
-
* @returns {boolean} - A boolean indicating whether the event was successfully triggered.
|
|
1424
|
-
*/
|
|
1425
912
|
async triggerSwitchEvent(event, log) {
|
|
1426
913
|
if (this.maybeNumber === undefined) {
|
|
1427
914
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1481,31 +968,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1481
968
|
}
|
|
1482
969
|
return true;
|
|
1483
970
|
}
|
|
1484
|
-
/**
|
|
1485
|
-
* Creates a default boolean state cluster server.
|
|
1486
|
-
*
|
|
1487
|
-
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
|
|
1488
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1489
|
-
*/
|
|
1490
971
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1491
972
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1492
973
|
events: { stateChange: true },
|
|
1493
974
|
}), {
|
|
1494
|
-
stateValue: contact ?? true,
|
|
975
|
+
stateValue: contact ?? true,
|
|
1495
976
|
});
|
|
1496
977
|
return this;
|
|
1497
978
|
}
|
|
1498
|
-
/**
|
|
1499
|
-
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
|
|
1500
|
-
*
|
|
1501
|
-
* @remarks Supports the enableDisableAlarm command.
|
|
1502
|
-
*
|
|
1503
|
-
* @param {boolean} [sensorFault=false] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1504
|
-
* @param {number} [currentSensitivityLevel=0] - The current sensitivity level. Defaults to `0` if not provided.
|
|
1505
|
-
* @param {number} [supportedSensitivityLevels=2] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
|
|
1506
|
-
* @param {number} [defaultSensitivityLevel=0] - The default sensitivity level. Defaults to `0` if not provided.
|
|
1507
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1508
|
-
*/
|
|
1509
979
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1510
980
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1511
981
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -1520,21 +990,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1520
990
|
});
|
|
1521
991
|
return this;
|
|
1522
992
|
}
|
|
1523
|
-
/**
|
|
1524
|
-
* Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
|
|
1525
|
-
*
|
|
1526
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1527
|
-
*/
|
|
1528
993
|
createDefaultPowerTopologyClusterServer() {
|
|
1529
994
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1530
995
|
return this;
|
|
1531
996
|
}
|
|
1532
|
-
/**
|
|
1533
|
-
* Creates a default Electrical Energy Measurement Cluster Server.
|
|
1534
|
-
*
|
|
1535
|
-
* @param {number} energy - The total consumption value in mW/h.
|
|
1536
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1537
|
-
*/
|
|
1538
997
|
createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
1539
998
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1540
999
|
accuracy: {
|
|
@@ -1550,15 +1009,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1550
1009
|
});
|
|
1551
1010
|
return this;
|
|
1552
1011
|
}
|
|
1553
|
-
/**
|
|
1554
|
-
* Creates a default Electrical Power Measurement Cluster Server.
|
|
1555
|
-
*
|
|
1556
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
1557
|
-
* @param {number} current - The current value in milliamperes.
|
|
1558
|
-
* @param {number} power - The power value in milliwatts.
|
|
1559
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
1560
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1561
|
-
*/
|
|
1562
1012
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1563
1013
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1564
1014
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1600,92 +1050,37 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1600
1050
|
});
|
|
1601
1051
|
return this;
|
|
1602
1052
|
}
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
this.behaviors.require(
|
|
1621
|
-
return this;
|
|
1622
|
-
}
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1628
|
-
*/
|
|
1629
|
-
createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1630
|
-
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue));
|
|
1631
|
-
return this;
|
|
1632
|
-
}
|
|
1633
|
-
/**
|
|
1634
|
-
* Creates a default IlluminanceMeasurement cluster server.
|
|
1635
|
-
*
|
|
1636
|
-
* @param {number} measuredValue - The measured value of illuminance.
|
|
1637
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1638
|
-
*
|
|
1639
|
-
* @remarks
|
|
1640
|
-
* Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
|
|
1641
|
-
* Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
|
|
1642
|
-
*/
|
|
1643
|
-
createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1644
|
-
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue));
|
|
1645
|
-
return this;
|
|
1646
|
-
}
|
|
1647
|
-
/**
|
|
1648
|
-
* Creates a default FlowMeasurement cluster server.
|
|
1649
|
-
*
|
|
1650
|
-
* @param {number} measuredValue - The measured value of the flow in 10 x m/h.
|
|
1651
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1652
|
-
*/
|
|
1653
|
-
createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1654
|
-
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue));
|
|
1655
|
-
return this;
|
|
1656
|
-
}
|
|
1657
|
-
/**
|
|
1658
|
-
* Creates a default OccupancySensing cluster server.
|
|
1659
|
-
*
|
|
1660
|
-
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1661
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1662
|
-
*/
|
|
1663
|
-
createDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1664
|
-
this.behaviors.require(OccupancySensingServer, getDefaultOccupancySensingClusterServer(occupied));
|
|
1665
|
-
return this;
|
|
1666
|
-
}
|
|
1667
|
-
/**
|
|
1668
|
-
* Creates a default AirQuality cluster server.
|
|
1669
|
-
*
|
|
1670
|
-
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
1671
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1672
|
-
*/
|
|
1053
|
+
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1054
|
+
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1055
|
+
return this;
|
|
1056
|
+
}
|
|
1057
|
+
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1058
|
+
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1059
|
+
return this;
|
|
1060
|
+
}
|
|
1061
|
+
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1062
|
+
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1063
|
+
return this;
|
|
1064
|
+
}
|
|
1065
|
+
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1066
|
+
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1067
|
+
return this;
|
|
1068
|
+
}
|
|
1069
|
+
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1070
|
+
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1071
|
+
return this;
|
|
1072
|
+
}
|
|
1073
|
+
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
1074
|
+
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
1075
|
+
return this;
|
|
1076
|
+
}
|
|
1673
1077
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1674
1078
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1675
1079
|
airQuality,
|
|
1676
1080
|
});
|
|
1677
1081
|
return this;
|
|
1678
1082
|
}
|
|
1679
|
-
|
|
1680
|
-
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server.
|
|
1681
|
-
*
|
|
1682
|
-
* @param {number} measuredValue - The measured value of the concentration (default to 0).
|
|
1683
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1684
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1685
|
-
* @param {number} [uncertainty] - The uncertainty value (optional).
|
|
1686
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1687
|
-
*/
|
|
1688
|
-
createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
1083
|
+
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
1689
1084
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1690
1085
|
measuredValue,
|
|
1691
1086
|
minMeasuredValue: null,
|
|
@@ -1696,11 +1091,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1696
1091
|
});
|
|
1697
1092
|
return this;
|
|
1698
1093
|
}
|
|
1699
|
-
/**
|
|
1700
|
-
* @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
|
|
1701
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1702
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1703
|
-
*/
|
|
1704
1094
|
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1705
1095
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
1706
1096
|
levelValue,
|
|
@@ -1708,14 +1098,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1708
1098
|
});
|
|
1709
1099
|
return this;
|
|
1710
1100
|
}
|
|
1711
|
-
|
|
1712
|
-
* Create a default CarbonMonoxideConcentrationMeasurement cluster server.
|
|
1713
|
-
*
|
|
1714
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1715
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1716
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1717
|
-
*/
|
|
1718
|
-
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1101
|
+
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1719
1102
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1720
1103
|
measuredValue,
|
|
1721
1104
|
minMeasuredValue: null,
|
|
@@ -1726,14 +1109,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1726
1109
|
});
|
|
1727
1110
|
return this;
|
|
1728
1111
|
}
|
|
1729
|
-
|
|
1730
|
-
* Create a default CarbonDioxideConcentrationMeasurement cluster server.
|
|
1731
|
-
*
|
|
1732
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1733
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1734
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1735
|
-
*/
|
|
1736
|
-
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1112
|
+
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1737
1113
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1738
1114
|
measuredValue,
|
|
1739
1115
|
minMeasuredValue: null,
|
|
@@ -1744,14 +1120,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1744
1120
|
});
|
|
1745
1121
|
return this;
|
|
1746
1122
|
}
|
|
1747
|
-
|
|
1748
|
-
* Create a default FormaldehydeConcentrationMeasurement cluster server.
|
|
1749
|
-
*
|
|
1750
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1751
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1752
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1753
|
-
*/
|
|
1754
|
-
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1123
|
+
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1755
1124
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1756
1125
|
measuredValue,
|
|
1757
1126
|
minMeasuredValue: null,
|
|
@@ -1762,14 +1131,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1762
1131
|
});
|
|
1763
1132
|
return this;
|
|
1764
1133
|
}
|
|
1765
|
-
|
|
1766
|
-
* Create a default Pm1ConcentrationMeasurement cluster server.
|
|
1767
|
-
*
|
|
1768
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1769
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1770
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1771
|
-
*/
|
|
1772
|
-
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1134
|
+
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1773
1135
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1774
1136
|
measuredValue,
|
|
1775
1137
|
minMeasuredValue: null,
|
|
@@ -1780,14 +1142,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1780
1142
|
});
|
|
1781
1143
|
return this;
|
|
1782
1144
|
}
|
|
1783
|
-
|
|
1784
|
-
* Create a default Pm25ConcentrationMeasurement cluster server.
|
|
1785
|
-
*
|
|
1786
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1787
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1788
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1789
|
-
*/
|
|
1790
|
-
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1145
|
+
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1791
1146
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1792
1147
|
measuredValue,
|
|
1793
1148
|
minMeasuredValue: null,
|
|
@@ -1798,14 +1153,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1798
1153
|
});
|
|
1799
1154
|
return this;
|
|
1800
1155
|
}
|
|
1801
|
-
|
|
1802
|
-
* Create a default Pm10ConcentrationMeasurement cluster server.
|
|
1803
|
-
*
|
|
1804
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1805
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1806
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1807
|
-
*/
|
|
1808
|
-
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1156
|
+
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1809
1157
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1810
1158
|
measuredValue,
|
|
1811
1159
|
minMeasuredValue: null,
|
|
@@ -1816,14 +1164,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1816
1164
|
});
|
|
1817
1165
|
return this;
|
|
1818
1166
|
}
|
|
1819
|
-
|
|
1820
|
-
* Create a default OzoneConcentrationMeasurement cluster server.
|
|
1821
|
-
*
|
|
1822
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1823
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
1824
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1825
|
-
*/
|
|
1826
|
-
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1167
|
+
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1827
1168
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1828
1169
|
measuredValue,
|
|
1829
1170
|
minMeasuredValue: null,
|
|
@@ -1834,14 +1175,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1834
1175
|
});
|
|
1835
1176
|
return this;
|
|
1836
1177
|
}
|
|
1837
|
-
|
|
1838
|
-
* Create a default RadonConcentrationMeasurement cluster server.
|
|
1839
|
-
*
|
|
1840
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1841
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1842
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1843
|
-
*/
|
|
1844
|
-
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1178
|
+
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1845
1179
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1846
1180
|
measuredValue,
|
|
1847
1181
|
minMeasuredValue: null,
|
|
@@ -1852,14 +1186,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1852
1186
|
});
|
|
1853
1187
|
return this;
|
|
1854
1188
|
}
|
|
1855
|
-
|
|
1856
|
-
* Create a default NitrogenDioxideConcentrationMeasurement cluster server.
|
|
1857
|
-
*
|
|
1858
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1859
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
1860
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1861
|
-
*/
|
|
1862
|
-
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1189
|
+
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1863
1190
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1864
1191
|
measuredValue,
|
|
1865
1192
|
minMeasuredValue: null,
|
|
@@ -1871,4 +1198,3 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1871
1198
|
return this;
|
|
1872
1199
|
}
|
|
1873
1200
|
}
|
|
1874
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|