matterbridge 3.0.6-dev-20250612-6b6e953 → 3.0.6
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 +3 -2
- package/README.md +4 -0
- package/dist/cli.d.ts +29 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +64 -4
- package/dist/cli.js.map +1 -0
- package/dist/cluster/export.d.ts +2 -0
- package/dist/cluster/export.d.ts.map +1 -0
- package/dist/cluster/export.js +2 -0
- package/dist/cluster/export.js.map +1 -0
- package/dist/defaultConfigSchema.d.ts +27 -0
- package/dist/defaultConfigSchema.d.ts.map +1 -0
- package/dist/defaultConfigSchema.js +23 -0
- package/dist/defaultConfigSchema.js.map +1 -0
- package/dist/deviceManager.d.ts +114 -0
- package/dist/deviceManager.d.ts.map +1 -0
- package/dist/deviceManager.js +94 -1
- package/dist/deviceManager.js.map +1 -0
- package/dist/evse.d.ts +67 -0
- package/dist/evse.d.ts.map +1 -0
- package/dist/evse.js +65 -9
- package/dist/evse.js.map +1 -0
- package/dist/frontend.d.ts +256 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/frontend.js +374 -16
- package/dist/frontend.js.map +1 -0
- package/dist/globalMatterbridge.d.ts +32 -0
- package/dist/globalMatterbridge.d.ts.map +1 -0
- package/dist/globalMatterbridge.js +43 -0
- package/dist/globalMatterbridge.js.map +1 -0
- package/dist/helpers.d.ts +47 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +51 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -0
- package/dist/laundryWasher.d.ts +243 -0
- package/dist/laundryWasher.d.ts.map +1 -0
- package/dist/laundryWasher.js +92 -7
- package/dist/laundryWasher.js.map +1 -0
- package/dist/logger/export.d.ts +2 -0
- package/dist/logger/export.d.ts.map +1 -0
- package/dist/logger/export.js +1 -0
- package/dist/logger/export.js.map +1 -0
- package/dist/matter/behaviors.d.ts +2 -0
- package/dist/matter/behaviors.d.ts.map +1 -0
- package/dist/matter/behaviors.js +2 -0
- package/dist/matter/behaviors.js.map +1 -0
- package/dist/matter/clusters.d.ts +2 -0
- package/dist/matter/clusters.d.ts.map +1 -0
- package/dist/matter/clusters.js +2 -0
- package/dist/matter/clusters.js.map +1 -0
- package/dist/matter/devices.d.ts +2 -0
- package/dist/matter/devices.d.ts.map +1 -0
- package/dist/matter/devices.js +2 -0
- package/dist/matter/devices.js.map +1 -0
- package/dist/matter/endpoints.d.ts +2 -0
- package/dist/matter/endpoints.d.ts.map +1 -0
- package/dist/matter/endpoints.js +2 -0
- package/dist/matter/endpoints.js.map +1 -0
- package/dist/matter/export.d.ts +5 -0
- package/dist/matter/export.d.ts.map +1 -0
- package/dist/matter/export.js +2 -0
- package/dist/matter/export.js.map +1 -0
- package/dist/matter/types.d.ts +3 -0
- package/dist/matter/types.d.ts.map +1 -0
- package/dist/matter/types.js +2 -0
- package/dist/matter/types.js.map +1 -0
- package/dist/matterbridge.d.ts +445 -0
- package/dist/matterbridge.d.ts.map +1 -0
- package/dist/matterbridge.js +748 -46
- package/dist/matterbridge.js.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts +40 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.js +34 -0
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
- package/dist/matterbridgeBehaviors.d.ts +1333 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +54 -1
- package/dist/matterbridgeBehaviors.js.map +1 -0
- package/dist/matterbridgeDeviceTypes.d.ts +644 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +578 -15
- package/dist/matterbridgeDeviceTypes.js.map +1 -0
- package/dist/matterbridgeDynamicPlatform.d.ts +40 -0
- package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
- package/dist/matterbridgeDynamicPlatform.js +34 -0
- package/dist/matterbridgeDynamicPlatform.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +1144 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +995 -40
- package/dist/matterbridgeEndpoint.js.map +1 -0
- package/dist/matterbridgeEndpointHelpers.d.ts +3083 -0
- package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
- package/dist/matterbridgeEndpointHelpers.js +204 -10
- package/dist/matterbridgeEndpointHelpers.js.map +1 -0
- package/dist/matterbridgePlatform.d.ts +294 -0
- package/dist/matterbridgePlatform.d.ts.map +1 -0
- package/dist/matterbridgePlatform.js +225 -7
- package/dist/matterbridgePlatform.js.map +1 -0
- package/dist/matterbridgeTypes.d.ts +196 -0
- package/dist/matterbridgeTypes.d.ts.map +1 -0
- package/dist/matterbridgeTypes.js +24 -0
- package/dist/matterbridgeTypes.js.map +1 -0
- package/dist/pluginManager.d.ts +273 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +269 -3
- package/dist/pluginManager.js.map +1 -0
- package/dist/roboticVacuumCleaner.d.ts +102 -0
- package/dist/roboticVacuumCleaner.d.ts.map +1 -0
- package/dist/roboticVacuumCleaner.js +81 -6
- package/dist/roboticVacuumCleaner.js.map +1 -0
- package/dist/shelly.d.ts +161 -0
- package/dist/shelly.d.ts.map +1 -0
- package/dist/shelly.js +155 -7
- package/dist/shelly.js.map +1 -0
- package/dist/storage/export.d.ts +2 -0
- package/dist/storage/export.d.ts.map +1 -0
- package/dist/storage/export.js +1 -0
- package/dist/storage/export.js.map +1 -0
- package/dist/update.d.ts +58 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +53 -0
- package/dist/update.js.map +1 -0
- package/dist/utils/colorUtils.d.ts +61 -0
- package/dist/utils/colorUtils.d.ts.map +1 -0
- package/dist/utils/colorUtils.js +205 -2
- package/dist/utils/colorUtils.js.map +1 -0
- package/dist/utils/commandLine.d.ts +58 -0
- package/dist/utils/commandLine.d.ts.map +1 -0
- package/dist/utils/commandLine.js +53 -0
- package/dist/utils/commandLine.js.map +1 -0
- package/dist/utils/copyDirectory.d.ts +32 -0
- package/dist/utils/copyDirectory.d.ts.map +1 -0
- package/dist/utils/copyDirectory.js +37 -1
- package/dist/utils/copyDirectory.js.map +1 -0
- package/dist/utils/createDirectory.d.ts +32 -0
- package/dist/utils/createDirectory.d.ts.map +1 -0
- package/dist/utils/createDirectory.js +31 -0
- package/dist/utils/createDirectory.js.map +1 -0
- package/dist/utils/createZip.d.ts +38 -0
- package/dist/utils/createZip.d.ts.map +1 -0
- package/dist/utils/createZip.js +42 -2
- package/dist/utils/createZip.js.map +1 -0
- package/dist/utils/deepCopy.d.ts +31 -0
- package/dist/utils/deepCopy.d.ts.map +1 -0
- package/dist/utils/deepCopy.js +38 -0
- package/dist/utils/deepCopy.js.map +1 -0
- package/dist/utils/deepEqual.d.ts +53 -0
- package/dist/utils/deepEqual.d.ts.map +1 -0
- package/dist/utils/deepEqual.js +71 -1
- package/dist/utils/deepEqual.js.map +1 -0
- package/dist/utils/export.d.ts +12 -0
- package/dist/utils/export.d.ts.map +1 -0
- package/dist/utils/export.js +1 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/hex.d.ts +48 -0
- package/dist/utils/hex.d.ts.map +1 -0
- package/dist/utils/hex.js +57 -0
- package/dist/utils/hex.js.map +1 -0
- package/dist/utils/isvalid.d.ts +102 -0
- package/dist/utils/isvalid.d.ts.map +1 -0
- package/dist/utils/isvalid.js +100 -0
- package/dist/utils/isvalid.js.map +1 -0
- package/dist/utils/network.d.ts +69 -0
- package/dist/utils/network.d.ts.map +1 -0
- package/dist/utils/network.js +76 -5
- package/dist/utils/network.js.map +1 -0
- package/dist/utils/spawn.d.ts +12 -0
- package/dist/utils/spawn.d.ts.map +1 -0
- package/dist/utils/spawn.js +16 -0
- package/dist/utils/spawn.js.map +1 -0
- package/dist/utils/wait.d.ts +52 -0
- package/dist/utils/wait.d.ts.map +1 -0
- package/dist/utils/wait.js +58 -9
- package/dist/utils/wait.js.map +1 -0
- package/dist/waterHeater.d.ts +90 -0
- package/dist/waterHeater.d.ts.map +1 -0
- package/dist/waterHeater.js +62 -2
- package/dist/waterHeater.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
|
@@ -1,10 +1,36 @@
|
|
|
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.1.1
|
|
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
|
|
1
24
|
import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
|
|
25
|
+
// Matterbridge
|
|
2
26
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
3
27
|
import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
|
|
4
28
|
import { MatterbridgeServer, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, } from './matterbridgeBehaviors.js';
|
|
5
29
|
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
|
|
6
31
|
import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, UINT16_MAX, UINT32_MAX, VendorId } from '@matter/main';
|
|
7
32
|
import { getClusterNameById, MeasurementType } from '@matter/main/types';
|
|
33
|
+
// @matter clusters
|
|
8
34
|
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
9
35
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
10
36
|
import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
|
|
@@ -31,6 +57,7 @@ import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/ther
|
|
|
31
57
|
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
32
58
|
import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
|
|
33
59
|
import { DeviceEnergyManagementMode } from '@matter/main/clusters/device-energy-management-mode';
|
|
60
|
+
// @matter behaviors
|
|
34
61
|
import { DescriptorServer } from '@matter/main/behaviors/descriptor';
|
|
35
62
|
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
36
63
|
import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
|
|
@@ -66,10 +93,15 @@ import { ActivatedCarbonFilterMonitoringServer } from '@matter/main/behaviors/ac
|
|
|
66
93
|
import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behaviors/thermostat-user-interface-configuration';
|
|
67
94
|
import { DeviceEnergyManagementServer } from '@matter/main/behaviors/device-energy-management';
|
|
68
95
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
96
|
+
/** The bridge mode of Matterbridge */
|
|
69
97
|
static bridgeMode = '';
|
|
70
|
-
|
|
98
|
+
/** The default log level of the new MatterbridgeEndpoints */
|
|
99
|
+
static logLevel = "info" /* LogLevel.INFO */;
|
|
100
|
+
/** The logger instance for the MatterbridgeEndpoint */
|
|
71
101
|
log;
|
|
102
|
+
/** The plugin name this MatterbridgeEndpoint belongs to */
|
|
72
103
|
plugin = undefined;
|
|
104
|
+
/** The configuration URL of the device, if available */
|
|
73
105
|
configUrl = undefined;
|
|
74
106
|
deviceName = undefined;
|
|
75
107
|
serialNumber = undefined;
|
|
@@ -83,14 +115,29 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
83
115
|
hardwareVersion = undefined;
|
|
84
116
|
hardwareVersionString = undefined;
|
|
85
117
|
productUrl = 'https://www.npmjs.com/package/matterbridge';
|
|
118
|
+
/** The server node of the endpoint, if it is a single not bridged endpoint */
|
|
119
|
+
serverNode;
|
|
120
|
+
/** The name of the first device type of the endpoint (old api compatibility) */
|
|
86
121
|
name = undefined;
|
|
122
|
+
/** The code of the first device type of the endpoint (old api compatibility) */
|
|
87
123
|
deviceType;
|
|
124
|
+
/** The id of the endpoint (old api compatibility) */
|
|
88
125
|
uniqueStorageKey = undefined;
|
|
89
126
|
tagList = undefined;
|
|
127
|
+
/** Maps the DeviceTypeDefinitions with their code */
|
|
90
128
|
deviceTypes = new Map();
|
|
129
|
+
/** Command handler for the MatterbridgeEndpoint commands */
|
|
91
130
|
commandHandler = new NamedHandler();
|
|
131
|
+
/**
|
|
132
|
+
* Represents a MatterbridgeEndpoint.
|
|
133
|
+
* @constructor
|
|
134
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
|
|
135
|
+
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
136
|
+
* @param {boolean} [debug=false] - Debug flag.
|
|
137
|
+
*/
|
|
92
138
|
constructor(definition, options = {}, debug = false) {
|
|
93
139
|
let deviceTypeList = [];
|
|
140
|
+
// Get the first DeviceTypeDefinition
|
|
94
141
|
let firstDefinition;
|
|
95
142
|
if (Array.isArray(definition)) {
|
|
96
143
|
firstDefinition = definition[0];
|
|
@@ -103,6 +150,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
103
150
|
firstDefinition = definition;
|
|
104
151
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
105
152
|
}
|
|
153
|
+
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
106
154
|
const deviceTypeDefinitionV8 = {
|
|
107
155
|
name: firstDefinition.name.replace('-', '_'),
|
|
108
156
|
deviceType: firstDefinition.code,
|
|
@@ -121,9 +169,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
121
169
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
122
170
|
};
|
|
123
171
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
172
|
+
// Check if the uniqueStorageKey is valid
|
|
124
173
|
if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
|
|
125
174
|
options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
|
|
126
175
|
}
|
|
176
|
+
// Convert the options to an Endpoint.Options
|
|
127
177
|
const optionsV8 = {
|
|
128
178
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
129
179
|
number: options.endpointId,
|
|
@@ -141,16 +191,40 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
141
191
|
}
|
|
142
192
|
else
|
|
143
193
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
144
|
-
|
|
194
|
+
// console.log('MatterbridgeEndpoint.option', options);
|
|
195
|
+
// console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
|
|
196
|
+
// console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
|
|
197
|
+
// Create the logger
|
|
198
|
+
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
|
|
145
199
|
this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
|
|
200
|
+
// Add MatterbridgeServer
|
|
146
201
|
this.behaviors.require(MatterbridgeServer, { log: this.log, commandHandler: this.commandHandler });
|
|
147
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* Loads an instance of the MatterbridgeEndpoint class.
|
|
205
|
+
*
|
|
206
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
|
|
207
|
+
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
208
|
+
* @param {boolean} [debug=false] - Debug flag.
|
|
209
|
+
* @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
|
|
210
|
+
*/
|
|
148
211
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
149
212
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
150
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Get all the device types of this endpoint.
|
|
216
|
+
*
|
|
217
|
+
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
|
|
218
|
+
*/
|
|
151
219
|
getDeviceTypes() {
|
|
152
220
|
return Array.from(this.deviceTypes.values());
|
|
153
221
|
}
|
|
222
|
+
/**
|
|
223
|
+
* Checks if the provided cluster server is supported by this endpoint.
|
|
224
|
+
*
|
|
225
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
226
|
+
* @returns {boolean} True if the cluster server is supported, false otherwise.
|
|
227
|
+
*/
|
|
154
228
|
hasClusterServer(cluster) {
|
|
155
229
|
const behavior = getBehavior(this, cluster);
|
|
156
230
|
if (behavior)
|
|
@@ -158,6 +232,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
158
232
|
else
|
|
159
233
|
return false;
|
|
160
234
|
}
|
|
235
|
+
/**
|
|
236
|
+
* Checks if the provided attribute server is supported for a given cluster of this endpoint.
|
|
237
|
+
*
|
|
238
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
239
|
+
* @param {string} attribute - The attribute name to check.
|
|
240
|
+
* @returns {boolean} True if the attribute server is supported, false otherwise.
|
|
241
|
+
*/
|
|
161
242
|
hasAttributeServer(cluster, attribute) {
|
|
162
243
|
const behavior = getBehavior(this, cluster);
|
|
163
244
|
if (!behavior || !this.behaviors.supported[behavior.id])
|
|
@@ -166,82 +247,235 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
166
247
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
167
248
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
168
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Retrieves the initial options for the provided cluster server.
|
|
252
|
+
*
|
|
253
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
|
|
254
|
+
* @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.
|
|
255
|
+
*/
|
|
169
256
|
getClusterServerOptions(cluster) {
|
|
170
257
|
const behavior = getBehavior(this, cluster);
|
|
171
258
|
if (!behavior)
|
|
172
259
|
return undefined;
|
|
173
260
|
return this.behaviors.optionsFor(behavior);
|
|
174
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Retrieves the value of the provided attribute from the given cluster.
|
|
264
|
+
*
|
|
265
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
266
|
+
* @param {string} attribute - The name of the attribute to retrieve.
|
|
267
|
+
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
268
|
+
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
269
|
+
*/
|
|
270
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
175
271
|
getAttribute(cluster, attribute, log) {
|
|
176
272
|
return getAttribute(this, cluster, attribute, log);
|
|
177
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Sets the value of an attribute on a cluster server.
|
|
276
|
+
*
|
|
277
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
|
|
278
|
+
* @param {string} attribute - The name of the attribute.
|
|
279
|
+
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
280
|
+
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
281
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
282
|
+
*/
|
|
178
283
|
async setAttribute(clusterId, attribute, value, log) {
|
|
179
284
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
180
285
|
}
|
|
286
|
+
/**
|
|
287
|
+
* Update the value of an attribute on a cluster server only if the value is different.
|
|
288
|
+
*
|
|
289
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
290
|
+
* @param {string} attribute - The name of the attribute.
|
|
291
|
+
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
292
|
+
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
|
|
293
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
294
|
+
*/
|
|
181
295
|
async updateAttribute(cluster, attribute, value, log) {
|
|
182
296
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
183
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Subscribes to the provided attribute on a cluster.
|
|
300
|
+
*
|
|
301
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
|
|
302
|
+
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
303
|
+
* @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.
|
|
304
|
+
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
305
|
+
* @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
|
|
306
|
+
*
|
|
307
|
+
* @remarks The listener function (cannot be async) will receive three parameters:
|
|
308
|
+
* - `newValue`: The new value of the attribute.
|
|
309
|
+
* - `oldValue`: The old value of the attribute.
|
|
310
|
+
* - `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.
|
|
311
|
+
*/
|
|
312
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
184
313
|
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
185
314
|
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
186
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Triggers an event on the specified cluster.
|
|
318
|
+
* @param {ClusterId} cluster - The ID of the cluster.
|
|
319
|
+
* @param {string} event - The name of the event to trigger.
|
|
320
|
+
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
321
|
+
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
322
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
323
|
+
*/
|
|
187
324
|
async triggerEvent(cluster, event, payload, log) {
|
|
188
325
|
return await triggerEvent(this, cluster, event, payload, log);
|
|
189
326
|
}
|
|
327
|
+
/**
|
|
328
|
+
* Adds cluster servers from the provided server list.
|
|
329
|
+
*
|
|
330
|
+
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
331
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
332
|
+
*/
|
|
190
333
|
addClusterServers(serverList) {
|
|
191
334
|
addClusterServers(this, serverList);
|
|
192
335
|
return this;
|
|
193
336
|
}
|
|
337
|
+
/**
|
|
338
|
+
* Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
|
|
339
|
+
*
|
|
340
|
+
* @param {string} label - The label to add.
|
|
341
|
+
* @param {string} value - The value of the label.
|
|
342
|
+
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
343
|
+
*/
|
|
194
344
|
async addFixedLabel(label, value) {
|
|
195
345
|
await addFixedLabel(this, label, value);
|
|
196
346
|
return this;
|
|
197
347
|
}
|
|
348
|
+
/**
|
|
349
|
+
* Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
|
|
350
|
+
*
|
|
351
|
+
* @param {string} label - The label to add.
|
|
352
|
+
* @param {string} value - The value of the label.
|
|
353
|
+
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
354
|
+
*/
|
|
198
355
|
async addUserLabel(label, value) {
|
|
199
356
|
await addUserLabel(this, label, value);
|
|
200
357
|
return this;
|
|
201
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* Adds a command handler for the specified command.
|
|
361
|
+
*
|
|
362
|
+
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
363
|
+
* @param {CommandHandlerFunction} handler - The handler function to execute when the command is received.
|
|
364
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
365
|
+
*
|
|
366
|
+
* @remarks
|
|
367
|
+
* The handler function will receive an object with the following properties:
|
|
368
|
+
* - `request`: The request object sent with the command.
|
|
369
|
+
* - `cluster`: The id of the cluster that received the command (i.e. "onOff").
|
|
370
|
+
* - `attributes`: The current attributes of the cluster that received the command (i.e. { onOff: true}).
|
|
371
|
+
* - `endpoint`: The MatterbridgeEndpoint instance that received the command.
|
|
372
|
+
*/
|
|
202
373
|
addCommandHandler(command, handler) {
|
|
203
374
|
this.commandHandler.addHandler(command, handler);
|
|
204
375
|
return this;
|
|
205
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* Execute the command handler for the specified command. Used ONLY in Jest tests.
|
|
379
|
+
*
|
|
380
|
+
* @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
|
|
381
|
+
* @param {Record<string, boolean | number | bigint | string | object | null>} [request] - The optional request to pass to the handler function.
|
|
382
|
+
*
|
|
383
|
+
* @deprecated Used ONLY in Jest tests.
|
|
384
|
+
*/
|
|
206
385
|
async executeCommandHandler(command, request) {
|
|
207
386
|
await this.commandHandler.executeHandler(command, { request });
|
|
208
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* Invokes a behavior command on the specified cluster. Used ONLY in Jest tests.
|
|
390
|
+
*
|
|
391
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
|
|
392
|
+
* @param {string} command - The command to invoke.
|
|
393
|
+
* @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The optional parameters to pass to the command.
|
|
394
|
+
*
|
|
395
|
+
* @deprecated Used ONLY in Jest tests.
|
|
396
|
+
*/
|
|
209
397
|
async invokeBehaviorCommand(cluster, command, params) {
|
|
210
398
|
await invokeBehaviorCommand(this, cluster, command, params);
|
|
211
399
|
}
|
|
400
|
+
/**
|
|
401
|
+
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
402
|
+
*
|
|
403
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
404
|
+
*/
|
|
212
405
|
addRequiredClusterServers() {
|
|
213
406
|
addRequiredClusterServers(this);
|
|
214
407
|
return this;
|
|
215
408
|
}
|
|
409
|
+
/**
|
|
410
|
+
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
411
|
+
*
|
|
412
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
413
|
+
*/
|
|
216
414
|
addOptionalClusterServers() {
|
|
217
415
|
addOptionalClusterServers(this);
|
|
218
416
|
return this;
|
|
219
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* Retrieves all cluster servers.
|
|
420
|
+
*
|
|
421
|
+
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
422
|
+
*/
|
|
220
423
|
getAllClusterServers() {
|
|
221
424
|
return Object.values(this.behaviors.supported);
|
|
222
425
|
}
|
|
426
|
+
/**
|
|
427
|
+
* Retrieves the names of all cluster servers.
|
|
428
|
+
*
|
|
429
|
+
* @returns {string[]} An array of all cluster server names.
|
|
430
|
+
*/
|
|
223
431
|
getAllClusterServerNames() {
|
|
224
432
|
return Object.keys(this.behaviors.supported);
|
|
225
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
|
|
436
|
+
*
|
|
437
|
+
* @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
|
|
438
|
+
*/
|
|
226
439
|
forEachAttribute(callback) {
|
|
227
440
|
if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
|
|
228
441
|
return;
|
|
229
442
|
for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
|
|
443
|
+
// Skip if the key / cluster name is a number, cause they are double indexed.
|
|
230
444
|
if (!isNaN(Number(clusterName)))
|
|
231
445
|
continue;
|
|
232
446
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
447
|
+
// Skip if the behavior has no associated cluster (i.e. matterbridge server)
|
|
233
448
|
const clusterId = getClusterId(this, clusterName);
|
|
234
449
|
if (clusterId === undefined) {
|
|
450
|
+
// this.log.debug(`***forEachAttribute: cluster ${clusterName} not found`);
|
|
235
451
|
continue;
|
|
236
452
|
}
|
|
453
|
+
// Skip if the attribute is not present in the ClusterBehavior.Type. Also skip if the attribute it is an internal state.
|
|
237
454
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
238
455
|
if (attributeId === undefined) {
|
|
456
|
+
// this.log.debug(`***forEachAttribute: attribute ${clusterName}.${attributeName} not found`);
|
|
239
457
|
continue;
|
|
240
458
|
}
|
|
241
459
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
242
460
|
}
|
|
243
461
|
}
|
|
244
462
|
}
|
|
463
|
+
/**
|
|
464
|
+
* Adds a child endpoint with the specified device types and options.
|
|
465
|
+
* If the child endpoint is not already present, it will be created and added.
|
|
466
|
+
* If the child endpoint is already present, the existing child endpoint will be returned.
|
|
467
|
+
*
|
|
468
|
+
* @param {string} endpointName - The name of the new endpoint to add.
|
|
469
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
470
|
+
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
|
|
471
|
+
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
472
|
+
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* ```typescript
|
|
476
|
+
* const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
477
|
+
* ```
|
|
478
|
+
*/
|
|
245
479
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
246
480
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
247
481
|
let alreadyAdded = false;
|
|
@@ -281,6 +515,23 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
281
515
|
}
|
|
282
516
|
return child;
|
|
283
517
|
}
|
|
518
|
+
/**
|
|
519
|
+
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
520
|
+
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
521
|
+
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
522
|
+
*
|
|
523
|
+
* @param {string} endpointName - The name of the new enpoint to add.
|
|
524
|
+
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
525
|
+
* @param {ClusterId[]} [serverList=[]] - The list of cluster IDs to include.
|
|
526
|
+
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
527
|
+
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
528
|
+
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* ```typescript
|
|
532
|
+
* const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
533
|
+
* ```
|
|
534
|
+
*/
|
|
284
535
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
285
536
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
286
537
|
let alreadyAdded = false;
|
|
@@ -343,15 +594,38 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
343
594
|
}
|
|
344
595
|
return child;
|
|
345
596
|
}
|
|
597
|
+
/**
|
|
598
|
+
* Retrieves a child endpoint by its name.
|
|
599
|
+
*
|
|
600
|
+
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
601
|
+
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
602
|
+
*/
|
|
346
603
|
getChildEndpointByName(endpointName) {
|
|
347
604
|
return this.parts.find((part) => part.id === endpointName);
|
|
348
605
|
}
|
|
606
|
+
/**
|
|
607
|
+
* Retrieves a child endpoint by its EndpointNumber.
|
|
608
|
+
*
|
|
609
|
+
* @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
|
|
610
|
+
* @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
|
|
611
|
+
*/
|
|
349
612
|
getChildEndpoint(endpointNumber) {
|
|
350
613
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
351
614
|
}
|
|
615
|
+
/**
|
|
616
|
+
* Get all the child endpoints of this endpoint.
|
|
617
|
+
*
|
|
618
|
+
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
619
|
+
*/
|
|
352
620
|
getChildEndpoints() {
|
|
353
621
|
return Array.from(this.parts);
|
|
354
622
|
}
|
|
623
|
+
/**
|
|
624
|
+
* Serializes the Matterbridge device into a serialized object.
|
|
625
|
+
*
|
|
626
|
+
* @param pluginName - The name of the plugin.
|
|
627
|
+
* @returns The serialized Matterbridge device object.
|
|
628
|
+
*/
|
|
355
629
|
static serialize(device) {
|
|
356
630
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId)
|
|
357
631
|
return;
|
|
@@ -374,9 +648,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
374
648
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
375
649
|
if (behaviorName === 'powerSource')
|
|
376
650
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
651
|
+
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
377
652
|
});
|
|
378
653
|
return serialized;
|
|
379
654
|
}
|
|
655
|
+
/**
|
|
656
|
+
* Deserializes the device into a serialized object.
|
|
657
|
+
*
|
|
658
|
+
* @returns The deserialized MatterbridgeDevice.
|
|
659
|
+
*/
|
|
380
660
|
static deserialize(serializedDevice) {
|
|
381
661
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
|
|
382
662
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -392,9 +672,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
392
672
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
393
673
|
else if (clusterId === PowerSource.Cluster.id)
|
|
394
674
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
675
|
+
// else addClusterServerFromList(device, [clusterId]);
|
|
395
676
|
}
|
|
396
677
|
return device;
|
|
397
678
|
}
|
|
679
|
+
/**
|
|
680
|
+
* Creates a default power source wired cluster server.
|
|
681
|
+
*
|
|
682
|
+
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
683
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
684
|
+
*/
|
|
398
685
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
399
686
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
|
|
400
687
|
wiredCurrentType,
|
|
@@ -405,6 +692,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
405
692
|
});
|
|
406
693
|
return this;
|
|
407
694
|
}
|
|
695
|
+
/**
|
|
696
|
+
* Creates a default power source replaceable battery cluster server.
|
|
697
|
+
*
|
|
698
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
699
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
700
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
701
|
+
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
702
|
+
* @param batQuantity - The battery quantity (default: 1).
|
|
703
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
704
|
+
*/
|
|
408
705
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
409
706
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
410
707
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -422,6 +719,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
422
719
|
});
|
|
423
720
|
return this;
|
|
424
721
|
}
|
|
722
|
+
/**
|
|
723
|
+
* Creates a default power source rechargeable battery cluster server.
|
|
724
|
+
*
|
|
725
|
+
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
726
|
+
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
727
|
+
* @param batVoltage - The battery voltage (default: 1500).
|
|
728
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
729
|
+
*/
|
|
425
730
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
426
731
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
427
732
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -440,6 +745,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
440
745
|
});
|
|
441
746
|
return this;
|
|
442
747
|
}
|
|
748
|
+
/**
|
|
749
|
+
* Setup the default Basic Information Cluster Server attributes for the server node.
|
|
750
|
+
*
|
|
751
|
+
* @param deviceName - The name of the device.
|
|
752
|
+
* @param serialNumber - The serial number of the device.
|
|
753
|
+
* @param vendorId - The vendor ID of the device.
|
|
754
|
+
* @param vendorName - The vendor name of the device.
|
|
755
|
+
* @param productId - The product ID of the device.
|
|
756
|
+
* @param productName - The product name of the device.
|
|
757
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
758
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
759
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
760
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
761
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
762
|
+
*/
|
|
443
763
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
444
764
|
this.log.logName = deviceName;
|
|
445
765
|
this.deviceName = deviceName;
|
|
@@ -463,6 +783,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
463
783
|
}
|
|
464
784
|
return this;
|
|
465
785
|
}
|
|
786
|
+
/**
|
|
787
|
+
* Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
|
|
788
|
+
*
|
|
789
|
+
* @param deviceName - The name of the device.
|
|
790
|
+
* @param serialNumber - The serial number of the device.
|
|
791
|
+
* @param vendorId - The vendor ID of the device.
|
|
792
|
+
* @param vendorName - The name of the vendor.
|
|
793
|
+
* @param productName - The name of the product.
|
|
794
|
+
* @param softwareVersion - The software version of the device. Default is 1.
|
|
795
|
+
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
796
|
+
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
797
|
+
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
798
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
799
|
+
*
|
|
800
|
+
* @remarks The bridgedNode device type must be added to the deviceTypeList of the Descriptor cluster.
|
|
801
|
+
*/
|
|
466
802
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
467
803
|
this.log.logName = deviceName;
|
|
468
804
|
this.deviceName = deviceName;
|
|
@@ -495,6 +831,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
495
831
|
});
|
|
496
832
|
return this;
|
|
497
833
|
}
|
|
834
|
+
/**
|
|
835
|
+
* Creates a default identify cluster server with the specified identify time and type.
|
|
836
|
+
*
|
|
837
|
+
* @param {number} [identifyTime=0] - The time to identify the server. Defaults to 0.
|
|
838
|
+
* @param {Identify.IdentifyType} [identifyType=Identify.IdentifyType.None] - The type of identification. Defaults to Identify.IdentifyType.None.
|
|
839
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
840
|
+
*/
|
|
498
841
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
499
842
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
500
843
|
identifyTime,
|
|
@@ -502,14 +845,34 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
502
845
|
});
|
|
503
846
|
return this;
|
|
504
847
|
}
|
|
848
|
+
/**
|
|
849
|
+
* Creates a default groups cluster server.
|
|
850
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
851
|
+
*/
|
|
505
852
|
createDefaultGroupsClusterServer() {
|
|
506
853
|
this.behaviors.require(GroupsServer);
|
|
507
854
|
return this;
|
|
508
855
|
}
|
|
856
|
+
/**
|
|
857
|
+
* Creates a default scenes management cluster server.
|
|
858
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
859
|
+
*
|
|
860
|
+
* @remarks The scenes management cluster server is still provisional and so not yet implemented.
|
|
861
|
+
*/
|
|
509
862
|
createDefaultScenesClusterServer() {
|
|
510
863
|
this.behaviors.require(ScenesManagementServer);
|
|
511
864
|
return this;
|
|
512
865
|
}
|
|
866
|
+
/**
|
|
867
|
+
* Creates a default OnOff cluster server for light devices with feature Lighting.
|
|
868
|
+
*
|
|
869
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
870
|
+
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
871
|
+
* @param {number} [onTime=0] - The on time value.
|
|
872
|
+
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
873
|
+
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
874
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
875
|
+
*/
|
|
513
876
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
514
877
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
515
878
|
onOff,
|
|
@@ -520,24 +883,52 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
520
883
|
});
|
|
521
884
|
return this;
|
|
522
885
|
}
|
|
886
|
+
/**
|
|
887
|
+
* Creates an OnOff cluster server without features.
|
|
888
|
+
*
|
|
889
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
890
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
891
|
+
*/
|
|
523
892
|
createOnOffClusterServer(onOff = false) {
|
|
524
893
|
this.behaviors.require(MatterbridgeOnOffServer, {
|
|
525
894
|
onOff,
|
|
526
895
|
});
|
|
527
896
|
return this;
|
|
528
897
|
}
|
|
898
|
+
/**
|
|
899
|
+
* Creates a DeadFront OnOff cluster server with feature DeadFrontBehavior.
|
|
900
|
+
*
|
|
901
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
902
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
903
|
+
*/
|
|
529
904
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
530
905
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
531
906
|
onOff,
|
|
532
907
|
});
|
|
533
908
|
return this;
|
|
534
909
|
}
|
|
910
|
+
/**
|
|
911
|
+
* Creates an OffOnly OnOff cluster server with feature OffOnly.
|
|
912
|
+
*
|
|
913
|
+
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
914
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
915
|
+
*/
|
|
535
916
|
createOffOnlyOnOffClusterServer(onOff = false) {
|
|
536
917
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
|
|
537
918
|
onOff,
|
|
538
919
|
});
|
|
539
920
|
return this;
|
|
540
921
|
}
|
|
922
|
+
/**
|
|
923
|
+
* Creates a default level control cluster server for light devices with feature OnOff and Lighting.
|
|
924
|
+
*
|
|
925
|
+
* @param {number} [currentLevel=254] - The current level (default: 254).
|
|
926
|
+
* @param {number} [minLevel=1] - The minimum level (default: 1).
|
|
927
|
+
* @param {number} [maxLevel=254] - The maximum level (default: 254).
|
|
928
|
+
* @param {number | null} [onLevel=null] - The on level (default: null).
|
|
929
|
+
* @param {number | null} [startUpCurrentLevel=null] - The startUp on level (default: null).
|
|
930
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
931
|
+
*/
|
|
541
932
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
542
933
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
543
934
|
currentLevel,
|
|
@@ -553,6 +944,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
553
944
|
});
|
|
554
945
|
return this;
|
|
555
946
|
}
|
|
947
|
+
/**
|
|
948
|
+
* Creates a level control cluster server without features.
|
|
949
|
+
*
|
|
950
|
+
* @param {number} [currentLevel=254] - The current level (default: 254).
|
|
951
|
+
* @param {number | null} [onLevel=null] - The on level (default: null).
|
|
952
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
953
|
+
*/
|
|
556
954
|
createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
|
|
557
955
|
this.behaviors.require(MatterbridgeLevelControlServer, {
|
|
558
956
|
currentLevel,
|
|
@@ -564,6 +962,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
564
962
|
});
|
|
565
963
|
return this;
|
|
566
964
|
}
|
|
965
|
+
/**
|
|
966
|
+
* Creates a default color control cluster server with features Xy, HueSaturation and ColorTemperature.
|
|
967
|
+
*
|
|
968
|
+
* @param currentX - The current X value (range 0-65279).
|
|
969
|
+
* @param currentY - The current Y value (range 0-65279).
|
|
970
|
+
* @param currentHue - The current hue value (range: 0-254).
|
|
971
|
+
* @param currentSaturation - The current saturation value (range: 0-254).
|
|
972
|
+
* @param colorTemperatureMireds - The color temperature in mireds (default range 147-500).
|
|
973
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
|
|
974
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
|
|
975
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
976
|
+
*
|
|
977
|
+
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
978
|
+
* @remarks currentHue and currentSaturation persist across restarts.
|
|
979
|
+
* @remarks currentX and currentY persist across restarts.
|
|
980
|
+
* @remarks colorTemperatureMireds persists across restarts.
|
|
981
|
+
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
982
|
+
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
983
|
+
*/
|
|
567
984
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
568
985
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
569
986
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -586,6 +1003,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
586
1003
|
});
|
|
587
1004
|
return this;
|
|
588
1005
|
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Creates a Xy color control cluster server with feature Xy and ColorTemperature.
|
|
1008
|
+
*
|
|
1009
|
+
* @param currentX - The current X value.
|
|
1010
|
+
* @param currentY - The current Y value.
|
|
1011
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1012
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1013
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1014
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1015
|
+
*
|
|
1016
|
+
* @remarks
|
|
1017
|
+
* From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
|
|
1018
|
+
*
|
|
1019
|
+
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1020
|
+
* @remarks currentX and currentY persist across restarts.
|
|
1021
|
+
* @remarks colorTemperatureMireds persists across restarts.
|
|
1022
|
+
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1023
|
+
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1024
|
+
*/
|
|
589
1025
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
590
1026
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
591
1027
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -606,6 +1042,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
606
1042
|
});
|
|
607
1043
|
return this;
|
|
608
1044
|
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Creates a default hue and saturation control cluster server with feature HueSaturation and ColorTemperature.
|
|
1047
|
+
*
|
|
1048
|
+
* @param currentHue - The current hue value.
|
|
1049
|
+
* @param currentSaturation - The current saturation value.
|
|
1050
|
+
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1051
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1052
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1053
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1054
|
+
*
|
|
1055
|
+
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1056
|
+
* @remarks currentHue and currentSaturation persist across restarts.
|
|
1057
|
+
* @remarks colorTemperatureMireds persists across restarts.
|
|
1058
|
+
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1059
|
+
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1060
|
+
*/
|
|
609
1061
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
610
1062
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
611
1063
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -626,6 +1078,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
626
1078
|
});
|
|
627
1079
|
return this;
|
|
628
1080
|
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Creates a color temperature color control cluster server with feature ColorTemperature.
|
|
1083
|
+
* This cluster server is used for devices that only support color temperature control.
|
|
1084
|
+
*
|
|
1085
|
+
* @param colorTemperatureMireds - The color temperature in mireds. Defaults to 250.
|
|
1086
|
+
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds. Defaults to 147.
|
|
1087
|
+
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds. Defaults to 500.
|
|
1088
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1089
|
+
*
|
|
1090
|
+
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1091
|
+
* @remarks colorTemperatureMireds persists across restarts.
|
|
1092
|
+
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1093
|
+
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1094
|
+
*/
|
|
629
1095
|
createCtColorControlClusterServer(colorTemperatureMireds = 250, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
630
1096
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
631
1097
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -644,15 +1110,34 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
644
1110
|
});
|
|
645
1111
|
return this;
|
|
646
1112
|
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Configures the color control mode for the device.
|
|
1115
|
+
*
|
|
1116
|
+
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1117
|
+
*
|
|
1118
|
+
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1119
|
+
*/
|
|
647
1120
|
async configureColorControlMode(colorMode) {
|
|
648
1121
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
649
1122
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
650
1123
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
651
1124
|
}
|
|
652
1125
|
}
|
|
1126
|
+
/**
|
|
1127
|
+
* Creates a default window covering cluster server with feature Lift and PositionAwareLift.
|
|
1128
|
+
*
|
|
1129
|
+
* @param {number} positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1130
|
+
* @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.Rollershade). Must support feature Lift.
|
|
1131
|
+
* @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.RollerShade). Must support feature Lift.
|
|
1132
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1133
|
+
*
|
|
1134
|
+
* @remarks mode attributes is writable and persists across restarts.
|
|
1135
|
+
* currentPositionLiftPercent100ths persists across restarts.
|
|
1136
|
+
* configStatus attributes persists across restarts.
|
|
1137
|
+
*/
|
|
653
1138
|
createDefaultWindowCoveringClusterServer(positionPercent100ths, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade) {
|
|
654
1139
|
this.behaviors.require(MatterbridgeLiftWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
655
|
-
type,
|
|
1140
|
+
type, // Must support feature Lift
|
|
656
1141
|
numberOfActuationsLift: 0,
|
|
657
1142
|
configStatus: {
|
|
658
1143
|
operational: true,
|
|
@@ -660,20 +1145,33 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
660
1145
|
liftMovementReversed: false,
|
|
661
1146
|
liftPositionAware: true,
|
|
662
1147
|
tiltPositionAware: false,
|
|
663
|
-
liftEncoderControlled: false,
|
|
664
|
-
tiltEncoderControlled: false,
|
|
1148
|
+
liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
1149
|
+
tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
665
1150
|
},
|
|
666
1151
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
667
|
-
endProductType,
|
|
1152
|
+
endProductType, // Must support feature Lift
|
|
668
1153
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
669
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
670
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1154
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1155
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
671
1156
|
});
|
|
672
1157
|
return this;
|
|
673
1158
|
}
|
|
1159
|
+
/**
|
|
1160
|
+
* Creates a default window covering cluster server with features Lift, PositionAwareLift, Tilt, PositionAwareTilt.
|
|
1161
|
+
*
|
|
1162
|
+
* @param {number} positionLiftPercent100ths - The lift position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1163
|
+
* @param {number} positionTiltPercent100ths - The tilt position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1164
|
+
* @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.TiltBlindLift). Must support features Lift and Tilt.
|
|
1165
|
+
* @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.InteriorBlind). Must support features Lift and Tilt.
|
|
1166
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1167
|
+
*
|
|
1168
|
+
* @remarks mode attributes is writable and persists across restarts.
|
|
1169
|
+
* currentPositionTiltPercent100ths persists across restarts.
|
|
1170
|
+
* configStatus attributes persists across restarts.
|
|
1171
|
+
*/
|
|
674
1172
|
createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind) {
|
|
675
1173
|
this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt), {
|
|
676
|
-
type,
|
|
1174
|
+
type, // Must support features Lift and Tilt
|
|
677
1175
|
numberOfActuationsLift: 0,
|
|
678
1176
|
numberOfActuationsTilt: 0,
|
|
679
1177
|
configStatus: {
|
|
@@ -682,19 +1180,23 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
682
1180
|
liftMovementReversed: false,
|
|
683
1181
|
liftPositionAware: true,
|
|
684
1182
|
tiltPositionAware: true,
|
|
685
|
-
liftEncoderControlled: false,
|
|
686
|
-
tiltEncoderControlled: false,
|
|
1183
|
+
liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
1184
|
+
tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
687
1185
|
},
|
|
688
1186
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
689
|
-
endProductType,
|
|
1187
|
+
endProductType, // Must support features Lift and Tilt
|
|
690
1188
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
691
|
-
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
692
|
-
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
693
|
-
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
694
|
-
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
1189
|
+
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1190
|
+
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1191
|
+
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1192
|
+
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
695
1193
|
});
|
|
696
1194
|
return this;
|
|
697
1195
|
}
|
|
1196
|
+
/**
|
|
1197
|
+
* Sets the window covering lift target position as the current position and stops the movement.
|
|
1198
|
+
*
|
|
1199
|
+
*/
|
|
698
1200
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
699
1201
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
700
1202
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -714,6 +1216,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
714
1216
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
715
1217
|
}
|
|
716
1218
|
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Sets the lift current and target position and the status of a window covering.
|
|
1221
|
+
* @param {number} current - The current position of the window covering.
|
|
1222
|
+
* @param {number} target - The target position of the window covering.
|
|
1223
|
+
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1224
|
+
*/
|
|
717
1225
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
718
1226
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
719
1227
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -724,6 +1232,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
724
1232
|
}, this.log);
|
|
725
1233
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
726
1234
|
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Sets the status of the window covering.
|
|
1237
|
+
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1238
|
+
*/
|
|
727
1239
|
async setWindowCoveringStatus(status) {
|
|
728
1240
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
729
1241
|
global: status,
|
|
@@ -732,6 +1244,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
732
1244
|
}, this.log);
|
|
733
1245
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
734
1246
|
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Retrieves the status of the window covering.
|
|
1249
|
+
*
|
|
1250
|
+
* @returns The global operational status of the window covering or undefined.
|
|
1251
|
+
*/
|
|
735
1252
|
getWindowCoveringStatus() {
|
|
736
1253
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
737
1254
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -739,6 +1256,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
739
1256
|
return status.global;
|
|
740
1257
|
}
|
|
741
1258
|
}
|
|
1259
|
+
/**
|
|
1260
|
+
* Sets the lift target and current position of the window covering.
|
|
1261
|
+
*
|
|
1262
|
+
* @param {number} liftPosition - The position to set, specified as a number.
|
|
1263
|
+
* @param {number} [tiltPosition] - The tilt position to set, specified as a number.
|
|
1264
|
+
*/
|
|
742
1265
|
async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
|
|
743
1266
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', liftPosition, this.log);
|
|
744
1267
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', liftPosition, this.log);
|
|
@@ -749,31 +1272,56 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
749
1272
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
|
|
750
1273
|
}
|
|
751
1274
|
}
|
|
1275
|
+
/**
|
|
1276
|
+
* Creates a default thermostat cluster server with features Heating, Cooling and AutoMode.
|
|
1277
|
+
*
|
|
1278
|
+
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1279
|
+
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1280
|
+
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1281
|
+
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
1282
|
+
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1283
|
+
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1284
|
+
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1285
|
+
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1286
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1287
|
+
*/
|
|
752
1288
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
753
1289
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
754
1290
|
localTemperature: localTemperature * 100,
|
|
755
1291
|
systemMode: Thermostat.SystemMode.Auto,
|
|
756
1292
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1293
|
+
// Thermostat.Feature.Heating
|
|
757
1294
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
758
1295
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
759
1296
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
760
1297
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
761
1298
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1299
|
+
// Thermostat.Feature.Cooling
|
|
762
1300
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
763
1301
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
764
1302
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
765
1303
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
766
1304
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1305
|
+
// Thermostat.Feature.AutoMode
|
|
767
1306
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
768
1307
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
769
1308
|
});
|
|
770
1309
|
return this;
|
|
771
1310
|
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Creates a default heating thermostat cluster server with feature Heating.
|
|
1313
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1314
|
+
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1315
|
+
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1316
|
+
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1317
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1318
|
+
*/
|
|
772
1319
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
773
1320
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
|
|
774
1321
|
localTemperature: localTemperature * 100,
|
|
775
1322
|
systemMode: Thermostat.SystemMode.Heat,
|
|
776
1323
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1324
|
+
// Thermostat.Feature.Heating
|
|
777
1325
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
778
1326
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
779
1327
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -782,11 +1330,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
782
1330
|
});
|
|
783
1331
|
return this;
|
|
784
1332
|
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Creates a default cooling thermostat cluster server with feature Cooling.
|
|
1335
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1336
|
+
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1337
|
+
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1338
|
+
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1339
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1340
|
+
*/
|
|
785
1341
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
786
1342
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
|
|
787
1343
|
localTemperature: localTemperature * 100,
|
|
788
1344
|
systemMode: Thermostat.SystemMode.Cool,
|
|
789
1345
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1346
|
+
// Thermostat.Feature.Cooling
|
|
790
1347
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
791
1348
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
792
1349
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -795,6 +1352,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
795
1352
|
});
|
|
796
1353
|
return this;
|
|
797
1354
|
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Creates a default thermostat user interface configuration cluster server.
|
|
1357
|
+
*
|
|
1358
|
+
* @remarks
|
|
1359
|
+
* The default values are:
|
|
1360
|
+
* - temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius (writeble).
|
|
1361
|
+
* - keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout (writeble).
|
|
1362
|
+
* - scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted (writeble).
|
|
1363
|
+
*/
|
|
798
1364
|
createDefaultThermostatUserInterfaceConfigurationClusterServer() {
|
|
799
1365
|
this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
|
|
800
1366
|
temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
|
|
@@ -803,69 +1369,158 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
803
1369
|
});
|
|
804
1370
|
return this;
|
|
805
1371
|
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Creates a default fan control cluster server with features Auto, and Step.
|
|
1374
|
+
*
|
|
1375
|
+
* @param {FanControl.FanMode} [fanMode=FanControl.FanMode.Off] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1376
|
+
* @param {FanControl.FanModeSequence} [fanModeSequence=FanControl.FanModeSequence.OffLowMedHighAuto] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
|
|
1377
|
+
* @param {number} [percentSetting=0] - The initial percent setting. Defaults to 0.
|
|
1378
|
+
* @param {number} [percentCurrent=0] - The initial percent current. Defaults to 0.
|
|
1379
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1380
|
+
*
|
|
1381
|
+
* @remarks
|
|
1382
|
+
* - fanmode is writable and persists across reboots.
|
|
1383
|
+
* - fanModeSequence is fixed.
|
|
1384
|
+
* - percentSetting is writable.
|
|
1385
|
+
*/
|
|
806
1386
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0) {
|
|
807
1387
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
808
|
-
fanMode,
|
|
809
|
-
fanModeSequence,
|
|
810
|
-
percentSetting,
|
|
1388
|
+
fanMode, // Writable and persistent attribute
|
|
1389
|
+
fanModeSequence, // Fixed attribute
|
|
1390
|
+
percentSetting, // Writable attribute
|
|
811
1391
|
percentCurrent,
|
|
812
1392
|
});
|
|
813
1393
|
return this;
|
|
814
1394
|
}
|
|
1395
|
+
/**
|
|
1396
|
+
* Creates a fan control cluster server with features MultiSpeed, Auto, and Step.
|
|
1397
|
+
*
|
|
1398
|
+
* @param {FanControl.FanMode} [fanMode=FanControl.FanMode.Off] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1399
|
+
* @param {number} [percentSetting=0] - The initial percent setting. Defaults to 0.
|
|
1400
|
+
* @param {number} [percentCurrent=0] - The initial percent current. Defaults to 0.
|
|
1401
|
+
* @param {number} [speedMax=10] - The maximum speed setting. Defaults to 10.
|
|
1402
|
+
* @param {number} [speedSetting=0] - The initial speed setting. Defaults to 0.
|
|
1403
|
+
* @param {number} [speedCurrent=0] - The initial speed current. Defaults to 0.
|
|
1404
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1405
|
+
*
|
|
1406
|
+
* @remarks
|
|
1407
|
+
* - fanmode is writable and persists across reboots.
|
|
1408
|
+
* - fanModeSequence is fixed.
|
|
1409
|
+
* - percentSetting is writable.
|
|
1410
|
+
* - speedMax is fixed.
|
|
1411
|
+
* - speedSetting is writable.
|
|
1412
|
+
*/
|
|
815
1413
|
createMultiSpeedFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0, speedMax = 10, speedSetting = 0, speedCurrent = 0) {
|
|
816
1414
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
817
|
-
fanMode,
|
|
818
|
-
fanModeSequence,
|
|
819
|
-
percentSetting,
|
|
1415
|
+
fanMode, // Writable and persistent attribute
|
|
1416
|
+
fanModeSequence, // Fixed attribute
|
|
1417
|
+
percentSetting, // Writable attribute
|
|
820
1418
|
percentCurrent,
|
|
821
|
-
|
|
822
|
-
|
|
1419
|
+
// MultiSpeed feature
|
|
1420
|
+
speedMax, // Fixed attribute
|
|
1421
|
+
speedSetting, // Writable attribute
|
|
823
1422
|
speedCurrent,
|
|
824
1423
|
});
|
|
825
1424
|
return this;
|
|
826
1425
|
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Creates a base fan control cluster server without features.
|
|
1428
|
+
*
|
|
1429
|
+
* @param {FanControl.FanMode} [fanMode=FanControl.FanMode.Off] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1430
|
+
* @param {FanControl.FanModeSequence} [fanModeSequence=FanControl.FanModeSequence.OffLowMedHigh] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHigh`.
|
|
1431
|
+
* @param {number} [percentSetting=0] - The initial percent setting. Defaults to 0.
|
|
1432
|
+
* @param {number} [percentCurrent=0] - The initial percent current. Defaults to 0.
|
|
1433
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1434
|
+
*
|
|
1435
|
+
* @remarks
|
|
1436
|
+
* fanmode is writable and persists across reboots.
|
|
1437
|
+
* fanModeSequence is fixed.
|
|
1438
|
+
* percentSetting is writable.
|
|
1439
|
+
*/
|
|
827
1440
|
createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHigh, percentSetting = 0, percentCurrent = 0) {
|
|
828
1441
|
this.behaviors.require(FanControlServer, {
|
|
829
|
-
fanMode,
|
|
830
|
-
fanModeSequence,
|
|
831
|
-
percentSetting,
|
|
1442
|
+
fanMode, // Writable and persistent attribute
|
|
1443
|
+
fanModeSequence, // Fixed attribute
|
|
1444
|
+
percentSetting, // Writable attribute
|
|
832
1445
|
percentCurrent,
|
|
833
1446
|
});
|
|
834
1447
|
return this;
|
|
835
1448
|
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Creates a default HEPA Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
|
|
1451
|
+
* It supports ResourceMonitoring.Feature.Condition and ResourceMonitoring.Feature.ReplacementProductList.
|
|
1452
|
+
*
|
|
1453
|
+
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
1454
|
+
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
|
|
1455
|
+
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
|
|
1456
|
+
*
|
|
1457
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1458
|
+
*/
|
|
836
1459
|
createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
837
1460
|
this.behaviors.require(HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
838
|
-
condition: 100,
|
|
839
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1461
|
+
condition: 100, // Feature.Condition
|
|
1462
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
|
|
840
1463
|
changeIndication,
|
|
841
1464
|
inPlaceIndicator,
|
|
842
1465
|
lastChangedTime,
|
|
843
|
-
replacementProductList: [],
|
|
1466
|
+
replacementProductList: [], // Feature.ReplacementProductList
|
|
844
1467
|
});
|
|
845
1468
|
return this;
|
|
846
1469
|
}
|
|
1470
|
+
/**
|
|
1471
|
+
* Creates a default Activated Carbon Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
|
|
1472
|
+
*
|
|
1473
|
+
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
1474
|
+
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
|
|
1475
|
+
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
|
|
1476
|
+
*
|
|
1477
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1478
|
+
*/
|
|
847
1479
|
createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
848
1480
|
this.behaviors.require(ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
849
|
-
condition: 100,
|
|
850
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1481
|
+
condition: 100, // Feature.Condition
|
|
1482
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
|
|
851
1483
|
changeIndication,
|
|
852
1484
|
inPlaceIndicator,
|
|
853
1485
|
lastChangedTime,
|
|
854
|
-
replacementProductList: [],
|
|
1486
|
+
replacementProductList: [], // Feature.ReplacementProductList
|
|
855
1487
|
});
|
|
856
1488
|
return this;
|
|
857
1489
|
}
|
|
1490
|
+
/**
|
|
1491
|
+
* Creates a default door lock cluster server.
|
|
1492
|
+
*
|
|
1493
|
+
* @param {DoorLock.LockState} [lockState=DoorLock.LockState.Locked] - The initial state of the lock (default: Locked).
|
|
1494
|
+
* @param {DoorLock.LockType} [lockType=DoorLock.LockType.DeadBolt] - The type of the lock (default: DeadBolt).
|
|
1495
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1496
|
+
*
|
|
1497
|
+
* @remarks
|
|
1498
|
+
* 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.
|
|
1499
|
+
*/
|
|
858
1500
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
859
1501
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
860
1502
|
lockState,
|
|
861
1503
|
lockType,
|
|
862
1504
|
actuatorEnabled: false,
|
|
863
1505
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
1506
|
+
// Special case of inverted bitmap: add also alwaysSet = 2047
|
|
864
1507
|
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
|
|
865
1508
|
alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
|
|
866
1509
|
});
|
|
867
1510
|
return this;
|
|
868
1511
|
}
|
|
1512
|
+
/**
|
|
1513
|
+
* Creates a default Mode Select cluster server.
|
|
1514
|
+
*
|
|
1515
|
+
* @param {string} description - The description of the mode select cluster.
|
|
1516
|
+
* @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
|
|
1517
|
+
* @param {number} [currentMode=0] - The current mode (default: 0).
|
|
1518
|
+
* @param {number} [startUpMode=0] - The startup mode (default: 0).
|
|
1519
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1520
|
+
*
|
|
1521
|
+
* @remarks
|
|
1522
|
+
* endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
|
|
1523
|
+
*/
|
|
869
1524
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
870
1525
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
871
1526
|
description: description,
|
|
@@ -876,21 +1531,35 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
876
1531
|
});
|
|
877
1532
|
return this;
|
|
878
1533
|
}
|
|
1534
|
+
/**
|
|
1535
|
+
* Creates the default Valve Configuration And Control cluster server with features Level.
|
|
1536
|
+
*
|
|
1537
|
+
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
1538
|
+
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
1539
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1540
|
+
*/
|
|
879
1541
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
880
1542
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
881
1543
|
currentState: valveState,
|
|
882
1544
|
targetState: valveState,
|
|
883
1545
|
openDuration: null,
|
|
884
|
-
defaultOpenDuration: null,
|
|
1546
|
+
defaultOpenDuration: null, // Writable and persistent across restarts
|
|
885
1547
|
remainingDuration: null,
|
|
886
1548
|
valveFault: { generalFault: false, blocked: false, leaking: false, notConnected: false, shortCircuit: false, currentExceeded: false },
|
|
1549
|
+
// Feature.Level
|
|
887
1550
|
currentLevel: valveLevel,
|
|
888
1551
|
targetLevel: valveLevel,
|
|
889
|
-
defaultOpenLevel: 100,
|
|
890
|
-
levelStep: 1,
|
|
1552
|
+
defaultOpenLevel: 100, // Writable and persistent across restarts
|
|
1553
|
+
levelStep: 1, // Fixed
|
|
891
1554
|
});
|
|
892
1555
|
return this;
|
|
893
1556
|
}
|
|
1557
|
+
/**
|
|
1558
|
+
* Creates the default PumpConfigurationAndControl cluster server with features ConstantSpeed.
|
|
1559
|
+
*
|
|
1560
|
+
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
1561
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1562
|
+
*/
|
|
894
1563
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
895
1564
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
896
1565
|
minConstSpeed: null,
|
|
@@ -905,6 +1574,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
905
1574
|
});
|
|
906
1575
|
return this;
|
|
907
1576
|
}
|
|
1577
|
+
/**
|
|
1578
|
+
* Creates the default SmokeCOAlarm Cluster Server with features SmokeAlarm and CoAlarm.
|
|
1579
|
+
*
|
|
1580
|
+
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1581
|
+
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1582
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1583
|
+
*/
|
|
908
1584
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
909
1585
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
910
1586
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -920,6 +1596,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
920
1596
|
});
|
|
921
1597
|
return this;
|
|
922
1598
|
}
|
|
1599
|
+
/**
|
|
1600
|
+
* Creates a smoke only SmokeCOAlarm Cluster Server with features SmokeAlarm.
|
|
1601
|
+
*
|
|
1602
|
+
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1603
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1604
|
+
*/
|
|
923
1605
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
924
1606
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
925
1607
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -934,6 +1616,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
934
1616
|
});
|
|
935
1617
|
return this;
|
|
936
1618
|
}
|
|
1619
|
+
/**
|
|
1620
|
+
* Creates a co only SmokeCOAlarm Cluster Server with features CoAlarm.
|
|
1621
|
+
*
|
|
1622
|
+
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1623
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1624
|
+
*/
|
|
937
1625
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
938
1626
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
939
1627
|
events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -948,6 +1636,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
948
1636
|
});
|
|
949
1637
|
return this;
|
|
950
1638
|
}
|
|
1639
|
+
/**
|
|
1640
|
+
* Creates a default momentary switch cluster server with features MomentarySwitch, MomentarySwitchRelease, MomentarySwitchLongPress and MomentarySwitchMultiPress.
|
|
1641
|
+
*
|
|
1642
|
+
* @remarks
|
|
1643
|
+
* This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
|
|
1644
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1645
|
+
*/
|
|
951
1646
|
createDefaultSwitchClusterServer() {
|
|
952
1647
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
953
1648
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -958,6 +1653,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
958
1653
|
});
|
|
959
1654
|
return this;
|
|
960
1655
|
}
|
|
1656
|
+
/**
|
|
1657
|
+
* Creates a default latching switch cluster server with features LatchingSwitch.
|
|
1658
|
+
*
|
|
1659
|
+
* @remarks
|
|
1660
|
+
* This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
|
|
1661
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1662
|
+
*/
|
|
961
1663
|
createDefaultLatchingSwitchClusterServer() {
|
|
962
1664
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
963
1665
|
events: { switchLatched: true },
|
|
@@ -967,6 +1669,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
967
1669
|
});
|
|
968
1670
|
return this;
|
|
969
1671
|
}
|
|
1672
|
+
/**
|
|
1673
|
+
* Triggers a switch event on the specified endpoint.
|
|
1674
|
+
*
|
|
1675
|
+
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1676
|
+
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1677
|
+
* @returns {boolean} - A boolean indicating whether the event was successfully triggered.
|
|
1678
|
+
*/
|
|
970
1679
|
async triggerSwitchEvent(event, log) {
|
|
971
1680
|
if (this.maybeNumber === undefined) {
|
|
972
1681
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1026,10 +1735,30 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1026
1735
|
}
|
|
1027
1736
|
return true;
|
|
1028
1737
|
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Creates a default OperationalState Cluster Server.
|
|
1740
|
+
*
|
|
1741
|
+
* @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state.
|
|
1742
|
+
*
|
|
1743
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1744
|
+
*/
|
|
1029
1745
|
createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
|
1030
1746
|
this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
|
|
1031
1747
|
return this;
|
|
1032
1748
|
}
|
|
1749
|
+
/**
|
|
1750
|
+
* Creates a default boolean state cluster server.
|
|
1751
|
+
* The stateChange event is enabled.
|
|
1752
|
+
*
|
|
1753
|
+
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
|
|
1754
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1755
|
+
*
|
|
1756
|
+
* @remarks
|
|
1757
|
+
* Water Leak Detector: true = leak, false = no leak
|
|
1758
|
+
* Water Freeze Detector: true = freeze, false = no freeze
|
|
1759
|
+
* Rain Sensor: true = rain, false = no rain
|
|
1760
|
+
* Contact Sensor: true = closed or contact, false = open or no contact
|
|
1761
|
+
*/
|
|
1033
1762
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1034
1763
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1035
1764
|
events: { stateChange: true },
|
|
@@ -1038,6 +1767,23 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1038
1767
|
});
|
|
1039
1768
|
return this;
|
|
1040
1769
|
}
|
|
1770
|
+
/**
|
|
1771
|
+
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
|
|
1772
|
+
*
|
|
1773
|
+
* Features:
|
|
1774
|
+
* - Visual
|
|
1775
|
+
* - Audible
|
|
1776
|
+
* - SensitivityLevel
|
|
1777
|
+
*
|
|
1778
|
+
* @remarks Supports the enableDisableAlarm command.
|
|
1779
|
+
*
|
|
1780
|
+
* @param {boolean} [sensorFault=false] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1781
|
+
* @param {number} [currentSensitivityLevel=0] - The current sensitivity level. Defaults to `0` if not provided.
|
|
1782
|
+
* @param {number} [supportedSensitivityLevels=2] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
|
|
1783
|
+
* @param {number} [defaultSensitivityLevel=0] - The default sensitivity level. Defaults to `0` if not provided.
|
|
1784
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1785
|
+
*
|
|
1786
|
+
*/
|
|
1041
1787
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1042
1788
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1043
1789
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -1052,17 +1798,50 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1052
1798
|
});
|
|
1053
1799
|
return this;
|
|
1054
1800
|
}
|
|
1801
|
+
/**
|
|
1802
|
+
* Creates a default Device Energy Management Cluster Server with feature PowerForecastReporting and with the specified ESA type, ESA canGenerate, ESA state, and power limits.
|
|
1803
|
+
*
|
|
1804
|
+
* @param {DeviceEnergyManagement.EsaType} [esaType=DeviceEnergyManagement.EsaType.Other] - The ESA type. Defaults to `DeviceEnergyManagement.EsaType.Other`.
|
|
1805
|
+
* @param {boolean} [esaCanGenerate=false] - Indicates if the ESA can generate energy. Defaults to `false`.
|
|
1806
|
+
* @param {DeviceEnergyManagement.EsaState} [esaState=DeviceEnergyManagement.EsaState.Online] - The ESA state. Defaults to `DeviceEnergyManagement.EsaState.Online`.
|
|
1807
|
+
* @param {number} [absMinPower=0] - The absolute minimum power in mW. Defaults to `0`.
|
|
1808
|
+
* @param {number} [absMaxPower=0] - The absolute maximum power in mW. Defaults to `0`.
|
|
1809
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1810
|
+
*
|
|
1811
|
+
* @remarks
|
|
1812
|
+
* - The forecast attribute is set to null, indicating that there is no forecast currently available.
|
|
1813
|
+
* - The ESA type and canGenerate attributes are fixed and cannot be changed after creation.
|
|
1814
|
+
* - The ESA state is set to Online by default.
|
|
1815
|
+
* - The absolute minimum and maximum power attributes are set to 0 by default.
|
|
1816
|
+
* - For example, a battery storage inverter that can charge its battery at a maximum power of 2000W and can
|
|
1817
|
+
* discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
|
|
1818
|
+
*/
|
|
1055
1819
|
createDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
|
|
1056
1820
|
this.behaviors.require(DeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting), {
|
|
1057
|
-
forecast: null,
|
|
1058
|
-
esaType,
|
|
1059
|
-
esaCanGenerate,
|
|
1821
|
+
forecast: null, // A null value indicates that there is no forecast currently available
|
|
1822
|
+
esaType, // Fixed attribute
|
|
1823
|
+
esaCanGenerate, // Fixed attribute
|
|
1060
1824
|
esaState,
|
|
1061
1825
|
absMinPower,
|
|
1062
1826
|
absMaxPower,
|
|
1063
1827
|
});
|
|
1064
1828
|
return this;
|
|
1065
1829
|
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Creates a default EnergyManagementMode Cluster Server.
|
|
1832
|
+
*
|
|
1833
|
+
* @param {number} [currentMode] - The current mode of the EnergyManagementMode cluster. Defaults to mode 1 (DeviceEnergyManagementMode.ModeTag.NoOptimization).
|
|
1834
|
+
* @param {EnergyManagementMode.ModeOption[]} [supportedModes] - The supported modes for the DeviceEnergyManagementMode cluster. The attribute is fixed and defaults to a predefined set of cluster modes.
|
|
1835
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1836
|
+
*
|
|
1837
|
+
* @remarks
|
|
1838
|
+
* A few examples of Device Energy Management modes and their mode tags are provided below.
|
|
1839
|
+
* - For the "No Energy Management (Forecast reporting only)" mode, tags: 0x4000 (NoOptimization).
|
|
1840
|
+
* - For the "Device Energy Management" mode, tags: 0x4001 (DeviceOptimization).
|
|
1841
|
+
* - For the "Home Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization).
|
|
1842
|
+
* - For the "Grid Energy Management" mode, tags: 0x4003 (GridOptimization).
|
|
1843
|
+
* - For the "Full Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization), 0x4003 (GridOptimization).
|
|
1844
|
+
*/
|
|
1066
1845
|
createDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
|
|
1067
1846
|
this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, {
|
|
1068
1847
|
supportedModes: supportedModes ?? [
|
|
@@ -1083,15 +1862,26 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1083
1862
|
mode: 5,
|
|
1084
1863
|
modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.DeviceOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }, { value: DeviceEnergyManagementMode.ModeTag.GridOptimization }],
|
|
1085
1864
|
},
|
|
1086
|
-
],
|
|
1865
|
+
], // Fixed attribute
|
|
1087
1866
|
currentMode: currentMode ?? 1,
|
|
1088
1867
|
});
|
|
1089
1868
|
return this;
|
|
1090
1869
|
}
|
|
1870
|
+
/**
|
|
1871
|
+
* Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
|
|
1872
|
+
*
|
|
1873
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1874
|
+
*/
|
|
1091
1875
|
createDefaultPowerTopologyClusterServer() {
|
|
1092
1876
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1093
1877
|
return this;
|
|
1094
1878
|
}
|
|
1879
|
+
/**
|
|
1880
|
+
* Creates a default Electrical Energy Measurement Cluster Server with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
|
|
1881
|
+
*
|
|
1882
|
+
* @param {number} energy - The total consumption value in mW/h.
|
|
1883
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1884
|
+
*/
|
|
1095
1885
|
createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
1096
1886
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1097
1887
|
accuracy: {
|
|
@@ -1107,6 +1897,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1107
1897
|
});
|
|
1108
1898
|
return this;
|
|
1109
1899
|
}
|
|
1900
|
+
/**
|
|
1901
|
+
* Creates a default Electrical Power Measurement Cluster Server with features AlternatingCurrent.
|
|
1902
|
+
*
|
|
1903
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
1904
|
+
* @param {number} current - The current value in milliamperes.
|
|
1905
|
+
* @param {number} power - The power value in milliwatts.
|
|
1906
|
+
* @param {number} frequency - The frequency value in millihertz.
|
|
1907
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1908
|
+
*/
|
|
1110
1909
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1111
1910
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1112
1911
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1148,36 +1947,112 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1148
1947
|
});
|
|
1149
1948
|
return this;
|
|
1150
1949
|
}
|
|
1950
|
+
/**
|
|
1951
|
+
* Creates a default TemperatureMeasurement cluster server.
|
|
1952
|
+
*
|
|
1953
|
+
* @param {number | null} measuredValue - The measured value of the temperature x 100.
|
|
1954
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
|
|
1955
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
|
|
1956
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1957
|
+
*/
|
|
1151
1958
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1152
1959
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1153
1960
|
return this;
|
|
1154
1961
|
}
|
|
1962
|
+
/**
|
|
1963
|
+
* Creates a default RelativeHumidityMeasurement cluster server.
|
|
1964
|
+
*
|
|
1965
|
+
* @param {number | null} measuredValue - The measured value of the relative humidity x 100.
|
|
1966
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
|
|
1967
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
|
|
1968
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1969
|
+
*/
|
|
1155
1970
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1156
1971
|
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1157
1972
|
return this;
|
|
1158
1973
|
}
|
|
1974
|
+
/**
|
|
1975
|
+
* Creates a default PressureMeasurement cluster server.
|
|
1976
|
+
*
|
|
1977
|
+
* @param {number | null} measuredValue - The measured value for the pressure.
|
|
1978
|
+
* @param {number | null} minMeasuredValue - The minimum measured value for the pressure.
|
|
1979
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value for the pressure.
|
|
1980
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1981
|
+
*/
|
|
1159
1982
|
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1160
1983
|
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1161
1984
|
return this;
|
|
1162
1985
|
}
|
|
1986
|
+
/**
|
|
1987
|
+
* Creates a default IlluminanceMeasurement cluster server.
|
|
1988
|
+
*
|
|
1989
|
+
* @param {number | null} measuredValue - The measured value of illuminance.
|
|
1990
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
|
|
1991
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
|
|
1992
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1993
|
+
*
|
|
1994
|
+
* @remark The default value for the illuminance measurement is null.
|
|
1995
|
+
* This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
|
|
1996
|
+
* • MeasuredValue = 10,000 x log10(illuminance) + 1,
|
|
1997
|
+
* where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
|
|
1998
|
+
* • 0 indicates a value of illuminance that is too low to be measured
|
|
1999
|
+
* • null indicates that the illuminance measurement is invalid.
|
|
2000
|
+
*
|
|
2001
|
+
* - Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
|
|
2002
|
+
* - Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
|
|
2003
|
+
*/
|
|
1163
2004
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1164
2005
|
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1165
2006
|
return this;
|
|
1166
2007
|
}
|
|
2008
|
+
/**
|
|
2009
|
+
* Creates a default FlowMeasurement cluster server.
|
|
2010
|
+
*
|
|
2011
|
+
* @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
|
|
2012
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
|
|
2013
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
|
|
2014
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2015
|
+
*/
|
|
1167
2016
|
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1168
2017
|
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1169
2018
|
return this;
|
|
1170
2019
|
}
|
|
2020
|
+
/**
|
|
2021
|
+
* Creates a default OccupancySensing cluster server with feature PassiveInfrared.
|
|
2022
|
+
*
|
|
2023
|
+
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
2024
|
+
* @param {number} holdTime - The hold time in seconds. Default is 30.
|
|
2025
|
+
* @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
|
|
2026
|
+
* @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
|
|
2027
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2028
|
+
*
|
|
2029
|
+
* @remark The default value for the occupancy sensor type is PIR.
|
|
2030
|
+
*/
|
|
1171
2031
|
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
1172
2032
|
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
1173
2033
|
return this;
|
|
1174
2034
|
}
|
|
2035
|
+
/**
|
|
2036
|
+
* Creates a default AirQuality cluster server.
|
|
2037
|
+
*
|
|
2038
|
+
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2039
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2040
|
+
*/
|
|
1175
2041
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1176
2042
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1177
2043
|
airQuality,
|
|
1178
2044
|
});
|
|
1179
2045
|
return this;
|
|
1180
2046
|
}
|
|
2047
|
+
/**
|
|
2048
|
+
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2049
|
+
*
|
|
2050
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2051
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2052
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2053
|
+
* @param {number} [uncertainty] - The uncertainty value (optional).
|
|
2054
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2055
|
+
*/
|
|
1181
2056
|
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
1182
2057
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1183
2058
|
measuredValue,
|
|
@@ -1189,6 +2064,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1189
2064
|
});
|
|
1190
2065
|
return this;
|
|
1191
2066
|
}
|
|
2067
|
+
/**
|
|
2068
|
+
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature LevelIndication.
|
|
2069
|
+
|
|
2070
|
+
* @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
|
|
2071
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2072
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2073
|
+
*/
|
|
1192
2074
|
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1193
2075
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
1194
2076
|
levelValue,
|
|
@@ -1196,6 +2078,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1196
2078
|
});
|
|
1197
2079
|
return this;
|
|
1198
2080
|
}
|
|
2081
|
+
/**
|
|
2082
|
+
* Create a default CarbonMonoxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2083
|
+
*
|
|
2084
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2085
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2086
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2087
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2088
|
+
*/
|
|
1199
2089
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1200
2090
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1201
2091
|
measuredValue,
|
|
@@ -1207,6 +2097,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1207
2097
|
});
|
|
1208
2098
|
return this;
|
|
1209
2099
|
}
|
|
2100
|
+
/**
|
|
2101
|
+
* Create a default CarbonDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2102
|
+
*
|
|
2103
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2104
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2105
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2106
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2107
|
+
*/
|
|
1210
2108
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1211
2109
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1212
2110
|
measuredValue,
|
|
@@ -1218,6 +2116,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1218
2116
|
});
|
|
1219
2117
|
return this;
|
|
1220
2118
|
}
|
|
2119
|
+
/**
|
|
2120
|
+
* Create a default FormaldehydeConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2121
|
+
*
|
|
2122
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2123
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2124
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2125
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2126
|
+
*/
|
|
1221
2127
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1222
2128
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1223
2129
|
measuredValue,
|
|
@@ -1229,6 +2135,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1229
2135
|
});
|
|
1230
2136
|
return this;
|
|
1231
2137
|
}
|
|
2138
|
+
/**
|
|
2139
|
+
* Create a default Pm1ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2140
|
+
*
|
|
2141
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2142
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2143
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2144
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2145
|
+
*/
|
|
1232
2146
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1233
2147
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1234
2148
|
measuredValue,
|
|
@@ -1240,6 +2154,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1240
2154
|
});
|
|
1241
2155
|
return this;
|
|
1242
2156
|
}
|
|
2157
|
+
/**
|
|
2158
|
+
* Create a default Pm25ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2159
|
+
*
|
|
2160
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2161
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2162
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2163
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2164
|
+
*/
|
|
1243
2165
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1244
2166
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1245
2167
|
measuredValue,
|
|
@@ -1251,6 +2173,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1251
2173
|
});
|
|
1252
2174
|
return this;
|
|
1253
2175
|
}
|
|
2176
|
+
/**
|
|
2177
|
+
* Create a default Pm10ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2178
|
+
*
|
|
2179
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2180
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2181
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2182
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2183
|
+
*/
|
|
1254
2184
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1255
2185
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1256
2186
|
measuredValue,
|
|
@@ -1262,6 +2192,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1262
2192
|
});
|
|
1263
2193
|
return this;
|
|
1264
2194
|
}
|
|
2195
|
+
/**
|
|
2196
|
+
* Create a default OzoneConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2197
|
+
*
|
|
2198
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2199
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2200
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2201
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2202
|
+
*/
|
|
1265
2203
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1266
2204
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1267
2205
|
measuredValue,
|
|
@@ -1273,6 +2211,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1273
2211
|
});
|
|
1274
2212
|
return this;
|
|
1275
2213
|
}
|
|
2214
|
+
/**
|
|
2215
|
+
* Create a default RadonConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2216
|
+
*
|
|
2217
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2218
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2219
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2220
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2221
|
+
*/
|
|
1276
2222
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1277
2223
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1278
2224
|
measuredValue,
|
|
@@ -1284,6 +2230,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1284
2230
|
});
|
|
1285
2231
|
return this;
|
|
1286
2232
|
}
|
|
2233
|
+
/**
|
|
2234
|
+
* Create a default NitrogenDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2235
|
+
*
|
|
2236
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2237
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2238
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2239
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2240
|
+
*/
|
|
1287
2241
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1288
2242
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1289
2243
|
measuredValue,
|
|
@@ -1296,3 +2250,4 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1296
2250
|
return this;
|
|
1297
2251
|
}
|
|
1298
2252
|
}
|
|
2253
|
+
//# sourceMappingURL=matterbridgeEndpoint.js.map
|