matterbridge 3.0.6 → 3.0.7-dev-20250614-0d145a8
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 +16 -0
- package/dist/cli.js +2 -62
- package/dist/cluster/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -23
- package/dist/deviceManager.js +1 -94
- package/dist/evse.js +9 -65
- package/dist/frontend.js +16 -374
- package/dist/globalMatterbridge.js +0 -20
- package/dist/helpers.js +0 -51
- package/dist/index.js +1 -28
- package/dist/laundryWasher.js +7 -92
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.js +0 -2
- package/dist/matter/types.js +0 -2
- package/dist/matterbridge.js +46 -748
- package/dist/matterbridgeAccessoryPlatform.js +0 -34
- package/dist/matterbridgeBehaviors.js +1 -54
- package/dist/matterbridgeDeviceTypes.js +15 -578
- package/dist/matterbridgeDynamicPlatform.js +0 -34
- package/dist/matterbridgeEndpoint.js +43 -997
- package/dist/matterbridgeEndpointHelpers.js +10 -204
- package/dist/matterbridgePlatform.js +7 -225
- package/dist/matterbridgeTypes.js +0 -24
- package/dist/pluginManager.js +3 -269
- package/dist/roboticVacuumCleaner.js +6 -81
- package/dist/shelly.js +7 -155
- package/dist/storage/export.js +0 -1
- package/dist/update.js +0 -53
- package/dist/utils/colorUtils.js +2 -205
- package/dist/utils/commandLine.js +0 -53
- package/dist/utils/copyDirectory.js +1 -37
- package/dist/utils/createDirectory.js +0 -31
- package/dist/utils/createZip.js +2 -42
- package/dist/utils/deepCopy.js +0 -38
- package/dist/utils/deepEqual.js +1 -71
- package/dist/utils/export.js +0 -1
- package/dist/utils/hex.js +0 -57
- package/dist/utils/isvalid.js +0 -100
- package/dist/utils/network.js +5 -76
- package/dist/utils/spawn.js +0 -16
- package/dist/utils/wait.js +9 -58
- package/dist/waterHeater.js +2 -62
- package/npm-shrinkwrap.json +40 -28
- package/package.json +2 -3
- package/dist/cli.d.ts +0 -29
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cluster/export.d.ts +0 -2
- package/dist/cluster/export.d.ts.map +0 -1
- package/dist/cluster/export.js.map +0 -1
- package/dist/defaultConfigSchema.d.ts +0 -27
- package/dist/defaultConfigSchema.d.ts.map +0 -1
- package/dist/defaultConfigSchema.js.map +0 -1
- package/dist/deviceManager.d.ts +0 -114
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/evse.d.ts +0 -67
- package/dist/evse.d.ts.map +0 -1
- package/dist/evse.js.map +0 -1
- package/dist/frontend.d.ts +0 -256
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/globalMatterbridge.d.ts +0 -32
- package/dist/globalMatterbridge.d.ts.map +0 -1
- package/dist/globalMatterbridge.js.map +0 -1
- package/dist/helpers.d.ts +0 -47
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/index.d.ts +0 -37
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/laundryWasher.d.ts +0 -243
- package/dist/laundryWasher.d.ts.map +0 -1
- package/dist/laundryWasher.js.map +0 -1
- package/dist/logger/export.d.ts +0 -2
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/behaviors.d.ts +0 -2
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts +0 -2
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts +0 -2
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts +0 -2
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts +0 -5
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts +0 -3
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -445
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -40
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -1333
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -644
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -40
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -1144
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -3083
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -294
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -196
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -273
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/roboticVacuumCleaner.d.ts +0 -102
- package/dist/roboticVacuumCleaner.d.ts.map +0 -1
- package/dist/roboticVacuumCleaner.js.map +0 -1
- package/dist/shelly.d.ts +0 -161
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.js.map +0 -1
- package/dist/storage/export.d.ts +0 -2
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/update.d.ts +0 -58
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -61
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/commandLine.d.ts +0 -58
- package/dist/utils/commandLine.d.ts.map +0 -1
- package/dist/utils/commandLine.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -32
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createDirectory.d.ts +0 -32
- package/dist/utils/createDirectory.d.ts.map +0 -1
- package/dist/utils/createDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -38
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -31
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -53
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/export.d.ts +0 -12
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/hex.d.ts +0 -48
- package/dist/utils/hex.d.ts.map +0 -1
- package/dist/utils/hex.js.map +0 -1
- package/dist/utils/isvalid.d.ts +0 -102
- package/dist/utils/isvalid.d.ts.map +0 -1
- package/dist/utils/isvalid.js.map +0 -1
- package/dist/utils/network.d.ts +0 -69
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/spawn.d.ts +0 -12
- package/dist/utils/spawn.d.ts.map +0 -1
- package/dist/utils/spawn.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -52
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
- package/dist/waterHeater.d.ts +0 -90
- package/dist/waterHeater.d.ts.map +0 -1
- package/dist/waterHeater.js.map +0 -1
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
|
|
3
|
-
*
|
|
4
|
-
* @file matterbridgeEndpoint.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2024-10-01
|
|
7
|
-
* @version 2.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
|
|
24
1
|
import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
|
|
25
|
-
// Matterbridge
|
|
26
2
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
27
3
|
import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
|
|
28
4
|
import { MatterbridgeServer, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, } from './matterbridgeBehaviors.js';
|
|
29
5
|
import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultOperationalStateClusterServer, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, invokeBehaviorCommand, triggerEvent, } from './matterbridgeEndpointHelpers.js';
|
|
30
|
-
// @matter
|
|
31
6
|
import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, UINT16_MAX, UINT32_MAX, VendorId } from '@matter/main';
|
|
32
7
|
import { getClusterNameById, MeasurementType } from '@matter/main/types';
|
|
33
|
-
// @matter clusters
|
|
34
8
|
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
35
9
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
36
10
|
import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
|
|
@@ -57,7 +31,6 @@ import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/ther
|
|
|
57
31
|
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
58
32
|
import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
|
|
59
33
|
import { DeviceEnergyManagementMode } from '@matter/main/clusters/device-energy-management-mode';
|
|
60
|
-
// @matter behaviors
|
|
61
34
|
import { DescriptorServer } from '@matter/main/behaviors/descriptor';
|
|
62
35
|
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
63
36
|
import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
|
|
@@ -93,15 +66,10 @@ import { ActivatedCarbonFilterMonitoringServer } from '@matter/main/behaviors/ac
|
|
|
93
66
|
import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behaviors/thermostat-user-interface-configuration';
|
|
94
67
|
import { DeviceEnergyManagementServer } from '@matter/main/behaviors/device-energy-management';
|
|
95
68
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
96
|
-
/** The bridge mode of Matterbridge */
|
|
97
69
|
static bridgeMode = '';
|
|
98
|
-
|
|
99
|
-
static logLevel = "info" /* LogLevel.INFO */;
|
|
100
|
-
/** The logger instance for the MatterbridgeEndpoint */
|
|
70
|
+
static logLevel = "info";
|
|
101
71
|
log;
|
|
102
|
-
/** The plugin name this MatterbridgeEndpoint belongs to */
|
|
103
72
|
plugin = undefined;
|
|
104
|
-
/** The configuration URL of the device, if available */
|
|
105
73
|
configUrl = undefined;
|
|
106
74
|
deviceName = undefined;
|
|
107
75
|
serialNumber = undefined;
|
|
@@ -115,29 +83,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
115
83
|
hardwareVersion = undefined;
|
|
116
84
|
hardwareVersionString = undefined;
|
|
117
85
|
productUrl = 'https://www.npmjs.com/package/matterbridge';
|
|
118
|
-
/** The server node of the endpoint, if it is a single not bridged endpoint */
|
|
119
86
|
serverNode;
|
|
120
|
-
/** The name of the first device type of the endpoint (old api compatibility) */
|
|
121
87
|
name = undefined;
|
|
122
|
-
/** The code of the first device type of the endpoint (old api compatibility) */
|
|
123
88
|
deviceType;
|
|
124
|
-
/** The id of the endpoint (old api compatibility) */
|
|
125
89
|
uniqueStorageKey = undefined;
|
|
126
90
|
tagList = undefined;
|
|
127
|
-
/** Maps the DeviceTypeDefinitions with their code */
|
|
128
91
|
deviceTypes = new Map();
|
|
129
|
-
/** Command handler for the MatterbridgeEndpoint commands */
|
|
130
92
|
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
|
-
*/
|
|
138
93
|
constructor(definition, options = {}, debug = false) {
|
|
139
94
|
let deviceTypeList = [];
|
|
140
|
-
// Get the first DeviceTypeDefinition
|
|
141
95
|
let firstDefinition;
|
|
142
96
|
if (Array.isArray(definition)) {
|
|
143
97
|
firstDefinition = definition[0];
|
|
@@ -150,7 +104,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
150
104
|
firstDefinition = definition;
|
|
151
105
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
152
106
|
}
|
|
153
|
-
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
154
107
|
const deviceTypeDefinitionV8 = {
|
|
155
108
|
name: firstDefinition.name.replace('-', '_'),
|
|
156
109
|
deviceType: firstDefinition.code,
|
|
@@ -169,11 +122,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
169
122
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
170
123
|
};
|
|
171
124
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
172
|
-
// Check if the uniqueStorageKey is valid
|
|
173
125
|
if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
|
|
174
126
|
options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
|
|
175
127
|
}
|
|
176
|
-
// Convert the options to an Endpoint.Options
|
|
177
128
|
const optionsV8 = {
|
|
178
129
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
179
130
|
number: options.endpointId,
|
|
@@ -191,40 +142,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
191
142
|
}
|
|
192
143
|
else
|
|
193
144
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
194
|
-
|
|
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
|
+
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
|
|
199
146
|
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
|
|
201
147
|
this.behaviors.require(MatterbridgeServer, { log: this.log, commandHandler: this.commandHandler });
|
|
202
148
|
}
|
|
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
|
-
*/
|
|
211
149
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
212
150
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
213
151
|
}
|
|
214
|
-
/**
|
|
215
|
-
* Get all the device types of this endpoint.
|
|
216
|
-
*
|
|
217
|
-
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
|
|
218
|
-
*/
|
|
219
152
|
getDeviceTypes() {
|
|
220
153
|
return Array.from(this.deviceTypes.values());
|
|
221
154
|
}
|
|
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
|
-
*/
|
|
228
155
|
hasClusterServer(cluster) {
|
|
229
156
|
const behavior = getBehavior(this, cluster);
|
|
230
157
|
if (behavior)
|
|
@@ -232,13 +159,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
232
159
|
else
|
|
233
160
|
return false;
|
|
234
161
|
}
|
|
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
|
-
*/
|
|
242
162
|
hasAttributeServer(cluster, attribute) {
|
|
243
163
|
const behavior = getBehavior(this, cluster);
|
|
244
164
|
if (!behavior || !this.behaviors.supported[behavior.id])
|
|
@@ -247,235 +167,82 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
247
167
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
248
168
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
249
169
|
}
|
|
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
|
-
*/
|
|
256
170
|
getClusterServerOptions(cluster) {
|
|
257
171
|
const behavior = getBehavior(this, cluster);
|
|
258
172
|
if (!behavior)
|
|
259
173
|
return undefined;
|
|
260
174
|
return this.behaviors.optionsFor(behavior);
|
|
261
175
|
}
|
|
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
|
|
271
176
|
getAttribute(cluster, attribute, log) {
|
|
272
177
|
return getAttribute(this, cluster, attribute, log);
|
|
273
178
|
}
|
|
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
|
-
*/
|
|
283
179
|
async setAttribute(clusterId, attribute, value, log) {
|
|
284
180
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
285
181
|
}
|
|
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
|
-
*/
|
|
295
182
|
async updateAttribute(cluster, attribute, value, log) {
|
|
296
183
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
297
184
|
}
|
|
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
|
|
313
185
|
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
314
186
|
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
315
187
|
}
|
|
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
|
-
*/
|
|
324
188
|
async triggerEvent(cluster, event, payload, log) {
|
|
325
189
|
return await triggerEvent(this, cluster, event, payload, log);
|
|
326
190
|
}
|
|
327
|
-
/**
|
|
328
|
-
* Adds cluster servers from the provided server list.
|
|
329
|
-
*
|
|
330
|
-
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
331
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
332
|
-
*/
|
|
333
191
|
addClusterServers(serverList) {
|
|
334
192
|
addClusterServers(this, serverList);
|
|
335
193
|
return this;
|
|
336
194
|
}
|
|
337
|
-
/**
|
|
338
|
-
* Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
|
|
339
|
-
*
|
|
340
|
-
* @param {string} label - The label to add.
|
|
341
|
-
* @param {string} value - The value of the label.
|
|
342
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
343
|
-
*/
|
|
344
195
|
async addFixedLabel(label, value) {
|
|
345
196
|
await addFixedLabel(this, label, value);
|
|
346
197
|
return this;
|
|
347
198
|
}
|
|
348
|
-
/**
|
|
349
|
-
* Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
|
|
350
|
-
*
|
|
351
|
-
* @param {string} label - The label to add.
|
|
352
|
-
* @param {string} value - The value of the label.
|
|
353
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
354
|
-
*/
|
|
355
199
|
async addUserLabel(label, value) {
|
|
356
200
|
await addUserLabel(this, label, value);
|
|
357
201
|
return this;
|
|
358
202
|
}
|
|
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
|
-
*/
|
|
373
203
|
addCommandHandler(command, handler) {
|
|
374
204
|
this.commandHandler.addHandler(command, handler);
|
|
375
205
|
return this;
|
|
376
206
|
}
|
|
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
|
-
*/
|
|
385
207
|
async executeCommandHandler(command, request) {
|
|
386
208
|
await this.commandHandler.executeHandler(command, { request });
|
|
387
209
|
}
|
|
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
|
-
*/
|
|
397
210
|
async invokeBehaviorCommand(cluster, command, params) {
|
|
398
211
|
await invokeBehaviorCommand(this, cluster, command, params);
|
|
399
212
|
}
|
|
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
|
-
*/
|
|
405
213
|
addRequiredClusterServers() {
|
|
406
214
|
addRequiredClusterServers(this);
|
|
407
215
|
return this;
|
|
408
216
|
}
|
|
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
|
-
*/
|
|
414
217
|
addOptionalClusterServers() {
|
|
415
218
|
addOptionalClusterServers(this);
|
|
416
219
|
return this;
|
|
417
220
|
}
|
|
418
|
-
/**
|
|
419
|
-
* Retrieves all cluster servers.
|
|
420
|
-
*
|
|
421
|
-
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
422
|
-
*/
|
|
423
221
|
getAllClusterServers() {
|
|
424
222
|
return Object.values(this.behaviors.supported);
|
|
425
223
|
}
|
|
426
|
-
/**
|
|
427
|
-
* Retrieves the names of all cluster servers.
|
|
428
|
-
*
|
|
429
|
-
* @returns {string[]} An array of all cluster server names.
|
|
430
|
-
*/
|
|
431
224
|
getAllClusterServerNames() {
|
|
432
225
|
return Object.keys(this.behaviors.supported);
|
|
433
226
|
}
|
|
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
|
-
*/
|
|
439
227
|
forEachAttribute(callback) {
|
|
440
228
|
if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
|
|
441
229
|
return;
|
|
442
230
|
for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
|
|
443
|
-
// Skip if the key / cluster name is a number, cause they are double indexed.
|
|
444
231
|
if (!isNaN(Number(clusterName)))
|
|
445
232
|
continue;
|
|
446
233
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
447
|
-
// Skip if the behavior has no associated cluster (i.e. matterbridge server)
|
|
448
234
|
const clusterId = getClusterId(this, clusterName);
|
|
449
235
|
if (clusterId === undefined) {
|
|
450
|
-
// this.log.debug(`***forEachAttribute: cluster ${clusterName} not found`);
|
|
451
236
|
continue;
|
|
452
237
|
}
|
|
453
|
-
// Skip if the attribute is not present in the ClusterBehavior.Type. Also skip if the attribute it is an internal state.
|
|
454
238
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
455
239
|
if (attributeId === undefined) {
|
|
456
|
-
// this.log.debug(`***forEachAttribute: attribute ${clusterName}.${attributeName} not found`);
|
|
457
240
|
continue;
|
|
458
241
|
}
|
|
459
242
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
460
243
|
}
|
|
461
244
|
}
|
|
462
245
|
}
|
|
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
|
-
*/
|
|
479
246
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
480
247
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
481
248
|
let alreadyAdded = false;
|
|
@@ -515,23 +282,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
515
282
|
}
|
|
516
283
|
return child;
|
|
517
284
|
}
|
|
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
|
-
*/
|
|
535
285
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
536
286
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
537
287
|
let alreadyAdded = false;
|
|
@@ -594,38 +344,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
594
344
|
}
|
|
595
345
|
return child;
|
|
596
346
|
}
|
|
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
|
-
*/
|
|
603
347
|
getChildEndpointByName(endpointName) {
|
|
604
348
|
return this.parts.find((part) => part.id === endpointName);
|
|
605
349
|
}
|
|
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
|
-
*/
|
|
612
350
|
getChildEndpoint(endpointNumber) {
|
|
613
351
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
614
352
|
}
|
|
615
|
-
/**
|
|
616
|
-
* Get all the child endpoints of this endpoint.
|
|
617
|
-
*
|
|
618
|
-
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
619
|
-
*/
|
|
620
353
|
getChildEndpoints() {
|
|
621
354
|
return Array.from(this.parts);
|
|
622
355
|
}
|
|
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
|
-
*/
|
|
629
356
|
static serialize(device) {
|
|
630
357
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId)
|
|
631
358
|
return;
|
|
@@ -648,15 +375,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
648
375
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
649
376
|
if (behaviorName === 'powerSource')
|
|
650
377
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
651
|
-
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
652
378
|
});
|
|
653
379
|
return serialized;
|
|
654
380
|
}
|
|
655
|
-
/**
|
|
656
|
-
* Deserializes the device into a serialized object.
|
|
657
|
-
*
|
|
658
|
-
* @returns The deserialized MatterbridgeDevice.
|
|
659
|
-
*/
|
|
660
381
|
static deserialize(serializedDevice) {
|
|
661
382
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
|
|
662
383
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -672,16 +393,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
672
393
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
673
394
|
else if (clusterId === PowerSource.Cluster.id)
|
|
674
395
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
675
|
-
// else addClusterServerFromList(device, [clusterId]);
|
|
676
396
|
}
|
|
677
397
|
return device;
|
|
678
398
|
}
|
|
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
|
-
*/
|
|
685
399
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
686
400
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
|
|
687
401
|
wiredCurrentType,
|
|
@@ -692,16 +406,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
692
406
|
});
|
|
693
407
|
return this;
|
|
694
408
|
}
|
|
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
|
-
*/
|
|
705
409
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
706
410
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
707
411
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -719,14 +423,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
719
423
|
});
|
|
720
424
|
return this;
|
|
721
425
|
}
|
|
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
|
-
*/
|
|
730
426
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
731
427
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
732
428
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -745,21 +441,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
745
441
|
});
|
|
746
442
|
return this;
|
|
747
443
|
}
|
|
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
|
-
*/
|
|
763
444
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
764
445
|
this.log.logName = deviceName;
|
|
765
446
|
this.deviceName = deviceName;
|
|
@@ -783,22 +464,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
783
464
|
}
|
|
784
465
|
return this;
|
|
785
466
|
}
|
|
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
|
-
*/
|
|
802
467
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
803
468
|
this.log.logName = deviceName;
|
|
804
469
|
this.deviceName = deviceName;
|
|
@@ -831,13 +496,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
831
496
|
});
|
|
832
497
|
return this;
|
|
833
498
|
}
|
|
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
|
-
*/
|
|
841
499
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
842
500
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
843
501
|
identifyTime,
|
|
@@ -845,34 +503,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
845
503
|
});
|
|
846
504
|
return this;
|
|
847
505
|
}
|
|
848
|
-
/**
|
|
849
|
-
* Creates a default groups cluster server.
|
|
850
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
851
|
-
*/
|
|
852
506
|
createDefaultGroupsClusterServer() {
|
|
853
507
|
this.behaviors.require(GroupsServer);
|
|
854
508
|
return this;
|
|
855
509
|
}
|
|
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
|
-
*/
|
|
862
510
|
createDefaultScenesClusterServer() {
|
|
863
511
|
this.behaviors.require(ScenesManagementServer);
|
|
864
512
|
return this;
|
|
865
513
|
}
|
|
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
|
-
*/
|
|
876
514
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
877
515
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
878
516
|
onOff,
|
|
@@ -883,52 +521,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
883
521
|
});
|
|
884
522
|
return this;
|
|
885
523
|
}
|
|
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
|
-
*/
|
|
892
524
|
createOnOffClusterServer(onOff = false) {
|
|
893
525
|
this.behaviors.require(MatterbridgeOnOffServer, {
|
|
894
526
|
onOff,
|
|
895
527
|
});
|
|
896
528
|
return this;
|
|
897
529
|
}
|
|
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
|
-
*/
|
|
904
530
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
905
531
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
906
532
|
onOff,
|
|
907
533
|
});
|
|
908
534
|
return this;
|
|
909
535
|
}
|
|
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
|
-
*/
|
|
916
536
|
createOffOnlyOnOffClusterServer(onOff = false) {
|
|
917
537
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
|
|
918
538
|
onOff,
|
|
919
539
|
});
|
|
920
540
|
return this;
|
|
921
541
|
}
|
|
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
|
-
*/
|
|
932
542
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
933
543
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
934
544
|
currentLevel,
|
|
@@ -944,13 +554,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
944
554
|
});
|
|
945
555
|
return this;
|
|
946
556
|
}
|
|
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
|
-
*/
|
|
954
557
|
createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
|
|
955
558
|
this.behaviors.require(MatterbridgeLevelControlServer, {
|
|
956
559
|
currentLevel,
|
|
@@ -962,25 +565,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
962
565
|
});
|
|
963
566
|
return this;
|
|
964
567
|
}
|
|
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
|
-
*/
|
|
984
568
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
985
569
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
986
570
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1003,25 +587,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1003
587
|
});
|
|
1004
588
|
return this;
|
|
1005
589
|
}
|
|
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
|
-
*/
|
|
1025
590
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1026
591
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
1027
592
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -1042,22 +607,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1042
607
|
});
|
|
1043
608
|
return this;
|
|
1044
609
|
}
|
|
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
|
-
*/
|
|
1061
610
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1062
611
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1063
612
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1078,20 +627,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1078
627
|
});
|
|
1079
628
|
return this;
|
|
1080
629
|
}
|
|
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
|
-
*/
|
|
1095
630
|
createCtColorControlClusterServer(colorTemperatureMireds = 250, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1096
631
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
1097
632
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1110,34 +645,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1110
645
|
});
|
|
1111
646
|
return this;
|
|
1112
647
|
}
|
|
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
|
-
*/
|
|
1120
648
|
async configureColorControlMode(colorMode) {
|
|
1121
649
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
1122
650
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
1123
651
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
1124
652
|
}
|
|
1125
653
|
}
|
|
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
|
-
*/
|
|
1138
654
|
createDefaultWindowCoveringClusterServer(positionPercent100ths, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade) {
|
|
1139
655
|
this.behaviors.require(MatterbridgeLiftWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1140
|
-
type,
|
|
656
|
+
type,
|
|
1141
657
|
numberOfActuationsLift: 0,
|
|
1142
658
|
configStatus: {
|
|
1143
659
|
operational: true,
|
|
@@ -1145,33 +661,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1145
661
|
liftMovementReversed: false,
|
|
1146
662
|
liftPositionAware: true,
|
|
1147
663
|
tiltPositionAware: false,
|
|
1148
|
-
liftEncoderControlled: false,
|
|
1149
|
-
tiltEncoderControlled: false,
|
|
664
|
+
liftEncoderControlled: false,
|
|
665
|
+
tiltEncoderControlled: false,
|
|
1150
666
|
},
|
|
1151
667
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1152
|
-
endProductType,
|
|
668
|
+
endProductType,
|
|
1153
669
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1154
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1155
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
670
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
671
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1156
672
|
});
|
|
1157
673
|
return this;
|
|
1158
674
|
}
|
|
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
|
-
*/
|
|
1172
675
|
createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind) {
|
|
1173
676
|
this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt), {
|
|
1174
|
-
type,
|
|
677
|
+
type,
|
|
1175
678
|
numberOfActuationsLift: 0,
|
|
1176
679
|
numberOfActuationsTilt: 0,
|
|
1177
680
|
configStatus: {
|
|
@@ -1180,23 +683,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1180
683
|
liftMovementReversed: false,
|
|
1181
684
|
liftPositionAware: true,
|
|
1182
685
|
tiltPositionAware: true,
|
|
1183
|
-
liftEncoderControlled: false,
|
|
1184
|
-
tiltEncoderControlled: false,
|
|
686
|
+
liftEncoderControlled: false,
|
|
687
|
+
tiltEncoderControlled: false,
|
|
1185
688
|
},
|
|
1186
689
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1187
|
-
endProductType,
|
|
690
|
+
endProductType,
|
|
1188
691
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1189
|
-
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
1190
|
-
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
1191
|
-
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
1192
|
-
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
692
|
+
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
693
|
+
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
694
|
+
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
695
|
+
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
1193
696
|
});
|
|
1194
697
|
return this;
|
|
1195
698
|
}
|
|
1196
|
-
/**
|
|
1197
|
-
* Sets the window covering lift target position as the current position and stops the movement.
|
|
1198
|
-
*
|
|
1199
|
-
*/
|
|
1200
699
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
1201
700
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
1202
701
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -1216,12 +715,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1216
715
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1217
716
|
}
|
|
1218
717
|
}
|
|
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
|
-
*/
|
|
1225
718
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
1226
719
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
1227
720
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -1232,10 +725,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1232
725
|
}, this.log);
|
|
1233
726
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1234
727
|
}
|
|
1235
|
-
/**
|
|
1236
|
-
* Sets the status of the window covering.
|
|
1237
|
-
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1238
|
-
*/
|
|
1239
728
|
async setWindowCoveringStatus(status) {
|
|
1240
729
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
1241
730
|
global: status,
|
|
@@ -1244,11 +733,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1244
733
|
}, this.log);
|
|
1245
734
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1246
735
|
}
|
|
1247
|
-
/**
|
|
1248
|
-
* Retrieves the status of the window covering.
|
|
1249
|
-
*
|
|
1250
|
-
* @returns The global operational status of the window covering or undefined.
|
|
1251
|
-
*/
|
|
1252
736
|
getWindowCoveringStatus() {
|
|
1253
737
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
1254
738
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -1256,12 +740,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1256
740
|
return status.global;
|
|
1257
741
|
}
|
|
1258
742
|
}
|
|
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
|
-
*/
|
|
1265
743
|
async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
|
|
1266
744
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', liftPosition, this.log);
|
|
1267
745
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', liftPosition, this.log);
|
|
@@ -1272,56 +750,31 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1272
750
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
|
|
1273
751
|
}
|
|
1274
752
|
}
|
|
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
|
-
*/
|
|
1288
753
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1289
754
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1290
755
|
localTemperature: localTemperature * 100,
|
|
1291
756
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1292
757
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1293
|
-
// Thermostat.Feature.Heating
|
|
1294
758
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1295
759
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1296
760
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1297
761
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1298
762
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1299
|
-
// Thermostat.Feature.Cooling
|
|
1300
763
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1301
764
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1302
765
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1303
766
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1304
767
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1305
|
-
// Thermostat.Feature.AutoMode
|
|
1306
768
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1307
769
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1308
770
|
});
|
|
1309
771
|
return this;
|
|
1310
772
|
}
|
|
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
|
-
*/
|
|
1319
773
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1320
774
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
|
|
1321
775
|
localTemperature: localTemperature * 100,
|
|
1322
776
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1323
777
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1324
|
-
// Thermostat.Feature.Heating
|
|
1325
778
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1326
779
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1327
780
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1330,20 +783,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1330
783
|
});
|
|
1331
784
|
return this;
|
|
1332
785
|
}
|
|
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
|
-
*/
|
|
1341
786
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1342
787
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
|
|
1343
788
|
localTemperature: localTemperature * 100,
|
|
1344
789
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1345
790
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1346
|
-
// Thermostat.Feature.Cooling
|
|
1347
791
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1348
792
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1349
793
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -1352,15 +796,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1352
796
|
});
|
|
1353
797
|
return this;
|
|
1354
798
|
}
|
|
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
|
-
*/
|
|
1364
799
|
createDefaultThermostatUserInterfaceConfigurationClusterServer() {
|
|
1365
800
|
this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
|
|
1366
801
|
temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
|
|
@@ -1369,158 +804,69 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1369
804
|
});
|
|
1370
805
|
return this;
|
|
1371
806
|
}
|
|
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
|
-
*/
|
|
1386
807
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0) {
|
|
1387
808
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1388
|
-
fanMode,
|
|
1389
|
-
fanModeSequence,
|
|
1390
|
-
percentSetting,
|
|
809
|
+
fanMode,
|
|
810
|
+
fanModeSequence,
|
|
811
|
+
percentSetting,
|
|
1391
812
|
percentCurrent,
|
|
1392
813
|
});
|
|
1393
814
|
return this;
|
|
1394
815
|
}
|
|
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
|
-
*/
|
|
1413
816
|
createMultiSpeedFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0, speedMax = 10, speedSetting = 0, speedCurrent = 0) {
|
|
1414
817
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1415
|
-
fanMode,
|
|
1416
|
-
fanModeSequence,
|
|
1417
|
-
percentSetting,
|
|
818
|
+
fanMode,
|
|
819
|
+
fanModeSequence,
|
|
820
|
+
percentSetting,
|
|
1418
821
|
percentCurrent,
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
speedSetting, // Writable attribute
|
|
822
|
+
speedMax,
|
|
823
|
+
speedSetting,
|
|
1422
824
|
speedCurrent,
|
|
1423
825
|
});
|
|
1424
826
|
return this;
|
|
1425
827
|
}
|
|
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
|
-
*/
|
|
1440
828
|
createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHigh, percentSetting = 0, percentCurrent = 0) {
|
|
1441
829
|
this.behaviors.require(FanControlServer, {
|
|
1442
|
-
fanMode,
|
|
1443
|
-
fanModeSequence,
|
|
1444
|
-
percentSetting,
|
|
830
|
+
fanMode,
|
|
831
|
+
fanModeSequence,
|
|
832
|
+
percentSetting,
|
|
1445
833
|
percentCurrent,
|
|
1446
834
|
});
|
|
1447
835
|
return this;
|
|
1448
836
|
}
|
|
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
|
-
*/
|
|
1459
837
|
createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
1460
838
|
this.behaviors.require(HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1461
|
-
condition: 100,
|
|
1462
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
839
|
+
condition: 100,
|
|
840
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1463
841
|
changeIndication,
|
|
1464
842
|
inPlaceIndicator,
|
|
1465
843
|
lastChangedTime,
|
|
1466
|
-
replacementProductList: [],
|
|
844
|
+
replacementProductList: [],
|
|
1467
845
|
});
|
|
1468
846
|
return this;
|
|
1469
847
|
}
|
|
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
|
-
*/
|
|
1479
848
|
createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
1480
849
|
this.behaviors.require(ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1481
|
-
condition: 100,
|
|
1482
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
850
|
+
condition: 100,
|
|
851
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1483
852
|
changeIndication,
|
|
1484
853
|
inPlaceIndicator,
|
|
1485
854
|
lastChangedTime,
|
|
1486
|
-
replacementProductList: [],
|
|
855
|
+
replacementProductList: [],
|
|
1487
856
|
});
|
|
1488
857
|
return this;
|
|
1489
858
|
}
|
|
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
|
-
*/
|
|
1500
859
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1501
860
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
1502
861
|
lockState,
|
|
1503
862
|
lockType,
|
|
1504
863
|
actuatorEnabled: false,
|
|
1505
864
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
1506
|
-
// Special case of inverted bitmap: add also alwaysSet = 2047
|
|
1507
865
|
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
|
|
1508
866
|
alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
|
|
1509
867
|
});
|
|
1510
868
|
return this;
|
|
1511
869
|
}
|
|
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
|
-
*/
|
|
1524
870
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1525
871
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
1526
872
|
description: description,
|
|
@@ -1531,35 +877,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1531
877
|
});
|
|
1532
878
|
return this;
|
|
1533
879
|
}
|
|
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
|
-
*/
|
|
1541
880
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
1542
881
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
1543
882
|
currentState: valveState,
|
|
1544
883
|
targetState: valveState,
|
|
1545
884
|
openDuration: null,
|
|
1546
|
-
defaultOpenDuration: null,
|
|
885
|
+
defaultOpenDuration: null,
|
|
1547
886
|
remainingDuration: null,
|
|
1548
887
|
valveFault: { generalFault: false, blocked: false, leaking: false, notConnected: false, shortCircuit: false, currentExceeded: false },
|
|
1549
|
-
// Feature.Level
|
|
1550
888
|
currentLevel: valveLevel,
|
|
1551
889
|
targetLevel: valveLevel,
|
|
1552
|
-
defaultOpenLevel: 100,
|
|
1553
|
-
levelStep: 1,
|
|
890
|
+
defaultOpenLevel: 100,
|
|
891
|
+
levelStep: 1,
|
|
1554
892
|
});
|
|
1555
893
|
return this;
|
|
1556
894
|
}
|
|
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
|
-
*/
|
|
1563
895
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1564
896
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
1565
897
|
minConstSpeed: null,
|
|
@@ -1574,13 +906,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1574
906
|
});
|
|
1575
907
|
return this;
|
|
1576
908
|
}
|
|
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
|
-
*/
|
|
1584
909
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1585
910
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1586
911
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1596,12 +921,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1596
921
|
});
|
|
1597
922
|
return this;
|
|
1598
923
|
}
|
|
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
|
-
*/
|
|
1605
924
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1606
925
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
1607
926
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1616,12 +935,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1616
935
|
});
|
|
1617
936
|
return this;
|
|
1618
937
|
}
|
|
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
|
-
*/
|
|
1625
938
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1626
939
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1627
940
|
events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1636,13 +949,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1636
949
|
});
|
|
1637
950
|
return this;
|
|
1638
951
|
}
|
|
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
|
-
*/
|
|
1646
952
|
createDefaultSwitchClusterServer() {
|
|
1647
953
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
1648
954
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -1653,13 +959,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1653
959
|
});
|
|
1654
960
|
return this;
|
|
1655
961
|
}
|
|
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
|
-
*/
|
|
1663
962
|
createDefaultLatchingSwitchClusterServer() {
|
|
1664
963
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
1665
964
|
events: { switchLatched: true },
|
|
@@ -1669,13 +968,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1669
968
|
});
|
|
1670
969
|
return this;
|
|
1671
970
|
}
|
|
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
|
-
*/
|
|
1679
971
|
async triggerSwitchEvent(event, log) {
|
|
1680
972
|
if (this.maybeNumber === undefined) {
|
|
1681
973
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1735,30 +1027,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1735
1027
|
}
|
|
1736
1028
|
return true;
|
|
1737
1029
|
}
|
|
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
|
-
*/
|
|
1745
1030
|
createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
|
1746
1031
|
this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
|
|
1747
1032
|
return this;
|
|
1748
1033
|
}
|
|
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
|
-
*/
|
|
1762
1034
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1763
1035
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1764
1036
|
events: { stateChange: true },
|
|
@@ -1767,23 +1039,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1767
1039
|
});
|
|
1768
1040
|
return this;
|
|
1769
1041
|
}
|
|
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
|
-
*/
|
|
1787
1042
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1788
1043
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1789
1044
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -1798,50 +1053,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1798
1053
|
});
|
|
1799
1054
|
return this;
|
|
1800
1055
|
}
|
|
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
|
-
*/
|
|
1819
1056
|
createDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
|
|
1820
1057
|
this.behaviors.require(DeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting), {
|
|
1821
|
-
forecast: null,
|
|
1822
|
-
esaType,
|
|
1823
|
-
esaCanGenerate,
|
|
1058
|
+
forecast: null,
|
|
1059
|
+
esaType,
|
|
1060
|
+
esaCanGenerate,
|
|
1824
1061
|
esaState,
|
|
1825
1062
|
absMinPower,
|
|
1826
1063
|
absMaxPower,
|
|
1827
1064
|
});
|
|
1828
1065
|
return this;
|
|
1829
1066
|
}
|
|
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
|
-
*/
|
|
1845
1067
|
createDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
|
|
1846
1068
|
this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, {
|
|
1847
1069
|
supportedModes: supportedModes ?? [
|
|
@@ -1862,27 +1084,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1862
1084
|
mode: 5,
|
|
1863
1085
|
modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.DeviceOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }, { value: DeviceEnergyManagementMode.ModeTag.GridOptimization }],
|
|
1864
1086
|
},
|
|
1865
|
-
],
|
|
1087
|
+
],
|
|
1866
1088
|
currentMode: currentMode ?? 1,
|
|
1867
1089
|
});
|
|
1868
1090
|
return this;
|
|
1869
1091
|
}
|
|
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
|
-
*/
|
|
1875
1092
|
createDefaultPowerTopologyClusterServer() {
|
|
1876
1093
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1877
1094
|
return this;
|
|
1878
1095
|
}
|
|
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
|
-
*/
|
|
1885
|
-
createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
1096
|
+
createDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
|
|
1886
1097
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1887
1098
|
accuracy: {
|
|
1888
1099
|
measurementType: MeasurementType.ElectricalEnergy,
|
|
@@ -1892,20 +1103,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1892
1103
|
accuracyRanges: [{ rangeMin: Number.MIN_SAFE_INTEGER, rangeMax: Number.MAX_SAFE_INTEGER, fixedMax: 1 }],
|
|
1893
1104
|
},
|
|
1894
1105
|
cumulativeEnergyReset: null,
|
|
1895
|
-
cumulativeEnergyImported:
|
|
1896
|
-
cumulativeEnergyExported: null,
|
|
1106
|
+
cumulativeEnergyImported: energyImported ? { energy: energyImported } : null,
|
|
1107
|
+
cumulativeEnergyExported: energyExported ? { energy: energyExported } : null,
|
|
1897
1108
|
});
|
|
1898
1109
|
return this;
|
|
1899
1110
|
}
|
|
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
|
-
*/
|
|
1909
1111
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1910
1112
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1911
1113
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1947,112 +1149,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1947
1149
|
});
|
|
1948
1150
|
return this;
|
|
1949
1151
|
}
|
|
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
|
-
*/
|
|
1958
1152
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1959
1153
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1960
1154
|
return this;
|
|
1961
1155
|
}
|
|
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
|
-
*/
|
|
1970
1156
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1971
1157
|
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1972
1158
|
return this;
|
|
1973
1159
|
}
|
|
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
|
-
*/
|
|
1982
1160
|
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1983
1161
|
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1984
1162
|
return this;
|
|
1985
1163
|
}
|
|
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
|
-
*/
|
|
2004
1164
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2005
1165
|
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2006
1166
|
return this;
|
|
2007
1167
|
}
|
|
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
|
-
*/
|
|
2016
1168
|
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2017
1169
|
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2018
1170
|
return this;
|
|
2019
1171
|
}
|
|
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
|
-
*/
|
|
2031
1172
|
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
2032
1173
|
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
2033
1174
|
return this;
|
|
2034
1175
|
}
|
|
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
|
-
*/
|
|
2041
1176
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
2042
1177
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
2043
1178
|
airQuality,
|
|
2044
1179
|
});
|
|
2045
1180
|
return this;
|
|
2046
1181
|
}
|
|
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
|
-
*/
|
|
2056
1182
|
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
2057
1183
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2058
1184
|
measuredValue,
|
|
@@ -2064,13 +1190,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2064
1190
|
});
|
|
2065
1191
|
return this;
|
|
2066
1192
|
}
|
|
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
|
-
*/
|
|
2074
1193
|
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2075
1194
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
2076
1195
|
levelValue,
|
|
@@ -2078,14 +1197,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2078
1197
|
});
|
|
2079
1198
|
return this;
|
|
2080
1199
|
}
|
|
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
|
-
*/
|
|
2089
1200
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2090
1201
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2091
1202
|
measuredValue,
|
|
@@ -2097,14 +1208,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2097
1208
|
});
|
|
2098
1209
|
return this;
|
|
2099
1210
|
}
|
|
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
|
-
*/
|
|
2108
1211
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2109
1212
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2110
1213
|
measuredValue,
|
|
@@ -2116,14 +1219,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2116
1219
|
});
|
|
2117
1220
|
return this;
|
|
2118
1221
|
}
|
|
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
|
-
*/
|
|
2127
1222
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2128
1223
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2129
1224
|
measuredValue,
|
|
@@ -2135,14 +1230,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2135
1230
|
});
|
|
2136
1231
|
return this;
|
|
2137
1232
|
}
|
|
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
|
-
*/
|
|
2146
1233
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2147
1234
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2148
1235
|
measuredValue,
|
|
@@ -2154,14 +1241,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2154
1241
|
});
|
|
2155
1242
|
return this;
|
|
2156
1243
|
}
|
|
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
|
-
*/
|
|
2165
1244
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2166
1245
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2167
1246
|
measuredValue,
|
|
@@ -2173,14 +1252,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2173
1252
|
});
|
|
2174
1253
|
return this;
|
|
2175
1254
|
}
|
|
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
|
-
*/
|
|
2184
1255
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2185
1256
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2186
1257
|
measuredValue,
|
|
@@ -2192,14 +1263,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2192
1263
|
});
|
|
2193
1264
|
return this;
|
|
2194
1265
|
}
|
|
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
|
-
*/
|
|
2203
1266
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2204
1267
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2205
1268
|
measuredValue,
|
|
@@ -2211,14 +1274,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2211
1274
|
});
|
|
2212
1275
|
return this;
|
|
2213
1276
|
}
|
|
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
|
-
*/
|
|
2222
1277
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2223
1278
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2224
1279
|
measuredValue,
|
|
@@ -2230,14 +1285,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2230
1285
|
});
|
|
2231
1286
|
return this;
|
|
2232
1287
|
}
|
|
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
|
-
*/
|
|
2241
1288
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2242
1289
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2243
1290
|
measuredValue,
|
|
@@ -2250,4 +1297,3 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2250
1297
|
return this;
|
|
2251
1298
|
}
|
|
2252
1299
|
}
|
|
2253
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|