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