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