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