matterbridge 3.0.1 → 3.0.2-dev-20250509-ae61aa7
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 +26 -3
- package/README.md +2 -2
- 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 +37 -341
- 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 +107 -748
- 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 +16 -814
- package/dist/matterbridgeEndpointHelpers.js +44 -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, invokeBehaviorCommand, } 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,75 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
236
164
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
237
165
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
238
166
|
}
|
|
239
|
-
/**
|
|
240
|
-
* Retrieves the initial options for the provided cluster server.
|
|
241
|
-
*
|
|
242
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
|
|
243
|
-
* @returns {Record<string, boolean | number | bigint | string | object | null> | undefined} The options for the provided cluster server, or undefined if the cluster is not supported.
|
|
244
|
-
*/
|
|
245
167
|
getClusterServerOptions(cluster) {
|
|
246
168
|
const behavior = getBehavior(this, cluster);
|
|
247
169
|
if (!behavior)
|
|
248
170
|
return undefined;
|
|
249
171
|
return this.behaviors.optionsFor(behavior);
|
|
250
172
|
}
|
|
251
|
-
/**
|
|
252
|
-
* Retrieves the value of the provided attribute from the given cluster.
|
|
253
|
-
*
|
|
254
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
255
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
256
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
257
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
258
|
-
*/
|
|
259
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
260
173
|
getAttribute(cluster, attribute, log) {
|
|
261
174
|
return getAttribute(this, cluster, attribute, log);
|
|
262
175
|
}
|
|
263
|
-
/**
|
|
264
|
-
* Sets the value of an attribute on a cluster server.
|
|
265
|
-
*
|
|
266
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
|
|
267
|
-
* @param {string} attribute - The name of the attribute.
|
|
268
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
269
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
270
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
271
|
-
*/
|
|
272
176
|
async setAttribute(clusterId, attribute, value, log) {
|
|
273
177
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
274
178
|
}
|
|
275
|
-
/**
|
|
276
|
-
* Update the value of an attribute on a cluster server only if the value is different.
|
|
277
|
-
*
|
|
278
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
279
|
-
* @param {string} attribute - The name of the attribute.
|
|
280
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
281
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
|
|
282
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
283
|
-
*/
|
|
284
179
|
async updateAttribute(cluster, attribute, value, log) {
|
|
285
180
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
286
181
|
}
|
|
287
|
-
/**
|
|
288
|
-
* Subscribes to the provided attribute on a cluster.
|
|
289
|
-
*
|
|
290
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
|
|
291
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
292
|
-
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
293
|
-
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
294
|
-
* @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
|
|
295
|
-
*/
|
|
296
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
297
182
|
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
298
183
|
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
299
184
|
}
|
|
300
|
-
/**
|
|
301
|
-
* Triggers an event on the specified cluster.
|
|
302
|
-
*
|
|
303
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
304
|
-
* @param {string} event - The name of the event to trigger.
|
|
305
|
-
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
306
|
-
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
307
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
308
|
-
*/
|
|
309
185
|
async triggerEvent(clusterId, event, payload, log) {
|
|
310
186
|
const clusterName = lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
311
187
|
if (this.construction.status !== Lifecycle.Status.Active) {
|
|
312
188
|
this.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${this.maybeId}${er}:${or}${this.maybeNumber}${er} is in the ${BLUE}${this.construction.status}${er} state`);
|
|
313
189
|
return false;
|
|
314
190
|
}
|
|
315
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
316
191
|
const events = this.events;
|
|
317
192
|
if (!(clusterName in events) || !(event in events[clusterName])) {
|
|
318
193
|
this.log.error(`triggerEvent ${hk}${event}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${this.id}${er}:${or}${this.number}${er}`);
|
|
319
194
|
return false;
|
|
320
195
|
}
|
|
321
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
322
|
-
// @ts-ignore
|
|
323
196
|
await this.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
|
|
324
197
|
log?.info(`${db}Trigger event ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${event}${db} with ${debugStringify(payload)}${db} on endpoint ${or}${this.id}${db}:${or}${this.number}${db} `);
|
|
325
198
|
return true;
|
|
326
199
|
}
|
|
327
|
-
/**
|
|
328
|
-
* Adds cluster servers from the provided server list.
|
|
329
|
-
*
|
|
330
|
-
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
331
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
332
|
-
*/
|
|
333
200
|
addClusterServers(serverList) {
|
|
334
201
|
addClusterServers(this, serverList);
|
|
335
202
|
return this;
|
|
336
203
|
}
|
|
337
|
-
/**
|
|
338
|
-
* Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
|
|
339
|
-
*
|
|
340
|
-
* @param {string} label - The label to add.
|
|
341
|
-
* @param {string} value - The value of the label.
|
|
342
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
343
|
-
*/
|
|
344
204
|
async addFixedLabel(label, value) {
|
|
345
205
|
await addFixedLabel(this, label, value);
|
|
346
206
|
return this;
|
|
347
207
|
}
|
|
348
|
-
/**
|
|
349
|
-
* Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
|
|
350
|
-
*
|
|
351
|
-
* @param {string} label - The label to add.
|
|
352
|
-
* @param {string} value - The value of the label.
|
|
353
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
354
|
-
*/
|
|
355
208
|
async addUserLabel(label, value) {
|
|
356
209
|
await addUserLabel(this, label, value);
|
|
357
210
|
return this;
|
|
358
211
|
}
|
|
359
|
-
/**
|
|
360
|
-
* Adds a command handler for the specified command.
|
|
361
|
-
*
|
|
362
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
363
|
-
* @param {HandlerFunction} handler - The handler function to execute when the command is received.
|
|
364
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
365
|
-
*/
|
|
366
212
|
addCommandHandler(command, handler) {
|
|
367
213
|
this.commandHandler.addHandler(command, handler);
|
|
368
214
|
return this;
|
|
369
215
|
}
|
|
370
|
-
/**
|
|
371
|
-
* Execute the command handler for the specified command. Mainly used in Jest tests.
|
|
372
|
-
*
|
|
373
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
|
|
374
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} request - The optional request to pass to the handler function.
|
|
375
|
-
* @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
|
-
|
|
382
|
-
|
|
383
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
384
|
-
*/
|
|
219
|
+
async invokeBehaviorCommand(cluster, command, params) {
|
|
220
|
+
await invokeBehaviorCommand(this, cluster, command, params);
|
|
221
|
+
}
|
|
385
222
|
addRequiredClusterServers() {
|
|
386
223
|
addRequiredClusterServers(this);
|
|
387
224
|
return this;
|
|
388
225
|
}
|
|
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
226
|
addOptionalClusterServers() {
|
|
395
227
|
addOptionalClusterServers(this);
|
|
396
228
|
return this;
|
|
397
229
|
}
|
|
398
|
-
/**
|
|
399
|
-
* Retrieves all cluster servers.
|
|
400
|
-
*
|
|
401
|
-
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
402
|
-
*/
|
|
403
230
|
getAllClusterServers() {
|
|
404
231
|
return Object.values(this.behaviors.supported);
|
|
405
232
|
}
|
|
406
|
-
/**
|
|
407
|
-
* Retrieves the names of all cluster servers.
|
|
408
|
-
*
|
|
409
|
-
* @returns {string[]} An array of all cluster server names.
|
|
410
|
-
*/
|
|
411
233
|
getAllClusterServerNames() {
|
|
412
234
|
return Object.keys(this.behaviors.supported);
|
|
413
235
|
}
|
|
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
236
|
forEachAttribute(callback) {
|
|
420
237
|
if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
|
|
421
238
|
return;
|
|
@@ -423,34 +240,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
423
240
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
424
241
|
const clusterId = getClusterId(this, clusterName);
|
|
425
242
|
if (clusterId === undefined) {
|
|
426
|
-
// this.log.error(`forEachAttribute error: cluster ${clusterName} not found`);
|
|
427
243
|
continue;
|
|
428
244
|
}
|
|
429
245
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
430
246
|
if (attributeId === undefined) {
|
|
431
|
-
// this.log.error(`forEachAttribute error: attribute ${clusterName}.${attributeName} not found`);
|
|
432
247
|
continue;
|
|
433
248
|
}
|
|
434
249
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
435
250
|
}
|
|
436
251
|
}
|
|
437
252
|
}
|
|
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
253
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
455
254
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
456
255
|
let alreadyAdded = false;
|
|
@@ -490,23 +289,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
490
289
|
}
|
|
491
290
|
return child;
|
|
492
291
|
}
|
|
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
292
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
511
293
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
512
294
|
let alreadyAdded = false;
|
|
@@ -569,38 +351,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
569
351
|
}
|
|
570
352
|
return child;
|
|
571
353
|
}
|
|
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
354
|
getChildEndpointByName(endpointName) {
|
|
579
355
|
return this.parts.find((part) => part.id === endpointName);
|
|
580
356
|
}
|
|
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
357
|
getChildEndpoint(endpointNumber) {
|
|
588
358
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
589
359
|
}
|
|
590
|
-
/**
|
|
591
|
-
* Get all the child endpoints of this endpoint.
|
|
592
|
-
*
|
|
593
|
-
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
594
|
-
*/
|
|
595
360
|
getChildEndpoints() {
|
|
596
361
|
return Array.from(this.parts);
|
|
597
362
|
}
|
|
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
363
|
static serialize(device) {
|
|
605
364
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId)
|
|
606
365
|
return;
|
|
@@ -623,15 +382,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
623
382
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
624
383
|
if (behaviorName === 'powerSource')
|
|
625
384
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
626
|
-
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
627
385
|
});
|
|
628
386
|
return serialized;
|
|
629
387
|
}
|
|
630
|
-
/**
|
|
631
|
-
* Deserializes the device into a serialized object.
|
|
632
|
-
*
|
|
633
|
-
* @returns The deserialized MatterbridgeDevice.
|
|
634
|
-
*/
|
|
635
388
|
static deserialize(serializedDevice) {
|
|
636
389
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
|
|
637
390
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -647,16 +400,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
647
400
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
648
401
|
else if (clusterId === PowerSource.Cluster.id)
|
|
649
402
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
650
|
-
// else addClusterServerFromList(device, [clusterId]);
|
|
651
403
|
}
|
|
652
404
|
return device;
|
|
653
405
|
}
|
|
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
406
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
661
407
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
|
|
662
408
|
wiredCurrentType,
|
|
@@ -667,16 +413,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
667
413
|
});
|
|
668
414
|
return this;
|
|
669
415
|
}
|
|
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
416
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
681
417
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
682
418
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -694,14 +430,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
694
430
|
});
|
|
695
431
|
return this;
|
|
696
432
|
}
|
|
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
433
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
706
434
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
707
435
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -720,21 +448,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
720
448
|
});
|
|
721
449
|
return this;
|
|
722
450
|
}
|
|
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
451
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
739
452
|
this.log.logName = deviceName;
|
|
740
453
|
this.deviceName = deviceName;
|
|
@@ -758,20 +471,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
758
471
|
}
|
|
759
472
|
return this;
|
|
760
473
|
}
|
|
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
474
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
776
475
|
this.log.logName = deviceName;
|
|
777
476
|
this.deviceName = deviceName;
|
|
@@ -788,7 +487,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
788
487
|
this.behaviors.require(BridgedDeviceBasicInformationServer.enable({
|
|
789
488
|
events: { leave: true, reachableChanged: true },
|
|
790
489
|
}), {
|
|
791
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
490
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
792
491
|
vendorName: vendorName.slice(0, 32),
|
|
793
492
|
productName: productName.slice(0, 32),
|
|
794
493
|
productUrl: this.productUrl.slice(0, 256),
|
|
@@ -804,13 +503,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
804
503
|
});
|
|
805
504
|
return this;
|
|
806
505
|
}
|
|
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
506
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
815
507
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
816
508
|
identifyTime,
|
|
@@ -818,32 +510,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
818
510
|
});
|
|
819
511
|
return this;
|
|
820
512
|
}
|
|
821
|
-
/**
|
|
822
|
-
* Creates a default groups cluster server.
|
|
823
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
824
|
-
*/
|
|
825
513
|
createDefaultGroupsClusterServer() {
|
|
826
514
|
this.behaviors.require(GroupsServer);
|
|
827
515
|
return this;
|
|
828
516
|
}
|
|
829
|
-
/**
|
|
830
|
-
* Creates a default scenes management cluster server.
|
|
831
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
832
|
-
*/
|
|
833
517
|
createDefaultScenesClusterServer() {
|
|
834
518
|
this.behaviors.require(ScenesManagementServer);
|
|
835
519
|
return this;
|
|
836
520
|
}
|
|
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
521
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
848
522
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
849
523
|
onOff,
|
|
@@ -854,52 +528,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
854
528
|
});
|
|
855
529
|
return this;
|
|
856
530
|
}
|
|
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
531
|
createOnOffClusterServer(onOff = false) {
|
|
864
532
|
this.behaviors.require(MatterbridgeOnOffServer, {
|
|
865
533
|
onOff,
|
|
866
534
|
});
|
|
867
535
|
return this;
|
|
868
536
|
}
|
|
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
537
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
876
538
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
877
539
|
onOff,
|
|
878
540
|
});
|
|
879
541
|
return this;
|
|
880
542
|
}
|
|
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
543
|
createOffOnlyOnOffClusterServer(onOff = false) {
|
|
888
544
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
|
|
889
545
|
onOff,
|
|
890
546
|
});
|
|
891
547
|
return this;
|
|
892
548
|
}
|
|
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
549
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
904
550
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
905
551
|
currentLevel,
|
|
@@ -915,13 +561,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
915
561
|
});
|
|
916
562
|
return this;
|
|
917
563
|
}
|
|
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
564
|
createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
|
|
926
565
|
this.behaviors.require(MatterbridgeLevelControlServer, {
|
|
927
566
|
currentLevel,
|
|
@@ -933,18 +572,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
933
572
|
});
|
|
934
573
|
return this;
|
|
935
574
|
}
|
|
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
575
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
949
576
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
950
577
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -967,19 +594,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
967
594
|
});
|
|
968
595
|
return this;
|
|
969
596
|
}
|
|
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
597
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
984
598
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
985
599
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -1000,16 +614,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1000
614
|
});
|
|
1001
615
|
return this;
|
|
1002
616
|
}
|
|
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
617
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1014
618
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1015
619
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1030,14 +634,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1030
634
|
});
|
|
1031
635
|
return this;
|
|
1032
636
|
}
|
|
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
637
|
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1042
638
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
1043
639
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1056,23 +652,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1056
652
|
});
|
|
1057
653
|
return this;
|
|
1058
654
|
}
|
|
1059
|
-
/**
|
|
1060
|
-
* Configures the color control mode for the device.
|
|
1061
|
-
*
|
|
1062
|
-
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1063
|
-
*/
|
|
1064
655
|
async configureColorControlMode(colorMode) {
|
|
1065
656
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
1066
657
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
1067
658
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
1068
659
|
}
|
|
1069
660
|
}
|
|
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
661
|
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1077
662
|
this.behaviors.require(MatterbridgeWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1078
663
|
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
@@ -1088,15 +673,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1088
673
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1089
674
|
endProductType: WindowCovering.EndProductType.RollerShade,
|
|
1090
675
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1091
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1092
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
676
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
677
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1093
678
|
});
|
|
1094
679
|
return this;
|
|
1095
680
|
}
|
|
1096
|
-
/**
|
|
1097
|
-
* Sets the window covering target position as the current position and stops the movement.
|
|
1098
|
-
*
|
|
1099
|
-
*/
|
|
1100
681
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
1101
682
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
1102
683
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -1109,12 +690,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1109
690
|
}
|
|
1110
691
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1111
692
|
}
|
|
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
693
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
1119
694
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
1120
695
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -1125,10 +700,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1125
700
|
}, this.log);
|
|
1126
701
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1127
702
|
}
|
|
1128
|
-
/**
|
|
1129
|
-
* Sets the status of the window covering.
|
|
1130
|
-
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1131
|
-
*/
|
|
1132
703
|
async setWindowCoveringStatus(status) {
|
|
1133
704
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
1134
705
|
global: status,
|
|
@@ -1137,11 +708,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1137
708
|
}, this.log);
|
|
1138
709
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1139
710
|
}
|
|
1140
|
-
/**
|
|
1141
|
-
* Retrieves the status of the window covering.
|
|
1142
|
-
*
|
|
1143
|
-
* @returns The global operational status of the window covering or undefined.
|
|
1144
|
-
*/
|
|
1145
711
|
getWindowCoveringStatus() {
|
|
1146
712
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
1147
713
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -1149,66 +715,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1149
715
|
return status.global;
|
|
1150
716
|
}
|
|
1151
717
|
}
|
|
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
718
|
async setWindowCoveringTargetAndCurrentPosition(position) {
|
|
1158
719
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', position, this.log);
|
|
1159
720
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', position, this.log);
|
|
1160
721
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${position} and targetPositionLiftPercent100ths: ${position}.`);
|
|
1161
722
|
}
|
|
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
723
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1176
724
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1177
725
|
localTemperature: localTemperature * 100,
|
|
1178
726
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1179
727
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1180
|
-
// Thermostat.Feature.Heating
|
|
1181
728
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1182
729
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1183
730
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1184
731
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1185
732
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1186
|
-
// Thermostat.Feature.Cooling
|
|
1187
733
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1188
734
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1189
735
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1190
736
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1191
737
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1192
|
-
// Thermostat.Feature.AutoMode
|
|
1193
738
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1194
739
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1195
740
|
});
|
|
1196
741
|
return this;
|
|
1197
742
|
}
|
|
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
743
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1207
744
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
|
|
1208
745
|
localTemperature: localTemperature * 100,
|
|
1209
746
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1210
747
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1211
|
-
// Thermostat.Feature.Heating
|
|
1212
748
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1213
749
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1214
750
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1217,20 +753,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1217
753
|
});
|
|
1218
754
|
return this;
|
|
1219
755
|
}
|
|
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
756
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1229
757
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
|
|
1230
758
|
localTemperature: localTemperature * 100,
|
|
1231
759
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1232
760
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1233
|
-
// Thermostat.Feature.Cooling
|
|
1234
761
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1235
762
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1236
763
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -1239,15 +766,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1239
766
|
});
|
|
1240
767
|
return this;
|
|
1241
768
|
}
|
|
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
769
|
createDefaultThermostatUserInterfaceConfigurationClusterServer() {
|
|
1252
770
|
this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
|
|
1253
771
|
temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
|
|
@@ -1256,12 +774,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1256
774
|
});
|
|
1257
775
|
return this;
|
|
1258
776
|
}
|
|
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
777
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1266
778
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1267
779
|
fanMode,
|
|
@@ -1274,12 +786,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1274
786
|
});
|
|
1275
787
|
return this;
|
|
1276
788
|
}
|
|
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
789
|
createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1284
790
|
this.behaviors.require(FanControlServer, {
|
|
1285
791
|
fanMode,
|
|
@@ -1289,82 +795,39 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1289
795
|
});
|
|
1290
796
|
return this;
|
|
1291
797
|
}
|
|
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
798
|
createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
1303
799
|
this.behaviors.require(HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1304
|
-
condition: 100,
|
|
1305
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
800
|
+
condition: 100,
|
|
801
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1306
802
|
changeIndication,
|
|
1307
803
|
inPlaceIndicator,
|
|
1308
804
|
lastChangedTime,
|
|
1309
|
-
replacementProductList: [],
|
|
805
|
+
replacementProductList: [],
|
|
1310
806
|
});
|
|
1311
807
|
return this;
|
|
1312
808
|
}
|
|
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
809
|
createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
1324
810
|
this.behaviors.require(ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1325
|
-
condition: 100,
|
|
1326
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
811
|
+
condition: 100,
|
|
812
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1327
813
|
changeIndication,
|
|
1328
814
|
inPlaceIndicator,
|
|
1329
815
|
lastChangedTime,
|
|
1330
|
-
replacementProductList: [],
|
|
816
|
+
replacementProductList: [],
|
|
1331
817
|
});
|
|
1332
818
|
return this;
|
|
1333
819
|
}
|
|
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
820
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1345
821
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
1346
822
|
lockState,
|
|
1347
823
|
lockType,
|
|
1348
824
|
actuatorEnabled: false,
|
|
1349
825
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
1350
|
-
// Special case of inverted bitmap: add also alwaysSet = 2047
|
|
1351
826
|
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
|
|
1352
827
|
alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
|
|
1353
828
|
});
|
|
1354
829
|
return this;
|
|
1355
830
|
}
|
|
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
831
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1369
832
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
1370
833
|
description: description,
|
|
@@ -1375,13 +838,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1375
838
|
});
|
|
1376
839
|
return this;
|
|
1377
840
|
}
|
|
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
841
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
1386
842
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
1387
843
|
currentState: valveState,
|
|
@@ -1397,12 +853,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1397
853
|
});
|
|
1398
854
|
return this;
|
|
1399
855
|
}
|
|
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
856
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1407
857
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
1408
858
|
minConstSpeed: null,
|
|
@@ -1417,13 +867,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1417
867
|
});
|
|
1418
868
|
return this;
|
|
1419
869
|
}
|
|
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
870
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1428
871
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1429
872
|
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 +882,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1439
882
|
});
|
|
1440
883
|
return this;
|
|
1441
884
|
}
|
|
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
885
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1449
886
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
1450
887
|
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 +896,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1459
896
|
});
|
|
1460
897
|
return this;
|
|
1461
898
|
}
|
|
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
899
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1469
900
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1470
901
|
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 +910,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1479
910
|
});
|
|
1480
911
|
return this;
|
|
1481
912
|
}
|
|
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
913
|
createDefaultSwitchClusterServer() {
|
|
1490
914
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
1491
915
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -1496,13 +920,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1496
920
|
});
|
|
1497
921
|
return this;
|
|
1498
922
|
}
|
|
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
923
|
createDefaultLatchingSwitchClusterServer() {
|
|
1507
924
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
1508
925
|
events: { switchLatched: true },
|
|
@@ -1512,13 +929,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1512
929
|
});
|
|
1513
930
|
return this;
|
|
1514
931
|
}
|
|
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
932
|
async triggerSwitchEvent(event, log) {
|
|
1523
933
|
if (this.maybeNumber === undefined) {
|
|
1524
934
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1578,40 +988,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1578
988
|
}
|
|
1579
989
|
return true;
|
|
1580
990
|
}
|
|
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
991
|
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
|
-
});
|
|
992
|
+
this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
|
|
1601
993
|
return this;
|
|
1602
994
|
}
|
|
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
995
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1616
996
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1617
997
|
events: { stateChange: true },
|
|
@@ -1620,18 +1000,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1620
1000
|
});
|
|
1621
1001
|
return this;
|
|
1622
1002
|
}
|
|
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
1003
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1636
1004
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1637
1005
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -1646,21 +1014,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1646
1014
|
});
|
|
1647
1015
|
return this;
|
|
1648
1016
|
}
|
|
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
1017
|
createDefaultPowerTopologyClusterServer() {
|
|
1655
1018
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1656
1019
|
return this;
|
|
1657
1020
|
}
|
|
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
1021
|
createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
1665
1022
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1666
1023
|
accuracy: {
|
|
@@ -1676,15 +1033,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1676
1033
|
});
|
|
1677
1034
|
return this;
|
|
1678
1035
|
}
|
|
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
1036
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1689
1037
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1690
1038
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1726,113 +1074,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1726
1074
|
});
|
|
1727
1075
|
return this;
|
|
1728
1076
|
}
|
|
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
1077
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1738
1078
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1739
1079
|
return this;
|
|
1740
1080
|
}
|
|
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
1081
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1750
1082
|
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1751
1083
|
return this;
|
|
1752
1084
|
}
|
|
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
1085
|
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1762
1086
|
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1763
1087
|
return this;
|
|
1764
1088
|
}
|
|
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
1089
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1785
1090
|
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1786
1091
|
return this;
|
|
1787
1092
|
}
|
|
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
1093
|
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1797
1094
|
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1798
1095
|
return this;
|
|
1799
1096
|
}
|
|
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
1097
|
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
1812
1098
|
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
1813
1099
|
return this;
|
|
1814
1100
|
}
|
|
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
1101
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1822
1102
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1823
1103
|
airQuality,
|
|
1824
1104
|
});
|
|
1825
1105
|
return this;
|
|
1826
1106
|
}
|
|
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
1107
|
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
1837
1108
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1838
1109
|
measuredValue,
|
|
@@ -1844,11 +1115,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1844
1115
|
});
|
|
1845
1116
|
return this;
|
|
1846
1117
|
}
|
|
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
1118
|
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1853
1119
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
1854
1120
|
levelValue,
|
|
@@ -1856,13 +1122,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1856
1122
|
});
|
|
1857
1123
|
return this;
|
|
1858
1124
|
}
|
|
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
1125
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1867
1126
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1868
1127
|
measuredValue,
|
|
@@ -1874,13 +1133,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1874
1133
|
});
|
|
1875
1134
|
return this;
|
|
1876
1135
|
}
|
|
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
1136
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1885
1137
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1886
1138
|
measuredValue,
|
|
@@ -1892,13 +1144,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1892
1144
|
});
|
|
1893
1145
|
return this;
|
|
1894
1146
|
}
|
|
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
1147
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1903
1148
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1904
1149
|
measuredValue,
|
|
@@ -1910,13 +1155,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1910
1155
|
});
|
|
1911
1156
|
return this;
|
|
1912
1157
|
}
|
|
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
1158
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1921
1159
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1922
1160
|
measuredValue,
|
|
@@ -1928,13 +1166,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1928
1166
|
});
|
|
1929
1167
|
return this;
|
|
1930
1168
|
}
|
|
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
1169
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1939
1170
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1940
1171
|
measuredValue,
|
|
@@ -1946,13 +1177,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1946
1177
|
});
|
|
1947
1178
|
return this;
|
|
1948
1179
|
}
|
|
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
1180
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1957
1181
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1958
1182
|
measuredValue,
|
|
@@ -1964,13 +1188,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1964
1188
|
});
|
|
1965
1189
|
return this;
|
|
1966
1190
|
}
|
|
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
1191
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1975
1192
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1976
1193
|
measuredValue,
|
|
@@ -1982,13 +1199,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1982
1199
|
});
|
|
1983
1200
|
return this;
|
|
1984
1201
|
}
|
|
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
1202
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1993
1203
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1994
1204
|
measuredValue,
|
|
@@ -2000,13 +1210,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2000
1210
|
});
|
|
2001
1211
|
return this;
|
|
2002
1212
|
}
|
|
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
1213
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2011
1214
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2012
1215
|
measuredValue,
|
|
@@ -2019,4 +1222,3 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2019
1222
|
return this;
|
|
2020
1223
|
}
|
|
2021
1224
|
}
|
|
2022
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|