matterbridge 2.1.1 → 2.1.2-dev.3
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 +17 -0
- package/dist/cli.js +0 -26
- package/dist/cluster/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -23
- package/dist/deviceManager.js +3 -29
- package/dist/frontend.js +51 -245
- package/dist/index.js +0 -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 +1 -2
- package/dist/matter/types.js +0 -2
- package/dist/matterbridge.js +38 -752
- package/dist/matterbridgeAccessoryPlatform.js +0 -33
- package/dist/matterbridgeBehaviors.js +1 -32
- package/dist/matterbridgeDeviceTypes.js +11 -112
- package/dist/matterbridgeDynamicPlatform.js +0 -33
- package/dist/matterbridgeEndpoint.js +6 -690
- package/dist/matterbridgeEndpointHelpers.js +0 -96
- package/dist/matterbridgePlatform.js +9 -129
- package/dist/matterbridgeTypes.js +0 -24
- package/dist/pluginManager.js +5 -243
- package/dist/storage/export.js +0 -1
- package/dist/utils/colorUtils.js +2 -205
- package/dist/utils/export.js +0 -1
- package/dist/utils/utils.js +7 -251
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -2
- package/dist/cli.d.ts +0 -25
- 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 -46
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/frontend.d.ts +0 -109
- 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 -4
- 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 -409
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -39
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -1056
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -177
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -39
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -834
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -2262
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -164
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -165
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -238
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.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/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/export.d.ts +0 -3
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/utils.d.ts +0 -221
- package/dist/utils/utils.d.ts.map +0 -1
- package/dist/utils/utils.js.map +0 -1
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
|
|
3
|
-
*
|
|
4
|
-
* @file matterbridgeEndpoint.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2024-10-01
|
|
7
|
-
* @version 2.0.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2024, 2025, 2026 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License. *
|
|
22
|
-
*/
|
|
23
|
-
// AnsiLogger module
|
|
24
1
|
import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, zb } from './logger/export.js';
|
|
25
|
-
// Matterbridge
|
|
26
2
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
27
3
|
import { isValidNumber, isValidObject } from './utils/utils.js';
|
|
28
4
|
import { MatterbridgeBehavior, MatterbridgeBehaviorDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, } from './matterbridgeBehaviors.js';
|
|
29
5
|
import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, capitalizeFirstLetter, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, } from './matterbridgeEndpointHelpers.js';
|
|
30
|
-
// @matter
|
|
31
6
|
import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, VendorId } from '@matter/main';
|
|
32
7
|
import { getClusterNameById, MeasurementType } from '@matter/main/types';
|
|
33
|
-
// @matter clusters
|
|
34
8
|
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
35
9
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
36
10
|
import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
|
|
@@ -52,7 +26,6 @@ import { ElectricalPowerMeasurement } from '@matter/main/clusters/electrical-pow
|
|
|
52
26
|
import { ElectricalEnergyMeasurement } from '@matter/main/clusters/electrical-energy-measurement';
|
|
53
27
|
import { AirQuality } from '@matter/main/clusters/air-quality';
|
|
54
28
|
import { ConcentrationMeasurement } from '@matter/main/clusters/concentration-measurement';
|
|
55
|
-
// @matter behaviors
|
|
56
29
|
import { DescriptorServer } from '@matter/main/behaviors/descriptor';
|
|
57
30
|
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
58
31
|
import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
|
|
@@ -83,7 +56,7 @@ import { RadonConcentrationMeasurementServer } from '@matter/main/behaviors/rado
|
|
|
83
56
|
import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/main/behaviors/total-volatile-organic-compounds-concentration-measurement';
|
|
84
57
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
85
58
|
static bridgeMode = '';
|
|
86
|
-
static logLevel = "info"
|
|
59
|
+
static logLevel = "info";
|
|
87
60
|
log;
|
|
88
61
|
plugin = undefined;
|
|
89
62
|
configUrl = undefined;
|
|
@@ -99,25 +72,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
99
72
|
hardwareVersion = undefined;
|
|
100
73
|
hardwareVersionString = undefined;
|
|
101
74
|
productUrl = 'https://www.npmjs.com/package/matterbridge';
|
|
102
|
-
// The first device type of the endpoint
|
|
103
75
|
name = undefined;
|
|
104
76
|
deviceType;
|
|
105
77
|
uniqueStorageKey = undefined;
|
|
106
78
|
tagList = undefined;
|
|
107
|
-
// Maps matter deviceTypes
|
|
108
79
|
deviceTypes = new Map();
|
|
109
|
-
// Command handler
|
|
110
80
|
commandHandler = new NamedHandler();
|
|
111
|
-
/**
|
|
112
|
-
* Represents a MatterbridgeEndpoint.
|
|
113
|
-
* @constructor
|
|
114
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
|
|
115
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
116
|
-
* @param {boolean} [debug=false] - Debug flag.
|
|
117
|
-
*/
|
|
118
81
|
constructor(definition, options = {}, debug = false) {
|
|
119
82
|
let deviceTypeList = [];
|
|
120
|
-
// Get the first DeviceTypeDefinition
|
|
121
83
|
let firstDefinition;
|
|
122
84
|
if (Array.isArray(definition)) {
|
|
123
85
|
firstDefinition = definition[0];
|
|
@@ -130,7 +92,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
130
92
|
firstDefinition = definition;
|
|
131
93
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
132
94
|
}
|
|
133
|
-
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
134
95
|
const deviceTypeDefinitionV8 = {
|
|
135
96
|
name: firstDefinition.name.replace('-', '_'),
|
|
136
97
|
deviceType: firstDefinition.code,
|
|
@@ -149,7 +110,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
149
110
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
150
111
|
};
|
|
151
112
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
152
|
-
// Convert the options to an Endpoint.Options
|
|
153
113
|
const optionsV8 = {
|
|
154
114
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
155
115
|
number: options.endpointId,
|
|
@@ -167,41 +127,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
167
127
|
}
|
|
168
128
|
else
|
|
169
129
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
170
|
-
|
|
171
|
-
// console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
|
|
172
|
-
// console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
|
|
173
|
-
// Create the logger
|
|
174
|
-
this.log = new AnsiLogger({ logName: 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
|
|
130
|
+
this.log = new AnsiLogger({ logName: 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
|
|
175
131
|
this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
|
|
176
132
|
`id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
|
|
177
|
-
// Add MatterbridgeBehavior with MatterbridgeBehaviorDevice
|
|
178
133
|
this.behaviors.require(MatterbridgeBehavior, { deviceCommand: new MatterbridgeBehaviorDevice(this.log, this.commandHandler, undefined) });
|
|
179
134
|
}
|
|
180
|
-
/**
|
|
181
|
-
* Loads an instance of the MatterbridgeEndpoint class.
|
|
182
|
-
*
|
|
183
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
|
|
184
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
185
|
-
* @param {boolean} [debug=false] - Debug flag.
|
|
186
|
-
* @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
|
|
187
|
-
*/
|
|
188
135
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
189
136
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
190
137
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Get all the device types of this endpoint.
|
|
193
|
-
*
|
|
194
|
-
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
|
|
195
|
-
*/
|
|
196
138
|
getDeviceTypes() {
|
|
197
139
|
return Array.from(this.deviceTypes.values());
|
|
198
140
|
}
|
|
199
|
-
/**
|
|
200
|
-
* Checks if the provided cluster server is supported by this endpoint.
|
|
201
|
-
*
|
|
202
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
203
|
-
* @returns {boolean} True if the cluster server is supported, false otherwise.
|
|
204
|
-
*/
|
|
205
141
|
hasClusterServer(cluster) {
|
|
206
142
|
const behavior = getBehavior(this, cluster);
|
|
207
143
|
if (behavior)
|
|
@@ -209,13 +145,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
209
145
|
else
|
|
210
146
|
return false;
|
|
211
147
|
}
|
|
212
|
-
/**
|
|
213
|
-
* Checks if the provided attribute server is supported for a given cluster of this endpoint.
|
|
214
|
-
*
|
|
215
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
216
|
-
* @param {string} attribute - The attribute name to check.
|
|
217
|
-
* @returns {boolean} True if the attribute server is supported, false otherwise.
|
|
218
|
-
*/
|
|
219
148
|
hasAttributeServer(cluster, attribute) {
|
|
220
149
|
const behavior = getBehavior(this, cluster);
|
|
221
150
|
if (!behavior || !this.behaviors.supported[behavior.id])
|
|
@@ -224,71 +153,26 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
224
153
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
225
154
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
226
155
|
}
|
|
227
|
-
/**
|
|
228
|
-
* Retrieves the initial options for the provided cluster server.
|
|
229
|
-
*
|
|
230
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
|
|
231
|
-
* @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.
|
|
232
|
-
*/
|
|
233
156
|
getClusterServerOptions(cluster) {
|
|
234
157
|
const behavior = getBehavior(this, cluster);
|
|
235
158
|
if (!behavior)
|
|
236
159
|
return undefined;
|
|
237
160
|
return this.behaviors.optionsFor(behavior);
|
|
238
161
|
}
|
|
239
|
-
/**
|
|
240
|
-
* Retrieves the value of the provided attribute from the given cluster.
|
|
241
|
-
*
|
|
242
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
243
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
244
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
245
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
246
|
-
*/
|
|
247
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
248
162
|
getAttribute(cluster, attribute, log) {
|
|
249
163
|
return getAttribute(this, cluster, attribute, log);
|
|
250
164
|
}
|
|
251
|
-
/**
|
|
252
|
-
* Sets the value of an attribute on a cluster server.
|
|
253
|
-
*
|
|
254
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
|
|
255
|
-
* @param {string} attribute - The name of the attribute.
|
|
256
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
257
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
258
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
259
|
-
*/
|
|
260
165
|
async setAttribute(clusterId, attribute, value, log) {
|
|
261
166
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
262
167
|
}
|
|
263
|
-
/**
|
|
264
|
-
* Update the value of an attribute on a cluster server only if the value is different.
|
|
265
|
-
*
|
|
266
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
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 the update. Errors are logged to the endpoint logger.
|
|
270
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
271
|
-
*/
|
|
272
168
|
async updateAttribute(cluster, attribute, value, log) {
|
|
273
169
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
274
170
|
}
|
|
275
|
-
/**
|
|
276
|
-
* Subscribes to the provided attribute on a cluster.
|
|
277
|
-
*
|
|
278
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
279
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
280
|
-
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
281
|
-
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
282
|
-
* @returns {boolean} - A boolean indicating whether the subscription was successful.
|
|
283
|
-
*/
|
|
284
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
285
171
|
async subscribeAttribute(clusterId, attribute, listener, log) {
|
|
286
172
|
const clusterName = lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
287
173
|
if (this.construction.status !== Lifecycle.Status.Active) {
|
|
288
|
-
// this.log.error(`subscribeAttribute ${hk}${clusterName}.${attribute}${er} error: Endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
289
174
|
await this.construction.ready;
|
|
290
175
|
}
|
|
291
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
292
176
|
const events = this.events;
|
|
293
177
|
if (!(clusterName in events)) {
|
|
294
178
|
this.log.error(`subscribeAttribute ${hk}${attribute}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${this.maybeId}${er}:${or}${this.maybeNumber}${er}`);
|
|
@@ -303,157 +187,68 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
303
187
|
log?.info(`${db}Subscribed endpoint ${or}${this.id}${db}:${or}${this.number}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
|
|
304
188
|
return true;
|
|
305
189
|
}
|
|
306
|
-
/**
|
|
307
|
-
* Triggers an event on the specified cluster.
|
|
308
|
-
*
|
|
309
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
310
|
-
* @param {string} event - The name of the event to trigger.
|
|
311
|
-
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
312
|
-
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
313
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
314
|
-
*/
|
|
315
190
|
async triggerEvent(clusterId, event, payload, log) {
|
|
316
191
|
const clusterName = lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
317
192
|
if (this.construction.status !== Lifecycle.Status.Active) {
|
|
318
193
|
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`);
|
|
319
194
|
return false;
|
|
320
195
|
}
|
|
321
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
322
196
|
const events = this.events;
|
|
323
197
|
if (!(clusterName in events) || !(event in events[clusterName])) {
|
|
324
198
|
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}`);
|
|
325
199
|
return false;
|
|
326
200
|
}
|
|
327
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
328
|
-
// @ts-ignore
|
|
329
201
|
await this.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
|
|
330
202
|
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} `);
|
|
331
203
|
return true;
|
|
332
204
|
}
|
|
333
|
-
/**
|
|
334
|
-
* Adds cluster servers from the provided server list.
|
|
335
|
-
*
|
|
336
|
-
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
337
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
338
|
-
*/
|
|
339
205
|
addClusterServers(serverList) {
|
|
340
206
|
addClusterServers(this, serverList);
|
|
341
207
|
}
|
|
342
|
-
/**
|
|
343
|
-
* Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
|
|
344
|
-
*
|
|
345
|
-
* @param {string} label - The label to add.
|
|
346
|
-
* @param {string} value - The value of the label.
|
|
347
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
348
|
-
*/
|
|
349
208
|
async addFixedLabel(label, value) {
|
|
350
209
|
await addFixedLabel(this, label, value);
|
|
351
210
|
return this;
|
|
352
211
|
}
|
|
353
|
-
/**
|
|
354
|
-
* Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
|
|
355
|
-
*
|
|
356
|
-
* @param {string} label - The label to add.
|
|
357
|
-
* @param {string} value - The value of the label.
|
|
358
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
359
|
-
*/
|
|
360
212
|
async addUserLabel(label, value) {
|
|
361
213
|
await addUserLabel(this, label, value);
|
|
362
214
|
return this;
|
|
363
215
|
}
|
|
364
|
-
/**
|
|
365
|
-
* Adds a command handler for the specified command.
|
|
366
|
-
*
|
|
367
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
368
|
-
* @param {HandlerFunction} handler - The handler function to execute when the command is received.
|
|
369
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
370
|
-
*/
|
|
371
216
|
addCommandHandler(command, handler) {
|
|
372
217
|
this.commandHandler.addHandler(command, handler);
|
|
373
218
|
return this;
|
|
374
219
|
}
|
|
375
|
-
/**
|
|
376
|
-
* Execute the command handler for the specified command. Mainly used in Jest tests.
|
|
377
|
-
*
|
|
378
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
|
|
379
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} request - The optional request to pass to the handler function.
|
|
380
|
-
* @returns {Promise<void>} A promise that resolves when the command handler has been executed
|
|
381
|
-
*/
|
|
382
220
|
async executeCommandHandler(command, request) {
|
|
383
221
|
await this.commandHandler.executeHandler(command, { request });
|
|
384
222
|
}
|
|
385
|
-
/**
|
|
386
|
-
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
387
|
-
*
|
|
388
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
389
|
-
*/
|
|
390
223
|
addRequiredClusterServers() {
|
|
391
224
|
addRequiredClusterServers(this);
|
|
392
225
|
return this;
|
|
393
226
|
}
|
|
394
|
-
/**
|
|
395
|
-
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
396
|
-
*
|
|
397
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
398
|
-
*/
|
|
399
227
|
addOptionalClusterServers() {
|
|
400
228
|
addOptionalClusterServers(this);
|
|
401
229
|
return this;
|
|
402
230
|
}
|
|
403
|
-
/**
|
|
404
|
-
* Retrieves all cluster servers.
|
|
405
|
-
*
|
|
406
|
-
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
407
|
-
*/
|
|
408
231
|
getAllClusterServers() {
|
|
409
232
|
return Object.values(this.behaviors.supported);
|
|
410
233
|
}
|
|
411
|
-
/**
|
|
412
|
-
* Retrieves the names of all cluster servers.
|
|
413
|
-
*
|
|
414
|
-
* @returns {string[]} An array of all cluster server names.
|
|
415
|
-
*/
|
|
416
234
|
getAllClusterServerNames() {
|
|
417
235
|
return Object.keys(this.behaviors.supported);
|
|
418
236
|
}
|
|
419
|
-
/**
|
|
420
|
-
* Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
|
|
421
|
-
*
|
|
422
|
-
* @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
|
|
423
|
-
*/
|
|
424
237
|
forEachAttribute(callback) {
|
|
425
238
|
for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
|
|
426
239
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
427
240
|
const clusterId = getClusterId(this, clusterName);
|
|
428
241
|
if (clusterId === undefined) {
|
|
429
|
-
// this.log.error(`forEachAttribute error: cluster ${clusterName} not found`);
|
|
430
242
|
continue;
|
|
431
243
|
}
|
|
432
244
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
433
245
|
if (attributeId === undefined) {
|
|
434
|
-
// this.log.error(`forEachAttribute error: attribute ${clusterName}.${attributeName} not found`);
|
|
435
246
|
continue;
|
|
436
247
|
}
|
|
437
248
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
438
249
|
}
|
|
439
250
|
}
|
|
440
251
|
}
|
|
441
|
-
/**
|
|
442
|
-
* Adds a child endpoint with the specified device types and options.
|
|
443
|
-
* If the child endpoint is not already present, it will be created and added.
|
|
444
|
-
* If the child endpoint is already present, the device types will be added to the existing child endpoint.
|
|
445
|
-
*
|
|
446
|
-
* @param {string} endpointName - The name of the new endpoint to add.
|
|
447
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
448
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
|
|
449
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
450
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
451
|
-
*
|
|
452
|
-
* @example
|
|
453
|
-
* ```typescript
|
|
454
|
-
* const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
455
|
-
* ```
|
|
456
|
-
*/
|
|
457
252
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
458
253
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
459
254
|
let alreadyAdded = false;
|
|
@@ -493,23 +288,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
493
288
|
}
|
|
494
289
|
return child;
|
|
495
290
|
}
|
|
496
|
-
/**
|
|
497
|
-
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
498
|
-
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
499
|
-
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
500
|
-
*
|
|
501
|
-
* @param {string} endpointName - The name of the new enpoint to add.
|
|
502
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
503
|
-
* @param {ClusterId[]} [serverList=[]] - The list of cluster IDs to include.
|
|
504
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
505
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
506
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
507
|
-
*
|
|
508
|
-
* @example
|
|
509
|
-
* ```typescript
|
|
510
|
-
* const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
511
|
-
* ```
|
|
512
|
-
*/
|
|
513
291
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
514
292
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
515
293
|
let alreadyAdded = false;
|
|
@@ -572,38 +350,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
572
350
|
}
|
|
573
351
|
return child;
|
|
574
352
|
}
|
|
575
|
-
/**
|
|
576
|
-
* Retrieves a child endpoint by its name.
|
|
577
|
-
*
|
|
578
|
-
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
579
|
-
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
580
|
-
*/
|
|
581
353
|
getChildEndpointByName(endpointName) {
|
|
582
354
|
return this.parts.find((part) => part.id === endpointName);
|
|
583
355
|
}
|
|
584
|
-
/**
|
|
585
|
-
* Retrieves a child endpoint by its EndpointNumber.
|
|
586
|
-
*
|
|
587
|
-
* @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
|
|
588
|
-
* @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
|
|
589
|
-
*/
|
|
590
356
|
getChildEndpoint(endpointNumber) {
|
|
591
357
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
592
358
|
}
|
|
593
|
-
/**
|
|
594
|
-
* Get all the child endpoints of this endpoint.
|
|
595
|
-
*
|
|
596
|
-
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
597
|
-
*/
|
|
598
359
|
getChildEndpoints() {
|
|
599
360
|
return Array.from(this.parts);
|
|
600
361
|
}
|
|
601
|
-
/**
|
|
602
|
-
* Serializes the Matterbridge device into a serialized object.
|
|
603
|
-
*
|
|
604
|
-
* @param pluginName - The name of the plugin.
|
|
605
|
-
* @returns The serialized Matterbridge device object.
|
|
606
|
-
*/
|
|
607
362
|
static serialize(device) {
|
|
608
363
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId)
|
|
609
364
|
return;
|
|
@@ -626,15 +381,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
626
381
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
627
382
|
if (behaviorName === 'powerSource')
|
|
628
383
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
629
|
-
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
630
384
|
});
|
|
631
385
|
return serialized;
|
|
632
386
|
}
|
|
633
|
-
/**
|
|
634
|
-
* Deserializes the device into a serialized object.
|
|
635
|
-
*
|
|
636
|
-
* @returns The deserialized MatterbridgeDevice.
|
|
637
|
-
*/
|
|
638
387
|
static deserialize(serializedDevice) {
|
|
639
388
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
|
|
640
389
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -650,16 +399,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
650
399
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
651
400
|
else if (clusterId === PowerSource.Cluster.id)
|
|
652
401
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
653
|
-
// else addClusterServerFromList(device, [clusterId]);
|
|
654
402
|
}
|
|
655
403
|
return device;
|
|
656
404
|
}
|
|
657
|
-
/**
|
|
658
|
-
* Creates a default power source wired cluster server.
|
|
659
|
-
*
|
|
660
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
661
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
662
|
-
*/
|
|
663
405
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
664
406
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
|
|
665
407
|
wiredCurrentType,
|
|
@@ -670,16 +412,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
670
412
|
});
|
|
671
413
|
return this;
|
|
672
414
|
}
|
|
673
|
-
/**
|
|
674
|
-
* Creates a default power source replaceable battery cluster server.
|
|
675
|
-
*
|
|
676
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
677
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
678
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
679
|
-
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
680
|
-
* @param batQuantity - The battery quantity (default: 1).
|
|
681
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
682
|
-
*/
|
|
683
415
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
684
416
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
685
417
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -697,14 +429,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
697
429
|
});
|
|
698
430
|
return this;
|
|
699
431
|
}
|
|
700
|
-
/**
|
|
701
|
-
* Creates a default power source rechargeable battery cluster server.
|
|
702
|
-
*
|
|
703
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
704
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
705
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
706
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
707
|
-
*/
|
|
708
432
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
709
433
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
710
434
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -723,21 +447,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
723
447
|
});
|
|
724
448
|
return this;
|
|
725
449
|
}
|
|
726
|
-
/**
|
|
727
|
-
* Creates a default Basic Information Cluster Server for the server node.
|
|
728
|
-
*
|
|
729
|
-
* @param deviceName - The name of the device.
|
|
730
|
-
* @param serialNumber - The serial number of the device.
|
|
731
|
-
* @param vendorId - The vendor ID of the device.
|
|
732
|
-
* @param vendorName - The vendor name of the device.
|
|
733
|
-
* @param productId - The product ID of the device.
|
|
734
|
-
* @param productName - The product name of the device.
|
|
735
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
736
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
737
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
738
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
739
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
740
|
-
*/
|
|
741
450
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
742
451
|
this.log.logName = deviceName;
|
|
743
452
|
this.deviceName = deviceName;
|
|
@@ -761,20 +470,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
761
470
|
}
|
|
762
471
|
return this;
|
|
763
472
|
}
|
|
764
|
-
/**
|
|
765
|
-
* Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
|
|
766
|
-
*
|
|
767
|
-
* @param deviceName - The name of the device.
|
|
768
|
-
* @param serialNumber - The serial number of the device.
|
|
769
|
-
* @param vendorId - The vendor ID of the device.
|
|
770
|
-
* @param vendorName - The name of the vendor.
|
|
771
|
-
* @param productName - The name of the product.
|
|
772
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
773
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
774
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
775
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
776
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
777
|
-
*/
|
|
778
473
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
779
474
|
this.log.logName = deviceName;
|
|
780
475
|
this.deviceName = deviceName;
|
|
@@ -791,7 +486,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
791
486
|
this.behaviors.require(BridgedDeviceBasicInformationServer.enable({
|
|
792
487
|
events: { leave: true, reachableChanged: true },
|
|
793
488
|
}), {
|
|
794
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
489
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
795
490
|
vendorName: vendorName.slice(0, 32),
|
|
796
491
|
productName: productName.slice(0, 32),
|
|
797
492
|
productUrl: this.productUrl,
|
|
@@ -807,13 +502,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
807
502
|
});
|
|
808
503
|
return this;
|
|
809
504
|
}
|
|
810
|
-
/**
|
|
811
|
-
* Creates a default identify cluster server with the specified identify time and type.
|
|
812
|
-
*
|
|
813
|
-
* @param {number} [identifyTime=0] - The time to identify the server. Defaults to 0.
|
|
814
|
-
* @param {Identify.IdentifyType} [identifyType=Identify.IdentifyType.None] - The type of identification. Defaults to Identify.IdentifyType.None.
|
|
815
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
816
|
-
*/
|
|
817
505
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
818
506
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
819
507
|
identifyTime,
|
|
@@ -821,32 +509,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
821
509
|
});
|
|
822
510
|
return this;
|
|
823
511
|
}
|
|
824
|
-
/**
|
|
825
|
-
* Creates a default groups cluster server.
|
|
826
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
827
|
-
*/
|
|
828
512
|
createDefaultGroupsClusterServer() {
|
|
829
513
|
this.behaviors.require(GroupsServer);
|
|
830
514
|
return this;
|
|
831
515
|
}
|
|
832
|
-
/**
|
|
833
|
-
* Creates a default scenes management cluster server.
|
|
834
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
835
|
-
*/
|
|
836
516
|
createDefaultScenesClusterServer() {
|
|
837
517
|
this.behaviors.require(ScenesManagementServer);
|
|
838
518
|
return this;
|
|
839
519
|
}
|
|
840
|
-
/**
|
|
841
|
-
* Creates a default OnOff cluster server for light devices.
|
|
842
|
-
*
|
|
843
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
844
|
-
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
845
|
-
* @param {number} [onTime=0] - The on time value.
|
|
846
|
-
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
847
|
-
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
848
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
849
|
-
*/
|
|
850
520
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
851
521
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
852
522
|
onOff,
|
|
@@ -857,40 +527,18 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
857
527
|
});
|
|
858
528
|
return this;
|
|
859
529
|
}
|
|
860
|
-
/**
|
|
861
|
-
* Creates an OnOff cluster server without features.
|
|
862
|
-
*
|
|
863
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
864
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
865
|
-
*/
|
|
866
530
|
createOnOffClusterServer(onOff = false) {
|
|
867
531
|
this.behaviors.require(MatterbridgeOnOffServer, {
|
|
868
532
|
onOff,
|
|
869
533
|
});
|
|
870
534
|
return this;
|
|
871
535
|
}
|
|
872
|
-
/**
|
|
873
|
-
* Creates a DeadFront OnOff cluster server.
|
|
874
|
-
*
|
|
875
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
876
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
877
|
-
*/
|
|
878
536
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
879
537
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
880
538
|
onOff,
|
|
881
539
|
});
|
|
882
540
|
return this;
|
|
883
541
|
}
|
|
884
|
-
/**
|
|
885
|
-
* Creates a default level control cluster server for light devices.
|
|
886
|
-
*
|
|
887
|
-
* @param {number} [currentLevel=254] - The current level (default: 254).
|
|
888
|
-
* @param {number} [minLevel=1] - The minimum level (default: 1).
|
|
889
|
-
* @param {number} [maxLevel=254] - The maximum level (default: 254).
|
|
890
|
-
* @param {number | null} [onLevel=null] - The on level (default: null).
|
|
891
|
-
* @param {number | null} [startUpCurrentLevel=null] - The startUp on level (default: null).
|
|
892
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
893
|
-
*/
|
|
894
542
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
895
543
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
896
544
|
currentLevel,
|
|
@@ -906,18 +554,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
906
554
|
});
|
|
907
555
|
return this;
|
|
908
556
|
}
|
|
909
|
-
/**
|
|
910
|
-
* Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
911
|
-
*
|
|
912
|
-
* @param currentX - The current X value.
|
|
913
|
-
* @param currentY - The current Y value.
|
|
914
|
-
* @param currentHue - The current hue value.
|
|
915
|
-
* @param currentSaturation - The current saturation value.
|
|
916
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
917
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
918
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
919
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
920
|
-
*/
|
|
921
557
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
922
558
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
923
559
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -940,19 +576,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
940
576
|
});
|
|
941
577
|
return this;
|
|
942
578
|
}
|
|
943
|
-
/**
|
|
944
|
-
* Creates a Xy color control cluster server with Xy and ColorTemperature.
|
|
945
|
-
*
|
|
946
|
-
* @param currentX - The current X value.
|
|
947
|
-
* @param currentY - The current Y value.
|
|
948
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
949
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
950
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
951
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
952
|
-
*
|
|
953
|
-
* @remarks
|
|
954
|
-
* From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
|
|
955
|
-
*/
|
|
956
579
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
957
580
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
958
581
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -973,16 +596,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
973
596
|
});
|
|
974
597
|
return this;
|
|
975
598
|
}
|
|
976
|
-
/**
|
|
977
|
-
* Creates a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
|
|
978
|
-
*
|
|
979
|
-
* @param currentHue - The current hue value.
|
|
980
|
-
* @param currentSaturation - The current saturation value.
|
|
981
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
982
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
983
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
984
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
985
|
-
*/
|
|
986
599
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
987
600
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
988
601
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1003,14 +616,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1003
616
|
});
|
|
1004
617
|
return this;
|
|
1005
618
|
}
|
|
1006
|
-
/**
|
|
1007
|
-
* Creates a color temperature color control cluster server.
|
|
1008
|
-
*
|
|
1009
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1010
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1011
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1012
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1013
|
-
*/
|
|
1014
619
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1015
620
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
1016
621
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1029,23 +634,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1029
634
|
});
|
|
1030
635
|
return this;
|
|
1031
636
|
}
|
|
1032
|
-
/**
|
|
1033
|
-
* Configures the color control mode for the device.
|
|
1034
|
-
*
|
|
1035
|
-
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1036
|
-
*/
|
|
1037
637
|
async configureColorControlMode(colorMode) {
|
|
1038
638
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
1039
639
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
1040
640
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
1041
641
|
}
|
|
1042
642
|
}
|
|
1043
|
-
/**
|
|
1044
|
-
* Creates a default window covering cluster server (Lift and PositionAwareLift).
|
|
1045
|
-
*
|
|
1046
|
-
* @param positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1047
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1048
|
-
*/
|
|
1049
643
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1050
644
|
this.behaviors.require(MatterbridgeWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1051
645
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
@@ -1061,15 +655,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1061
655
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1062
656
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
1063
657
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1064
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1065
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
658
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
659
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1066
660
|
});
|
|
1067
661
|
return this;
|
|
1068
662
|
}
|
|
1069
|
-
/**
|
|
1070
|
-
* Sets the window covering target position as the current position and stops the movement.
|
|
1071
|
-
*
|
|
1072
|
-
*/
|
|
1073
663
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
1074
664
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
1075
665
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -1082,12 +672,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1082
672
|
}
|
|
1083
673
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1084
674
|
}
|
|
1085
|
-
/**
|
|
1086
|
-
* Sets the current and target status of a window covering.
|
|
1087
|
-
* @param {number} current - The current position of the window covering.
|
|
1088
|
-
* @param {number} target - The target position of the window covering.
|
|
1089
|
-
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1090
|
-
*/
|
|
1091
675
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
1092
676
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
1093
677
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -1098,10 +682,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1098
682
|
}, this.log);
|
|
1099
683
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1100
684
|
}
|
|
1101
|
-
/**
|
|
1102
|
-
* Sets the status of the window covering.
|
|
1103
|
-
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1104
|
-
*/
|
|
1105
685
|
async setWindowCoveringStatus(status) {
|
|
1106
686
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
1107
687
|
global: status,
|
|
@@ -1110,11 +690,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1110
690
|
}, this.log);
|
|
1111
691
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1112
692
|
}
|
|
1113
|
-
/**
|
|
1114
|
-
* Retrieves the status of the window covering.
|
|
1115
|
-
*
|
|
1116
|
-
* @returns The global operational status of the window covering or undefined.
|
|
1117
|
-
*/
|
|
1118
693
|
getWindowCoveringStatus() {
|
|
1119
694
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
1120
695
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -1122,66 +697,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1122
697
|
return status.global;
|
|
1123
698
|
}
|
|
1124
699
|
}
|
|
1125
|
-
/**
|
|
1126
|
-
* Sets the target and current position of the window covering.
|
|
1127
|
-
*
|
|
1128
|
-
* @param position - The position to set, specified as a number.
|
|
1129
|
-
*/
|
|
1130
700
|
async setWindowCoveringTargetAndCurrentPosition(position) {
|
|
1131
701
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', position, this.log);
|
|
1132
702
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', position, this.log);
|
|
1133
703
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
1134
704
|
}
|
|
1135
|
-
/**
|
|
1136
|
-
* Creates a default thermostat cluster server with Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode.
|
|
1137
|
-
*
|
|
1138
|
-
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1139
|
-
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1140
|
-
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1141
|
-
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
1142
|
-
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1143
|
-
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1144
|
-
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1145
|
-
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1146
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1147
|
-
*/
|
|
1148
705
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1149
706
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1150
707
|
localTemperature: localTemperature * 100,
|
|
1151
708
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1152
709
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1153
|
-
// Thermostat.Feature.Heating
|
|
1154
710
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1155
711
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1156
712
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1157
713
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1158
714
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1159
|
-
// Thermostat.Feature.Cooling
|
|
1160
715
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1161
716
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1162
717
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1163
718
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1164
719
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1165
|
-
// Thermostat.Feature.AutoMode
|
|
1166
720
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1167
721
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1168
722
|
});
|
|
1169
723
|
return this;
|
|
1170
724
|
}
|
|
1171
|
-
/**
|
|
1172
|
-
* Creates a default heating thermostat cluster server with Thermostat.Feature.Heating.
|
|
1173
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1174
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1175
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1176
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1177
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1178
|
-
*/
|
|
1179
725
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1180
726
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
|
|
1181
727
|
localTemperature: localTemperature * 100,
|
|
1182
728
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1183
729
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1184
|
-
// Thermostat.Feature.Heating
|
|
1185
730
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1186
731
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1187
732
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1190,20 +735,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1190
735
|
});
|
|
1191
736
|
return this;
|
|
1192
737
|
}
|
|
1193
|
-
/**
|
|
1194
|
-
* Creates a default cooling thermostat cluster server with Thermostat.Feature.Cooling.
|
|
1195
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1196
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1197
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1198
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1199
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1200
|
-
*/
|
|
1201
738
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1202
739
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
|
|
1203
740
|
localTemperature: localTemperature * 100,
|
|
1204
741
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1205
742
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1206
|
-
// Thermostat.Feature.Cooling
|
|
1207
743
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1208
744
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1209
745
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -1212,12 +748,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1212
748
|
});
|
|
1213
749
|
return this;
|
|
1214
750
|
}
|
|
1215
|
-
/**
|
|
1216
|
-
* Creates a default fan control cluster server.
|
|
1217
|
-
*
|
|
1218
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1219
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1220
|
-
*/
|
|
1221
751
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1222
752
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1223
753
|
fanMode,
|
|
@@ -1230,13 +760,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1230
760
|
});
|
|
1231
761
|
return this;
|
|
1232
762
|
}
|
|
1233
|
-
/**
|
|
1234
|
-
* Creates a default door lock cluster server.
|
|
1235
|
-
*
|
|
1236
|
-
* @param {DoorLock.LockState} [lockState=DoorLock.LockState.Locked] - The initial state of the lock (default: Locked).
|
|
1237
|
-
* @param {DoorLock.LockType} [lockType=DoorLock.LockType.DeadBolt] - The type of the lock (default: DeadBolt).
|
|
1238
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1239
|
-
*/
|
|
1240
763
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1241
764
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
1242
765
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
@@ -1247,18 +770,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1247
770
|
});
|
|
1248
771
|
return this;
|
|
1249
772
|
}
|
|
1250
|
-
/**
|
|
1251
|
-
* Creates a default Mode Select cluster server.
|
|
1252
|
-
*
|
|
1253
|
-
* @param {string} description - The description of the mode select cluster.
|
|
1254
|
-
* @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
|
|
1255
|
-
* @param {number} [currentMode=0] - The current mode (default: 0).
|
|
1256
|
-
* @param {number} [startUpMode=0] - The startup mode (default: 0).
|
|
1257
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1258
|
-
*
|
|
1259
|
-
* @remarks
|
|
1260
|
-
* endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
|
|
1261
|
-
*/
|
|
1262
773
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1263
774
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
1264
775
|
description: description,
|
|
@@ -1269,13 +780,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1269
780
|
});
|
|
1270
781
|
return this;
|
|
1271
782
|
}
|
|
1272
|
-
/**
|
|
1273
|
-
* Creates the default Valve Configuration And Control cluster server.
|
|
1274
|
-
*
|
|
1275
|
-
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
1276
|
-
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
1277
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1278
|
-
*/
|
|
1279
783
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
1280
784
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
1281
785
|
currentState: valveState,
|
|
@@ -1288,12 +792,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1288
792
|
});
|
|
1289
793
|
return this;
|
|
1290
794
|
}
|
|
1291
|
-
/**
|
|
1292
|
-
* Creates the default PumpConfigurationAndControl cluster server.
|
|
1293
|
-
*
|
|
1294
|
-
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
1295
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1296
|
-
*/
|
|
1297
795
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1298
796
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
1299
797
|
minConstSpeed: null,
|
|
@@ -1308,13 +806,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1308
806
|
});
|
|
1309
807
|
return this;
|
|
1310
808
|
}
|
|
1311
|
-
/**
|
|
1312
|
-
* Creates the default SmokeCOAlarm Cluster Server.
|
|
1313
|
-
*
|
|
1314
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1315
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1316
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1317
|
-
*/
|
|
1318
809
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1319
810
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1320
811
|
events: { smokeAlarm: true, interconnectSmokeAlarm: true, coAlarm: true, interconnectCoAlarm: true, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1332,13 +823,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1332
823
|
});
|
|
1333
824
|
return this;
|
|
1334
825
|
}
|
|
1335
|
-
/**
|
|
1336
|
-
* Creates a default momentary switch cluster server.
|
|
1337
|
-
*
|
|
1338
|
-
* @remarks
|
|
1339
|
-
* This method adds a cluster server with default momentary switch features and configurations suitable for (AppleHome) Single Double Long automations.
|
|
1340
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1341
|
-
*/
|
|
1342
826
|
createDefaultSwitchClusterServer() {
|
|
1343
827
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
1344
828
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -1349,12 +833,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1349
833
|
});
|
|
1350
834
|
return this;
|
|
1351
835
|
}
|
|
1352
|
-
/**
|
|
1353
|
-
* Creates a default latching switch cluster server.
|
|
1354
|
-
*
|
|
1355
|
-
* @remarks
|
|
1356
|
-
* This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
|
|
1357
|
-
*/
|
|
1358
836
|
createDefaultLatchingSwitchClusterServer() {
|
|
1359
837
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
1360
838
|
events: { switchLatched: true },
|
|
@@ -1364,13 +842,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1364
842
|
});
|
|
1365
843
|
return this;
|
|
1366
844
|
}
|
|
1367
|
-
/**
|
|
1368
|
-
* Triggers a switch event on the specified endpoint.
|
|
1369
|
-
*
|
|
1370
|
-
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1371
|
-
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1372
|
-
* @returns {boolean} - A boolean indicating whether the event was successfully triggered.
|
|
1373
|
-
*/
|
|
1374
845
|
async triggerSwitchEvent(event, log) {
|
|
1375
846
|
if (this.maybeNumber === undefined) {
|
|
1376
847
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1430,31 +901,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1430
901
|
}
|
|
1431
902
|
return true;
|
|
1432
903
|
}
|
|
1433
|
-
/**
|
|
1434
|
-
* Creates a default boolean state cluster server.
|
|
1435
|
-
*
|
|
1436
|
-
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
|
|
1437
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1438
|
-
*/
|
|
1439
904
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1440
905
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1441
906
|
events: { stateChange: true },
|
|
1442
907
|
}), {
|
|
1443
|
-
stateValue: contact ?? true,
|
|
908
|
+
stateValue: contact ?? true,
|
|
1444
909
|
});
|
|
1445
910
|
return this;
|
|
1446
911
|
}
|
|
1447
|
-
/**
|
|
1448
|
-
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
|
|
1449
|
-
*
|
|
1450
|
-
* @remarks Supports the enableDisableAlarm command.
|
|
1451
|
-
*
|
|
1452
|
-
* @param {boolean} [sensorFault=false] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1453
|
-
* @param {number} [currentSensitivityLevel=0] - The current sensitivity level. Defaults to `0` if not provided.
|
|
1454
|
-
* @param {number} [supportedSensitivityLevels=2] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
|
|
1455
|
-
* @param {number} [defaultSensitivityLevel=0] - The default sensitivity level. Defaults to `0` if not provided.
|
|
1456
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1457
|
-
*/
|
|
1458
912
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1459
913
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1460
914
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -1469,21 +923,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1469
923
|
});
|
|
1470
924
|
return this;
|
|
1471
925
|
}
|
|
1472
|
-
/**
|
|
1473
|
-
* Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
|
|
1474
|
-
*
|
|
1475
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1476
|
-
*/
|
|
1477
926
|
createDefaultPowerTopologyClusterServer() {
|
|
1478
927
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1479
928
|
return this;
|
|
1480
929
|
}
|
|
1481
|
-
/**
|
|
1482
|
-
* Creates a default Electrical Energy Measurement Cluster Server.
|
|
1483
|
-
*
|
|
1484
|
-
* @param {number} energy - The total consumption value in mW/h.
|
|
1485
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1486
|
-
*/
|
|
1487
930
|
createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
1488
931
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1489
932
|
accuracy: {
|
|
@@ -1499,15 +942,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1499
942
|
});
|
|
1500
943
|
return this;
|
|
1501
944
|
}
|
|
1502
|
-
/**
|
|
1503
|
-
* Creates a default Electrical Power Measurement Cluster Server.
|
|
1504
|
-
*
|
|
1505
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
1506
|
-
* @param {number} current - The current value in milliamperes.
|
|
1507
|
-
* @param {number} power - The power value in milliwatts.
|
|
1508
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
1509
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1510
|
-
*/
|
|
1511
945
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1512
946
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1513
947
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1549,90 +983,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1549
983
|
});
|
|
1550
984
|
return this;
|
|
1551
985
|
}
|
|
1552
|
-
/**
|
|
1553
|
-
* Creates a default TemperatureMeasurement cluster server.
|
|
1554
|
-
*
|
|
1555
|
-
* @param {number} measuredValue - The measured value of the temperature x 100.
|
|
1556
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1557
|
-
*/
|
|
1558
986
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1559
987
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue));
|
|
1560
988
|
return this;
|
|
1561
989
|
}
|
|
1562
|
-
/**
|
|
1563
|
-
* Creates a default RelativeHumidityMeasurement cluster server.
|
|
1564
|
-
*
|
|
1565
|
-
* @param {number} measuredValue - The measured value of the relative humidity x 100.
|
|
1566
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1567
|
-
*/
|
|
1568
990
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1569
991
|
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
|
|
1570
992
|
return this;
|
|
1571
993
|
}
|
|
1572
|
-
/**
|
|
1573
|
-
* Creates a default PressureMeasurement cluster server.
|
|
1574
|
-
*
|
|
1575
|
-
* @param {number} measuredValue - The measured value for the pressure.
|
|
1576
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1577
|
-
*/
|
|
1578
994
|
createDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
1579
995
|
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue));
|
|
1580
996
|
return this;
|
|
1581
997
|
}
|
|
1582
|
-
/**
|
|
1583
|
-
* Creates a default IlluminanceMeasurement cluster server.
|
|
1584
|
-
*
|
|
1585
|
-
* @param {number} measuredValue - The measured value of illuminance.
|
|
1586
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1587
|
-
*
|
|
1588
|
-
* @remarks
|
|
1589
|
-
* Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
|
|
1590
|
-
* Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
|
|
1591
|
-
*/
|
|
1592
998
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
1593
999
|
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue));
|
|
1594
1000
|
return this;
|
|
1595
1001
|
}
|
|
1596
|
-
/**
|
|
1597
|
-
* Creates a default FlowMeasurement cluster server.
|
|
1598
|
-
*
|
|
1599
|
-
* @param {number} measuredValue - The measured value of the flow in 10 x m/h.
|
|
1600
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1601
|
-
*/
|
|
1602
1002
|
createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1603
1003
|
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue));
|
|
1604
1004
|
return this;
|
|
1605
1005
|
}
|
|
1606
|
-
/**
|
|
1607
|
-
* Creates a default OccupancySensing cluster server.
|
|
1608
|
-
*
|
|
1609
|
-
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1610
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1611
|
-
*/
|
|
1612
1006
|
createDefaultOccupancySensingClusterServer(occupied = false) {
|
|
1613
1007
|
this.behaviors.require(OccupancySensingServer, getDefaultOccupancySensingClusterServer(occupied));
|
|
1614
1008
|
return this;
|
|
1615
1009
|
}
|
|
1616
|
-
/**
|
|
1617
|
-
* Creates a default AirQuality cluster server.
|
|
1618
|
-
*
|
|
1619
|
-
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
1620
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1621
|
-
*/
|
|
1622
1010
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1623
1011
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1624
1012
|
airQuality,
|
|
1625
1013
|
});
|
|
1626
1014
|
return this;
|
|
1627
1015
|
}
|
|
1628
|
-
/**
|
|
1629
|
-
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server.
|
|
1630
|
-
*
|
|
1631
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1632
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1633
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1634
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1635
|
-
*/
|
|
1636
1016
|
createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1637
1017
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1638
1018
|
measuredValue,
|
|
@@ -1644,13 +1024,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1644
1024
|
});
|
|
1645
1025
|
return this;
|
|
1646
1026
|
}
|
|
1647
|
-
/**
|
|
1648
|
-
* Create a default CarbonMonoxideConcentrationMeasurement cluster server.
|
|
1649
|
-
*
|
|
1650
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1651
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1652
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1653
|
-
*/
|
|
1654
1027
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1655
1028
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1656
1029
|
measuredValue,
|
|
@@ -1662,13 +1035,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1662
1035
|
});
|
|
1663
1036
|
return this;
|
|
1664
1037
|
}
|
|
1665
|
-
/**
|
|
1666
|
-
* Create a default CarbonDioxideConcentrationMeasurement cluster server.
|
|
1667
|
-
*
|
|
1668
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1669
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1670
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1671
|
-
*/
|
|
1672
1038
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1673
1039
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1674
1040
|
measuredValue,
|
|
@@ -1680,13 +1046,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1680
1046
|
});
|
|
1681
1047
|
return this;
|
|
1682
1048
|
}
|
|
1683
|
-
/**
|
|
1684
|
-
* Create a default FormaldehydeConcentrationMeasurement cluster server.
|
|
1685
|
-
*
|
|
1686
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1687
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1688
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1689
|
-
*/
|
|
1690
1049
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1691
1050
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1692
1051
|
measuredValue,
|
|
@@ -1698,13 +1057,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1698
1057
|
});
|
|
1699
1058
|
return this;
|
|
1700
1059
|
}
|
|
1701
|
-
/**
|
|
1702
|
-
* Create a default Pm1ConcentrationMeasurement cluster server.
|
|
1703
|
-
*
|
|
1704
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1705
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1706
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1707
|
-
*/
|
|
1708
1060
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1709
1061
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1710
1062
|
measuredValue,
|
|
@@ -1716,13 +1068,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1716
1068
|
});
|
|
1717
1069
|
return this;
|
|
1718
1070
|
}
|
|
1719
|
-
/**
|
|
1720
|
-
* Create a default Pm25ConcentrationMeasurement cluster server.
|
|
1721
|
-
*
|
|
1722
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1723
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1724
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1725
|
-
*/
|
|
1726
1071
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1727
1072
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1728
1073
|
measuredValue,
|
|
@@ -1734,13 +1079,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1734
1079
|
});
|
|
1735
1080
|
return this;
|
|
1736
1081
|
}
|
|
1737
|
-
/**
|
|
1738
|
-
* Create a default Pm10ConcentrationMeasurement cluster server.
|
|
1739
|
-
*
|
|
1740
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1741
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1742
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1743
|
-
*/
|
|
1744
1082
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1745
1083
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1746
1084
|
measuredValue,
|
|
@@ -1752,13 +1090,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1752
1090
|
});
|
|
1753
1091
|
return this;
|
|
1754
1092
|
}
|
|
1755
|
-
/**
|
|
1756
|
-
* Create a default OzoneConcentrationMeasurement cluster server.
|
|
1757
|
-
*
|
|
1758
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1759
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
1760
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1761
|
-
*/
|
|
1762
1093
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1763
1094
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1764
1095
|
measuredValue,
|
|
@@ -1770,13 +1101,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1770
1101
|
});
|
|
1771
1102
|
return this;
|
|
1772
1103
|
}
|
|
1773
|
-
/**
|
|
1774
|
-
* Create a default RadonConcentrationMeasurement cluster server.
|
|
1775
|
-
*
|
|
1776
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1777
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1778
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1779
|
-
*/
|
|
1780
1104
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1781
1105
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1782
1106
|
measuredValue,
|
|
@@ -1788,13 +1112,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1788
1112
|
});
|
|
1789
1113
|
return this;
|
|
1790
1114
|
}
|
|
1791
|
-
/**
|
|
1792
|
-
* Create a default NitrogenDioxideConcentrationMeasurement cluster server.
|
|
1793
|
-
*
|
|
1794
|
-
* @param {number} measuredValue - The measured value of the concentration.
|
|
1795
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
1796
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1797
|
-
*/
|
|
1798
1115
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1799
1116
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1800
1117
|
measuredValue,
|
|
@@ -1807,4 +1124,3 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1807
1124
|
return this;
|
|
1808
1125
|
}
|
|
1809
1126
|
}
|
|
1810
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|