matterbridge 3.0.3 → 3.0.4-dev-20250525-c88cf84
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 +25 -4
- package/README.md +6 -12
- package/dist/cli.js +2 -37
- package/dist/cluster/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -23
- package/dist/deviceManager.js +1 -94
- package/dist/frontend.js +100 -437
- package/dist/helpers.js +9 -53
- package/dist/index.js +1 -27
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.js +1 -3
- package/dist/matter/types.js +0 -2
- package/dist/matterbridge.js +47 -747
- package/dist/matterbridgeAccessoryPlatform.js +0 -34
- package/dist/matterbridgeBehaviors.js +43 -61
- package/dist/matterbridgeDeviceTypes.js +15 -563
- package/dist/matterbridgeDynamicPlatform.js +0 -34
- package/dist/matterbridgeEndpoint.js +68 -837
- package/dist/matterbridgeEndpointHelpers.js +33 -204
- package/dist/matterbridgePlatform.js +7 -225
- package/dist/matterbridgeTypes.js +0 -24
- package/dist/pluginManager.js +3 -264
- package/dist/roboticVacuumCleaner.js +3 -78
- package/dist/shelly.js +7 -155
- package/dist/storage/export.js +0 -1
- package/dist/update.js +0 -53
- package/dist/utils/colorUtils.js +2 -205
- package/dist/utils/commandLine.js +0 -53
- package/dist/utils/copyDirectory.js +1 -37
- package/dist/utils/createZip.js +2 -42
- package/dist/utils/deepCopy.js +0 -38
- package/dist/utils/deepEqual.js +1 -71
- package/dist/utils/export.js +0 -1
- package/dist/utils/hex.js +0 -57
- package/dist/utils/isvalid.js +0 -100
- package/dist/utils/network.js +5 -76
- package/dist/utils/wait.js +9 -58
- package/dist/waterHeater.js +0 -52
- package/npm-shrinkwrap.json +10 -10
- 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/frontend.d.ts +0 -241
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/helpers.d.ts +0 -47
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/index.d.ts +0 -35
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger/export.d.ts +0 -2
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/behaviors.d.ts +0 -2
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts +0 -2
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts +0 -2
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts +0 -2
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts +0 -5
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts +0 -3
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -445
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -40
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -1201
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -629
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -40
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -967
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -2728
- 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 -188
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -273
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/roboticVacuumCleaner.d.ts +0 -82
- package/dist/roboticVacuumCleaner.d.ts.map +0 -1
- package/dist/roboticVacuumCleaner.js.map +0 -1
- package/dist/shelly.d.ts +0 -153
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.js.map +0 -1
- package/dist/storage/export.d.ts +0 -2
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/update.d.ts +0 -58
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -61
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/commandLine.d.ts +0 -58
- package/dist/utils/commandLine.d.ts.map +0 -1
- package/dist/utils/commandLine.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -32
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -38
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -31
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -53
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/export.d.ts +0 -11
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/hex.d.ts +0 -48
- package/dist/utils/hex.d.ts.map +0 -1
- package/dist/utils/hex.js.map +0 -1
- package/dist/utils/isvalid.d.ts +0 -102
- package/dist/utils/isvalid.d.ts.map +0 -1
- package/dist/utils/isvalid.js.map +0 -1
- package/dist/utils/network.d.ts +0 -69
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -52
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
- package/dist/waterHeater.d.ts +0 -75
- package/dist/waterHeater.d.ts.map +0 -1
- package/dist/waterHeater.js.map +0 -1
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
* This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
|
|
3
|
-
*
|
|
4
|
-
* @file matterbridgeEndpoint.ts
|
|
5
|
-
* @author Luca Liguori
|
|
6
|
-
* @date 2024-10-01
|
|
7
|
-
* @version 2.0.0
|
|
8
|
-
*
|
|
9
|
-
* Copyright 2024, 2025, 2026 Luca Liguori.
|
|
10
|
-
*
|
|
11
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License.
|
|
13
|
-
* You may obtain a copy of the License at
|
|
14
|
-
*
|
|
15
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
-
*
|
|
17
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
18
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
19
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
20
|
-
* See the License for the specific language governing permissions and
|
|
21
|
-
* limitations under the License. *
|
|
22
|
-
*/
|
|
23
|
-
// AnsiLogger module
|
|
24
|
-
import { AnsiLogger, BLUE, CYAN, YELLOW, db, debugStringify, er, hk, or, zb } from './logger/export.js';
|
|
25
|
-
// Matterbridge
|
|
1
|
+
import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
|
|
26
2
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
27
3
|
import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
|
|
28
|
-
import { MatterbridgeServer, MatterbridgeServerDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer,
|
|
29
|
-
import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel,
|
|
30
|
-
// @matter
|
|
4
|
+
import { MatterbridgeServer, MatterbridgeServerDevice, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, } from './matterbridgeBehaviors.js';
|
|
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';
|
|
31
6
|
import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, UINT16_MAX, UINT32_MAX, VendorId } from '@matter/main';
|
|
32
7
|
import { getClusterNameById, MeasurementType } from '@matter/main/types';
|
|
33
|
-
// @matter clusters
|
|
34
8
|
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
35
9
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
36
10
|
import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
|
|
@@ -55,7 +29,6 @@ import { ConcentrationMeasurement } from '@matter/main/clusters/concentration-me
|
|
|
55
29
|
import { OccupancySensing } from '@matter/main/clusters/occupancy-sensing';
|
|
56
30
|
import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/thermostat-user-interface-configuration';
|
|
57
31
|
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
58
|
-
// @matter behaviors
|
|
59
32
|
import { DescriptorServer } from '@matter/main/behaviors/descriptor';
|
|
60
33
|
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
61
34
|
import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
|
|
@@ -91,7 +64,7 @@ import { ActivatedCarbonFilterMonitoringServer } from '@matter/main/behaviors/ac
|
|
|
91
64
|
import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behaviors/thermostat-user-interface-configuration';
|
|
92
65
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
93
66
|
static bridgeMode = '';
|
|
94
|
-
static logLevel = "info"
|
|
67
|
+
static logLevel = "info";
|
|
95
68
|
log;
|
|
96
69
|
plugin = undefined;
|
|
97
70
|
configUrl = undefined;
|
|
@@ -107,25 +80,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
107
80
|
hardwareVersion = undefined;
|
|
108
81
|
hardwareVersionString = undefined;
|
|
109
82
|
productUrl = 'https://www.npmjs.com/package/matterbridge';
|
|
110
|
-
// The first device type of the endpoint
|
|
111
83
|
name = undefined;
|
|
112
84
|
deviceType;
|
|
113
85
|
uniqueStorageKey = undefined;
|
|
114
86
|
tagList = undefined;
|
|
115
|
-
// Maps matter deviceTypes
|
|
116
87
|
deviceTypes = new Map();
|
|
117
|
-
// Command handler
|
|
118
88
|
commandHandler = new NamedHandler();
|
|
119
|
-
/**
|
|
120
|
-
* Represents a MatterbridgeEndpoint.
|
|
121
|
-
* @constructor
|
|
122
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
|
|
123
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
124
|
-
* @param {boolean} [debug=false] - Debug flag.
|
|
125
|
-
*/
|
|
126
89
|
constructor(definition, options = {}, debug = false) {
|
|
127
90
|
let deviceTypeList = [];
|
|
128
|
-
// Get the first DeviceTypeDefinition
|
|
129
91
|
let firstDefinition;
|
|
130
92
|
if (Array.isArray(definition)) {
|
|
131
93
|
firstDefinition = definition[0];
|
|
@@ -138,7 +100,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
138
100
|
firstDefinition = definition;
|
|
139
101
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
140
102
|
}
|
|
141
|
-
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
142
103
|
const deviceTypeDefinitionV8 = {
|
|
143
104
|
name: firstDefinition.name.replace('-', '_'),
|
|
144
105
|
deviceType: firstDefinition.code,
|
|
@@ -157,11 +118,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
157
118
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
158
119
|
};
|
|
159
120
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
160
|
-
// Check if the uniqueStorageKey is valid
|
|
161
121
|
if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
|
|
162
122
|
options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
|
|
163
123
|
}
|
|
164
|
-
// Convert the options to an Endpoint.Options
|
|
165
124
|
const optionsV8 = {
|
|
166
125
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
167
126
|
number: options.endpointId,
|
|
@@ -179,41 +138,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
179
138
|
}
|
|
180
139
|
else
|
|
181
140
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
182
|
-
|
|
183
|
-
// console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
|
|
184
|
-
// console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
|
|
185
|
-
// Create the logger
|
|
186
|
-
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
|
|
141
|
+
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
|
|
187
142
|
this.log.debug(`${YELLOW}new${db} MatterbridgeEndpoint: ${zb}${'0x' + firstDefinition.code.toString(16).padStart(4, '0')}${db}-${zb}${firstDefinition.name}${db} ` +
|
|
188
143
|
`id: ${CYAN}${options.uniqueStorageKey}${db} number: ${CYAN}${options.endpointId}${db} taglist: ${CYAN}${options.tagList ? debugStringify(options.tagList) : 'undefined'}${db}`);
|
|
189
|
-
// Add MatterbridgeBehavior with MatterbridgeBehaviorDevice
|
|
190
144
|
this.behaviors.require(MatterbridgeServer, { deviceCommand: new MatterbridgeServerDevice(this.log, this.commandHandler, undefined) });
|
|
191
145
|
}
|
|
192
|
-
/**
|
|
193
|
-
* Loads an instance of the MatterbridgeEndpoint class.
|
|
194
|
-
*
|
|
195
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
|
|
196
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
197
|
-
* @param {boolean} [debug=false] - Debug flag.
|
|
198
|
-
* @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
|
|
199
|
-
*/
|
|
200
146
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
201
147
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
202
148
|
}
|
|
203
|
-
/**
|
|
204
|
-
* Get all the device types of this endpoint.
|
|
205
|
-
*
|
|
206
|
-
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
|
|
207
|
-
*/
|
|
208
149
|
getDeviceTypes() {
|
|
209
150
|
return Array.from(this.deviceTypes.values());
|
|
210
151
|
}
|
|
211
|
-
/**
|
|
212
|
-
* Checks if the provided cluster server is supported by this endpoint.
|
|
213
|
-
*
|
|
214
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
215
|
-
* @returns {boolean} True if the cluster server is supported, false otherwise.
|
|
216
|
-
*/
|
|
217
152
|
hasClusterServer(cluster) {
|
|
218
153
|
const behavior = getBehavior(this, cluster);
|
|
219
154
|
if (behavior)
|
|
@@ -221,13 +156,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
221
156
|
else
|
|
222
157
|
return false;
|
|
223
158
|
}
|
|
224
|
-
/**
|
|
225
|
-
* Checks if the provided attribute server is supported for a given cluster of this endpoint.
|
|
226
|
-
*
|
|
227
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
228
|
-
* @param {string} attribute - The attribute name to check.
|
|
229
|
-
* @returns {boolean} True if the attribute server is supported, false otherwise.
|
|
230
|
-
*/
|
|
231
159
|
hasAttributeServer(cluster, attribute) {
|
|
232
160
|
const behavior = getBehavior(this, cluster);
|
|
233
161
|
if (!behavior || !this.behaviors.supported[behavior.id])
|
|
@@ -236,230 +164,82 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
236
164
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
237
165
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
238
166
|
}
|
|
239
|
-
/**
|
|
240
|
-
* Retrieves the initial options for the provided cluster server.
|
|
241
|
-
*
|
|
242
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
|
|
243
|
-
* @returns {Record<string, boolean | number | bigint | string | object | null> | undefined} The options for the provided cluster server, or undefined if the cluster is not supported.
|
|
244
|
-
*/
|
|
245
167
|
getClusterServerOptions(cluster) {
|
|
246
168
|
const behavior = getBehavior(this, cluster);
|
|
247
169
|
if (!behavior)
|
|
248
170
|
return undefined;
|
|
249
171
|
return this.behaviors.optionsFor(behavior);
|
|
250
172
|
}
|
|
251
|
-
/**
|
|
252
|
-
* Retrieves the value of the provided attribute from the given cluster.
|
|
253
|
-
*
|
|
254
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
255
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
256
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
257
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
258
|
-
*/
|
|
259
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
260
173
|
getAttribute(cluster, attribute, log) {
|
|
261
174
|
return getAttribute(this, cluster, attribute, log);
|
|
262
175
|
}
|
|
263
|
-
/**
|
|
264
|
-
* Sets the value of an attribute on a cluster server.
|
|
265
|
-
*
|
|
266
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
|
|
267
|
-
* @param {string} attribute - The name of the attribute.
|
|
268
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
269
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
270
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
271
|
-
*/
|
|
272
176
|
async setAttribute(clusterId, attribute, value, log) {
|
|
273
177
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
274
178
|
}
|
|
275
|
-
/**
|
|
276
|
-
* Update the value of an attribute on a cluster server only if the value is different.
|
|
277
|
-
*
|
|
278
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
279
|
-
* @param {string} attribute - The name of the attribute.
|
|
280
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
281
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
|
|
282
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
283
|
-
*/
|
|
284
179
|
async updateAttribute(cluster, attribute, value, log) {
|
|
285
180
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
286
181
|
}
|
|
287
|
-
/**
|
|
288
|
-
* Subscribes to the provided attribute on a cluster.
|
|
289
|
-
*
|
|
290
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
|
|
291
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
292
|
-
* @param {(newValue: any, oldValue: any, context?: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
293
|
-
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
294
|
-
* @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
|
|
295
|
-
*/
|
|
296
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
297
182
|
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
298
183
|
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
299
184
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
*
|
|
303
|
-
* @param {ClusterId} clusterId - The ID of the cluster.
|
|
304
|
-
* @param {string} event - The name of the event to trigger.
|
|
305
|
-
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
306
|
-
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
307
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
308
|
-
*/
|
|
309
|
-
async triggerEvent(clusterId, event, payload, log) {
|
|
310
|
-
const clusterName = lowercaseFirstLetter(getClusterNameById(clusterId));
|
|
311
|
-
if (this.construction.status !== Lifecycle.Status.Active) {
|
|
312
|
-
this.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${this.maybeId}${er}:${or}${this.maybeNumber}${er} is in the ${BLUE}${this.construction.status}${er} state`);
|
|
313
|
-
return false;
|
|
314
|
-
}
|
|
315
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
316
|
-
const events = this.events;
|
|
317
|
-
if (!(clusterName in events) || !(event in events[clusterName])) {
|
|
318
|
-
this.log.error(`triggerEvent ${hk}${event}${er} error: Cluster ${'0x' + clusterId.toString(16).padStart(4, '0')}:${clusterName} not found on endpoint ${or}${this.id}${er}:${or}${this.number}${er}`);
|
|
319
|
-
return false;
|
|
320
|
-
}
|
|
321
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
322
|
-
// @ts-ignore
|
|
323
|
-
await this.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
|
|
324
|
-
log?.info(`${db}Trigger event ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${event}${db} with ${debugStringify(payload)}${db} on endpoint ${or}${this.id}${db}:${or}${this.number}${db} `);
|
|
325
|
-
return true;
|
|
185
|
+
async triggerEvent(cluster, event, payload, log) {
|
|
186
|
+
return await triggerEvent(this, cluster, event, payload, log);
|
|
326
187
|
}
|
|
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
188
|
addClusterServers(serverList) {
|
|
334
189
|
addClusterServers(this, serverList);
|
|
335
190
|
return this;
|
|
336
191
|
}
|
|
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
192
|
async addFixedLabel(label, value) {
|
|
345
193
|
await addFixedLabel(this, label, value);
|
|
346
194
|
return this;
|
|
347
195
|
}
|
|
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
196
|
async addUserLabel(label, value) {
|
|
356
197
|
await addUserLabel(this, label, value);
|
|
357
198
|
return this;
|
|
358
199
|
}
|
|
359
|
-
/**
|
|
360
|
-
* Adds a command handler for the specified command.
|
|
361
|
-
*
|
|
362
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
363
|
-
* @param {HandlerFunction} handler - The handler function to execute when the command is received.
|
|
364
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
365
|
-
*/
|
|
366
200
|
addCommandHandler(command, handler) {
|
|
367
201
|
this.commandHandler.addHandler(command, handler);
|
|
368
202
|
return this;
|
|
369
203
|
}
|
|
370
|
-
/**
|
|
371
|
-
* Execute the command handler for the specified command. Mainly used in Jest tests.
|
|
372
|
-
*
|
|
373
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
|
|
374
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} [request] - The optional request to pass to the handler function.
|
|
375
|
-
*/
|
|
376
204
|
async executeCommandHandler(command, request) {
|
|
377
205
|
await this.commandHandler.executeHandler(command, { request });
|
|
378
206
|
}
|
|
379
|
-
/**
|
|
380
|
-
* Invokes a behavior command on the specified cluster. Mainly used in Jest tests.
|
|
381
|
-
*
|
|
382
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
|
|
383
|
-
* @param {string} command - The command to invoke.
|
|
384
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The optional parameters to pass to the command.
|
|
385
|
-
*/
|
|
386
207
|
async invokeBehaviorCommand(cluster, command, params) {
|
|
387
208
|
await invokeBehaviorCommand(this, cluster, command, params);
|
|
388
209
|
}
|
|
389
|
-
/**
|
|
390
|
-
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
391
|
-
*
|
|
392
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
393
|
-
*/
|
|
394
210
|
addRequiredClusterServers() {
|
|
395
211
|
addRequiredClusterServers(this);
|
|
396
212
|
return this;
|
|
397
213
|
}
|
|
398
|
-
/**
|
|
399
|
-
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
400
|
-
*
|
|
401
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
402
|
-
*/
|
|
403
214
|
addOptionalClusterServers() {
|
|
404
215
|
addOptionalClusterServers(this);
|
|
405
216
|
return this;
|
|
406
217
|
}
|
|
407
|
-
/**
|
|
408
|
-
* Retrieves all cluster servers.
|
|
409
|
-
*
|
|
410
|
-
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
411
|
-
*/
|
|
412
218
|
getAllClusterServers() {
|
|
413
219
|
return Object.values(this.behaviors.supported);
|
|
414
220
|
}
|
|
415
|
-
/**
|
|
416
|
-
* Retrieves the names of all cluster servers.
|
|
417
|
-
*
|
|
418
|
-
* @returns {string[]} An array of all cluster server names.
|
|
419
|
-
*/
|
|
420
221
|
getAllClusterServerNames() {
|
|
421
222
|
return Object.keys(this.behaviors.supported);
|
|
422
223
|
}
|
|
423
|
-
/**
|
|
424
|
-
* Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
|
|
425
|
-
*
|
|
426
|
-
* @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
|
|
427
|
-
*/
|
|
428
224
|
forEachAttribute(callback) {
|
|
429
225
|
if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
|
|
430
226
|
return;
|
|
431
227
|
for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
|
|
228
|
+
if (!isNaN(Number(clusterName)))
|
|
229
|
+
continue;
|
|
432
230
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
433
231
|
const clusterId = getClusterId(this, clusterName);
|
|
434
232
|
if (clusterId === undefined) {
|
|
435
|
-
// this.log.error(`forEachAttribute error: cluster ${clusterName} not found`);
|
|
436
233
|
continue;
|
|
437
234
|
}
|
|
438
235
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
439
236
|
if (attributeId === undefined) {
|
|
440
|
-
// this.log.error(`forEachAttribute error: attribute ${clusterName}.${attributeName} not found`);
|
|
441
237
|
continue;
|
|
442
238
|
}
|
|
443
239
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
444
240
|
}
|
|
445
241
|
}
|
|
446
242
|
}
|
|
447
|
-
/**
|
|
448
|
-
* Adds a child endpoint with the specified device types and options.
|
|
449
|
-
* If the child endpoint is not already present, it will be created and added.
|
|
450
|
-
* If the child endpoint is already present, the existing child endpoint will be returned.
|
|
451
|
-
*
|
|
452
|
-
* @param {string} endpointName - The name of the new endpoint to add.
|
|
453
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
454
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the endpoint.
|
|
455
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
456
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
457
|
-
*
|
|
458
|
-
* @example
|
|
459
|
-
* ```typescript
|
|
460
|
-
* const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
461
|
-
* ```
|
|
462
|
-
*/
|
|
463
243
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
464
244
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
465
245
|
let alreadyAdded = false;
|
|
@@ -499,23 +279,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
499
279
|
}
|
|
500
280
|
return child;
|
|
501
281
|
}
|
|
502
|
-
/**
|
|
503
|
-
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
504
|
-
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
505
|
-
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
506
|
-
*
|
|
507
|
-
* @param {string} endpointName - The name of the new enpoint to add.
|
|
508
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
509
|
-
* @param {ClusterId[]} [serverList=[]] - The list of cluster IDs to include.
|
|
510
|
-
* @param {MatterbridgeEndpointOptions} [options={}] - The options for the device.
|
|
511
|
-
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
512
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
513
|
-
*
|
|
514
|
-
* @example
|
|
515
|
-
* ```typescript
|
|
516
|
-
* const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
517
|
-
* ```
|
|
518
|
-
*/
|
|
519
282
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
520
283
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
521
284
|
let alreadyAdded = false;
|
|
@@ -578,38 +341,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
578
341
|
}
|
|
579
342
|
return child;
|
|
580
343
|
}
|
|
581
|
-
/**
|
|
582
|
-
* Retrieves a child endpoint by its name.
|
|
583
|
-
*
|
|
584
|
-
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
585
|
-
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
586
|
-
*/
|
|
587
344
|
getChildEndpointByName(endpointName) {
|
|
588
345
|
return this.parts.find((part) => part.id === endpointName);
|
|
589
346
|
}
|
|
590
|
-
/**
|
|
591
|
-
* Retrieves a child endpoint by its EndpointNumber.
|
|
592
|
-
*
|
|
593
|
-
* @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
|
|
594
|
-
* @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
|
|
595
|
-
*/
|
|
596
347
|
getChildEndpoint(endpointNumber) {
|
|
597
348
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
598
349
|
}
|
|
599
|
-
/**
|
|
600
|
-
* Get all the child endpoints of this endpoint.
|
|
601
|
-
*
|
|
602
|
-
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
603
|
-
*/
|
|
604
350
|
getChildEndpoints() {
|
|
605
351
|
return Array.from(this.parts);
|
|
606
352
|
}
|
|
607
|
-
/**
|
|
608
|
-
* Serializes the Matterbridge device into a serialized object.
|
|
609
|
-
*
|
|
610
|
-
* @param pluginName - The name of the plugin.
|
|
611
|
-
* @returns The serialized Matterbridge device object.
|
|
612
|
-
*/
|
|
613
353
|
static serialize(device) {
|
|
614
354
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId)
|
|
615
355
|
return;
|
|
@@ -632,15 +372,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
632
372
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
633
373
|
if (behaviorName === 'powerSource')
|
|
634
374
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
635
|
-
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
636
375
|
});
|
|
637
376
|
return serialized;
|
|
638
377
|
}
|
|
639
|
-
/**
|
|
640
|
-
* Deserializes the device into a serialized object.
|
|
641
|
-
*
|
|
642
|
-
* @returns The deserialized MatterbridgeDevice.
|
|
643
|
-
*/
|
|
644
378
|
static deserialize(serializedDevice) {
|
|
645
379
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
|
|
646
380
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -656,16 +390,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
656
390
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
657
391
|
else if (clusterId === PowerSource.Cluster.id)
|
|
658
392
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
659
|
-
// else addClusterServerFromList(device, [clusterId]);
|
|
660
393
|
}
|
|
661
394
|
return device;
|
|
662
395
|
}
|
|
663
|
-
/**
|
|
664
|
-
* Creates a default power source wired cluster server.
|
|
665
|
-
*
|
|
666
|
-
* @param wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
667
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
668
|
-
*/
|
|
669
396
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
670
397
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
|
|
671
398
|
wiredCurrentType,
|
|
@@ -676,16 +403,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
676
403
|
});
|
|
677
404
|
return this;
|
|
678
405
|
}
|
|
679
|
-
/**
|
|
680
|
-
* Creates a default power source replaceable battery cluster server.
|
|
681
|
-
*
|
|
682
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
683
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
684
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
685
|
-
* @param batReplacementDescription - The battery replacement description (default: 'Battery type').
|
|
686
|
-
* @param batQuantity - The battery quantity (default: 1).
|
|
687
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
688
|
-
*/
|
|
689
406
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1) {
|
|
690
407
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
691
408
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -703,14 +420,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
703
420
|
});
|
|
704
421
|
return this;
|
|
705
422
|
}
|
|
706
|
-
/**
|
|
707
|
-
* Creates a default power source rechargeable battery cluster server.
|
|
708
|
-
*
|
|
709
|
-
* @param batPercentRemaining - The remaining battery percentage (default: 100).
|
|
710
|
-
* @param batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
711
|
-
* @param batVoltage - The battery voltage (default: 1500).
|
|
712
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
713
|
-
*/
|
|
714
423
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500) {
|
|
715
424
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
716
425
|
status: PowerSource.PowerSourceStatus.Active,
|
|
@@ -729,21 +438,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
729
438
|
});
|
|
730
439
|
return this;
|
|
731
440
|
}
|
|
732
|
-
/**
|
|
733
|
-
* Creates a default Basic Information Cluster Server for the server node.
|
|
734
|
-
*
|
|
735
|
-
* @param deviceName - The name of the device.
|
|
736
|
-
* @param serialNumber - The serial number of the device.
|
|
737
|
-
* @param vendorId - The vendor ID of the device.
|
|
738
|
-
* @param vendorName - The vendor name of the device.
|
|
739
|
-
* @param productId - The product ID of the device.
|
|
740
|
-
* @param productName - The product name of the device.
|
|
741
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
742
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
743
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
744
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
745
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
746
|
-
*/
|
|
747
441
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
748
442
|
this.log.logName = deviceName;
|
|
749
443
|
this.deviceName = deviceName;
|
|
@@ -767,20 +461,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
767
461
|
}
|
|
768
462
|
return this;
|
|
769
463
|
}
|
|
770
|
-
/**
|
|
771
|
-
* Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
|
|
772
|
-
*
|
|
773
|
-
* @param deviceName - The name of the device.
|
|
774
|
-
* @param serialNumber - The serial number of the device.
|
|
775
|
-
* @param vendorId - The vendor ID of the device.
|
|
776
|
-
* @param vendorName - The name of the vendor.
|
|
777
|
-
* @param productName - The name of the product.
|
|
778
|
-
* @param softwareVersion - The software version of the device. Default is 1.
|
|
779
|
-
* @param softwareVersionString - The software version string of the device. Default is 'v.1.0.0'.
|
|
780
|
-
* @param hardwareVersion - The hardware version of the device. Default is 1.
|
|
781
|
-
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
782
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
783
|
-
*/
|
|
784
464
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
785
465
|
this.log.logName = deviceName;
|
|
786
466
|
this.deviceName = deviceName;
|
|
@@ -797,7 +477,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
797
477
|
this.behaviors.require(BridgedDeviceBasicInformationServer.enable({
|
|
798
478
|
events: { leave: true, reachableChanged: true },
|
|
799
479
|
}), {
|
|
800
|
-
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
480
|
+
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined,
|
|
801
481
|
vendorName: vendorName.slice(0, 32),
|
|
802
482
|
productName: productName.slice(0, 32),
|
|
803
483
|
productUrl: this.productUrl.slice(0, 256),
|
|
@@ -813,13 +493,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
813
493
|
});
|
|
814
494
|
return this;
|
|
815
495
|
}
|
|
816
|
-
/**
|
|
817
|
-
* Creates a default identify cluster server with the specified identify time and type.
|
|
818
|
-
*
|
|
819
|
-
* @param {number} [identifyTime=0] - The time to identify the server. Defaults to 0.
|
|
820
|
-
* @param {Identify.IdentifyType} [identifyType=Identify.IdentifyType.None] - The type of identification. Defaults to Identify.IdentifyType.None.
|
|
821
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
822
|
-
*/
|
|
823
496
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
824
497
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
825
498
|
identifyTime,
|
|
@@ -827,32 +500,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
827
500
|
});
|
|
828
501
|
return this;
|
|
829
502
|
}
|
|
830
|
-
/**
|
|
831
|
-
* Creates a default groups cluster server.
|
|
832
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
833
|
-
*/
|
|
834
503
|
createDefaultGroupsClusterServer() {
|
|
835
504
|
this.behaviors.require(GroupsServer);
|
|
836
505
|
return this;
|
|
837
506
|
}
|
|
838
|
-
/**
|
|
839
|
-
* Creates a default scenes management cluster server.
|
|
840
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
841
|
-
*/
|
|
842
507
|
createDefaultScenesClusterServer() {
|
|
843
508
|
this.behaviors.require(ScenesManagementServer);
|
|
844
509
|
return this;
|
|
845
510
|
}
|
|
846
|
-
/**
|
|
847
|
-
* Creates a default OnOff cluster server for light devices.
|
|
848
|
-
*
|
|
849
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
850
|
-
* @param {boolean} [globalSceneControl=false] - The global scene control state.
|
|
851
|
-
* @param {number} [onTime=0] - The on time value.
|
|
852
|
-
* @param {number} [offWaitTime=0] - The off wait time value.
|
|
853
|
-
* @param {OnOff.StartUpOnOff | null} [startUpOnOff=null] - The start-up OnOff state. Null means previous state.
|
|
854
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
855
|
-
*/
|
|
856
511
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
857
512
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
858
513
|
onOff,
|
|
@@ -863,52 +518,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
863
518
|
});
|
|
864
519
|
return this;
|
|
865
520
|
}
|
|
866
|
-
/**
|
|
867
|
-
* Creates an OnOff cluster server without features.
|
|
868
|
-
*
|
|
869
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
870
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
871
|
-
*/
|
|
872
521
|
createOnOffClusterServer(onOff = false) {
|
|
873
522
|
this.behaviors.require(MatterbridgeOnOffServer, {
|
|
874
523
|
onOff,
|
|
875
524
|
});
|
|
876
525
|
return this;
|
|
877
526
|
}
|
|
878
|
-
/**
|
|
879
|
-
* Creates a DeadFront OnOff cluster server.
|
|
880
|
-
*
|
|
881
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
882
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
883
|
-
*/
|
|
884
527
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
885
528
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
886
529
|
onOff,
|
|
887
530
|
});
|
|
888
531
|
return this;
|
|
889
532
|
}
|
|
890
|
-
/**
|
|
891
|
-
* Creates an OffOnly OnOff cluster server.
|
|
892
|
-
*
|
|
893
|
-
* @param {boolean} [onOff=false] - The initial state of the OnOff cluster.
|
|
894
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
895
|
-
*/
|
|
896
533
|
createOffOnlyOnOffClusterServer(onOff = false) {
|
|
897
534
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
|
|
898
535
|
onOff,
|
|
899
536
|
});
|
|
900
537
|
return this;
|
|
901
538
|
}
|
|
902
|
-
/**
|
|
903
|
-
* Creates a default level control cluster server for light devices.
|
|
904
|
-
*
|
|
905
|
-
* @param {number} [currentLevel=254] - The current level (default: 254).
|
|
906
|
-
* @param {number} [minLevel=1] - The minimum level (default: 1).
|
|
907
|
-
* @param {number} [maxLevel=254] - The maximum level (default: 254).
|
|
908
|
-
* @param {number | null} [onLevel=null] - The on level (default: null).
|
|
909
|
-
* @param {number | null} [startUpCurrentLevel=null] - The startUp on level (default: null).
|
|
910
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
911
|
-
*/
|
|
912
539
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
913
540
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
914
541
|
currentLevel,
|
|
@@ -924,13 +551,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
924
551
|
});
|
|
925
552
|
return this;
|
|
926
553
|
}
|
|
927
|
-
/**
|
|
928
|
-
* Creates a level control cluster server without features.
|
|
929
|
-
*
|
|
930
|
-
* @param {number} [currentLevel=254] - The current level (default: 254).
|
|
931
|
-
* @param {number | null} [onLevel=null] - The on level (default: null).
|
|
932
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
933
|
-
*/
|
|
934
554
|
createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
|
|
935
555
|
this.behaviors.require(MatterbridgeLevelControlServer, {
|
|
936
556
|
currentLevel,
|
|
@@ -942,18 +562,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
942
562
|
});
|
|
943
563
|
return this;
|
|
944
564
|
}
|
|
945
|
-
/**
|
|
946
|
-
* Creates a default color control cluster server with Xy, HueSaturation and ColorTemperature.
|
|
947
|
-
*
|
|
948
|
-
* @param currentX - The current X value (range 0-65279).
|
|
949
|
-
* @param currentY - The current Y value (range 0-65279).
|
|
950
|
-
* @param currentHue - The current hue value (range: 0-254).
|
|
951
|
-
* @param currentSaturation - The current saturation value (range: 0-254).
|
|
952
|
-
* @param colorTemperatureMireds - The color temperature in mireds (default range 147-500).
|
|
953
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
|
|
954
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
|
|
955
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
956
|
-
*/
|
|
957
565
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
958
566
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
959
567
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -971,24 +579,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
971
579
|
colorTempPhysicalMinMireds,
|
|
972
580
|
colorTempPhysicalMaxMireds,
|
|
973
581
|
coupleColorTempToLevelMinMireds: colorTempPhysicalMinMireds,
|
|
974
|
-
remainingTime: 0,
|
|
975
582
|
startUpColorTemperatureMireds: null,
|
|
583
|
+
remainingTime: 0,
|
|
976
584
|
});
|
|
977
585
|
return this;
|
|
978
586
|
}
|
|
979
|
-
/**
|
|
980
|
-
* Creates a Xy color control cluster server with Xy and ColorTemperature.
|
|
981
|
-
*
|
|
982
|
-
* @param currentX - The current X value.
|
|
983
|
-
* @param currentY - The current Y value.
|
|
984
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
985
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
986
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
987
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
988
|
-
*
|
|
989
|
-
* @remarks
|
|
990
|
-
* From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
|
|
991
|
-
*/
|
|
992
587
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
993
588
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
994
589
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -1009,16 +604,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1009
604
|
});
|
|
1010
605
|
return this;
|
|
1011
606
|
}
|
|
1012
|
-
/**
|
|
1013
|
-
* Creates a default hue and saturation control cluster server with HueSaturation and ColorTemperature.
|
|
1014
|
-
*
|
|
1015
|
-
* @param currentHue - The current hue value.
|
|
1016
|
-
* @param currentSaturation - The current saturation value.
|
|
1017
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1018
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1019
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1020
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1021
|
-
*/
|
|
1022
607
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1023
608
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1024
609
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1039,15 +624,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1039
624
|
});
|
|
1040
625
|
return this;
|
|
1041
626
|
}
|
|
1042
|
-
|
|
1043
|
-
* Creates a color temperature color control cluster server.
|
|
1044
|
-
*
|
|
1045
|
-
* @param colorTemperatureMireds - The color temperature in mireds.
|
|
1046
|
-
* @param colorTempPhysicalMinMireds - The physical minimum color temperature in mireds.
|
|
1047
|
-
* @param colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds.
|
|
1048
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1049
|
-
*/
|
|
1050
|
-
createCtColorControlClusterServer(colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
627
|
+
createCtColorControlClusterServer(colorTemperatureMireds = 250, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1051
628
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
1052
629
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
1053
630
|
enhancedColorMode: ColorControl.EnhancedColorMode.ColorTemperatureMireds,
|
|
@@ -1060,34 +637,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1060
637
|
colorTempPhysicalMinMireds,
|
|
1061
638
|
colorTempPhysicalMaxMireds,
|
|
1062
639
|
coupleColorTempToLevelMinMireds: colorTempPhysicalMinMireds,
|
|
1063
|
-
remainingTime: 0,
|
|
1064
640
|
startUpColorTemperatureMireds: null,
|
|
641
|
+
remainingTime: 0,
|
|
1065
642
|
});
|
|
1066
643
|
return this;
|
|
1067
644
|
}
|
|
1068
|
-
/**
|
|
1069
|
-
* Configures the color control mode for the device.
|
|
1070
|
-
*
|
|
1071
|
-
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1072
|
-
*/
|
|
1073
645
|
async configureColorControlMode(colorMode) {
|
|
1074
646
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
1075
647
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
1076
648
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
1077
649
|
}
|
|
1078
650
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1084
|
-
*/
|
|
1085
|
-
createDefaultWindowCoveringClusterServer(positionPercent100ths) {
|
|
1086
|
-
this.behaviors.require(MatterbridgeWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1087
|
-
type: WindowCovering.WindowCoveringType.Rollershade,
|
|
651
|
+
createDefaultWindowCoveringClusterServer(positionPercent100ths, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade) {
|
|
652
|
+
this.behaviors.require(MatterbridgeLiftWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
653
|
+
type,
|
|
654
|
+
numberOfActuationsLift: 0,
|
|
1088
655
|
configStatus: {
|
|
1089
656
|
operational: true,
|
|
1090
|
-
onlineReserved:
|
|
657
|
+
onlineReserved: false,
|
|
1091
658
|
liftMovementReversed: false,
|
|
1092
659
|
liftPositionAware: true,
|
|
1093
660
|
tiltPositionAware: false,
|
|
@@ -1095,17 +662,37 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1095
662
|
tiltEncoderControlled: false,
|
|
1096
663
|
},
|
|
1097
664
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1098
|
-
endProductType
|
|
665
|
+
endProductType,
|
|
1099
666
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1100
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1101
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
667
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
668
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
669
|
+
});
|
|
670
|
+
return this;
|
|
671
|
+
}
|
|
672
|
+
createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind) {
|
|
673
|
+
this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt), {
|
|
674
|
+
type,
|
|
675
|
+
numberOfActuationsLift: 0,
|
|
676
|
+
numberOfActuationsTilt: 0,
|
|
677
|
+
configStatus: {
|
|
678
|
+
operational: true,
|
|
679
|
+
onlineReserved: false,
|
|
680
|
+
liftMovementReversed: false,
|
|
681
|
+
liftPositionAware: true,
|
|
682
|
+
tiltPositionAware: true,
|
|
683
|
+
liftEncoderControlled: false,
|
|
684
|
+
tiltEncoderControlled: false,
|
|
685
|
+
},
|
|
686
|
+
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
687
|
+
endProductType,
|
|
688
|
+
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
689
|
+
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
690
|
+
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
691
|
+
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
692
|
+
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
1102
693
|
});
|
|
1103
694
|
return this;
|
|
1104
695
|
}
|
|
1105
|
-
/**
|
|
1106
|
-
* Sets the window covering target position as the current position and stops the movement.
|
|
1107
|
-
*
|
|
1108
|
-
*/
|
|
1109
696
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
1110
697
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
1111
698
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -1117,13 +704,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1117
704
|
}, this.log);
|
|
1118
705
|
}
|
|
1119
706
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths and targetPositionLiftPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
707
|
+
if (this.hasAttributeServer(WindowCovering.Cluster.id, 'currentPositionTiltPercent100ths')) {
|
|
708
|
+
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionTiltPercent100ths', this.log);
|
|
709
|
+
if (isValidNumber(position, 0, 10000)) {
|
|
710
|
+
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionTiltPercent100ths', position, this.log);
|
|
711
|
+
}
|
|
712
|
+
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
713
|
+
}
|
|
1120
714
|
}
|
|
1121
|
-
/**
|
|
1122
|
-
* Sets the current and target status of a window covering.
|
|
1123
|
-
* @param {number} current - The current position of the window covering.
|
|
1124
|
-
* @param {number} target - The target position of the window covering.
|
|
1125
|
-
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1126
|
-
*/
|
|
1127
715
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
1128
716
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
1129
717
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -1134,10 +722,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1134
722
|
}, this.log);
|
|
1135
723
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1136
724
|
}
|
|
1137
|
-
/**
|
|
1138
|
-
* Sets the status of the window covering.
|
|
1139
|
-
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1140
|
-
*/
|
|
1141
725
|
async setWindowCoveringStatus(status) {
|
|
1142
726
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
1143
727
|
global: status,
|
|
@@ -1146,11 +730,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1146
730
|
}, this.log);
|
|
1147
731
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1148
732
|
}
|
|
1149
|
-
/**
|
|
1150
|
-
* Retrieves the status of the window covering.
|
|
1151
|
-
*
|
|
1152
|
-
* @returns The global operational status of the window covering or undefined.
|
|
1153
|
-
*/
|
|
1154
733
|
getWindowCoveringStatus() {
|
|
1155
734
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
1156
735
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -1158,66 +737,41 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1158
737
|
return status.global;
|
|
1159
738
|
}
|
|
1160
739
|
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
}
|
|
1171
|
-
/**
|
|
1172
|
-
* Creates a default thermostat cluster server with Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode.
|
|
1173
|
-
*
|
|
1174
|
-
* @param {number} [localTemperature=23] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1175
|
-
* @param {number} [occupiedHeatingSetpoint=21] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1176
|
-
* @param {number} [occupiedCoolingSetpoint=25] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1177
|
-
* @param {number} [minSetpointDeadBand=1] - The minimum setpoint dead band value. Defaults to 1°.
|
|
1178
|
-
* @param {number} [minHeatSetpointLimit=0] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1179
|
-
* @param {number} [maxHeatSetpointLimit=50] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1180
|
-
* @param {number} [minCoolSetpointLimit=0] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1181
|
-
* @param {number} [maxCoolSetpointLimit=50] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1182
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1183
|
-
*/
|
|
740
|
+
async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
|
|
741
|
+
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', liftPosition, this.log);
|
|
742
|
+
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', liftPosition, this.log);
|
|
743
|
+
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${liftPosition} and targetPositionLiftPercent100ths: ${liftPosition}.`);
|
|
744
|
+
if (tiltPosition && this.hasAttributeServer(WindowCovering.Cluster.id, 'currentPositionTiltPercent100ths')) {
|
|
745
|
+
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionTiltPercent100ths', tiltPosition, this.log);
|
|
746
|
+
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionTiltPercent100ths', tiltPosition, this.log);
|
|
747
|
+
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
|
|
748
|
+
}
|
|
749
|
+
}
|
|
1184
750
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1185
751
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1186
752
|
localTemperature: localTemperature * 100,
|
|
1187
753
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1188
754
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1189
|
-
// Thermostat.Feature.Heating
|
|
1190
755
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1191
756
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1192
757
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1193
758
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1194
759
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1195
|
-
// Thermostat.Feature.Cooling
|
|
1196
760
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1197
761
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1198
762
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1199
763
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1200
764
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1201
|
-
// Thermostat.Feature.AutoMode
|
|
1202
765
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1203
766
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1204
767
|
});
|
|
1205
768
|
return this;
|
|
1206
769
|
}
|
|
1207
|
-
/**
|
|
1208
|
-
* Creates a default heating thermostat cluster server with Thermostat.Feature.Heating.
|
|
1209
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1210
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1211
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1212
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1213
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1214
|
-
*/
|
|
1215
770
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1216
771
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
|
|
1217
772
|
localTemperature: localTemperature * 100,
|
|
1218
773
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1219
774
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1220
|
-
// Thermostat.Feature.Heating
|
|
1221
775
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1222
776
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1223
777
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1226,20 +780,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1226
780
|
});
|
|
1227
781
|
return this;
|
|
1228
782
|
}
|
|
1229
|
-
/**
|
|
1230
|
-
* Creates a default cooling thermostat cluster server with Thermostat.Feature.Cooling.
|
|
1231
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1232
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1233
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1234
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1235
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1236
|
-
*/
|
|
1237
783
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1238
784
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
|
|
1239
785
|
localTemperature: localTemperature * 100,
|
|
1240
786
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1241
787
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1242
|
-
// Thermostat.Feature.Cooling
|
|
1243
788
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1244
789
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1245
790
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -1248,15 +793,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1248
793
|
});
|
|
1249
794
|
return this;
|
|
1250
795
|
}
|
|
1251
|
-
/**
|
|
1252
|
-
* Creates a default thermostat user interface configuration cluster server.
|
|
1253
|
-
*
|
|
1254
|
-
* @remarks
|
|
1255
|
-
* The default values are:
|
|
1256
|
-
* - temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius (writeble).
|
|
1257
|
-
* - keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout (writeble).
|
|
1258
|
-
* - scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted (writeble).
|
|
1259
|
-
*/
|
|
1260
796
|
createDefaultThermostatUserInterfaceConfigurationClusterServer() {
|
|
1261
797
|
this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
|
|
1262
798
|
temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
|
|
@@ -1265,12 +801,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1265
801
|
});
|
|
1266
802
|
return this;
|
|
1267
803
|
}
|
|
1268
|
-
/**
|
|
1269
|
-
* Creates a default fan control cluster server.
|
|
1270
|
-
*
|
|
1271
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1272
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1273
|
-
*/
|
|
1274
804
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1275
805
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1276
806
|
fanMode,
|
|
@@ -1283,12 +813,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1283
813
|
});
|
|
1284
814
|
return this;
|
|
1285
815
|
}
|
|
1286
|
-
/**
|
|
1287
|
-
* Creates a base fan control cluster server.
|
|
1288
|
-
*
|
|
1289
|
-
* @param fanMode The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1290
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1291
|
-
*/
|
|
1292
816
|
createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1293
817
|
this.behaviors.require(FanControlServer, {
|
|
1294
818
|
fanMode,
|
|
@@ -1298,82 +822,39 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1298
822
|
});
|
|
1299
823
|
return this;
|
|
1300
824
|
}
|
|
1301
|
-
/**
|
|
1302
|
-
* Creates a default HEPA Filter Monitoring Cluster Server.
|
|
1303
|
-
* It supports ResourceMonitoring.Feature.Condition and ResourceMonitoring.Feature.ReplacementProductList.
|
|
1304
|
-
*
|
|
1305
|
-
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
1306
|
-
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
|
|
1307
|
-
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
|
|
1308
|
-
*
|
|
1309
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1310
|
-
*/
|
|
1311
825
|
createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
1312
826
|
this.behaviors.require(HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1313
|
-
condition: 100,
|
|
1314
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
827
|
+
condition: 100,
|
|
828
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1315
829
|
changeIndication,
|
|
1316
830
|
inPlaceIndicator,
|
|
1317
831
|
lastChangedTime,
|
|
1318
|
-
replacementProductList: [],
|
|
832
|
+
replacementProductList: [],
|
|
1319
833
|
});
|
|
1320
834
|
return this;
|
|
1321
835
|
}
|
|
1322
|
-
/**
|
|
1323
|
-
* Creates a default Activated Carbon Filter Monitoring Cluster Server.
|
|
1324
|
-
* It supports ResourceMonitoring.Feature.Condition and ResourceMonitoring.Feature.ReplacementProductList.
|
|
1325
|
-
*
|
|
1326
|
-
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
1327
|
-
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
|
|
1328
|
-
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
|
|
1329
|
-
*
|
|
1330
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1331
|
-
*/
|
|
1332
836
|
createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
1333
837
|
this.behaviors.require(ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1334
|
-
condition: 100,
|
|
1335
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
838
|
+
condition: 100,
|
|
839
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1336
840
|
changeIndication,
|
|
1337
841
|
inPlaceIndicator,
|
|
1338
842
|
lastChangedTime,
|
|
1339
|
-
replacementProductList: [],
|
|
843
|
+
replacementProductList: [],
|
|
1340
844
|
});
|
|
1341
845
|
return this;
|
|
1342
846
|
}
|
|
1343
|
-
/**
|
|
1344
|
-
* Creates a default door lock cluster server.
|
|
1345
|
-
*
|
|
1346
|
-
* @param {DoorLock.LockState} [lockState=DoorLock.LockState.Locked] - The initial state of the lock (default: Locked).
|
|
1347
|
-
* @param {DoorLock.LockType} [lockType=DoorLock.LockType.DeadBolt] - The type of the lock (default: DeadBolt).
|
|
1348
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1349
|
-
*
|
|
1350
|
-
* @remarks
|
|
1351
|
-
* 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.
|
|
1352
|
-
*/
|
|
1353
847
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1354
848
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
1355
849
|
lockState,
|
|
1356
850
|
lockType,
|
|
1357
851
|
actuatorEnabled: false,
|
|
1358
852
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
1359
|
-
// Special case of inverted bitmap: add also alwaysSet = 2047
|
|
1360
853
|
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
|
|
1361
854
|
alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
|
|
1362
855
|
});
|
|
1363
856
|
return this;
|
|
1364
857
|
}
|
|
1365
|
-
/**
|
|
1366
|
-
* Creates a default Mode Select cluster server.
|
|
1367
|
-
*
|
|
1368
|
-
* @param {string} description - The description of the mode select cluster.
|
|
1369
|
-
* @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
|
|
1370
|
-
* @param {number} [currentMode=0] - The current mode (default: 0).
|
|
1371
|
-
* @param {number} [startUpMode=0] - The startup mode (default: 0).
|
|
1372
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1373
|
-
*
|
|
1374
|
-
* @remarks
|
|
1375
|
-
* endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
|
|
1376
|
-
*/
|
|
1377
858
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1378
859
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
1379
860
|
description: description,
|
|
@@ -1384,13 +865,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1384
865
|
});
|
|
1385
866
|
return this;
|
|
1386
867
|
}
|
|
1387
|
-
/**
|
|
1388
|
-
* Creates the default Valve Configuration And Control cluster server.
|
|
1389
|
-
*
|
|
1390
|
-
* @param {ValveConfigurationAndControl.ValveState} [valveState=ValveConfigurationAndControl.ValveState.Closed] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
1391
|
-
* @param {number} [valveLevel=0] - The valve level to set. Defaults to 0.
|
|
1392
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1393
|
-
*/
|
|
1394
868
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
1395
869
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
1396
870
|
currentState: valveState,
|
|
@@ -1406,12 +880,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1406
880
|
});
|
|
1407
881
|
return this;
|
|
1408
882
|
}
|
|
1409
|
-
/**
|
|
1410
|
-
* Creates the default PumpConfigurationAndControl cluster server.
|
|
1411
|
-
*
|
|
1412
|
-
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode=PumpConfigurationAndControl.OperationMode.Normal] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
1413
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1414
|
-
*/
|
|
1415
883
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1416
884
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
1417
885
|
minConstSpeed: null,
|
|
@@ -1426,13 +894,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1426
894
|
});
|
|
1427
895
|
return this;
|
|
1428
896
|
}
|
|
1429
|
-
/**
|
|
1430
|
-
* Creates the default SmokeCOAlarm Cluster Server.
|
|
1431
|
-
*
|
|
1432
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1433
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1434
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1435
|
-
*/
|
|
1436
897
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1437
898
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1438
899
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1448,12 +909,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1448
909
|
});
|
|
1449
910
|
return this;
|
|
1450
911
|
}
|
|
1451
|
-
/**
|
|
1452
|
-
* Creates a smoke only SmokeCOAlarm Cluster Server.
|
|
1453
|
-
*
|
|
1454
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1455
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1456
|
-
*/
|
|
1457
912
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1458
913
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
1459
914
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1468,12 +923,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1468
923
|
});
|
|
1469
924
|
return this;
|
|
1470
925
|
}
|
|
1471
|
-
/**
|
|
1472
|
-
* Creates a co only SmokeCOAlarm Cluster Server.
|
|
1473
|
-
*
|
|
1474
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1475
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1476
|
-
*/
|
|
1477
926
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1478
927
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1479
928
|
events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1488,13 +937,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1488
937
|
});
|
|
1489
938
|
return this;
|
|
1490
939
|
}
|
|
1491
|
-
/**
|
|
1492
|
-
* Creates a default momentary switch cluster server.
|
|
1493
|
-
*
|
|
1494
|
-
* @remarks
|
|
1495
|
-
* This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
|
|
1496
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1497
|
-
*/
|
|
1498
940
|
createDefaultSwitchClusterServer() {
|
|
1499
941
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
1500
942
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -1505,13 +947,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1505
947
|
});
|
|
1506
948
|
return this;
|
|
1507
949
|
}
|
|
1508
|
-
/**
|
|
1509
|
-
* Creates a default latching switch cluster server.
|
|
1510
|
-
*
|
|
1511
|
-
* @remarks
|
|
1512
|
-
* This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
|
|
1513
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1514
|
-
*/
|
|
1515
950
|
createDefaultLatchingSwitchClusterServer() {
|
|
1516
951
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
1517
952
|
events: { switchLatched: true },
|
|
@@ -1521,13 +956,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1521
956
|
});
|
|
1522
957
|
return this;
|
|
1523
958
|
}
|
|
1524
|
-
/**
|
|
1525
|
-
* Triggers a switch event on the specified endpoint.
|
|
1526
|
-
*
|
|
1527
|
-
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1528
|
-
* @param {Endpoint} endpoint - The endpoint on which to trigger the event (default the device endpoint).
|
|
1529
|
-
* @returns {boolean} - A boolean indicating whether the event was successfully triggered.
|
|
1530
|
-
*/
|
|
1531
959
|
async triggerSwitchEvent(event, log) {
|
|
1532
960
|
if (this.maybeNumber === undefined) {
|
|
1533
961
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1587,29 +1015,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1587
1015
|
}
|
|
1588
1016
|
return true;
|
|
1589
1017
|
}
|
|
1590
|
-
/**
|
|
1591
|
-
* Creates a default OperationalState Cluster Server.
|
|
1592
|
-
*
|
|
1593
|
-
* @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state.
|
|
1594
|
-
*
|
|
1595
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1596
|
-
*/
|
|
1597
1018
|
createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
|
1598
1019
|
this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
|
|
1599
1020
|
return this;
|
|
1600
1021
|
}
|
|
1601
|
-
/**
|
|
1602
|
-
* Creates a default boolean state cluster server.
|
|
1603
|
-
*
|
|
1604
|
-
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
|
|
1605
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1606
|
-
*
|
|
1607
|
-
* @remarks
|
|
1608
|
-
* Water Leak Detector: true = leak, false = no leak
|
|
1609
|
-
* Water Freeze Detector: true = freeze, false = no freeze
|
|
1610
|
-
* Rain Sensor: true = rain, false = no rain
|
|
1611
|
-
* Contact Sensor: true = closed or contact, false = open or no contact
|
|
1612
|
-
*/
|
|
1613
1022
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1614
1023
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1615
1024
|
events: { stateChange: true },
|
|
@@ -1618,18 +1027,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1618
1027
|
});
|
|
1619
1028
|
return this;
|
|
1620
1029
|
}
|
|
1621
|
-
/**
|
|
1622
|
-
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
|
|
1623
|
-
*
|
|
1624
|
-
* @remarks Supports the enableDisableAlarm command.
|
|
1625
|
-
*
|
|
1626
|
-
* @param {boolean} [sensorFault=false] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1627
|
-
* @param {number} [currentSensitivityLevel=0] - The current sensitivity level. Defaults to `0` if not provided.
|
|
1628
|
-
* @param {number} [supportedSensitivityLevels=2] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
|
|
1629
|
-
* @param {number} [defaultSensitivityLevel=0] - The default sensitivity level. Defaults to `0` if not provided.
|
|
1630
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1631
|
-
*
|
|
1632
|
-
*/
|
|
1633
1030
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1634
1031
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1635
1032
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -1644,21 +1041,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1644
1041
|
});
|
|
1645
1042
|
return this;
|
|
1646
1043
|
}
|
|
1647
|
-
/**
|
|
1648
|
-
* Creates a default Power Topology Cluster Server with feature TreeTopology. Only needed for an electricalSensor device type.
|
|
1649
|
-
*
|
|
1650
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1651
|
-
*/
|
|
1652
1044
|
createDefaultPowerTopologyClusterServer() {
|
|
1653
1045
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1654
1046
|
return this;
|
|
1655
1047
|
}
|
|
1656
|
-
/**
|
|
1657
|
-
* Creates a default Electrical Energy Measurement Cluster Server.
|
|
1658
|
-
*
|
|
1659
|
-
* @param {number} energy - The total consumption value in mW/h.
|
|
1660
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1661
|
-
*/
|
|
1662
1048
|
createDefaultElectricalEnergyMeasurementClusterServer(energy = null) {
|
|
1663
1049
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1664
1050
|
accuracy: {
|
|
@@ -1674,15 +1060,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1674
1060
|
});
|
|
1675
1061
|
return this;
|
|
1676
1062
|
}
|
|
1677
|
-
/**
|
|
1678
|
-
* Creates a default Electrical Power Measurement Cluster Server.
|
|
1679
|
-
*
|
|
1680
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
1681
|
-
* @param {number} current - The current value in milliamperes.
|
|
1682
|
-
* @param {number} power - The power value in milliwatts.
|
|
1683
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
1684
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1685
|
-
*/
|
|
1686
1063
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1687
1064
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1688
1065
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1724,113 +1101,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1724
1101
|
});
|
|
1725
1102
|
return this;
|
|
1726
1103
|
}
|
|
1727
|
-
/**
|
|
1728
|
-
* Creates a default TemperatureMeasurement cluster server.
|
|
1729
|
-
*
|
|
1730
|
-
* @param {number | null} measuredValue - The measured value of the temperature x 100.
|
|
1731
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
|
|
1732
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
|
|
1733
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1734
|
-
*/
|
|
1735
1104
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1736
1105
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1737
1106
|
return this;
|
|
1738
1107
|
}
|
|
1739
|
-
/**
|
|
1740
|
-
* Creates a default RelativeHumidityMeasurement cluster server.
|
|
1741
|
-
*
|
|
1742
|
-
* @param {number | null} measuredValue - The measured value of the relative humidity x 100.
|
|
1743
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
|
|
1744
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
|
|
1745
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1746
|
-
*/
|
|
1747
1108
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1748
1109
|
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1749
1110
|
return this;
|
|
1750
1111
|
}
|
|
1751
|
-
/**
|
|
1752
|
-
* Creates a default PressureMeasurement cluster server.
|
|
1753
|
-
*
|
|
1754
|
-
* @param {number | null} measuredValue - The measured value for the pressure.
|
|
1755
|
-
* @param {number | null} minMeasuredValue - The minimum measured value for the pressure.
|
|
1756
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value for the pressure.
|
|
1757
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1758
|
-
*/
|
|
1759
1112
|
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1760
1113
|
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1761
1114
|
return this;
|
|
1762
1115
|
}
|
|
1763
|
-
/**
|
|
1764
|
-
* Creates a default IlluminanceMeasurement cluster server.
|
|
1765
|
-
*
|
|
1766
|
-
* @param {number | null} measuredValue - The measured value of illuminance.
|
|
1767
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
|
|
1768
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
|
|
1769
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1770
|
-
*
|
|
1771
|
-
* @remark The default value for the illuminance measurement is null.
|
|
1772
|
-
* This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
|
|
1773
|
-
* • MeasuredValue = 10,000 x log10(illuminance) + 1,
|
|
1774
|
-
* where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
|
|
1775
|
-
* • 0 indicates a value of illuminance that is too low to be measured
|
|
1776
|
-
* • null indicates that the illuminance measurement is invalid.
|
|
1777
|
-
*
|
|
1778
|
-
* @remarks
|
|
1779
|
-
* Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
|
|
1780
|
-
* Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
|
|
1781
|
-
*/
|
|
1782
1116
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1783
1117
|
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1784
1118
|
return this;
|
|
1785
1119
|
}
|
|
1786
|
-
/**
|
|
1787
|
-
* Creates a default FlowMeasurement cluster server.
|
|
1788
|
-
*
|
|
1789
|
-
* @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
|
|
1790
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
|
|
1791
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
|
|
1792
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1793
|
-
*/
|
|
1794
1120
|
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1795
1121
|
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1796
1122
|
return this;
|
|
1797
1123
|
}
|
|
1798
|
-
/**
|
|
1799
|
-
* Creates a default OccupancySensing cluster server.
|
|
1800
|
-
*
|
|
1801
|
-
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
1802
|
-
* @param {number} holdTime - The hold time in seconds. Default is 30.
|
|
1803
|
-
* @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
|
|
1804
|
-
* @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
|
|
1805
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1806
|
-
*
|
|
1807
|
-
* @remark The default value for the occupancy sensor type is PIR.
|
|
1808
|
-
*/
|
|
1809
1124
|
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
1810
1125
|
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
1811
1126
|
return this;
|
|
1812
1127
|
}
|
|
1813
|
-
/**
|
|
1814
|
-
* Creates a default AirQuality cluster server.
|
|
1815
|
-
*
|
|
1816
|
-
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
1817
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1818
|
-
*/
|
|
1819
1128
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1820
1129
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1821
1130
|
airQuality,
|
|
1822
1131
|
});
|
|
1823
1132
|
return this;
|
|
1824
1133
|
}
|
|
1825
|
-
/**
|
|
1826
|
-
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server.
|
|
1827
|
-
*
|
|
1828
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1829
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1830
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1831
|
-
* @param {number} [uncertainty] - The uncertainty value (optional).
|
|
1832
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1833
|
-
*/
|
|
1834
1134
|
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
1835
1135
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1836
1136
|
measuredValue,
|
|
@@ -1842,11 +1142,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1842
1142
|
});
|
|
1843
1143
|
return this;
|
|
1844
1144
|
}
|
|
1845
|
-
/**
|
|
1846
|
-
* @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
|
|
1847
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1848
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1849
|
-
*/
|
|
1850
1145
|
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1851
1146
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
1852
1147
|
levelValue,
|
|
@@ -1854,13 +1149,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1854
1149
|
});
|
|
1855
1150
|
return this;
|
|
1856
1151
|
}
|
|
1857
|
-
/**
|
|
1858
|
-
* Create a default CarbonMonoxideConcentrationMeasurement cluster server.
|
|
1859
|
-
*
|
|
1860
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1861
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1862
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1863
|
-
*/
|
|
1864
1152
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1865
1153
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1866
1154
|
measuredValue,
|
|
@@ -1872,13 +1160,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1872
1160
|
});
|
|
1873
1161
|
return this;
|
|
1874
1162
|
}
|
|
1875
|
-
/**
|
|
1876
|
-
* Create a default CarbonDioxideConcentrationMeasurement cluster server.
|
|
1877
|
-
*
|
|
1878
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1879
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1880
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1881
|
-
*/
|
|
1882
1163
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1883
1164
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1884
1165
|
measuredValue,
|
|
@@ -1890,13 +1171,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1890
1171
|
});
|
|
1891
1172
|
return this;
|
|
1892
1173
|
}
|
|
1893
|
-
/**
|
|
1894
|
-
* Create a default FormaldehydeConcentrationMeasurement cluster server.
|
|
1895
|
-
*
|
|
1896
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1897
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1898
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1899
|
-
*/
|
|
1900
1174
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1901
1175
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1902
1176
|
measuredValue,
|
|
@@ -1908,13 +1182,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1908
1182
|
});
|
|
1909
1183
|
return this;
|
|
1910
1184
|
}
|
|
1911
|
-
/**
|
|
1912
|
-
* Create a default Pm1ConcentrationMeasurement cluster server.
|
|
1913
|
-
*
|
|
1914
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1915
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1916
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1917
|
-
*/
|
|
1918
1185
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1919
1186
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1920
1187
|
measuredValue,
|
|
@@ -1926,13 +1193,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1926
1193
|
});
|
|
1927
1194
|
return this;
|
|
1928
1195
|
}
|
|
1929
|
-
/**
|
|
1930
|
-
* Create a default Pm25ConcentrationMeasurement cluster server.
|
|
1931
|
-
*
|
|
1932
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1933
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1934
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1935
|
-
*/
|
|
1936
1196
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1937
1197
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1938
1198
|
measuredValue,
|
|
@@ -1944,13 +1204,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1944
1204
|
});
|
|
1945
1205
|
return this;
|
|
1946
1206
|
}
|
|
1947
|
-
/**
|
|
1948
|
-
* Create a default Pm10ConcentrationMeasurement cluster server.
|
|
1949
|
-
*
|
|
1950
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1951
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1952
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1953
|
-
*/
|
|
1954
1207
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1955
1208
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1956
1209
|
measuredValue,
|
|
@@ -1962,13 +1215,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1962
1215
|
});
|
|
1963
1216
|
return this;
|
|
1964
1217
|
}
|
|
1965
|
-
/**
|
|
1966
|
-
* Create a default OzoneConcentrationMeasurement cluster server.
|
|
1967
|
-
*
|
|
1968
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1969
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
1970
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1971
|
-
*/
|
|
1972
1218
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1973
1219
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1974
1220
|
measuredValue,
|
|
@@ -1980,13 +1226,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1980
1226
|
});
|
|
1981
1227
|
return this;
|
|
1982
1228
|
}
|
|
1983
|
-
/**
|
|
1984
|
-
* Create a default RadonConcentrationMeasurement cluster server.
|
|
1985
|
-
*
|
|
1986
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
1987
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
1988
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
1989
|
-
*/
|
|
1990
1229
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1991
1230
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1992
1231
|
measuredValue,
|
|
@@ -1998,13 +1237,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1998
1237
|
});
|
|
1999
1238
|
return this;
|
|
2000
1239
|
}
|
|
2001
|
-
/**
|
|
2002
|
-
* Create a default NitrogenDioxideConcentrationMeasurement cluster server.
|
|
2003
|
-
*
|
|
2004
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2005
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2006
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2007
|
-
*/
|
|
2008
1240
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2009
1241
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2010
1242
|
measuredValue,
|
|
@@ -2017,4 +1249,3 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2017
1249
|
return this;
|
|
2018
1250
|
}
|
|
2019
1251
|
}
|
|
2020
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|