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