matterbridge 3.0.4-dev-20250525-b1cbfb7 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -2
- package/dist/cli.d.ts +29 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +37 -2
- package/dist/cli.js.map +1 -0
- package/dist/cluster/export.d.ts +2 -0
- package/dist/cluster/export.d.ts.map +1 -0
- package/dist/cluster/export.js +2 -0
- package/dist/cluster/export.js.map +1 -0
- package/dist/defaultConfigSchema.d.ts +27 -0
- package/dist/defaultConfigSchema.d.ts.map +1 -0
- package/dist/defaultConfigSchema.js +23 -0
- package/dist/defaultConfigSchema.js.map +1 -0
- package/dist/deviceManager.d.ts +114 -0
- package/dist/deviceManager.d.ts.map +1 -0
- package/dist/deviceManager.js +94 -1
- package/dist/deviceManager.js.map +1 -0
- package/dist/frontend.d.ts +256 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/frontend.js +363 -16
- package/dist/frontend.js.map +1 -0
- package/dist/helpers.d.ts +47 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +51 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -1
- package/dist/index.js.map +1 -0
- package/dist/logger/export.d.ts +2 -0
- package/dist/logger/export.d.ts.map +1 -0
- package/dist/logger/export.js +1 -0
- package/dist/logger/export.js.map +1 -0
- package/dist/matter/behaviors.d.ts +2 -0
- package/dist/matter/behaviors.d.ts.map +1 -0
- package/dist/matter/behaviors.js +2 -0
- package/dist/matter/behaviors.js.map +1 -0
- package/dist/matter/clusters.d.ts +2 -0
- package/dist/matter/clusters.d.ts.map +1 -0
- package/dist/matter/clusters.js +2 -0
- package/dist/matter/clusters.js.map +1 -0
- package/dist/matter/devices.d.ts +2 -0
- package/dist/matter/devices.d.ts.map +1 -0
- package/dist/matter/devices.js +2 -0
- package/dist/matter/devices.js.map +1 -0
- package/dist/matter/endpoints.d.ts +2 -0
- package/dist/matter/endpoints.d.ts.map +1 -0
- package/dist/matter/endpoints.js +2 -0
- package/dist/matter/endpoints.js.map +1 -0
- package/dist/matter/export.d.ts +5 -0
- package/dist/matter/export.d.ts.map +1 -0
- package/dist/matter/export.js +2 -0
- package/dist/matter/export.js.map +1 -0
- package/dist/matter/types.d.ts +3 -0
- package/dist/matter/types.d.ts.map +1 -0
- package/dist/matter/types.js +2 -0
- package/dist/matter/types.js.map +1 -0
- package/dist/matterbridge.d.ts +445 -0
- package/dist/matterbridge.d.ts.map +1 -0
- package/dist/matterbridge.js +747 -47
- package/dist/matterbridge.js.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts +40 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.js +34 -0
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
- package/dist/matterbridgeBehaviors.d.ts +1398 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +61 -4
- package/dist/matterbridgeBehaviors.js.map +1 -0
- package/dist/matterbridgeDeviceTypes.d.ts +629 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +563 -15
- package/dist/matterbridgeDeviceTypes.js.map +1 -0
- package/dist/matterbridgeDynamicPlatform.d.ts +40 -0
- package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
- package/dist/matterbridgeDynamicPlatform.js +34 -0
- package/dist/matterbridgeDynamicPlatform.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +1053 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +903 -23
- package/dist/matterbridgeEndpoint.js.map +1 -0
- package/dist/matterbridgeEndpointHelpers.d.ts +2749 -0
- package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
- package/dist/matterbridgeEndpointHelpers.js +172 -10
- package/dist/matterbridgeEndpointHelpers.js.map +1 -0
- package/dist/matterbridgePlatform.d.ts +294 -0
- package/dist/matterbridgePlatform.d.ts.map +1 -0
- package/dist/matterbridgePlatform.js +225 -7
- package/dist/matterbridgePlatform.js.map +1 -0
- package/dist/matterbridgeTypes.d.ts +196 -0
- package/dist/matterbridgeTypes.d.ts.map +1 -0
- package/dist/matterbridgeTypes.js +24 -0
- package/dist/matterbridgeTypes.js.map +1 -0
- package/dist/pluginManager.d.ts +273 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +264 -3
- package/dist/pluginManager.js.map +1 -0
- package/dist/roboticVacuumCleaner.d.ts +82 -0
- package/dist/roboticVacuumCleaner.d.ts.map +1 -0
- package/dist/roboticVacuumCleaner.js +78 -3
- package/dist/roboticVacuumCleaner.js.map +1 -0
- package/dist/shelly.d.ts +153 -0
- package/dist/shelly.d.ts.map +1 -0
- package/dist/shelly.js +155 -7
- package/dist/shelly.js.map +1 -0
- package/dist/storage/export.d.ts +2 -0
- package/dist/storage/export.d.ts.map +1 -0
- package/dist/storage/export.js +1 -0
- package/dist/storage/export.js.map +1 -0
- package/dist/update.d.ts +58 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +53 -0
- package/dist/update.js.map +1 -0
- package/dist/utils/colorUtils.d.ts +61 -0
- package/dist/utils/colorUtils.d.ts.map +1 -0
- package/dist/utils/colorUtils.js +205 -2
- package/dist/utils/colorUtils.js.map +1 -0
- package/dist/utils/commandLine.d.ts +58 -0
- package/dist/utils/commandLine.d.ts.map +1 -0
- package/dist/utils/commandLine.js +53 -0
- package/dist/utils/commandLine.js.map +1 -0
- package/dist/utils/copyDirectory.d.ts +32 -0
- package/dist/utils/copyDirectory.d.ts.map +1 -0
- package/dist/utils/copyDirectory.js +37 -1
- package/dist/utils/copyDirectory.js.map +1 -0
- package/dist/utils/createZip.d.ts +38 -0
- package/dist/utils/createZip.d.ts.map +1 -0
- package/dist/utils/createZip.js +42 -2
- package/dist/utils/createZip.js.map +1 -0
- package/dist/utils/deepCopy.d.ts +31 -0
- package/dist/utils/deepCopy.d.ts.map +1 -0
- package/dist/utils/deepCopy.js +38 -0
- package/dist/utils/deepCopy.js.map +1 -0
- package/dist/utils/deepEqual.d.ts +53 -0
- package/dist/utils/deepEqual.d.ts.map +1 -0
- package/dist/utils/deepEqual.js +71 -1
- package/dist/utils/deepEqual.js.map +1 -0
- package/dist/utils/export.d.ts +11 -0
- package/dist/utils/export.d.ts.map +1 -0
- package/dist/utils/export.js +1 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/hex.d.ts +48 -0
- package/dist/utils/hex.d.ts.map +1 -0
- package/dist/utils/hex.js +57 -0
- package/dist/utils/hex.js.map +1 -0
- package/dist/utils/isvalid.d.ts +102 -0
- package/dist/utils/isvalid.d.ts.map +1 -0
- package/dist/utils/isvalid.js +100 -0
- package/dist/utils/isvalid.js.map +1 -0
- package/dist/utils/network.d.ts +69 -0
- package/dist/utils/network.d.ts.map +1 -0
- package/dist/utils/network.js +76 -5
- package/dist/utils/network.js.map +1 -0
- package/dist/utils/wait.d.ts +52 -0
- package/dist/utils/wait.d.ts.map +1 -0
- package/dist/utils/wait.js +58 -9
- package/dist/utils/wait.js.map +1 -0
- package/dist/waterHeater.d.ts +75 -0
- package/dist/waterHeater.d.ts.map +1 -0
- package/dist/waterHeater.js +52 -0
- package/dist/waterHeater.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
|
@@ -1,10 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
|
|
3
|
+
*
|
|
4
|
+
* @file matterbridgeEndpoint.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @date 2024-10-01
|
|
7
|
+
* @version 2.0.0
|
|
8
|
+
*
|
|
9
|
+
* Copyright 2024, 2025, 2026 Luca Liguori.
|
|
10
|
+
*
|
|
11
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
+
* you may not use this file except in compliance with the License.
|
|
13
|
+
* You may obtain a copy of the License at
|
|
14
|
+
*
|
|
15
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
+
* See the License for the specific language governing permissions and
|
|
21
|
+
* limitations under the License. *
|
|
22
|
+
*/
|
|
23
|
+
// AnsiLogger module
|
|
1
24
|
import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
|
|
25
|
+
// Matterbridge
|
|
2
26
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
3
27
|
import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
|
|
4
28
|
import { MatterbridgeServer, MatterbridgeServerDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, } from './matterbridgeBehaviors.js';
|
|
5
29
|
import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultOperationalStateClusterServer, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, invokeBehaviorCommand, triggerEvent, } from './matterbridgeEndpointHelpers.js';
|
|
30
|
+
// @matter
|
|
6
31
|
import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, UINT16_MAX, UINT32_MAX, VendorId } from '@matter/main';
|
|
7
32
|
import { getClusterNameById, MeasurementType } from '@matter/main/types';
|
|
33
|
+
// @matter clusters
|
|
8
34
|
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
9
35
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
10
36
|
import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
|
|
@@ -29,6 +55,7 @@ import { ConcentrationMeasurement } from '@matter/main/clusters/concentration-me
|
|
|
29
55
|
import { OccupancySensing } from '@matter/main/clusters/occupancy-sensing';
|
|
30
56
|
import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/thermostat-user-interface-configuration';
|
|
31
57
|
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
58
|
+
// @matter behaviors
|
|
32
59
|
import { DescriptorServer } from '@matter/main/behaviors/descriptor';
|
|
33
60
|
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
34
61
|
import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
|
|
@@ -64,7 +91,7 @@ import { ActivatedCarbonFilterMonitoringServer } from '@matter/main/behaviors/ac
|
|
|
64
91
|
import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behaviors/thermostat-user-interface-configuration';
|
|
65
92
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
66
93
|
static bridgeMode = '';
|
|
67
|
-
static logLevel = "info"
|
|
94
|
+
static logLevel = "info" /* LogLevel.INFO */;
|
|
68
95
|
log;
|
|
69
96
|
plugin = undefined;
|
|
70
97
|
configUrl = undefined;
|
|
@@ -80,14 +107,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
80
107
|
hardwareVersion = undefined;
|
|
81
108
|
hardwareVersionString = undefined;
|
|
82
109
|
productUrl = 'https://www.npmjs.com/package/matterbridge';
|
|
110
|
+
// The first device type of the endpoint
|
|
83
111
|
name = undefined;
|
|
84
112
|
deviceType;
|
|
85
113
|
uniqueStorageKey = undefined;
|
|
86
114
|
tagList = undefined;
|
|
115
|
+
// Maps matter deviceTypes
|
|
87
116
|
deviceTypes = new Map();
|
|
117
|
+
// Command handler
|
|
88
118
|
commandHandler = new NamedHandler();
|
|
119
|
+
/**
|
|
120
|
+
* Represents a MatterbridgeEndpoint.
|
|
121
|
+
* @constructor
|
|
122
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
|
|
123
|
+
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
124
|
+
* @param {boolean} [debug=false] - Debug flag.
|
|
125
|
+
*/
|
|
89
126
|
constructor(definition, options = {}, debug = false) {
|
|
90
127
|
let deviceTypeList = [];
|
|
128
|
+
// Get the first DeviceTypeDefinition
|
|
91
129
|
let firstDefinition;
|
|
92
130
|
if (Array.isArray(definition)) {
|
|
93
131
|
firstDefinition = definition[0];
|
|
@@ -100,6 +138,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
100
138
|
firstDefinition = definition;
|
|
101
139
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
102
140
|
}
|
|
141
|
+
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
103
142
|
const deviceTypeDefinitionV8 = {
|
|
104
143
|
name: firstDefinition.name.replace('-', '_'),
|
|
105
144
|
deviceType: firstDefinition.code,
|
|
@@ -118,9 +157,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
118
157
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
119
158
|
};
|
|
120
159
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
160
|
+
// Check if the uniqueStorageKey is valid
|
|
121
161
|
if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
|
|
122
162
|
options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
|
|
123
163
|
}
|
|
164
|
+
// Convert the options to an Endpoint.Options
|
|
124
165
|
const optionsV8 = {
|
|
125
166
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
126
167
|
number: options.endpointId,
|
|
@@ -138,17 +179,41 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
138
179
|
}
|
|
139
180
|
else
|
|
140
181
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
141
|
-
|
|
182
|
+
// console.log('MatterbridgeEndpoint.option', options);
|
|
183
|
+
// console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
|
|
184
|
+
// console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
|
|
185
|
+
// Create the logger
|
|
186
|
+
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
|
|
142
187
|
this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
|
|
143
188
|
`id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
|
|
189
|
+
// Add MatterbridgeBehavior with MatterbridgeBehaviorDevice
|
|
144
190
|
this.behaviors.require(MatterbridgeServer, { deviceCommand: new MatterbridgeServerDevice(this.log, this.commandHandler, undefined) });
|
|
145
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Loads an instance of the MatterbridgeEndpoint class.
|
|
194
|
+
*
|
|
195
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
|
|
196
|
+
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
197
|
+
* @param {boolean} [debug=false] - Debug flag.
|
|
198
|
+
* @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
|
|
199
|
+
*/
|
|
146
200
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
147
201
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
148
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Get all the device types of this endpoint.
|
|
205
|
+
*
|
|
206
|
+
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
|
|
207
|
+
*/
|
|
149
208
|
getDeviceTypes() {
|
|
150
209
|
return Array.from(this.deviceTypes.values());
|
|
151
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Checks if the provided cluster server is supported by this endpoint.
|
|
213
|
+
*
|
|
214
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
215
|
+
* @returns {boolean} True if the cluster server is supported, false otherwise.
|
|
216
|
+
*/
|
|
152
217
|
hasClusterServer(cluster) {
|
|
153
218
|
const behavior = getBehavior(this, cluster);
|
|
154
219
|
if (behavior)
|
|
@@ -156,6 +221,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
156
221
|
else
|
|
157
222
|
return false;
|
|
158
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Checks if the provided attribute server is supported for a given cluster of this endpoint.
|
|
226
|
+
*
|
|
227
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
228
|
+
* @param {string} attribute - The attribute name to check.
|
|
229
|
+
* @returns {boolean} True if the attribute server is supported, false otherwise.
|
|
230
|
+
*/
|
|
159
231
|
hasAttributeServer(cluster, attribute) {
|
|
160
232
|
const behavior = getBehavior(this, cluster);
|
|
161
233
|
if (!behavior || !this.behaviors.supported[behavior.id])
|
|
@@ -164,82 +236,228 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
164
236
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
165
237
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
166
238
|
}
|
|
239
|
+
/**
|
|
240
|
+
* Retrieves the initial options for the provided cluster server.
|
|
241
|
+
*
|
|
242
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
|
|
243
|
+
* @returns {Record<string, boolean | number | bigint | string | object | null> | undefined} The options for the provided cluster server, or undefined if the cluster is not supported.
|
|
244
|
+
*/
|
|
167
245
|
getClusterServerOptions(cluster) {
|
|
168
246
|
const behavior = getBehavior(this, cluster);
|
|
169
247
|
if (!behavior)
|
|
170
248
|
return undefined;
|
|
171
249
|
return this.behaviors.optionsFor(behavior);
|
|
172
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Retrieves the value of the provided attribute from the given cluster.
|
|
253
|
+
*
|
|
254
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
255
|
+
* @param {string} attribute - The name of the attribute to retrieve.
|
|
256
|
+
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
257
|
+
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
258
|
+
*/
|
|
259
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
173
260
|
getAttribute(cluster, attribute, log) {
|
|
174
261
|
return getAttribute(this, cluster, attribute, log);
|
|
175
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* Sets the value of an attribute on a cluster server.
|
|
265
|
+
*
|
|
266
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
|
|
267
|
+
* @param {string} attribute - The name of the attribute.
|
|
268
|
+
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
269
|
+
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
270
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
271
|
+
*/
|
|
176
272
|
async setAttribute(clusterId, attribute, value, log) {
|
|
177
273
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
178
274
|
}
|
|
275
|
+
/**
|
|
276
|
+
* Update the value of an attribute on a cluster server only if the value is different.
|
|
277
|
+
*
|
|
278
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
279
|
+
* @param {string} attribute - The name of the attribute.
|
|
280
|
+
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
281
|
+
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
|
|
282
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
283
|
+
*/
|
|
179
284
|
async updateAttribute(cluster, attribute, value, log) {
|
|
180
285
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
181
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Subscribes to the provided attribute on a cluster.
|
|
289
|
+
*
|
|
290
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
|
|
291
|
+
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
292
|
+
* @param {(newValue: any, oldValue: any, context: ActionContext) => void} listener - A callback function that will be called when the attribute value changes. When context.offline === true then the change is locally generated and not from the controller.
|
|
293
|
+
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
294
|
+
* @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
|
|
295
|
+
*
|
|
296
|
+
* @remarks The listener function (cannot be async) will receive three parameters:
|
|
297
|
+
* - `newValue`: The new value of the attribute.
|
|
298
|
+
* - `oldValue`: The old value of the attribute.
|
|
299
|
+
* - `context`: The action context, which includes information about the action that triggered the change. When context.offline === true then the change is locally generated and not from the controller.
|
|
300
|
+
*/
|
|
301
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
182
302
|
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
183
303
|
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
184
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* Triggers an event on the specified cluster.
|
|
307
|
+
* @param {ClusterId} cluster - The ID of the cluster.
|
|
308
|
+
* @param {string} event - The name of the event to trigger.
|
|
309
|
+
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
310
|
+
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
311
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
312
|
+
*/
|
|
185
313
|
async triggerEvent(cluster, event, payload, log) {
|
|
186
314
|
return await triggerEvent(this, cluster, event, payload, log);
|
|
187
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Adds cluster servers from the provided server list.
|
|
318
|
+
*
|
|
319
|
+
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
320
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
321
|
+
*/
|
|
188
322
|
addClusterServers(serverList) {
|
|
189
323
|
addClusterServers(this, serverList);
|
|
190
324
|
return this;
|
|
191
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
|
|
328
|
+
*
|
|
329
|
+
* @param {string} label - The label to add.
|
|
330
|
+
* @param {string} value - The value of the label.
|
|
331
|
+
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
332
|
+
*/
|
|
192
333
|
async addFixedLabel(label, value) {
|
|
193
334
|
await addFixedLabel(this, label, value);
|
|
194
335
|
return this;
|
|
195
336
|
}
|
|
337
|
+
/**
|
|
338
|
+
* Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
|
|
339
|
+
*
|
|
340
|
+
* @param {string} label - The label to add.
|
|
341
|
+
* @param {string} value - The value of the label.
|
|
342
|
+
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
343
|
+
*/
|
|
196
344
|
async addUserLabel(label, value) {
|
|
197
345
|
await addUserLabel(this, label, value);
|
|
198
346
|
return this;
|
|
199
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* Adds a command handler for the specified command.
|
|
350
|
+
*
|
|
351
|
+
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
352
|
+
* @param {HandlerFunction} handler - The handler function to execute when the command is received.
|
|
353
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
354
|
+
*/
|
|
200
355
|
addCommandHandler(command, handler) {
|
|
201
356
|
this.commandHandler.addHandler(command, handler);
|
|
202
357
|
return this;
|
|
203
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* Execute the command handler for the specified command. Used ONLY in Jest tests.
|
|
361
|
+
*
|
|
362
|
+
* @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
|
|
363
|
+
* @param {Record<string, boolean | number | bigint | string | object | null>} [request] - The optional request to pass to the handler function.
|
|
364
|
+
*
|
|
365
|
+
* @deprecated Used ONLY in Jest tests.
|
|
366
|
+
*/
|
|
204
367
|
async executeCommandHandler(command, request) {
|
|
205
368
|
await this.commandHandler.executeHandler(command, { request });
|
|
206
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Invokes a behavior command on the specified cluster. Used ONLY in Jest tests.
|
|
372
|
+
*
|
|
373
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
|
|
374
|
+
* @param {string} command - The command to invoke.
|
|
375
|
+
* @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The optional parameters to pass to the command.
|
|
376
|
+
*
|
|
377
|
+
* @deprecated Used ONLY in Jest tests.
|
|
378
|
+
*/
|
|
207
379
|
async invokeBehaviorCommand(cluster, command, params) {
|
|
208
380
|
await invokeBehaviorCommand(this, cluster, command, params);
|
|
209
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
384
|
+
*
|
|
385
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
386
|
+
*/
|
|
210
387
|
addRequiredClusterServers() {
|
|
211
388
|
addRequiredClusterServers(this);
|
|
212
389
|
return this;
|
|
213
390
|
}
|
|
391
|
+
/**
|
|
392
|
+
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
393
|
+
*
|
|
394
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
395
|
+
*/
|
|
214
396
|
addOptionalClusterServers() {
|
|
215
397
|
addOptionalClusterServers(this);
|
|
216
398
|
return this;
|
|
217
399
|
}
|
|
400
|
+
/**
|
|
401
|
+
* Retrieves all cluster servers.
|
|
402
|
+
*
|
|
403
|
+
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
404
|
+
*/
|
|
218
405
|
getAllClusterServers() {
|
|
219
406
|
return Object.values(this.behaviors.supported);
|
|
220
407
|
}
|
|
408
|
+
/**
|
|
409
|
+
* Retrieves the names of all cluster servers.
|
|
410
|
+
*
|
|
411
|
+
* @returns {string[]} An array of all cluster server names.
|
|
412
|
+
*/
|
|
221
413
|
getAllClusterServerNames() {
|
|
222
414
|
return Object.keys(this.behaviors.supported);
|
|
223
415
|
}
|
|
416
|
+
/**
|
|
417
|
+
* Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
|
|
418
|
+
*
|
|
419
|
+
* @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
|
|
420
|
+
*/
|
|
224
421
|
forEachAttribute(callback) {
|
|
225
422
|
if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
|
|
226
423
|
return;
|
|
227
424
|
for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
|
|
425
|
+
// Skip if the key / cluster name is a number, cause they are double indexed.
|
|
228
426
|
if (!isNaN(Number(clusterName)))
|
|
229
427
|
continue;
|
|
230
428
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
429
|
+
// Skip if the behavior has no associated cluster (i.e. matterbridge server)
|
|
231
430
|
const clusterId = getClusterId(this, clusterName);
|
|
232
431
|
if (clusterId === undefined) {
|
|
432
|
+
// this.log.debug(`***forEachAttribute: cluster ${clusterName} not found`);
|
|
233
433
|
continue;
|
|
234
434
|
}
|
|
435
|
+
// Skip if the attribute is not present in the ClusterBehavior.Type. Also skip if the attribute it is an internal state.
|
|
235
436
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
236
437
|
if (attributeId === undefined) {
|
|
438
|
+
// this.log.debug(`***forEachAttribute: attribute ${clusterName}.${attributeName} not found`);
|
|
237
439
|
continue;
|
|
238
440
|
}
|
|
239
441
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
240
442
|
}
|
|
241
443
|
}
|
|
242
444
|
}
|
|
445
|
+
/**
|
|
446
|
+
* Adds a child endpoint with the specified device types and options.
|
|
447
|
+
* If the child endpoint is not already present, it will be created and added.
|
|
448
|
+
* If the child endpoint is already present, the existing child endpoint will be returned.
|
|
449
|
+
*
|
|
450
|
+
* @param {string} endpointName - The name of the new endpoint to add.
|
|
451
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
452
|
+
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
|
|
453
|
+
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
454
|
+
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```typescript
|
|
458
|
+
* const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
459
|
+
* ```
|
|
460
|
+
*/
|
|
243
461
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
244
462
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
245
463
|
let alreadyAdded = false;
|
|
@@ -279,6 +497,23 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
279
497
|
}
|
|
280
498
|
return child;
|
|
281
499
|
}
|
|
500
|
+
/**
|
|
501
|
+
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
502
|
+
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
503
|
+
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
504
|
+
*
|
|
505
|
+
* @param {string} endpointName - The name of the new enpoint to add.
|
|
506
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
507
|
+
* @param {ClusterId[]} [serverList=[]] - The list of cluster IDs to include.
|
|
508
|
+
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
509
|
+
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
510
|
+
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
511
|
+
*
|
|
512
|
+
* @example
|
|
513
|
+
* ```typescript
|
|
514
|
+
* const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
515
|
+
* ```
|
|
516
|
+
*/
|
|
282
517
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
283
518
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
284
519
|
let alreadyAdded = false;
|
|
@@ -341,15 +576,38 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
341
576
|
}
|
|
342
577
|
return child;
|
|
343
578
|
}
|
|
579
|
+
/**
|
|
580
|
+
* Retrieves a child endpoint by its name.
|
|
581
|
+
*
|
|
582
|
+
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
583
|
+
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
584
|
+
*/
|
|
344
585
|
getChildEndpointByName(endpointName) {
|
|
345
586
|
return this.parts.find((part) => part.id === endpointName);
|
|
346
587
|
}
|
|
588
|
+
/**
|
|
589
|
+
* Retrieves a child endpoint by its EndpointNumber.
|
|
590
|
+
*
|
|
591
|
+
* @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
|
|
592
|
+
* @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
|
|
593
|
+
*/
|
|
347
594
|
getChildEndpoint(endpointNumber) {
|
|
348
595
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
349
596
|
}
|
|
597
|
+
/**
|
|
598
|
+
* Get all the child endpoints of this endpoint.
|
|
599
|
+
*
|
|
600
|
+
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
601
|
+
*/
|
|
350
602
|
getChildEndpoints() {
|
|
351
603
|
return Array.from(this.parts);
|
|
352
604
|
}
|
|
605
|
+
/**
|
|
606
|
+
* Serializes the Matterbridge device into a serialized object.
|
|
607
|
+
*
|
|
608
|
+
* @param pluginName - The name of the plugin.
|
|
609
|
+
* @returns The serialized Matterbridge device object.
|
|
610
|
+
*/
|
|
353
611
|
static serialize(device) {
|
|
354
612
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId)
|
|
355
613
|
return;
|
|
@@ -372,9 +630,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
372
630
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
373
631
|
if (behaviorName === 'powerSource')
|
|
374
632
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
633
|
+
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
375
634
|
});
|
|
376
635
|
return serialized;
|
|
377
636
|
}
|
|
637
|
+
/**
|
|
638
|
+
* Deserializes the device into a serialized object.
|
|
639
|
+
*
|
|
640
|
+
* @returns The deserialized MatterbridgeDevice.
|
|
641
|
+
*/
|
|
378
642
|
static deserialize(serializedDevice) {
|
|
379
643
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
|
|
380
644
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -390,9 +654,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
390
654
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
391
655
|
else if (clusterId === PowerSource.Cluster.id)
|
|
392
656
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
657
|
+
// else addClusterServerFromList(device, [clusterId]);
|
|
393
658
|
}
|
|
394
659
|
return device;
|
|
395
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* Creates a default power source wired cluster server.
|
|
663
|
+
*
|
|
664
|
+
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
665
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
666
|
+
*/
|
|
396
667
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
397
668
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
|
|
398
669
|
wiredCurrentType,
|
|
@@ -403,6 +674,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
403
674
|
});
|
|
404
675
|
return this;
|
|
405
676
|
}
|
|
677
|
+
/**
|
|
678
|
+
* Creates a default power source replaceable battery cluster server.
|
|
679
|
+
*
|
|
680
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
681
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
682
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
683
|
+
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
684
|
+
* @param batQuantity - The battery quantity (default: 1).
|
|
685
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
686
|
+
*/
|
|
406
687
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
407
688
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
408
689
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -420,6 +701,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
420
701
|
});
|
|
421
702
|
return this;
|
|
422
703
|
}
|
|
704
|
+
/**
|
|
705
|
+
* Creates a default power source rechargeable battery cluster server.
|
|
706
|
+
*
|
|
707
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
708
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
709
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
710
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
711
|
+
*/
|
|
423
712
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
424
713
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
425
714
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -438,6 +727,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
438
727
|
});
|
|
439
728
|
return this;
|
|
440
729
|
}
|
|
730
|
+
/**
|
|
731
|
+
* Setup the default Basic Information Cluster Server attributes for the server node.
|
|
732
|
+
*
|
|
733
|
+
* @param deviceName - The name of the device.
|
|
734
|
+
* @param serialNumber - The serial number of the device.
|
|
735
|
+
* @param vendorId - The vendor ID of the device.
|
|
736
|
+
* @param vendorName - The vendor name of the device.
|
|
737
|
+
* @param productId - The product ID of the device.
|
|
738
|
+
* @param productName - The product name of the device.
|
|
739
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
740
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
741
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
742
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
743
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
744
|
+
*/
|
|
441
745
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
442
746
|
this.log.logName = deviceName;
|
|
443
747
|
this.deviceName = deviceName;
|
|
@@ -461,6 +765,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
461
765
|
}
|
|
462
766
|
return this;
|
|
463
767
|
}
|
|
768
|
+
/**
|
|
769
|
+
* Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
|
|
770
|
+
*
|
|
771
|
+
* @param deviceName - The name of the device.
|
|
772
|
+
* @param serialNumber - The serial number of the device.
|
|
773
|
+
* @param vendorId - The vendor ID of the device.
|
|
774
|
+
* @param vendorName - The name of the vendor.
|
|
775
|
+
* @param productName - The name of the product.
|
|
776
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
777
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
778
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
779
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
780
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
781
|
+
*
|
|
782
|
+
* @remarks The bridgedNode device type must be added to the deviceTypeList of the Descriptor cluster.
|
|
783
|
+
*/
|
|
464
784
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
465
785
|
this.log.logName = deviceName;
|
|
466
786
|
this.deviceName = deviceName;
|
|
@@ -477,7 +797,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
477
797
|
this.behaviors.require(BridgedDeviceBasicInformationServer.enable({
|
|
478
798
|
events: { leave: true, reachableChanged: true },
|
|
479
799
|
}), {
|
|
480
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
800
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
|
|
481
801
|
vendorName: vendorName.slice(0, 32),
|
|
482
802
|
productName: productName.slice(0, 32),
|
|
483
803
|
productUrl: this.productUrl.slice(0, 256),
|
|
@@ -493,6 +813,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
493
813
|
});
|
|
494
814
|
return this;
|
|
495
815
|
}
|
|
816
|
+
/**
|
|
817
|
+
* Creates a default identify cluster server with the specified identify time and type.
|
|
818
|
+
*
|
|
819
|
+
* @param {number} [identifyTime=0] - The time to identify the server. Defaults to 0.
|
|
820
|
+
* @param {Identify.IdentifyType} [identifyType=Identify.IdentifyType.None] - The type of identification. Defaults to Identify.IdentifyType.None.
|
|
821
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
822
|
+
*/
|
|
496
823
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
497
824
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
498
825
|
identifyTime,
|
|
@@ -500,14 +827,34 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
500
827
|
});
|
|
501
828
|
return this;
|
|
502
829
|
}
|
|
830
|
+
/**
|
|
831
|
+
* Creates a default groups cluster server.
|
|
832
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
833
|
+
*/
|
|
503
834
|
createDefaultGroupsClusterServer() {
|
|
504
835
|
this.behaviors.require(GroupsServer);
|
|
505
836
|
return this;
|
|
506
837
|
}
|
|
838
|
+
/**
|
|
839
|
+
* Creates a default scenes management cluster server.
|
|
840
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
841
|
+
*
|
|
842
|
+
* @remarks The scenes management cluster server is still provisional and so not yet implemented.
|
|
843
|
+
*/
|
|
507
844
|
createDefaultScenesClusterServer() {
|
|
508
845
|
this.behaviors.require(ScenesManagementServer);
|
|
509
846
|
return this;
|
|
510
847
|
}
|
|
848
|
+
/**
|
|
849
|
+
* Creates a default OnOff cluster server for light devices with feature Lighting.
|
|
850
|
+
*
|
|
851
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
852
|
+
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
853
|
+
* @param {number} [onTime=0] - The on time value.
|
|
854
|
+
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
855
|
+
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
856
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
857
|
+
*/
|
|
511
858
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
512
859
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
513
860
|
onOff,
|
|
@@ -518,24 +865,52 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
518
865
|
});
|
|
519
866
|
return this;
|
|
520
867
|
}
|
|
868
|
+
/**
|
|
869
|
+
* Creates an OnOff cluster server without features.
|
|
870
|
+
*
|
|
871
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
872
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
873
|
+
*/
|
|
521
874
|
createOnOffClusterServer(onOff = false) {
|
|
522
875
|
this.behaviors.require(MatterbridgeOnOffServer, {
|
|
523
876
|
onOff,
|
|
524
877
|
});
|
|
525
878
|
return this;
|
|
526
879
|
}
|
|
880
|
+
/**
|
|
881
|
+
* Creates a DeadFront OnOff cluster server with feature DeadFrontBehavior.
|
|
882
|
+
*
|
|
883
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
884
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
885
|
+
*/
|
|
527
886
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
528
887
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
529
888
|
onOff,
|
|
530
889
|
});
|
|
531
890
|
return this;
|
|
532
891
|
}
|
|
892
|
+
/**
|
|
893
|
+
* Creates an OffOnly OnOff cluster server with feature OffOnly.
|
|
894
|
+
*
|
|
895
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
896
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
897
|
+
*/
|
|
533
898
|
createOffOnlyOnOffClusterServer(onOff = false) {
|
|
534
899
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
|
|
535
900
|
onOff,
|
|
536
901
|
});
|
|
537
902
|
return this;
|
|
538
903
|
}
|
|
904
|
+
/**
|
|
905
|
+
* Creates a default level control cluster server for light devices with feature OnOff and Lighting.
|
|
906
|
+
*
|
|
907
|
+
* @param {number} [currentLevel=254] - The current level (default: 254).
|
|
908
|
+
* @param {number} [minLevel=1] - The minimum level (default: 1).
|
|
909
|
+
* @param {number} [maxLevel=254] - The maximum level (default: 254).
|
|
910
|
+
* @param {number | null} [onLevel=null] - The on level (default: null).
|
|
911
|
+
* @param {number | null} [startUpCurrentLevel=null] - The startUp on level (default: null).
|
|
912
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
913
|
+
*/
|
|
539
914
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
540
915
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
541
916
|
currentLevel,
|
|
@@ -551,6 +926,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
551
926
|
});
|
|
552
927
|
return this;
|
|
553
928
|
}
|
|
929
|
+
/**
|
|
930
|
+
* Creates a level control cluster server without features.
|
|
931
|
+
*
|
|
932
|
+
* @param {number} [currentLevel=254] - The current level (default: 254).
|
|
933
|
+
* @param {number | null} [onLevel=null] - The on level (default: null).
|
|
934
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
935
|
+
*/
|
|
554
936
|
createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
|
|
555
937
|
this.behaviors.require(MatterbridgeLevelControlServer, {
|
|
556
938
|
currentLevel,
|
|
@@ -562,6 +944,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
562
944
|
});
|
|
563
945
|
return this;
|
|
564
946
|
}
|
|
947
|
+
/**
|
|
948
|
+
* Creates a default color control cluster server with features Xy, HueSaturation and ColorTemperature.
|
|
949
|
+
*
|
|
950
|
+
* @param currentX - The current X value (range 0-65279).
|
|
951
|
+
* @param currentY - The current Y value (range 0-65279).
|
|
952
|
+
* @param currentHue - The current hue value (range: 0-254).
|
|
953
|
+
* @param currentSaturation - The current saturation value (range: 0-254).
|
|
954
|
+
* @param colorTemperatureMireds - The color temperature in mireds (default range 147-500).
|
|
955
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
|
|
956
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
|
|
957
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
958
|
+
*
|
|
959
|
+
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
960
|
+
* @remarks currentHue and currentSaturation persist across restarts.
|
|
961
|
+
* @remarks currentX and currentY persist across restarts.
|
|
962
|
+
* @remarks colorTemperatureMireds persists across restarts.
|
|
963
|
+
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
964
|
+
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
965
|
+
*/
|
|
565
966
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
566
967
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
567
968
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -584,6 +985,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
584
985
|
});
|
|
585
986
|
return this;
|
|
586
987
|
}
|
|
988
|
+
/**
|
|
989
|
+
* Creates a Xy color control cluster server with feature Xy and ColorTemperature.
|
|
990
|
+
*
|
|
991
|
+
* @param currentX - The current X value.
|
|
992
|
+
* @param currentY - The current Y value.
|
|
993
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
994
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
995
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
996
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
997
|
+
*
|
|
998
|
+
* @remarks
|
|
999
|
+
* From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
|
|
1000
|
+
*
|
|
1001
|
+
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1002
|
+
* @remarks currentX and currentY persist across restarts.
|
|
1003
|
+
* @remarks colorTemperatureMireds persists across restarts.
|
|
1004
|
+
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1005
|
+
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1006
|
+
*/
|
|
587
1007
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
588
1008
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
589
1009
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -604,6 +1024,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
604
1024
|
});
|
|
605
1025
|
return this;
|
|
606
1026
|
}
|
|
1027
|
+
/**
|
|
1028
|
+
* Creates a default hue and saturation control cluster server with feature HueSaturation and ColorTemperature.
|
|
1029
|
+
*
|
|
1030
|
+
* @param currentHue - The current hue value.
|
|
1031
|
+
* @param currentSaturation - The current saturation value.
|
|
1032
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1033
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1034
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1035
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1036
|
+
*
|
|
1037
|
+
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1038
|
+
* @remarks currentHue and currentSaturation persist across restarts.
|
|
1039
|
+
* @remarks colorTemperatureMireds persists across restarts.
|
|
1040
|
+
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1041
|
+
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1042
|
+
*/
|
|
607
1043
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
608
1044
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
609
1045
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -624,6 +1060,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
624
1060
|
});
|
|
625
1061
|
return this;
|
|
626
1062
|
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Creates a color temperature color control cluster server with feature ColorTemperature.
|
|
1065
|
+
* This cluster server is used for devices that only support color temperature control.
|
|
1066
|
+
*
|
|
1067
|
+
* @param colorTemperatureMireds - The color temperature in mireds. Defaults to 250.
|
|
1068
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds. Defaults to 147.
|
|
1069
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds. Defaults to 500.
|
|
1070
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1071
|
+
*
|
|
1072
|
+
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1073
|
+
* @remarks colorTemperatureMireds persists across restarts.
|
|
1074
|
+
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1075
|
+
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1076
|
+
*/
|
|
627
1077
|
createCtColorControlClusterServer(colorTemperatureMireds = 250, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
628
1078
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
629
1079
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -642,15 +1092,34 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
642
1092
|
});
|
|
643
1093
|
return this;
|
|
644
1094
|
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Configures the color control mode for the device.
|
|
1097
|
+
*
|
|
1098
|
+
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1099
|
+
*
|
|
1100
|
+
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1101
|
+
*/
|
|
645
1102
|
async configureColorControlMode(colorMode) {
|
|
646
1103
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
647
1104
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
648
1105
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
649
1106
|
}
|
|
650
1107
|
}
|
|
1108
|
+
/**
|
|
1109
|
+
* Creates a default window covering cluster server with feature Lift and PositionAwareLift.
|
|
1110
|
+
*
|
|
1111
|
+
* @param {number} positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1112
|
+
* @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.Rollershade). Must support feature Lift.
|
|
1113
|
+
* @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.RollerShade). Must support feature Lift.
|
|
1114
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1115
|
+
*
|
|
1116
|
+
* @remarks mode attributes is writable and persists across restarts.
|
|
1117
|
+
* currentPositionLiftPercent100ths persists across restarts.
|
|
1118
|
+
* configStatus attributes persists across restarts.
|
|
1119
|
+
*/
|
|
651
1120
|
createDefaultWindowCoveringClusterServer(positionPercent100ths, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade) {
|
|
652
1121
|
this.behaviors.require(MatterbridgeLiftWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
653
|
-
type,
|
|
1122
|
+
type, // Must support feature Lift
|
|
654
1123
|
numberOfActuationsLift: 0,
|
|
655
1124
|
configStatus: {
|
|
656
1125
|
operational: true,
|
|
@@ -658,20 +1127,33 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
658
1127
|
liftMovementReversed: false,
|
|
659
1128
|
liftPositionAware: true,
|
|
660
1129
|
tiltPositionAware: false,
|
|
661
|
-
liftEncoderControlled: false,
|
|
662
|
-
tiltEncoderControlled: false,
|
|
1130
|
+
liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
1131
|
+
tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
663
1132
|
},
|
|
664
1133
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
665
|
-
endProductType,
|
|
1134
|
+
endProductType, // Must support feature Lift
|
|
666
1135
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
667
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
668
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1136
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1137
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
669
1138
|
});
|
|
670
1139
|
return this;
|
|
671
1140
|
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Creates a default window covering cluster server with features Lift, PositionAwareLift, Tilt, PositionAwareTilt.
|
|
1143
|
+
*
|
|
1144
|
+
* @param {number} positionLiftPercent100ths - The lift position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1145
|
+
* @param {number} positionTiltPercent100ths - The tilt position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1146
|
+
* @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.TiltBlindLift). Must support features Lift and Tilt.
|
|
1147
|
+
* @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.InteriorBlind). Must support features Lift and Tilt.
|
|
1148
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1149
|
+
*
|
|
1150
|
+
* @remarks mode attributes is writable and persists across restarts.
|
|
1151
|
+
* currentPositionTiltPercent100ths persists across restarts.
|
|
1152
|
+
* configStatus attributes persists across restarts.
|
|
1153
|
+
*/
|
|
672
1154
|
createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind) {
|
|
673
1155
|
this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt), {
|
|
674
|
-
type,
|
|
1156
|
+
type, // Must support features Lift and Tilt
|
|
675
1157
|
numberOfActuationsLift: 0,
|
|
676
1158
|
numberOfActuationsTilt: 0,
|
|
677
1159
|
configStatus: {
|
|
@@ -680,19 +1162,23 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
680
1162
|
liftMovementReversed: false,
|
|
681
1163
|
liftPositionAware: true,
|
|
682
1164
|
tiltPositionAware: true,
|
|
683
|
-
liftEncoderControlled: false,
|
|
684
|
-
tiltEncoderControlled: false,
|
|
1165
|
+
liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
1166
|
+
tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
685
1167
|
},
|
|
686
1168
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
687
|
-
endProductType,
|
|
1169
|
+
endProductType, // Must support features Lift and Tilt
|
|
688
1170
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
689
|
-
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
690
|
-
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
691
|
-
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
692
|
-
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
1171
|
+
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1172
|
+
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1173
|
+
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1174
|
+
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
693
1175
|
});
|
|
694
1176
|
return this;
|
|
695
1177
|
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Sets the window covering lift target position as the current position and stops the movement.
|
|
1180
|
+
*
|
|
1181
|
+
*/
|
|
696
1182
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
697
1183
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
698
1184
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -712,6 +1198,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
712
1198
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
713
1199
|
}
|
|
714
1200
|
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Sets the lift current and target position and the status of a window covering.
|
|
1203
|
+
* @param {number} current - The current position of the window covering.
|
|
1204
|
+
* @param {number} target - The target position of the window covering.
|
|
1205
|
+
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1206
|
+
*/
|
|
715
1207
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
716
1208
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
717
1209
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -722,6 +1214,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
722
1214
|
}, this.log);
|
|
723
1215
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
724
1216
|
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Sets the status of the window covering.
|
|
1219
|
+
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1220
|
+
*/
|
|
725
1221
|
async setWindowCoveringStatus(status) {
|
|
726
1222
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
727
1223
|
global: status,
|
|
@@ -730,6 +1226,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
730
1226
|
}, this.log);
|
|
731
1227
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
732
1228
|
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Retrieves the status of the window covering.
|
|
1231
|
+
*
|
|
1232
|
+
* @returns The global operational status of the window covering or undefined.
|
|
1233
|
+
*/
|
|
733
1234
|
getWindowCoveringStatus() {
|
|
734
1235
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
735
1236
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -737,6 +1238,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
737
1238
|
return status.global;
|
|
738
1239
|
}
|
|
739
1240
|
}
|
|
1241
|
+
/**
|
|
1242
|
+
* Sets the lift target and current position of the window covering.
|
|
1243
|
+
*
|
|
1244
|
+
* @param {number} liftPosition - The position to set, specified as a number.
|
|
1245
|
+
* @param {number} [tiltPosition] - The tilt position to set, specified as a number.
|
|
1246
|
+
*/
|
|
740
1247
|
async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
|
|
741
1248
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', liftPosition, this.log);
|
|
742
1249
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', liftPosition, this.log);
|
|
@@ -747,31 +1254,56 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
747
1254
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
|
|
748
1255
|
}
|
|
749
1256
|
}
|
|
1257
|
+
/**
|
|
1258
|
+
* Creates a default thermostat cluster server with features Heating, Cooling and AutoMode.
|
|
1259
|
+
*
|
|
1260
|
+
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1261
|
+
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1262
|
+
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1263
|
+
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
1264
|
+
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1265
|
+
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1266
|
+
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1267
|
+
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1268
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1269
|
+
*/
|
|
750
1270
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
751
1271
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
752
1272
|
localTemperature: localTemperature * 100,
|
|
753
1273
|
systemMode: Thermostat.SystemMode.Auto,
|
|
754
1274
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1275
|
+
// Thermostat.Feature.Heating
|
|
755
1276
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
756
1277
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
757
1278
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
758
1279
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
759
1280
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1281
|
+
// Thermostat.Feature.Cooling
|
|
760
1282
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
761
1283
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
762
1284
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
763
1285
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
764
1286
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1287
|
+
// Thermostat.Feature.AutoMode
|
|
765
1288
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
766
1289
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
767
1290
|
});
|
|
768
1291
|
return this;
|
|
769
1292
|
}
|
|
1293
|
+
/**
|
|
1294
|
+
* Creates a default heating thermostat cluster server with feature Heating.
|
|
1295
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1296
|
+
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1297
|
+
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1298
|
+
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1299
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1300
|
+
*/
|
|
770
1301
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
771
1302
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
|
|
772
1303
|
localTemperature: localTemperature * 100,
|
|
773
1304
|
systemMode: Thermostat.SystemMode.Heat,
|
|
774
1305
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1306
|
+
// Thermostat.Feature.Heating
|
|
775
1307
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
776
1308
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
777
1309
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -780,11 +1312,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
780
1312
|
});
|
|
781
1313
|
return this;
|
|
782
1314
|
}
|
|
1315
|
+
/**
|
|
1316
|
+
* Creates a default cooling thermostat cluster server with feature Cooling.
|
|
1317
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1318
|
+
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1319
|
+
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1320
|
+
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1321
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1322
|
+
*/
|
|
783
1323
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
784
1324
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
|
|
785
1325
|
localTemperature: localTemperature * 100,
|
|
786
1326
|
systemMode: Thermostat.SystemMode.Cool,
|
|
787
1327
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1328
|
+
// Thermostat.Feature.Cooling
|
|
788
1329
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
789
1330
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
790
1331
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -793,6 +1334,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
793
1334
|
});
|
|
794
1335
|
return this;
|
|
795
1336
|
}
|
|
1337
|
+
/**
|
|
1338
|
+
* Creates a default thermostat user interface configuration cluster server.
|
|
1339
|
+
*
|
|
1340
|
+
* @remarks
|
|
1341
|
+
* The default values are:
|
|
1342
|
+
* - temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius (writeble).
|
|
1343
|
+
* - keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout (writeble).
|
|
1344
|
+
* - scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted (writeble).
|
|
1345
|
+
*/
|
|
796
1346
|
createDefaultThermostatUserInterfaceConfigurationClusterServer() {
|
|
797
1347
|
this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
|
|
798
1348
|
temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
|
|
@@ -801,6 +1351,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
801
1351
|
});
|
|
802
1352
|
return this;
|
|
803
1353
|
}
|
|
1354
|
+
/**
|
|
1355
|
+
* Creates a default fan control cluster server with features MultiSpeed, Auto, and Step.
|
|
1356
|
+
*
|
|
1357
|
+
* @param {FanControl.FanMode} [fanMode=FanControl.FanMode.Off] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1358
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1359
|
+
*
|
|
1360
|
+
* @remarks
|
|
1361
|
+
* fanmode is writable and persists across reboots.
|
|
1362
|
+
* percentSetting is writable.
|
|
1363
|
+
* speedSetting is writable.
|
|
1364
|
+
*/
|
|
804
1365
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
805
1366
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
806
1367
|
fanMode,
|
|
@@ -813,6 +1374,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
813
1374
|
});
|
|
814
1375
|
return this;
|
|
815
1376
|
}
|
|
1377
|
+
/**
|
|
1378
|
+
* Creates a base fan control cluster server without features.
|
|
1379
|
+
*
|
|
1380
|
+
* @param {FanControl.FanMode} [fanMode=FanControl.FanMode.Off] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1381
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1382
|
+
*
|
|
1383
|
+
* @remarks
|
|
1384
|
+
* fanmode is writable and persists across reboots.
|
|
1385
|
+
* percentSetting is writable.
|
|
1386
|
+
*/
|
|
816
1387
|
createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
817
1388
|
this.behaviors.require(FanControlServer, {
|
|
818
1389
|
fanMode,
|
|
@@ -822,39 +1393,81 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
822
1393
|
});
|
|
823
1394
|
return this;
|
|
824
1395
|
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Creates a default HEPA Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
|
|
1398
|
+
* It supports ResourceMonitoring.Feature.Condition and ResourceMonitoring.Feature.ReplacementProductList.
|
|
1399
|
+
*
|
|
1400
|
+
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
1401
|
+
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
|
|
1402
|
+
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
|
|
1403
|
+
*
|
|
1404
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1405
|
+
*/
|
|
825
1406
|
createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
826
1407
|
this.behaviors.require(HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
827
|
-
condition: 100,
|
|
828
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1408
|
+
condition: 100, // Feature.Condition
|
|
1409
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
|
|
829
1410
|
changeIndication,
|
|
830
1411
|
inPlaceIndicator,
|
|
831
1412
|
lastChangedTime,
|
|
832
|
-
replacementProductList: [],
|
|
1413
|
+
replacementProductList: [], // Feature.ReplacementProductList
|
|
833
1414
|
});
|
|
834
1415
|
return this;
|
|
835
1416
|
}
|
|
1417
|
+
/**
|
|
1418
|
+
* Creates a default Activated Carbon Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
|
|
1419
|
+
*
|
|
1420
|
+
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
1421
|
+
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
|
|
1422
|
+
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
|
|
1423
|
+
*
|
|
1424
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1425
|
+
*/
|
|
836
1426
|
createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
837
1427
|
this.behaviors.require(ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
838
|
-
condition: 100,
|
|
839
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1428
|
+
condition: 100, // Feature.Condition
|
|
1429
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
|
|
840
1430
|
changeIndication,
|
|
841
1431
|
inPlaceIndicator,
|
|
842
1432
|
lastChangedTime,
|
|
843
|
-
replacementProductList: [],
|
|
1433
|
+
replacementProductList: [], // Feature.ReplacementProductList
|
|
844
1434
|
});
|
|
845
1435
|
return this;
|
|
846
1436
|
}
|
|
1437
|
+
/**
|
|
1438
|
+
* Creates a default door lock cluster server.
|
|
1439
|
+
*
|
|
1440
|
+
* @param {DoorLock.LockState} [lockState=DoorLock.LockState.Locked] - The initial state of the lock (default: Locked).
|
|
1441
|
+
* @param {DoorLock.LockType} [lockType=DoorLock.LockType.DeadBolt] - The type of the lock (default: DeadBolt).
|
|
1442
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1443
|
+
*
|
|
1444
|
+
* @remarks
|
|
1445
|
+
* All operating modes NOT supported by a lock SHALL be set to one. The value of the OperatingMode enumeration defines the related bit to be set.
|
|
1446
|
+
*/
|
|
847
1447
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
848
1448
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
849
1449
|
lockState,
|
|
850
1450
|
lockType,
|
|
851
1451
|
actuatorEnabled: false,
|
|
852
1452
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
1453
|
+
// Special case of inverted bitmap: add also alwaysSet = 2047
|
|
853
1454
|
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
|
|
854
1455
|
alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
|
|
855
1456
|
});
|
|
856
1457
|
return this;
|
|
857
1458
|
}
|
|
1459
|
+
/**
|
|
1460
|
+
* Creates a default Mode Select cluster server.
|
|
1461
|
+
*
|
|
1462
|
+
* @param {string} description - The description of the mode select cluster.
|
|
1463
|
+
* @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
|
|
1464
|
+
* @param {number} [currentMode=0] - The current mode (default: 0).
|
|
1465
|
+
* @param {number} [startUpMode=0] - The startup mode (default: 0).
|
|
1466
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1467
|
+
*
|
|
1468
|
+
* @remarks
|
|
1469
|
+
* endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
|
|
1470
|
+
*/
|
|
858
1471
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
859
1472
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
860
1473
|
description: description,
|
|
@@ -865,6 +1478,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
865
1478
|
});
|
|
866
1479
|
return this;
|
|
867
1480
|
}
|
|
1481
|
+
/**
|
|
1482
|
+
* Creates the default Valve Configuration And Control cluster server with features Level.
|
|
1483
|
+
*
|
|
1484
|
+
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
1485
|
+
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
1486
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1487
|
+
*/
|
|
868
1488
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
869
1489
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
870
1490
|
currentState: valveState,
|
|
@@ -880,6 +1500,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
880
1500
|
});
|
|
881
1501
|
return this;
|
|
882
1502
|
}
|
|
1503
|
+
/**
|
|
1504
|
+
* Creates the default PumpConfigurationAndControl cluster server with features ConstantSpeed.
|
|
1505
|
+
*
|
|
1506
|
+
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
1507
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1508
|
+
*/
|
|
883
1509
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
884
1510
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
885
1511
|
minConstSpeed: null,
|
|
@@ -894,6 +1520,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
894
1520
|
});
|
|
895
1521
|
return this;
|
|
896
1522
|
}
|
|
1523
|
+
/**
|
|
1524
|
+
* Creates the default SmokeCOAlarm Cluster Server with features SmokeAlarm and CoAlarm.
|
|
1525
|
+
*
|
|
1526
|
+
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1527
|
+
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1528
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1529
|
+
*/
|
|
897
1530
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
898
1531
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
899
1532
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -909,6 +1542,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
909
1542
|
});
|
|
910
1543
|
return this;
|
|
911
1544
|
}
|
|
1545
|
+
/**
|
|
1546
|
+
* Creates a smoke only SmokeCOAlarm Cluster Server with features SmokeAlarm.
|
|
1547
|
+
*
|
|
1548
|
+
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1549
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1550
|
+
*/
|
|
912
1551
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
913
1552
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
914
1553
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -923,6 +1562,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
923
1562
|
});
|
|
924
1563
|
return this;
|
|
925
1564
|
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Creates a co only SmokeCOAlarm Cluster Server with features CoAlarm.
|
|
1567
|
+
*
|
|
1568
|
+
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1569
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1570
|
+
*/
|
|
926
1571
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
927
1572
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
928
1573
|
events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -937,6 +1582,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
937
1582
|
});
|
|
938
1583
|
return this;
|
|
939
1584
|
}
|
|
1585
|
+
/**
|
|
1586
|
+
* Creates a default momentary switch cluster server with features MomentarySwitch, MomentarySwitchRelease, MomentarySwitchLongPress and MomentarySwitchMultiPress.
|
|
1587
|
+
*
|
|
1588
|
+
* @remarks
|
|
1589
|
+
* This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
|
|
1590
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1591
|
+
*/
|
|
940
1592
|
createDefaultSwitchClusterServer() {
|
|
941
1593
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
942
1594
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -947,6 +1599,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
947
1599
|
});
|
|
948
1600
|
return this;
|
|
949
1601
|
}
|
|
1602
|
+
/**
|
|
1603
|
+
* Creates a default latching switch cluster server with features LatchingSwitch.
|
|
1604
|
+
*
|
|
1605
|
+
* @remarks
|
|
1606
|
+
* This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
|
|
1607
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1608
|
+
*/
|
|
950
1609
|
createDefaultLatchingSwitchClusterServer() {
|
|
951
1610
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
952
1611
|
events: { switchLatched: true },
|
|
@@ -956,6 +1615,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
956
1615
|
});
|
|
957
1616
|
return this;
|
|
958
1617
|
}
|
|
1618
|
+
/**
|
|
1619
|
+
* Triggers a switch event on the specified endpoint.
|
|
1620
|
+
*
|
|
1621
|
+
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1622
|
+
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1623
|
+
* @returns {boolean} - A boolean indicating whether the event was successfully triggered.
|
|
1624
|
+
*/
|
|
959
1625
|
async triggerSwitchEvent(event, log) {
|
|
960
1626
|
if (this.maybeNumber === undefined) {
|
|
961
1627
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1015,10 +1681,30 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1015
1681
|
}
|
|
1016
1682
|
return true;
|
|
1017
1683
|
}
|
|
1684
|
+
/**
|
|
1685
|
+
* Creates a default OperationalState Cluster Server.
|
|
1686
|
+
*
|
|
1687
|
+
* @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state.
|
|
1688
|
+
*
|
|
1689
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1690
|
+
*/
|
|
1018
1691
|
createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
|
1019
1692
|
this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
|
|
1020
1693
|
return this;
|
|
1021
1694
|
}
|
|
1695
|
+
/**
|
|
1696
|
+
* Creates a default boolean state cluster server.
|
|
1697
|
+
* The stateChange event is enabled.
|
|
1698
|
+
*
|
|
1699
|
+
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
|
|
1700
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1701
|
+
*
|
|
1702
|
+
* @remarks
|
|
1703
|
+
* Water Leak Detector: true = leak, false = no leak
|
|
1704
|
+
* Water Freeze Detector: true = freeze, false = no freeze
|
|
1705
|
+
* Rain Sensor: true = rain, false = no rain
|
|
1706
|
+
* Contact Sensor: true = closed or contact, false = open or no contact
|
|
1707
|
+
*/
|
|
1022
1708
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1023
1709
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1024
1710
|
events: { stateChange: true },
|
|
@@ -1027,6 +1713,23 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1027
1713
|
});
|
|
1028
1714
|
return this;
|
|
1029
1715
|
}
|
|
1716
|
+
/**
|
|
1717
|
+
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
|
|
1718
|
+
*
|
|
1719
|
+
* Features:
|
|
1720
|
+
* - Visual
|
|
1721
|
+
* - Audible
|
|
1722
|
+
* - SensitivityLevel
|
|
1723
|
+
*
|
|
1724
|
+
* @remarks Supports the enableDisableAlarm command.
|
|
1725
|
+
*
|
|
1726
|
+
* @param {boolean} [sensorFault=false] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1727
|
+
* @param {number} [currentSensitivityLevel=0] - The current sensitivity level. Defaults to `0` if not provided.
|
|
1728
|
+
* @param {number} [supportedSensitivityLevels=2] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
|
|
1729
|
+
* @param {number} [defaultSensitivityLevel=0] - The default sensitivity level. Defaults to `0` if not provided.
|
|
1730
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1731
|
+
*
|
|
1732
|
+
*/
|
|
1030
1733
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1031
1734
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1032
1735
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -1041,10 +1744,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1041
1744
|
});
|
|
1042
1745
|
return this;
|
|
1043
1746
|
}
|
|
1747
|
+
/**
|
|
1748
|
+
* Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
|
|
1749
|
+
*
|
|
1750
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1751
|
+
*/
|
|
1044
1752
|
createDefaultPowerTopologyClusterServer() {
|
|
1045
1753
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1046
1754
|
return this;
|
|
1047
1755
|
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Creates a default Electrical Energy Measurement Cluster Server with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
|
|
1758
|
+
*
|
|
1759
|
+
* @param {number} energy - The total consumption value in mW/h.
|
|
1760
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1761
|
+
*/
|
|
1048
1762
|
createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
1049
1763
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1050
1764
|
accuracy: {
|
|
@@ -1060,6 +1774,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1060
1774
|
});
|
|
1061
1775
|
return this;
|
|
1062
1776
|
}
|
|
1777
|
+
/**
|
|
1778
|
+
* Creates a default Electrical Power Measurement Cluster Server with features AlternatingCurrent.
|
|
1779
|
+
*
|
|
1780
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
1781
|
+
* @param {number} current - The current value in milliamperes.
|
|
1782
|
+
* @param {number} power - The power value in milliwatts.
|
|
1783
|
+
* @param {number} frequency - The frequency value in millihertz.
|
|
1784
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1785
|
+
*/
|
|
1063
1786
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1064
1787
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1065
1788
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1101,36 +1824,113 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1101
1824
|
});
|
|
1102
1825
|
return this;
|
|
1103
1826
|
}
|
|
1827
|
+
/**
|
|
1828
|
+
* Creates a default TemperatureMeasurement cluster server.
|
|
1829
|
+
*
|
|
1830
|
+
* @param {number | null} measuredValue - The measured value of the temperature x 100.
|
|
1831
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
|
|
1832
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
|
|
1833
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1834
|
+
*/
|
|
1104
1835
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1105
1836
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1106
1837
|
return this;
|
|
1107
1838
|
}
|
|
1839
|
+
/**
|
|
1840
|
+
* Creates a default RelativeHumidityMeasurement cluster server.
|
|
1841
|
+
*
|
|
1842
|
+
* @param {number | null} measuredValue - The measured value of the relative humidity x 100.
|
|
1843
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
|
|
1844
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
|
|
1845
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1846
|
+
*/
|
|
1108
1847
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1109
1848
|
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1110
1849
|
return this;
|
|
1111
1850
|
}
|
|
1851
|
+
/**
|
|
1852
|
+
* Creates a default PressureMeasurement cluster server.
|
|
1853
|
+
*
|
|
1854
|
+
* @param {number | null} measuredValue - The measured value for the pressure.
|
|
1855
|
+
* @param {number | null} minMeasuredValue - The minimum measured value for the pressure.
|
|
1856
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value for the pressure.
|
|
1857
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1858
|
+
*/
|
|
1112
1859
|
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1113
1860
|
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1114
1861
|
return this;
|
|
1115
1862
|
}
|
|
1863
|
+
/**
|
|
1864
|
+
* Creates a default IlluminanceMeasurement cluster server.
|
|
1865
|
+
*
|
|
1866
|
+
* @param {number | null} measuredValue - The measured value of illuminance.
|
|
1867
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
|
|
1868
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
|
|
1869
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1870
|
+
*
|
|
1871
|
+
* @remark The default value for the illuminance measurement is null.
|
|
1872
|
+
* This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
|
|
1873
|
+
* • MeasuredValue = 10,000 x log10(illuminance) + 1,
|
|
1874
|
+
* where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
|
|
1875
|
+
* • 0 indicates a value of illuminance that is too low to be measured
|
|
1876
|
+
* • null indicates that the illuminance measurement is invalid.
|
|
1877
|
+
*
|
|
1878
|
+
* @remarks
|
|
1879
|
+
* Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
|
|
1880
|
+
* Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
|
|
1881
|
+
*/
|
|
1116
1882
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1117
1883
|
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1118
1884
|
return this;
|
|
1119
1885
|
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Creates a default FlowMeasurement cluster server.
|
|
1888
|
+
*
|
|
1889
|
+
* @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
|
|
1890
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
|
|
1891
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
|
|
1892
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1893
|
+
*/
|
|
1120
1894
|
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1121
1895
|
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1122
1896
|
return this;
|
|
1123
1897
|
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Creates a default OccupancySensing cluster server with feature PassiveInfrared.
|
|
1900
|
+
*
|
|
1901
|
+
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1902
|
+
* @param {number} holdTime - The hold time in seconds. Default is 30.
|
|
1903
|
+
* @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
|
|
1904
|
+
* @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
|
|
1905
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1906
|
+
*
|
|
1907
|
+
* @remark The default value for the occupancy sensor type is PIR.
|
|
1908
|
+
*/
|
|
1124
1909
|
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
1125
1910
|
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
1126
1911
|
return this;
|
|
1127
1912
|
}
|
|
1913
|
+
/**
|
|
1914
|
+
* Creates a default AirQuality cluster server.
|
|
1915
|
+
*
|
|
1916
|
+
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
1917
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1918
|
+
*/
|
|
1128
1919
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1129
1920
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1130
1921
|
airQuality,
|
|
1131
1922
|
});
|
|
1132
1923
|
return this;
|
|
1133
1924
|
}
|
|
1925
|
+
/**
|
|
1926
|
+
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
1927
|
+
*
|
|
1928
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1929
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1930
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1931
|
+
* @param {number} [uncertainty] - The uncertainty value (optional).
|
|
1932
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1933
|
+
*/
|
|
1134
1934
|
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
1135
1935
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1136
1936
|
measuredValue,
|
|
@@ -1142,6 +1942,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1142
1942
|
});
|
|
1143
1943
|
return this;
|
|
1144
1944
|
}
|
|
1945
|
+
/**
|
|
1946
|
+
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature LevelIndication.
|
|
1947
|
+
|
|
1948
|
+
* @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
|
|
1949
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1950
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1951
|
+
*/
|
|
1145
1952
|
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1146
1953
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
1147
1954
|
levelValue,
|
|
@@ -1149,6 +1956,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1149
1956
|
});
|
|
1150
1957
|
return this;
|
|
1151
1958
|
}
|
|
1959
|
+
/**
|
|
1960
|
+
* Create a default CarbonMonoxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
1961
|
+
*
|
|
1962
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1963
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1964
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1965
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1966
|
+
*/
|
|
1152
1967
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1153
1968
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1154
1969
|
measuredValue,
|
|
@@ -1160,6 +1975,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1160
1975
|
});
|
|
1161
1976
|
return this;
|
|
1162
1977
|
}
|
|
1978
|
+
/**
|
|
1979
|
+
* Create a default CarbonDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
1980
|
+
*
|
|
1981
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1982
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1983
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1984
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1985
|
+
*/
|
|
1163
1986
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1164
1987
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1165
1988
|
measuredValue,
|
|
@@ -1171,6 +1994,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1171
1994
|
});
|
|
1172
1995
|
return this;
|
|
1173
1996
|
}
|
|
1997
|
+
/**
|
|
1998
|
+
* Create a default FormaldehydeConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
1999
|
+
*
|
|
2000
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2001
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2002
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2003
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2004
|
+
*/
|
|
1174
2005
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1175
2006
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1176
2007
|
measuredValue,
|
|
@@ -1182,6 +2013,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1182
2013
|
});
|
|
1183
2014
|
return this;
|
|
1184
2015
|
}
|
|
2016
|
+
/**
|
|
2017
|
+
* Create a default Pm1ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2018
|
+
*
|
|
2019
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2020
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2021
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2022
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2023
|
+
*/
|
|
1185
2024
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1186
2025
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1187
2026
|
measuredValue,
|
|
@@ -1193,6 +2032,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1193
2032
|
});
|
|
1194
2033
|
return this;
|
|
1195
2034
|
}
|
|
2035
|
+
/**
|
|
2036
|
+
* Create a default Pm25ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2037
|
+
*
|
|
2038
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2039
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2040
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2041
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2042
|
+
*/
|
|
1196
2043
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1197
2044
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1198
2045
|
measuredValue,
|
|
@@ -1204,6 +2051,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1204
2051
|
});
|
|
1205
2052
|
return this;
|
|
1206
2053
|
}
|
|
2054
|
+
/**
|
|
2055
|
+
* Create a default Pm10ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2056
|
+
*
|
|
2057
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2058
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2059
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2060
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2061
|
+
*/
|
|
1207
2062
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1208
2063
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1209
2064
|
measuredValue,
|
|
@@ -1215,6 +2070,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1215
2070
|
});
|
|
1216
2071
|
return this;
|
|
1217
2072
|
}
|
|
2073
|
+
/**
|
|
2074
|
+
* Create a default OzoneConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2075
|
+
*
|
|
2076
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2077
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2078
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2079
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2080
|
+
*/
|
|
1218
2081
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1219
2082
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1220
2083
|
measuredValue,
|
|
@@ -1226,6 +2089,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1226
2089
|
});
|
|
1227
2090
|
return this;
|
|
1228
2091
|
}
|
|
2092
|
+
/**
|
|
2093
|
+
* Create a default RadonConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2094
|
+
*
|
|
2095
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2096
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2097
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2098
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2099
|
+
*/
|
|
1229
2100
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1230
2101
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1231
2102
|
measuredValue,
|
|
@@ -1237,6 +2108,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1237
2108
|
});
|
|
1238
2109
|
return this;
|
|
1239
2110
|
}
|
|
2111
|
+
/**
|
|
2112
|
+
* Create a default NitrogenDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2113
|
+
*
|
|
2114
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2115
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2116
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2117
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2118
|
+
*/
|
|
1240
2119
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1241
2120
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1242
2121
|
measuredValue,
|
|
@@ -1249,3 +2128,4 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1249
2128
|
return this;
|
|
1250
2129
|
}
|
|
1251
2130
|
}
|
|
2131
|
+
//# sourceMappingURL=matterbridgeEndpoint.js.map
|