matterbridge 3.1.4 → 3.1.5-dev-20250720-5a0b41e
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 +19 -0
- package/README-DEV.md +59 -0
- package/dist/cli.js +2 -91
- package/dist/cliEmitter.js +0 -30
- package/dist/clusters/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -24
- package/dist/deviceManager.js +1 -94
- package/dist/devices/batteryStorage.js +1 -48
- package/dist/devices/evse.js +10 -74
- package/dist/devices/export.js +0 -2
- package/dist/devices/heatPump.js +2 -50
- package/dist/devices/laundryDryer.js +6 -83
- package/dist/devices/laundryWasher.js +7 -91
- package/dist/devices/roboticVacuumCleaner.js +17 -97
- package/dist/devices/solarPower.js +0 -38
- package/dist/devices/waterHeater.js +2 -82
- package/dist/frontend.js +22 -430
- package/dist/globalMatterbridge.js +0 -47
- package/dist/helpers.js +0 -53
- package/dist/index.js +1 -30
- 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 +66 -802
- package/dist/matterbridgeAccessoryPlatform.js +0 -36
- package/dist/matterbridgeBehaviors.js +1 -61
- package/dist/matterbridgeDeviceTypes.js +15 -579
- package/dist/matterbridgeDynamicPlatform.js +0 -36
- package/dist/matterbridgeEndpoint.js +42 -1106
- package/dist/matterbridgeEndpointHelpers.js +12 -322
- package/dist/matterbridgePlatform.js +0 -233
- package/dist/matterbridgeTypes.js +0 -25
- package/dist/pluginManager.js +46 -350
- 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/error.js +9 -0
- 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 -81
- package/dist/utils/spawn.js +0 -18
- package/dist/utils/wait.js +9 -62
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -2
- package/dist/cli.d.ts +0 -26
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cliEmitter.d.ts +0 -34
- package/dist/cliEmitter.d.ts.map +0 -1
- package/dist/cliEmitter.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/batteryStorage.d.ts +0 -48
- package/dist/devices/batteryStorage.d.ts.map +0 -1
- package/dist/devices/batteryStorage.js.map +0 -1
- package/dist/devices/evse.d.ts +0 -75
- package/dist/devices/evse.d.ts.map +0 -1
- package/dist/devices/evse.js.map +0 -1
- package/dist/devices/export.d.ts +0 -9
- package/dist/devices/export.d.ts.map +0 -1
- package/dist/devices/export.js.map +0 -1
- package/dist/devices/heatPump.d.ts +0 -47
- package/dist/devices/heatPump.d.ts.map +0 -1
- package/dist/devices/heatPump.js.map +0 -1
- package/dist/devices/laundryDryer.d.ts +0 -87
- package/dist/devices/laundryDryer.d.ts.map +0 -1
- package/dist/devices/laundryDryer.js.map +0 -1
- package/dist/devices/laundryWasher.d.ts +0 -242
- package/dist/devices/laundryWasher.d.ts.map +0 -1
- package/dist/devices/laundryWasher.js.map +0 -1
- package/dist/devices/roboticVacuumCleaner.d.ts +0 -110
- package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
- package/dist/devices/roboticVacuumCleaner.js.map +0 -1
- package/dist/devices/solarPower.d.ts +0 -40
- package/dist/devices/solarPower.d.ts.map +0 -1
- package/dist/devices/solarPower.js.map +0 -1
- package/dist/devices/waterHeater.d.ts +0 -111
- package/dist/devices/waterHeater.d.ts.map +0 -1
- package/dist/devices/waterHeater.js.map +0 -1
- package/dist/frontend.d.ts +0 -304
- 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 -33
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger/export.d.ts +0 -2
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/behaviors.d.ts +0 -2
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts +0 -2
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts +0 -2
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts +0 -2
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts +0 -5
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts +0 -3
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -444
- 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 -1340
- 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 -1250
- 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 -195
- 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/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 -74
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/spawn.d.ts +0 -11
- 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
|
@@ -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';
|
|
@@ -85,39 +59,18 @@ import { ResourceMonitoring } from '@matter/main/clusters/resource-monitoring';
|
|
|
85
59
|
import { HepaFilterMonitoringServer } from '@matter/main/behaviors/hepa-filter-monitoring';
|
|
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
|
-
// AnsiLogger module
|
|
89
62
|
import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
|
|
90
|
-
// Matterbridge
|
|
91
63
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
92
64
|
import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
|
|
93
65
|
import { MatterbridgeServer, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, MatterbridgeDeviceEnergyManagementServer, } from './matterbridgeBehaviors.js';
|
|
94
66
|
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';
|
|
95
67
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
96
|
-
/** The bridge mode of Matterbridge */
|
|
97
68
|
static bridgeMode = '';
|
|
98
|
-
|
|
99
|
-
static logLevel = "info" /* LogLevel.INFO */;
|
|
100
|
-
/**
|
|
101
|
-
* Activates a special mode for this endpoint.
|
|
102
|
-
* - 'server': it creates the device server node and add the device as Matter device that needs to be paired individually.
|
|
103
|
-
* 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.
|
|
104
|
-
*
|
|
105
|
-
* - 'matter': it adds the device directly to the bridge server node as Matter device. In this case the implementation must respect
|
|
106
|
-
* the 9.2.3. Disambiguation rule (i.e. use taglist if needed cause the device doesn't have nodeLabel).
|
|
107
|
-
* Furthermore the device will be a part of the bridge (i.e. will have the same name and will be in the same room).
|
|
108
|
-
* See 9.12.2.2. Native Matter functionality in Bridge.
|
|
109
|
-
*
|
|
110
|
-
* @remarks
|
|
111
|
-
* Always use createDefaultBasicInformationClusterServer() to create the BasicInformation cluster server.
|
|
112
|
-
*/
|
|
69
|
+
static logLevel = "info";
|
|
113
70
|
mode = undefined;
|
|
114
|
-
/** The server node of the endpoint, if it is a single not bridged endpoint */
|
|
115
71
|
serverNode;
|
|
116
|
-
/** The logger instance for the MatterbridgeEndpoint */
|
|
117
72
|
log;
|
|
118
|
-
/** The plugin name this MatterbridgeEndpoint belongs to */
|
|
119
73
|
plugin = undefined;
|
|
120
|
-
/** The configuration URL of the device, if available */
|
|
121
74
|
configUrl = undefined;
|
|
122
75
|
deviceName = undefined;
|
|
123
76
|
serialNumber = undefined;
|
|
@@ -131,28 +84,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
131
84
|
hardwareVersion = undefined;
|
|
132
85
|
hardwareVersionString = undefined;
|
|
133
86
|
productUrl = 'https://www.npmjs.com/package/matterbridge';
|
|
134
|
-
/** The name of the first device type of the endpoint (old api compatibility) */
|
|
135
87
|
name = undefined;
|
|
136
|
-
/** The code of the first device type of the endpoint (old api compatibility) */
|
|
137
88
|
deviceType = undefined;
|
|
138
|
-
/** The original id (with spaces and .) of the endpoint (old api compatibility) */
|
|
139
89
|
uniqueStorageKey = undefined;
|
|
140
90
|
tagList = undefined;
|
|
141
|
-
/** Maps the DeviceTypeDefinitions with their code */
|
|
142
91
|
deviceTypes = new Map();
|
|
143
|
-
/** Command handler for the MatterbridgeEndpoint commands */
|
|
144
92
|
commandHandler = new NamedHandler();
|
|
145
|
-
/**
|
|
146
|
-
* Represents a MatterbridgeEndpoint.
|
|
147
|
-
*
|
|
148
|
-
* @class MatterbridgeEndpoint
|
|
149
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
|
|
150
|
-
* @param {MatterbridgeEndpointOptions} [options] - The options for the device.
|
|
151
|
-
* @param {boolean} [debug] - Debug flag.
|
|
152
|
-
*/
|
|
153
93
|
constructor(definition, options = {}, debug = false) {
|
|
154
94
|
let deviceTypeList = [];
|
|
155
|
-
// Get the first DeviceTypeDefinition
|
|
156
95
|
let firstDefinition;
|
|
157
96
|
if (Array.isArray(definition)) {
|
|
158
97
|
firstDefinition = definition[0];
|
|
@@ -165,7 +104,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
165
104
|
firstDefinition = definition;
|
|
166
105
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
167
106
|
}
|
|
168
|
-
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
169
107
|
const deviceTypeDefinitionV8 = {
|
|
170
108
|
name: firstDefinition.name.replace('-', '_'),
|
|
171
109
|
deviceType: firstDefinition.code,
|
|
@@ -184,20 +122,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
184
122
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
185
123
|
};
|
|
186
124
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
187
|
-
// Check if the uniqueStorageKey is valid
|
|
188
125
|
if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
|
|
189
126
|
options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
|
|
190
127
|
}
|
|
191
128
|
if (options.id && checkNotLatinCharacters(options.id)) {
|
|
192
129
|
options.id = generateUniqueId(options.id);
|
|
193
130
|
}
|
|
194
|
-
// Convert the options to an Endpoint.Options
|
|
195
131
|
const optionsV8 = {
|
|
196
132
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
197
133
|
number: options.endpointId,
|
|
198
134
|
descriptor: options.tagList ? { tagList: options.tagList, deviceTypeList } : { deviceTypeList },
|
|
199
135
|
};
|
|
200
|
-
// Override the deprecated uniqueStorageKey && endpointId with id and number if provided
|
|
201
136
|
if (options.id !== undefined) {
|
|
202
137
|
optionsV8.id = options.id.replace(/[ .]/g, '');
|
|
203
138
|
}
|
|
@@ -217,40 +152,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
217
152
|
}
|
|
218
153
|
else
|
|
219
154
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
220
|
-
|
|
221
|
-
// console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
|
|
222
|
-
// console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
|
|
223
|
-
// Create the logger
|
|
224
|
-
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4 /* TimestampFormat.TIME_MILLIS */, logLevel: debug === true ? "debug" /* LogLevel.DEBUG */ : MatterbridgeEndpoint.logLevel });
|
|
155
|
+
this.log = new AnsiLogger({ logName: options.uniqueStorageKey ?? 'MatterbridgeEndpoint', logTimestampFormat: 4, logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel });
|
|
225
156
|
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}`);
|
|
226
|
-
// Add MatterbridgeServer
|
|
227
157
|
this.behaviors.require(MatterbridgeServer, { log: this.log, commandHandler: this.commandHandler });
|
|
228
158
|
}
|
|
229
|
-
/**
|
|
230
|
-
* Loads an instance of the MatterbridgeEndpoint class.
|
|
231
|
-
*
|
|
232
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
|
|
233
|
-
* @param {MatterbridgeEndpointOptions} [options] - The options for the device.
|
|
234
|
-
* @param {boolean} [debug] - Debug flag.
|
|
235
|
-
* @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
|
|
236
|
-
*/
|
|
237
159
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
238
160
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
239
161
|
}
|
|
240
|
-
/**
|
|
241
|
-
* Get all the device types of this endpoint.
|
|
242
|
-
*
|
|
243
|
-
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
|
|
244
|
-
*/
|
|
245
162
|
getDeviceTypes() {
|
|
246
163
|
return Array.from(this.deviceTypes.values());
|
|
247
164
|
}
|
|
248
|
-
/**
|
|
249
|
-
* Checks if the provided cluster server is supported by this endpoint.
|
|
250
|
-
*
|
|
251
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
252
|
-
* @returns {boolean} True if the cluster server is supported, false otherwise.
|
|
253
|
-
*/
|
|
254
165
|
hasClusterServer(cluster) {
|
|
255
166
|
const behavior = getBehavior(this, cluster);
|
|
256
167
|
if (behavior)
|
|
@@ -258,13 +169,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
258
169
|
else
|
|
259
170
|
return false;
|
|
260
171
|
}
|
|
261
|
-
/**
|
|
262
|
-
* Checks if the provided attribute server is supported for a given cluster of this endpoint.
|
|
263
|
-
*
|
|
264
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
265
|
-
* @param {string} attribute - The attribute name to check.
|
|
266
|
-
* @returns {boolean} True if the attribute server is supported, false otherwise.
|
|
267
|
-
*/
|
|
268
172
|
hasAttributeServer(cluster, attribute) {
|
|
269
173
|
const behavior = getBehavior(this, cluster);
|
|
270
174
|
if (!behavior || !this.behaviors.supported[behavior.id])
|
|
@@ -273,239 +177,82 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
273
177
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
274
178
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
275
179
|
}
|
|
276
|
-
/**
|
|
277
|
-
* Retrieves the initial options for the provided cluster server.
|
|
278
|
-
*
|
|
279
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
|
|
280
|
-
* @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.
|
|
281
|
-
*/
|
|
282
180
|
getClusterServerOptions(cluster) {
|
|
283
181
|
const behavior = getBehavior(this, cluster);
|
|
284
182
|
if (!behavior)
|
|
285
183
|
return undefined;
|
|
286
184
|
return this.behaviors.optionsFor(behavior);
|
|
287
185
|
}
|
|
288
|
-
/**
|
|
289
|
-
* Retrieves the value of the provided attribute from the given cluster.
|
|
290
|
-
*
|
|
291
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
292
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
293
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
294
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
295
|
-
*/
|
|
296
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
297
186
|
getAttribute(cluster, attribute, log) {
|
|
298
187
|
return getAttribute(this, cluster, attribute, log);
|
|
299
188
|
}
|
|
300
|
-
/**
|
|
301
|
-
* Sets the value of an attribute on a cluster server.
|
|
302
|
-
*
|
|
303
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
|
|
304
|
-
* @param {string} attribute - The name of the attribute.
|
|
305
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
306
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
307
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
308
|
-
*/
|
|
309
189
|
async setAttribute(clusterId, attribute, value, log) {
|
|
310
190
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
311
191
|
}
|
|
312
|
-
/**
|
|
313
|
-
* Update the value of an attribute on a cluster server only if the value is different.
|
|
314
|
-
*
|
|
315
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
316
|
-
* @param {string} attribute - The name of the attribute.
|
|
317
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
318
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
|
|
319
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
320
|
-
*/
|
|
321
192
|
async updateAttribute(cluster, attribute, value, log) {
|
|
322
193
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
323
194
|
}
|
|
324
|
-
/**
|
|
325
|
-
* Subscribes to the provided attribute on a cluster.
|
|
326
|
-
*
|
|
327
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
|
|
328
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
329
|
-
* @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.
|
|
330
|
-
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
331
|
-
* @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
|
|
332
|
-
*
|
|
333
|
-
* @remarks The listener function (cannot be async) will receive three parameters:
|
|
334
|
-
* - `newValue`: The new value of the attribute.
|
|
335
|
-
* - `oldValue`: The old value of the attribute.
|
|
336
|
-
* - `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.
|
|
337
|
-
*/
|
|
338
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
339
195
|
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
340
196
|
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
341
197
|
}
|
|
342
|
-
/**
|
|
343
|
-
* Triggers an event on the specified cluster.
|
|
344
|
-
*
|
|
345
|
-
* @param {ClusterId} cluster - The ID of the cluster.
|
|
346
|
-
* @param {string} event - The name of the event to trigger.
|
|
347
|
-
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
348
|
-
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
349
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
350
|
-
*/
|
|
351
198
|
async triggerEvent(cluster, event, payload, log) {
|
|
352
199
|
return await triggerEvent(this, cluster, event, payload, log);
|
|
353
200
|
}
|
|
354
|
-
/**
|
|
355
|
-
* Adds cluster servers from the provided server list.
|
|
356
|
-
*
|
|
357
|
-
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
358
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
359
|
-
*/
|
|
360
201
|
addClusterServers(serverList) {
|
|
361
202
|
addClusterServers(this, serverList);
|
|
362
203
|
return this;
|
|
363
204
|
}
|
|
364
|
-
/**
|
|
365
|
-
* Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
|
|
366
|
-
*
|
|
367
|
-
* @param {string} label - The label to add.
|
|
368
|
-
* @param {string} value - The value of the label.
|
|
369
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
370
|
-
*/
|
|
371
205
|
async addFixedLabel(label, value) {
|
|
372
206
|
await addFixedLabel(this, label, value);
|
|
373
207
|
return this;
|
|
374
208
|
}
|
|
375
|
-
/**
|
|
376
|
-
* Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
|
|
377
|
-
*
|
|
378
|
-
* @param {string} label - The label to add.
|
|
379
|
-
* @param {string} value - The value of the label.
|
|
380
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
381
|
-
*/
|
|
382
209
|
async addUserLabel(label, value) {
|
|
383
210
|
await addUserLabel(this, label, value);
|
|
384
211
|
return this;
|
|
385
212
|
}
|
|
386
|
-
/**
|
|
387
|
-
* Adds a command handler for the specified command.
|
|
388
|
-
*
|
|
389
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
390
|
-
* @param {CommandHandlerFunction} handler - The handler function to execute when the command is received.
|
|
391
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
392
|
-
*
|
|
393
|
-
* @remarks
|
|
394
|
-
* The handler function will receive an object with the following properties:
|
|
395
|
-
* - `request`: The request object sent with the command.
|
|
396
|
-
* - `cluster`: The id of the cluster that received the command (i.e. "onOff").
|
|
397
|
-
* - `attributes`: The current attributes of the cluster that received the command (i.e. { onOff: true}).
|
|
398
|
-
* - `endpoint`: The MatterbridgeEndpoint instance that received the command.
|
|
399
|
-
*/
|
|
400
213
|
addCommandHandler(command, handler) {
|
|
401
214
|
this.commandHandler.addHandler(command, handler);
|
|
402
215
|
return this;
|
|
403
216
|
}
|
|
404
|
-
/**
|
|
405
|
-
* Execute the command handler for the specified command. Used ONLY in Jest tests.
|
|
406
|
-
*
|
|
407
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
|
|
408
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} [request] - The optional request to pass to the handler function.
|
|
409
|
-
* @param {string} [cluster] - The optional cluster to pass to the handler function.
|
|
410
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} [attributes] - The optional attributes to pass to the handler function.
|
|
411
|
-
* @param {MatterbridgeEndpoint} [endpoint] - The optional MatterbridgeEndpoint instance to pass to the handler function
|
|
412
|
-
*
|
|
413
|
-
* @deprecated Used ONLY in Jest tests.
|
|
414
|
-
*/
|
|
415
217
|
async executeCommandHandler(command, request, cluster, attributes, endpoint) {
|
|
416
218
|
await this.commandHandler.executeHandler(command, { request, cluster, attributes, endpoint });
|
|
417
219
|
}
|
|
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
220
|
async invokeBehaviorCommand(cluster, command, params) {
|
|
428
221
|
await invokeBehaviorCommand(this, cluster, command, params);
|
|
429
222
|
}
|
|
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
223
|
addRequiredClusterServers() {
|
|
436
224
|
addRequiredClusterServers(this);
|
|
437
225
|
return this;
|
|
438
226
|
}
|
|
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
227
|
addOptionalClusterServers() {
|
|
445
228
|
addOptionalClusterServers(this);
|
|
446
229
|
return this;
|
|
447
230
|
}
|
|
448
|
-
/**
|
|
449
|
-
* Retrieves all cluster servers.
|
|
450
|
-
*
|
|
451
|
-
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
452
|
-
*/
|
|
453
231
|
getAllClusterServers() {
|
|
454
232
|
return Object.values(this.behaviors.supported);
|
|
455
233
|
}
|
|
456
|
-
/**
|
|
457
|
-
* Retrieves the names of all cluster servers.
|
|
458
|
-
*
|
|
459
|
-
* @returns {string[]} An array of all cluster server names.
|
|
460
|
-
*/
|
|
461
234
|
getAllClusterServerNames() {
|
|
462
235
|
return Object.keys(this.behaviors.supported);
|
|
463
236
|
}
|
|
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
237
|
forEachAttribute(callback) {
|
|
470
238
|
if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
|
|
471
239
|
return;
|
|
472
240
|
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
241
|
if (!isNaN(Number(clusterName)))
|
|
475
242
|
continue;
|
|
476
243
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
477
|
-
// Skip if the behavior has no associated cluster (i.e. matterbridge server)
|
|
478
244
|
const clusterId = getClusterId(this, clusterName);
|
|
479
245
|
if (clusterId === undefined) {
|
|
480
|
-
// this.log.debug(`***forEachAttribute: cluster ${clusterName} not found`);
|
|
481
246
|
continue;
|
|
482
247
|
}
|
|
483
|
-
// Skip if the attribute is not present in the ClusterBehavior.Type. Also skip if the attribute it is an internal state.
|
|
484
248
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
485
249
|
if (attributeId === undefined) {
|
|
486
|
-
// this.log.debug(`***forEachAttribute: attribute ${clusterName}.${attributeName} not found`);
|
|
487
250
|
continue;
|
|
488
251
|
}
|
|
489
252
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
490
253
|
}
|
|
491
254
|
}
|
|
492
255
|
}
|
|
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
256
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
510
257
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
511
258
|
let alreadyAdded = false;
|
|
@@ -545,23 +292,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
545
292
|
}
|
|
546
293
|
return child;
|
|
547
294
|
}
|
|
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
295
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
566
296
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
567
297
|
let alreadyAdded = false;
|
|
@@ -624,39 +354,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
624
354
|
}
|
|
625
355
|
return child;
|
|
626
356
|
}
|
|
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
357
|
getChildEndpointByName(endpointName) {
|
|
634
358
|
return this.parts.find((part) => part.id === endpointName);
|
|
635
359
|
}
|
|
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
360
|
getChildEndpoint(endpointNumber) {
|
|
643
361
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
644
362
|
}
|
|
645
|
-
/**
|
|
646
|
-
* Get all the child endpoints of this endpoint.
|
|
647
|
-
*
|
|
648
|
-
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
649
|
-
*/
|
|
650
363
|
getChildEndpoints() {
|
|
651
364
|
return Array.from(this.parts);
|
|
652
365
|
}
|
|
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
366
|
static serialize(device) {
|
|
661
367
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId)
|
|
662
368
|
return;
|
|
@@ -679,16 +385,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
679
385
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
680
386
|
if (behaviorName === 'powerSource')
|
|
681
387
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
682
|
-
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
683
388
|
});
|
|
684
389
|
return serialized;
|
|
685
390
|
}
|
|
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
391
|
static deserialize(serializedDevice) {
|
|
693
392
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
|
|
694
393
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -704,122 +403,55 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
704
403
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
705
404
|
else if (clusterId === PowerSource.Cluster.id)
|
|
706
405
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
707
|
-
// else addClusterServerFromList(device, [clusterId]);
|
|
708
406
|
}
|
|
709
407
|
return device;
|
|
710
408
|
}
|
|
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
|
-
* @remarks
|
|
718
|
-
* - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
|
|
719
|
-
* - description: The description of the power source is a fixed attribute that describes the power source type.
|
|
720
|
-
* - wiredCurrentType: The type of wired current is a fixed attribute that indicates the type of wired current used by the power source (AC or DC).
|
|
721
|
-
*/
|
|
722
409
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
723
410
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
|
|
724
|
-
// Base attributes
|
|
725
411
|
status: PowerSource.PowerSourceStatus.Active,
|
|
726
412
|
order: 0,
|
|
727
413
|
description: wiredCurrentType === PowerSource.WiredCurrentType.Ac ? 'AC Power' : 'DC Power',
|
|
728
414
|
endpointList: [],
|
|
729
|
-
// Wired feature attributes
|
|
730
415
|
wiredCurrentType,
|
|
731
416
|
});
|
|
732
417
|
return this;
|
|
733
418
|
}
|
|
734
|
-
/**
|
|
735
|
-
* Creates a default power source replaceable battery cluster server.
|
|
736
|
-
*
|
|
737
|
-
* @param {number} batPercentRemaining - The remaining battery percentage (default: 100).
|
|
738
|
-
* @param {PowerSource.BatChargeLevel} batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
739
|
-
* @param {number} batVoltage - The battery voltage (default: 1500).
|
|
740
|
-
* @param {string} batReplacementDescription - The description of the battery replacement (default: 'Battery type').
|
|
741
|
-
* @param {number} batQuantity - The quantity of the battery (default: 1).
|
|
742
|
-
* @param {PowerSource.BatReplaceability} batReplaceability - The replaceability of the battery (default: PowerSource.BatReplaceability.Unspecified).
|
|
743
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
744
|
-
*
|
|
745
|
-
* @remarks
|
|
746
|
-
* - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
|
|
747
|
-
* - description: The description of the power source is a fixed attribute that describes the power source type.
|
|
748
|
-
* - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
|
|
749
|
-
* - batReplacementDescription: The description of the battery replacement is a fixed attribute that describes the battery type.
|
|
750
|
-
* - batQuantity: The quantity of the battery is a fixed attribute that indicates how many batteries are present in the device.
|
|
751
|
-
*/
|
|
752
419
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1, batReplaceability = PowerSource.BatReplaceability.UserReplaceable) {
|
|
753
420
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
754
|
-
// Base attributes
|
|
755
421
|
status: PowerSource.PowerSourceStatus.Active,
|
|
756
422
|
order: 0,
|
|
757
423
|
description: 'Primary battery',
|
|
758
424
|
endpointList: [],
|
|
759
|
-
// Battery feature attributes
|
|
760
425
|
batVoltage,
|
|
761
426
|
batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
|
|
762
427
|
batChargeLevel,
|
|
763
428
|
batReplacementNeeded: false,
|
|
764
429
|
batReplaceability,
|
|
765
430
|
activeBatFaults: undefined,
|
|
766
|
-
// Replaceable feature attributes
|
|
767
431
|
batReplacementDescription,
|
|
768
432
|
batQuantity,
|
|
769
433
|
});
|
|
770
434
|
return this;
|
|
771
435
|
}
|
|
772
|
-
/**
|
|
773
|
-
* Creates a default power source rechargeable battery cluster server.
|
|
774
|
-
*
|
|
775
|
-
* @param {number} [batPercentRemaining] - The remaining battery percentage (default: 100).
|
|
776
|
-
* @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
777
|
-
* @param {number} [batVoltage] - The battery voltage in mV (default: 1500).
|
|
778
|
-
* @param {PowerSource.BatReplaceability} [batReplaceability] - The replaceability of the battery (default: PowerSource.BatReplaceability.Unspecified).
|
|
779
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
780
|
-
*
|
|
781
|
-
* @remarks
|
|
782
|
-
* - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
|
|
783
|
-
* - description: The description of the power source is a fixed attribute that describes the power source type.
|
|
784
|
-
* - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
|
|
785
|
-
*/
|
|
786
436
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplaceability = PowerSource.BatReplaceability.Unspecified) {
|
|
787
437
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
788
|
-
// Base attributes
|
|
789
438
|
status: PowerSource.PowerSourceStatus.Active,
|
|
790
439
|
order: 0,
|
|
791
440
|
description: 'Primary battery',
|
|
792
441
|
endpointList: [],
|
|
793
|
-
// Battery feature attributes
|
|
794
442
|
batVoltage,
|
|
795
443
|
batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
|
|
796
|
-
batTimeRemaining: null,
|
|
444
|
+
batTimeRemaining: null,
|
|
797
445
|
batChargeLevel,
|
|
798
446
|
batReplacementNeeded: false,
|
|
799
447
|
batReplaceability,
|
|
800
448
|
batPresent: true,
|
|
801
449
|
activeBatFaults: [],
|
|
802
|
-
// Rechargeable feature attributes
|
|
803
450
|
batChargeState: PowerSource.BatChargeState.IsNotCharging,
|
|
804
451
|
batFunctionalWhileCharging: true,
|
|
805
452
|
});
|
|
806
453
|
return this;
|
|
807
454
|
}
|
|
808
|
-
/**
|
|
809
|
-
* Setup the default Basic Information Cluster Server attributes for the server node.
|
|
810
|
-
*
|
|
811
|
-
* @param {string} deviceName - The name of the device.
|
|
812
|
-
* @param {string} serialNumber - The serial number of the device.
|
|
813
|
-
* @param {number} [vendorId] - The vendor ID of the device. Default is 0xfff1 (Matter Test VendorId).
|
|
814
|
-
* @param {string} [vendorName] - The name of the vendor. Default is 'Matterbridge'.
|
|
815
|
-
* @param {number} [productId] - The product ID of the device. Default is 0x8000 (Matter Test ProductId).
|
|
816
|
-
* @param {string} [productName] - The name of the product. Default is 'Matterbridge device'.
|
|
817
|
-
* @param {number} [softwareVersion] - The software version of the device. Default is 1.
|
|
818
|
-
* @param {string} [softwareVersionString] - The software version string of the device. Default is '1.0.0'.
|
|
819
|
-
* @param {number} [hardwareVersion] - The hardware version of the device. Default is 1.
|
|
820
|
-
* @param {string} [hardwareVersionString] - The hardware version string of the device. Default is '1.0.0'.
|
|
821
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
822
|
-
*/
|
|
823
455
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productId = 0x8000, productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
824
456
|
this.log.logName = deviceName;
|
|
825
457
|
this.deviceName = deviceName;
|
|
@@ -843,22 +475,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
843
475
|
}
|
|
844
476
|
return this;
|
|
845
477
|
}
|
|
846
|
-
/**
|
|
847
|
-
* Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
|
|
848
|
-
*
|
|
849
|
-
* @param {string} deviceName - The name of the device.
|
|
850
|
-
* @param {string} serialNumber - The serial number of the device.
|
|
851
|
-
* @param {number} [vendorId] - The vendor ID of the device. Default is 0xfff1 (Matter Test VendorId).
|
|
852
|
-
* @param {string} [vendorName] - The name of the vendor. Default is 'Matterbridge'.
|
|
853
|
-
* @param {string} [productName] - The name of the product. Default is 'Matterbridge device'.
|
|
854
|
-
* @param {number} [softwareVersion] - The software version of the device. Default is 1.
|
|
855
|
-
* @param {string} [softwareVersionString] - The software version string of the device. Default is '1.0.0'.
|
|
856
|
-
* @param {number} [hardwareVersion] - The hardware version of the device. Default is 1.
|
|
857
|
-
* @param {string} [hardwareVersionString] - The hardware version string of the device. Default is '1.0.0'.
|
|
858
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
859
|
-
*
|
|
860
|
-
* @remarks The bridgedNode device type must be added to the deviceTypeList of the Descriptor cluster.
|
|
861
|
-
*/
|
|
862
478
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
863
479
|
this.log.logName = deviceName;
|
|
864
480
|
this.deviceName = deviceName;
|
|
@@ -891,13 +507,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
891
507
|
});
|
|
892
508
|
return this;
|
|
893
509
|
}
|
|
894
|
-
/**
|
|
895
|
-
* Creates a default identify cluster server with the specified identify time and type.
|
|
896
|
-
*
|
|
897
|
-
* @param {number} [identifyTime] - The time to identify the server. Defaults to 0.
|
|
898
|
-
* @param {Identify.IdentifyType} [identifyType] - The type of identification. Defaults to Identify.IdentifyType.None.
|
|
899
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
900
|
-
*/
|
|
901
510
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
902
511
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
903
512
|
identifyTime,
|
|
@@ -905,36 +514,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
905
514
|
});
|
|
906
515
|
return this;
|
|
907
516
|
}
|
|
908
|
-
/**
|
|
909
|
-
* Creates a default groups cluster server.
|
|
910
|
-
*
|
|
911
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
912
|
-
*/
|
|
913
517
|
createDefaultGroupsClusterServer() {
|
|
914
518
|
this.behaviors.require(GroupsServer);
|
|
915
519
|
return this;
|
|
916
520
|
}
|
|
917
|
-
/**
|
|
918
|
-
* Creates a default scenes management cluster server.
|
|
919
|
-
*
|
|
920
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
921
|
-
*
|
|
922
|
-
* @remarks The scenes management cluster server is still provisional and so not yet implemented.
|
|
923
|
-
*/
|
|
924
521
|
createDefaultScenesClusterServer() {
|
|
925
522
|
this.behaviors.require(ScenesManagementServer);
|
|
926
523
|
return this;
|
|
927
524
|
}
|
|
928
|
-
/**
|
|
929
|
-
* Creates a default OnOff cluster server for light devices with feature Lighting.
|
|
930
|
-
*
|
|
931
|
-
* @param {boolean} [onOff] - The initial state of the OnOff cluster.
|
|
932
|
-
* @param {boolean} [globalSceneControl] - The global scene control state.
|
|
933
|
-
* @param {number} [onTime] - The on time value.
|
|
934
|
-
* @param {number} [offWaitTime] - The off wait time value.
|
|
935
|
-
* @param {OnOff.StartUpOnOff | null} [startUpOnOff] - The start-up OnOff state. Null means previous state.
|
|
936
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
937
|
-
*/
|
|
938
525
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
939
526
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
940
527
|
onOff,
|
|
@@ -945,52 +532,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
945
532
|
});
|
|
946
533
|
return this;
|
|
947
534
|
}
|
|
948
|
-
/**
|
|
949
|
-
* Creates an OnOff cluster server without features.
|
|
950
|
-
*
|
|
951
|
-
* @param {boolean} [onOff] - The initial state of the OnOff cluster.
|
|
952
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
953
|
-
*/
|
|
954
535
|
createOnOffClusterServer(onOff = false) {
|
|
955
536
|
this.behaviors.require(MatterbridgeOnOffServer, {
|
|
956
537
|
onOff,
|
|
957
538
|
});
|
|
958
539
|
return this;
|
|
959
540
|
}
|
|
960
|
-
/**
|
|
961
|
-
* Creates a DeadFront OnOff cluster server with feature DeadFrontBehavior.
|
|
962
|
-
*
|
|
963
|
-
* @param {boolean} [onOff] - The initial state of the OnOff cluster.
|
|
964
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
965
|
-
*/
|
|
966
541
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
967
542
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
968
543
|
onOff,
|
|
969
544
|
});
|
|
970
545
|
return this;
|
|
971
546
|
}
|
|
972
|
-
/**
|
|
973
|
-
* Creates an OffOnly OnOff cluster server with feature OffOnly.
|
|
974
|
-
*
|
|
975
|
-
* @param {boolean} [onOff] - The initial state of the OnOff cluster.
|
|
976
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
977
|
-
*/
|
|
978
547
|
createOffOnlyOnOffClusterServer(onOff = false) {
|
|
979
548
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
|
|
980
549
|
onOff,
|
|
981
550
|
});
|
|
982
551
|
return this;
|
|
983
552
|
}
|
|
984
|
-
/**
|
|
985
|
-
* Creates a default level control cluster server for light devices with feature OnOff and Lighting.
|
|
986
|
-
*
|
|
987
|
-
* @param {number} [currentLevel] - The current level (default: 254).
|
|
988
|
-
* @param {number} [minLevel] - The minimum level (default: 1).
|
|
989
|
-
* @param {number} [maxLevel] - The maximum level (default: 254).
|
|
990
|
-
* @param {number | null} [onLevel] - The on level (default: null).
|
|
991
|
-
* @param {number | null} [startUpCurrentLevel] - The startUp on level (default: null).
|
|
992
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
993
|
-
*/
|
|
994
553
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
995
554
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
996
555
|
currentLevel,
|
|
@@ -1006,13 +565,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1006
565
|
});
|
|
1007
566
|
return this;
|
|
1008
567
|
}
|
|
1009
|
-
/**
|
|
1010
|
-
* Creates a level control cluster server without features.
|
|
1011
|
-
*
|
|
1012
|
-
* @param {number} [currentLevel] - The current level (default: 254).
|
|
1013
|
-
* @param {number | null} [onLevel] - The on level (default: null).
|
|
1014
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1015
|
-
*/
|
|
1016
568
|
createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
|
|
1017
569
|
this.behaviors.require(MatterbridgeLevelControlServer, {
|
|
1018
570
|
currentLevel,
|
|
@@ -1024,25 +576,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1024
576
|
});
|
|
1025
577
|
return this;
|
|
1026
578
|
}
|
|
1027
|
-
/**
|
|
1028
|
-
* Creates a default color control cluster server with features Xy, HueSaturation and ColorTemperature.
|
|
1029
|
-
*
|
|
1030
|
-
* @param {number} currentX - The current X value (range 0-65279).
|
|
1031
|
-
* @param {number} currentY - The current Y value (range 0-65279).
|
|
1032
|
-
* @param {number} currentHue - The current hue value (range: 0-254).
|
|
1033
|
-
* @param {number} currentSaturation - The current saturation value (range: 0-254).
|
|
1034
|
-
* @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
|
|
1035
|
-
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
|
|
1036
|
-
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
|
|
1037
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1038
|
-
*
|
|
1039
|
-
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1040
|
-
* @remarks currentHue and currentSaturation persist across restarts.
|
|
1041
|
-
* @remarks currentX and currentY persist across restarts.
|
|
1042
|
-
* @remarks colorTemperatureMireds persists across restarts.
|
|
1043
|
-
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1044
|
-
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1045
|
-
*/
|
|
1046
579
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1047
580
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1048
581
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1065,25 +598,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1065
598
|
});
|
|
1066
599
|
return this;
|
|
1067
600
|
}
|
|
1068
|
-
/**
|
|
1069
|
-
* Creates a Xy color control cluster server with feature Xy and ColorTemperature.
|
|
1070
|
-
*
|
|
1071
|
-
* @param {number} currentX - The current X value (range 0-65279).
|
|
1072
|
-
* @param {number} currentY - The current Y value (range 0-65279).
|
|
1073
|
-
* @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
|
|
1074
|
-
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
|
|
1075
|
-
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
|
|
1076
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1077
|
-
*
|
|
1078
|
-
* @remarks
|
|
1079
|
-
* From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
|
|
1080
|
-
*
|
|
1081
|
-
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1082
|
-
* @remarks currentX and currentY persist across restarts.
|
|
1083
|
-
* @remarks colorTemperatureMireds persists across restarts.
|
|
1084
|
-
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1085
|
-
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1086
|
-
*/
|
|
1087
601
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1088
602
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
1089
603
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -1104,22 +618,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1104
618
|
});
|
|
1105
619
|
return this;
|
|
1106
620
|
}
|
|
1107
|
-
/**
|
|
1108
|
-
* Creates a default hue and saturation control cluster server with feature HueSaturation and ColorTemperature.
|
|
1109
|
-
*
|
|
1110
|
-
* @param {number} currentHue - The current hue value (range: 0-254).
|
|
1111
|
-
* @param {number} currentSaturation - The current saturation value (range: 0-254).
|
|
1112
|
-
* @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
|
|
1113
|
-
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
|
|
1114
|
-
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
|
|
1115
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1116
|
-
*
|
|
1117
|
-
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1118
|
-
* @remarks currentHue and currentSaturation persist across restarts.
|
|
1119
|
-
* @remarks colorTemperatureMireds persists across restarts.
|
|
1120
|
-
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1121
|
-
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1122
|
-
*/
|
|
1123
621
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1124
622
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1125
623
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1140,20 +638,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1140
638
|
});
|
|
1141
639
|
return this;
|
|
1142
640
|
}
|
|
1143
|
-
/**
|
|
1144
|
-
* Creates a color temperature color control cluster server with feature ColorTemperature.
|
|
1145
|
-
* This cluster server is used for devices that only support color temperature control.
|
|
1146
|
-
*
|
|
1147
|
-
* @param {number} colorTemperatureMireds - The color temperature in mireds (default range 147-500).
|
|
1148
|
-
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default range 147).
|
|
1149
|
-
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default range 500).
|
|
1150
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1151
|
-
*
|
|
1152
|
-
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1153
|
-
* @remarks colorTemperatureMireds persists across restarts.
|
|
1154
|
-
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1155
|
-
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1156
|
-
*/
|
|
1157
641
|
createCtColorControlClusterServer(colorTemperatureMireds = 250, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1158
642
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
1159
643
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1172,34 +656,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1172
656
|
});
|
|
1173
657
|
return this;
|
|
1174
658
|
}
|
|
1175
|
-
/**
|
|
1176
|
-
* Configures the color control mode for the device.
|
|
1177
|
-
*
|
|
1178
|
-
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1179
|
-
*
|
|
1180
|
-
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1181
|
-
*/
|
|
1182
659
|
async configureColorControlMode(colorMode) {
|
|
1183
660
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
1184
661
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
1185
662
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
1186
663
|
}
|
|
1187
664
|
}
|
|
1188
|
-
/**
|
|
1189
|
-
* Creates a default window covering cluster server with feature Lift and PositionAwareLift.
|
|
1190
|
-
*
|
|
1191
|
-
* @param {number} positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1192
|
-
* @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.Rollershade). Must support feature Lift.
|
|
1193
|
-
* @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.RollerShade). Must support feature Lift.
|
|
1194
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1195
|
-
*
|
|
1196
|
-
* @remarks mode attributes is writable and persists across restarts.
|
|
1197
|
-
* currentPositionLiftPercent100ths persists across restarts.
|
|
1198
|
-
* configStatus attributes persists across restarts.
|
|
1199
|
-
*/
|
|
1200
665
|
createDefaultWindowCoveringClusterServer(positionPercent100ths, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade) {
|
|
1201
666
|
this.behaviors.require(MatterbridgeLiftWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1202
|
-
type,
|
|
667
|
+
type,
|
|
1203
668
|
numberOfActuationsLift: 0,
|
|
1204
669
|
configStatus: {
|
|
1205
670
|
operational: true,
|
|
@@ -1207,33 +672,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1207
672
|
liftMovementReversed: false,
|
|
1208
673
|
liftPositionAware: true,
|
|
1209
674
|
tiltPositionAware: false,
|
|
1210
|
-
liftEncoderControlled: false,
|
|
1211
|
-
tiltEncoderControlled: false,
|
|
675
|
+
liftEncoderControlled: false,
|
|
676
|
+
tiltEncoderControlled: false,
|
|
1212
677
|
},
|
|
1213
678
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1214
|
-
endProductType,
|
|
679
|
+
endProductType,
|
|
1215
680
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1216
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1217
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
681
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
682
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1218
683
|
});
|
|
1219
684
|
return this;
|
|
1220
685
|
}
|
|
1221
|
-
/**
|
|
1222
|
-
* Creates a default window covering cluster server with features Lift, PositionAwareLift, Tilt, PositionAwareTilt.
|
|
1223
|
-
*
|
|
1224
|
-
* @param {number} positionLiftPercent100ths - The lift position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1225
|
-
* @param {number} positionTiltPercent100ths - The tilt position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1226
|
-
* @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.TiltBlindLift). Must support features Lift and Tilt.
|
|
1227
|
-
* @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.InteriorBlind). Must support features Lift and Tilt.
|
|
1228
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1229
|
-
*
|
|
1230
|
-
* @remarks mode attributes is writable and persists across restarts.
|
|
1231
|
-
* currentPositionTiltPercent100ths persists across restarts.
|
|
1232
|
-
* configStatus attributes persists across restarts.
|
|
1233
|
-
*/
|
|
1234
686
|
createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind) {
|
|
1235
687
|
this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt), {
|
|
1236
|
-
type,
|
|
688
|
+
type,
|
|
1237
689
|
numberOfActuationsLift: 0,
|
|
1238
690
|
numberOfActuationsTilt: 0,
|
|
1239
691
|
configStatus: {
|
|
@@ -1242,23 +694,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1242
694
|
liftMovementReversed: false,
|
|
1243
695
|
liftPositionAware: true,
|
|
1244
696
|
tiltPositionAware: true,
|
|
1245
|
-
liftEncoderControlled: false,
|
|
1246
|
-
tiltEncoderControlled: false,
|
|
697
|
+
liftEncoderControlled: false,
|
|
698
|
+
tiltEncoderControlled: false,
|
|
1247
699
|
},
|
|
1248
700
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1249
|
-
endProductType,
|
|
701
|
+
endProductType,
|
|
1250
702
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1251
|
-
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
1252
|
-
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
1253
|
-
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
1254
|
-
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
703
|
+
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
704
|
+
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
705
|
+
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
706
|
+
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
1255
707
|
});
|
|
1256
708
|
return this;
|
|
1257
709
|
}
|
|
1258
|
-
/**
|
|
1259
|
-
* Sets the window covering lift target position as the current position and stops the movement.
|
|
1260
|
-
*
|
|
1261
|
-
*/
|
|
1262
710
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
1263
711
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
1264
712
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -1278,13 +726,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1278
726
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1279
727
|
}
|
|
1280
728
|
}
|
|
1281
|
-
/**
|
|
1282
|
-
* Sets the lift current and target position and the status of a window covering.
|
|
1283
|
-
*
|
|
1284
|
-
* @param {number} current - The current position of the window covering.
|
|
1285
|
-
* @param {number} target - The target position of the window covering.
|
|
1286
|
-
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1287
|
-
*/
|
|
1288
729
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
1289
730
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
1290
731
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -1295,11 +736,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1295
736
|
}, this.log);
|
|
1296
737
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1297
738
|
}
|
|
1298
|
-
/**
|
|
1299
|
-
* Sets the status of the window covering.
|
|
1300
|
-
*
|
|
1301
|
-
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1302
|
-
*/
|
|
1303
739
|
async setWindowCoveringStatus(status) {
|
|
1304
740
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
1305
741
|
global: status,
|
|
@@ -1308,11 +744,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1308
744
|
}, this.log);
|
|
1309
745
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1310
746
|
}
|
|
1311
|
-
/**
|
|
1312
|
-
* Retrieves the status of the window covering.
|
|
1313
|
-
*
|
|
1314
|
-
* @returns {WindowCovering.MovementStatus | undefined} The movement status of the window covering, or undefined if not available.
|
|
1315
|
-
*/
|
|
1316
747
|
getWindowCoveringStatus() {
|
|
1317
748
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
1318
749
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -1320,12 +751,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1320
751
|
return status.global;
|
|
1321
752
|
}
|
|
1322
753
|
}
|
|
1323
|
-
/**
|
|
1324
|
-
* Sets the lift target and current position of the window covering.
|
|
1325
|
-
*
|
|
1326
|
-
* @param {number} liftPosition - The position to set, specified as a number.
|
|
1327
|
-
* @param {number} [tiltPosition] - The tilt position to set, specified as a number.
|
|
1328
|
-
*/
|
|
1329
754
|
async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
|
|
1330
755
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', liftPosition, this.log);
|
|
1331
756
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', liftPosition, this.log);
|
|
@@ -1336,57 +761,31 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1336
761
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
|
|
1337
762
|
}
|
|
1338
763
|
}
|
|
1339
|
-
/**
|
|
1340
|
-
* Creates a default thermostat cluster server with features Heating, Cooling and AutoMode.
|
|
1341
|
-
*
|
|
1342
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1343
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1344
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1345
|
-
* @param {number} [minSetpointDeadBand] - The minimum setpoint dead band value. Defaults to 1°.
|
|
1346
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1347
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1348
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1349
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1350
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1351
|
-
*/
|
|
1352
764
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1353
765
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1354
766
|
localTemperature: localTemperature * 100,
|
|
1355
767
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1356
768
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1357
|
-
// Thermostat.Feature.Heating
|
|
1358
769
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1359
770
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1360
771
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1361
772
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1362
773
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1363
|
-
// Thermostat.Feature.Cooling
|
|
1364
774
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1365
775
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1366
776
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1367
777
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1368
778
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1369
|
-
// Thermostat.Feature.AutoMode
|
|
1370
779
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1371
780
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1372
781
|
});
|
|
1373
782
|
return this;
|
|
1374
783
|
}
|
|
1375
|
-
/**
|
|
1376
|
-
* Creates a default heating thermostat cluster server with feature Heating.
|
|
1377
|
-
*
|
|
1378
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1379
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1380
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1381
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1382
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1383
|
-
*/
|
|
1384
784
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1385
785
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
|
|
1386
786
|
localTemperature: localTemperature * 100,
|
|
1387
787
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1388
788
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1389
|
-
// Thermostat.Feature.Heating
|
|
1390
789
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1391
790
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1392
791
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -1395,21 +794,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1395
794
|
});
|
|
1396
795
|
return this;
|
|
1397
796
|
}
|
|
1398
|
-
/**
|
|
1399
|
-
* Creates a default cooling thermostat cluster server with feature Cooling.
|
|
1400
|
-
*
|
|
1401
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1402
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1403
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1404
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1405
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1406
|
-
*/
|
|
1407
797
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1408
798
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
|
|
1409
799
|
localTemperature: localTemperature * 100,
|
|
1410
800
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1411
801
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1412
|
-
// Thermostat.Feature.Cooling
|
|
1413
802
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1414
803
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1415
804
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -1418,16 +807,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1418
807
|
});
|
|
1419
808
|
return this;
|
|
1420
809
|
}
|
|
1421
|
-
/**
|
|
1422
|
-
* Creates a default thermostat user interface configuration cluster server.
|
|
1423
|
-
*
|
|
1424
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1425
|
-
* @remarks
|
|
1426
|
-
* The default values are:
|
|
1427
|
-
* - temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius (writeble).
|
|
1428
|
-
* - keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout (writeble).
|
|
1429
|
-
* - scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted (writeble).
|
|
1430
|
-
*/
|
|
1431
810
|
createDefaultThermostatUserInterfaceConfigurationClusterServer() {
|
|
1432
811
|
this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
|
|
1433
812
|
temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
|
|
@@ -1436,159 +815,69 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1436
815
|
});
|
|
1437
816
|
return this;
|
|
1438
817
|
}
|
|
1439
|
-
/**
|
|
1440
|
-
* Creates a default fan control cluster server with features Auto, and Step.
|
|
1441
|
-
*
|
|
1442
|
-
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1443
|
-
* @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
|
|
1444
|
-
* @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
|
|
1445
|
-
* @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
|
|
1446
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1447
|
-
*
|
|
1448
|
-
* @remarks
|
|
1449
|
-
* - fanmode is writable and persists across reboots.
|
|
1450
|
-
* - fanModeSequence is fixed.
|
|
1451
|
-
* - percentSetting is writable.
|
|
1452
|
-
*/
|
|
1453
818
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0) {
|
|
1454
819
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1455
|
-
fanMode,
|
|
1456
|
-
fanModeSequence,
|
|
1457
|
-
percentSetting,
|
|
820
|
+
fanMode,
|
|
821
|
+
fanModeSequence,
|
|
822
|
+
percentSetting,
|
|
1458
823
|
percentCurrent,
|
|
1459
824
|
});
|
|
1460
825
|
return this;
|
|
1461
826
|
}
|
|
1462
|
-
/**
|
|
1463
|
-
* Creates a fan control cluster server with features MultiSpeed, Auto, and Step.
|
|
1464
|
-
*
|
|
1465
|
-
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1466
|
-
* @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
|
|
1467
|
-
* @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
|
|
1468
|
-
* @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
|
|
1469
|
-
* @param {number} [speedMax] - The maximum speed setting. Defaults to 10.
|
|
1470
|
-
* @param {number} [speedSetting] - The initial speed setting. Defaults to 0.
|
|
1471
|
-
* @param {number} [speedCurrent] - The initial speed current. Defaults to 0.
|
|
1472
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1473
|
-
*
|
|
1474
|
-
* @remarks
|
|
1475
|
-
* - fanmode is writable and persists across reboots.
|
|
1476
|
-
* - fanModeSequence is fixed.
|
|
1477
|
-
* - percentSetting is writable.
|
|
1478
|
-
* - speedMax is fixed.
|
|
1479
|
-
* - speedSetting is writable.
|
|
1480
|
-
*/
|
|
1481
827
|
createMultiSpeedFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0, speedMax = 10, speedSetting = 0, speedCurrent = 0) {
|
|
1482
828
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1483
|
-
fanMode,
|
|
1484
|
-
fanModeSequence,
|
|
1485
|
-
percentSetting,
|
|
829
|
+
fanMode,
|
|
830
|
+
fanModeSequence,
|
|
831
|
+
percentSetting,
|
|
1486
832
|
percentCurrent,
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
speedSetting, // Writable attribute
|
|
833
|
+
speedMax,
|
|
834
|
+
speedSetting,
|
|
1490
835
|
speedCurrent,
|
|
1491
836
|
});
|
|
1492
837
|
return this;
|
|
1493
838
|
}
|
|
1494
|
-
/**
|
|
1495
|
-
* Creates a base fan control cluster server without features.
|
|
1496
|
-
*
|
|
1497
|
-
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1498
|
-
* @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHigh`.
|
|
1499
|
-
* @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
|
|
1500
|
-
* @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
|
|
1501
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1502
|
-
*
|
|
1503
|
-
* @remarks
|
|
1504
|
-
* fanmode is writable and persists across reboots.
|
|
1505
|
-
* fanModeSequence is fixed.
|
|
1506
|
-
* percentSetting is writable.
|
|
1507
|
-
*/
|
|
1508
839
|
createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHigh, percentSetting = 0, percentCurrent = 0) {
|
|
1509
840
|
this.behaviors.require(FanControlServer, {
|
|
1510
|
-
fanMode,
|
|
1511
|
-
fanModeSequence,
|
|
1512
|
-
percentSetting,
|
|
841
|
+
fanMode,
|
|
842
|
+
fanModeSequence,
|
|
843
|
+
percentSetting,
|
|
1513
844
|
percentCurrent,
|
|
1514
845
|
});
|
|
1515
846
|
return this;
|
|
1516
847
|
}
|
|
1517
|
-
/**
|
|
1518
|
-
* Creates a default HEPA Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
|
|
1519
|
-
* It supports ResourceMonitoring.Feature.Condition and ResourceMonitoring.Feature.ReplacementProductList.
|
|
1520
|
-
*
|
|
1521
|
-
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
1522
|
-
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
|
|
1523
|
-
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
|
|
1524
|
-
*
|
|
1525
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1526
|
-
*/
|
|
1527
848
|
createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
1528
849
|
this.behaviors.require(HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1529
|
-
condition: 100,
|
|
1530
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
850
|
+
condition: 100,
|
|
851
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1531
852
|
changeIndication,
|
|
1532
853
|
inPlaceIndicator,
|
|
1533
854
|
lastChangedTime,
|
|
1534
|
-
replacementProductList: [],
|
|
855
|
+
replacementProductList: [],
|
|
1535
856
|
});
|
|
1536
857
|
return this;
|
|
1537
858
|
}
|
|
1538
|
-
/**
|
|
1539
|
-
* Creates a default Activated Carbon Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
|
|
1540
|
-
*
|
|
1541
|
-
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
1542
|
-
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
|
|
1543
|
-
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
|
|
1544
|
-
*
|
|
1545
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1546
|
-
*/
|
|
1547
859
|
createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
1548
860
|
this.behaviors.require(ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1549
|
-
condition: 100,
|
|
1550
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
861
|
+
condition: 100,
|
|
862
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1551
863
|
changeIndication,
|
|
1552
864
|
inPlaceIndicator,
|
|
1553
865
|
lastChangedTime,
|
|
1554
|
-
replacementProductList: [],
|
|
866
|
+
replacementProductList: [],
|
|
1555
867
|
});
|
|
1556
868
|
return this;
|
|
1557
869
|
}
|
|
1558
|
-
/**
|
|
1559
|
-
* Creates a default door lock cluster server.
|
|
1560
|
-
*
|
|
1561
|
-
* @param {DoorLock.LockState} [lockState] - The initial state of the lock (default: Locked).
|
|
1562
|
-
* @param {DoorLock.LockType} [lockType] - The type of the lock (default: DeadBolt).
|
|
1563
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1564
|
-
*
|
|
1565
|
-
* @remarks
|
|
1566
|
-
* 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.
|
|
1567
|
-
*/
|
|
1568
870
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1569
871
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
1570
872
|
lockState,
|
|
1571
873
|
lockType,
|
|
1572
874
|
actuatorEnabled: false,
|
|
1573
875
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
1574
|
-
// Special case of inverted bitmap: add also alwaysSet = 2047
|
|
1575
876
|
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
|
|
1576
877
|
alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
|
|
1577
878
|
});
|
|
1578
879
|
return this;
|
|
1579
880
|
}
|
|
1580
|
-
/**
|
|
1581
|
-
* Creates a default Mode Select cluster server.
|
|
1582
|
-
*
|
|
1583
|
-
* @param {string} description - The description of the mode select cluster.
|
|
1584
|
-
* @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
|
|
1585
|
-
* @param {number} [currentMode] - The current mode (default: 0).
|
|
1586
|
-
* @param {number} [startUpMode] - The startup mode (default: 0).
|
|
1587
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1588
|
-
*
|
|
1589
|
-
* @remarks
|
|
1590
|
-
* endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
|
|
1591
|
-
*/
|
|
1592
881
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1593
882
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
1594
883
|
description: description,
|
|
@@ -1599,35 +888,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1599
888
|
});
|
|
1600
889
|
return this;
|
|
1601
890
|
}
|
|
1602
|
-
/**
|
|
1603
|
-
* Creates the default Valve Configuration And Control cluster server with features Level.
|
|
1604
|
-
*
|
|
1605
|
-
* @param {ValveConfigurationAndControl.ValveState} [valveState] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
1606
|
-
* @param {number} [valveLevel] - The valve level to set. Defaults to 0.
|
|
1607
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1608
|
-
*/
|
|
1609
891
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
1610
892
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
1611
893
|
currentState: valveState,
|
|
1612
894
|
targetState: valveState,
|
|
1613
895
|
openDuration: null,
|
|
1614
|
-
defaultOpenDuration: null,
|
|
896
|
+
defaultOpenDuration: null,
|
|
1615
897
|
remainingDuration: null,
|
|
1616
898
|
valveFault: { generalFault: false, blocked: false, leaking: false, notConnected: false, shortCircuit: false, currentExceeded: false },
|
|
1617
|
-
// Feature.Level
|
|
1618
899
|
currentLevel: valveLevel,
|
|
1619
900
|
targetLevel: valveLevel,
|
|
1620
|
-
defaultOpenLevel: 100,
|
|
1621
|
-
levelStep: 1,
|
|
901
|
+
defaultOpenLevel: 100,
|
|
902
|
+
levelStep: 1,
|
|
1622
903
|
});
|
|
1623
904
|
return this;
|
|
1624
905
|
}
|
|
1625
|
-
/**
|
|
1626
|
-
* Creates the default PumpConfigurationAndControl cluster server with features ConstantSpeed.
|
|
1627
|
-
*
|
|
1628
|
-
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
1629
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1630
|
-
*/
|
|
1631
906
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1632
907
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
1633
908
|
minConstSpeed: null,
|
|
@@ -1642,13 +917,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1642
917
|
});
|
|
1643
918
|
return this;
|
|
1644
919
|
}
|
|
1645
|
-
/**
|
|
1646
|
-
* Creates the default SmokeCOAlarm Cluster Server with features SmokeAlarm and CoAlarm.
|
|
1647
|
-
*
|
|
1648
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1649
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1650
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1651
|
-
*/
|
|
1652
920
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1653
921
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1654
922
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1664,12 +932,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1664
932
|
});
|
|
1665
933
|
return this;
|
|
1666
934
|
}
|
|
1667
|
-
/**
|
|
1668
|
-
* Creates a smoke only SmokeCOAlarm Cluster Server with features SmokeAlarm.
|
|
1669
|
-
*
|
|
1670
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1671
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1672
|
-
*/
|
|
1673
935
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1674
936
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
1675
937
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1684,12 +946,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1684
946
|
});
|
|
1685
947
|
return this;
|
|
1686
948
|
}
|
|
1687
|
-
/**
|
|
1688
|
-
* Creates a co only SmokeCOAlarm Cluster Server with features CoAlarm.
|
|
1689
|
-
*
|
|
1690
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1691
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1692
|
-
*/
|
|
1693
949
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1694
950
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1695
951
|
events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1704,15 +960,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1704
960
|
});
|
|
1705
961
|
return this;
|
|
1706
962
|
}
|
|
1707
|
-
/**
|
|
1708
|
-
* Creates a default momentary switch cluster server with features MomentarySwitch, MomentarySwitchRelease, MomentarySwitchLongPress and MomentarySwitchMultiPress
|
|
1709
|
-
* and events initialPress, longPress, shortRelease, longRelease, multiPressOngoing, multiPressComplete.
|
|
1710
|
-
*
|
|
1711
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1712
|
-
*
|
|
1713
|
-
* @remarks
|
|
1714
|
-
* This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
|
|
1715
|
-
*/
|
|
1716
963
|
createDefaultSwitchClusterServer() {
|
|
1717
964
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
1718
965
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -1723,14 +970,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1723
970
|
});
|
|
1724
971
|
return this;
|
|
1725
972
|
}
|
|
1726
|
-
/**
|
|
1727
|
-
* Creates a default momentary switch cluster server with feature MomentarySwitch and event initialPress.
|
|
1728
|
-
*
|
|
1729
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1730
|
-
*
|
|
1731
|
-
* @remarks
|
|
1732
|
-
* This method adds a cluster server with default momentary switch features and configuration suitable for Single press automations.
|
|
1733
|
-
*/
|
|
1734
973
|
createDefaultMomentarySwitchClusterServer() {
|
|
1735
974
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch).enable({
|
|
1736
975
|
events: { initialPress: true },
|
|
@@ -1740,14 +979,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1740
979
|
});
|
|
1741
980
|
return this;
|
|
1742
981
|
}
|
|
1743
|
-
/**
|
|
1744
|
-
* Creates a default latching switch cluster server with features LatchingSwitch.
|
|
1745
|
-
*
|
|
1746
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1747
|
-
*
|
|
1748
|
-
* @remarks
|
|
1749
|
-
* This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
|
|
1750
|
-
*/
|
|
1751
982
|
createDefaultLatchingSwitchClusterServer() {
|
|
1752
983
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
1753
984
|
events: { switchLatched: true },
|
|
@@ -1757,13 +988,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1757
988
|
});
|
|
1758
989
|
return this;
|
|
1759
990
|
}
|
|
1760
|
-
/**
|
|
1761
|
-
* Triggers a switch event on the specified endpoint.
|
|
1762
|
-
*
|
|
1763
|
-
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1764
|
-
* @param {AnsiLogger} log - Optional logger to log the event.
|
|
1765
|
-
* @returns {boolean} - A boolean indicating whether the event was successfully triggered.
|
|
1766
|
-
*/
|
|
1767
991
|
async triggerSwitchEvent(event, log) {
|
|
1768
992
|
if (this.maybeNumber === undefined) {
|
|
1769
993
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1823,30 +1047,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1823
1047
|
}
|
|
1824
1048
|
return true;
|
|
1825
1049
|
}
|
|
1826
|
-
/**
|
|
1827
|
-
* Creates a default OperationalState Cluster Server.
|
|
1828
|
-
*
|
|
1829
|
-
* @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state.
|
|
1830
|
-
*
|
|
1831
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1832
|
-
*/
|
|
1833
1050
|
createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
|
1834
1051
|
this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
|
|
1835
1052
|
return this;
|
|
1836
1053
|
}
|
|
1837
|
-
/**
|
|
1838
|
-
* Creates a default boolean state cluster server.
|
|
1839
|
-
* The stateChange event is enabled.
|
|
1840
|
-
*
|
|
1841
|
-
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
|
|
1842
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1843
|
-
*
|
|
1844
|
-
* @remarks
|
|
1845
|
-
* Water Leak Detector: true = leak, false = no leak
|
|
1846
|
-
* Water Freeze Detector: true = freeze, false = no freeze
|
|
1847
|
-
* Rain Sensor: true = rain, false = no rain
|
|
1848
|
-
* Contact Sensor: true = closed or contact, false = open or no contact
|
|
1849
|
-
*/
|
|
1850
1054
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1851
1055
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1852
1056
|
events: { stateChange: true },
|
|
@@ -1855,22 +1059,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1855
1059
|
});
|
|
1856
1060
|
return this;
|
|
1857
1061
|
}
|
|
1858
|
-
/**
|
|
1859
|
-
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
|
|
1860
|
-
*
|
|
1861
|
-
* Features:
|
|
1862
|
-
* - Visual
|
|
1863
|
-
* - Audible
|
|
1864
|
-
* - SensitivityLevel
|
|
1865
|
-
*
|
|
1866
|
-
* @remarks Supports the enableDisableAlarm command.
|
|
1867
|
-
*
|
|
1868
|
-
* @param {boolean} [sensorFault] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1869
|
-
* @param {number} [currentSensitivityLevel] - The current sensitivity level. Defaults to `0` if not provided.
|
|
1870
|
-
* @param {number} [supportedSensitivityLevels] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
|
|
1871
|
-
* @param {number} [defaultSensitivityLevel] - The default sensitivity level. Defaults to `0` if not provided.
|
|
1872
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1873
|
-
*/
|
|
1874
1062
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1875
1063
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1876
1064
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -1885,51 +1073,18 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1885
1073
|
});
|
|
1886
1074
|
return this;
|
|
1887
1075
|
}
|
|
1888
|
-
/**
|
|
1889
|
-
* Creates a default Device Energy Management Cluster Server with feature PowerForecastReporting and with the specified ESA type, ESA canGenerate, ESA state, and power limits.
|
|
1890
|
-
*
|
|
1891
|
-
* @param {DeviceEnergyManagement.EsaType} [esaType] - The ESA type. Defaults to `DeviceEnergyManagement.EsaType.Other`.
|
|
1892
|
-
* @param {boolean} [esaCanGenerate] - Indicates if the ESA can generate energy. Defaults to `false`.
|
|
1893
|
-
* @param {DeviceEnergyManagement.EsaState} [esaState] - The ESA state. Defaults to `DeviceEnergyManagement.EsaState.Online`.
|
|
1894
|
-
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
1895
|
-
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
1896
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1897
|
-
*
|
|
1898
|
-
* @remarks
|
|
1899
|
-
* - The forecast attribute is set to null, indicating that there is no forecast currently available.
|
|
1900
|
-
* - The ESA type and canGenerate attributes are fixed and cannot be changed after creation.
|
|
1901
|
-
* - The ESA state is set to Online by default.
|
|
1902
|
-
* - The absolute minimum and maximum power attributes are set to 0 by default.
|
|
1903
|
-
* - For example, a battery storage inverter that can charge its battery at a maximum power of 2000W and can
|
|
1904
|
-
* discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
|
|
1905
|
-
*/
|
|
1906
1076
|
createDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
|
|
1907
1077
|
this.behaviors.require(MatterbridgeDeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.PowerAdjustment), {
|
|
1908
|
-
forecast: null,
|
|
1909
|
-
powerAdjustmentCapability: null,
|
|
1910
|
-
esaType,
|
|
1911
|
-
esaCanGenerate,
|
|
1078
|
+
forecast: null,
|
|
1079
|
+
powerAdjustmentCapability: null,
|
|
1080
|
+
esaType,
|
|
1081
|
+
esaCanGenerate,
|
|
1912
1082
|
esaState,
|
|
1913
1083
|
absMinPower,
|
|
1914
1084
|
absMaxPower,
|
|
1915
1085
|
});
|
|
1916
1086
|
return this;
|
|
1917
1087
|
}
|
|
1918
|
-
/**
|
|
1919
|
-
* Creates a default EnergyManagementMode Cluster Server.
|
|
1920
|
-
*
|
|
1921
|
-
* @param {number} [currentMode] - The current mode of the EnergyManagementMode cluster. Defaults to mode 1 (DeviceEnergyManagementMode.ModeTag.NoOptimization).
|
|
1922
|
-
* @param {EnergyManagementMode.ModeOption[]} [supportedModes] - The supported modes for the DeviceEnergyManagementMode cluster. The attribute is fixed and defaults to a predefined set of cluster modes.
|
|
1923
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1924
|
-
*
|
|
1925
|
-
* @remarks
|
|
1926
|
-
* A few examples of Device Energy Management modes and their mode tags are provided below.
|
|
1927
|
-
* - For the "No Energy Management (Forecast reporting only)" mode, tags: 0x4000 (NoOptimization).
|
|
1928
|
-
* - For the "Device Energy Management" mode, tags: 0x4001 (DeviceOptimization).
|
|
1929
|
-
* - For the "Home Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization).
|
|
1930
|
-
* - For the "Grid Energy Management" mode, tags: 0x4003 (GridOptimization).
|
|
1931
|
-
* - For the "Full Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization), 0x4003 (GridOptimization).
|
|
1932
|
-
*/
|
|
1933
1088
|
createDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
|
|
1934
1089
|
this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, {
|
|
1935
1090
|
supportedModes: supportedModes ?? [
|
|
@@ -1950,27 +1105,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1950
1105
|
mode: 5,
|
|
1951
1106
|
modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.DeviceOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }, { value: DeviceEnergyManagementMode.ModeTag.GridOptimization }],
|
|
1952
1107
|
},
|
|
1953
|
-
],
|
|
1108
|
+
],
|
|
1954
1109
|
currentMode: currentMode ?? 1,
|
|
1955
1110
|
});
|
|
1956
1111
|
return this;
|
|
1957
1112
|
}
|
|
1958
|
-
/**
|
|
1959
|
-
* Creates a default Power Topology Cluster Server with feature TreeTopology (the endpoint provides or consumes power to/from itself and its child endpoints). Only needed for an electricalSensor device type.
|
|
1960
|
-
*
|
|
1961
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1962
|
-
*/
|
|
1963
1113
|
createDefaultPowerTopologyClusterServer() {
|
|
1964
1114
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1965
1115
|
return this;
|
|
1966
1116
|
}
|
|
1967
|
-
/**
|
|
1968
|
-
* Creates a default Electrical Energy Measurement Cluster Server with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
|
|
1969
|
-
*
|
|
1970
|
-
* @param {number} energyImported - The total consumption value in mW/h.
|
|
1971
|
-
* @param {number} energyExported - The total production value in mW/h.
|
|
1972
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1973
|
-
*/
|
|
1974
1117
|
createDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
|
|
1975
1118
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1976
1119
|
accuracy: {
|
|
@@ -1986,15 +1129,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1986
1129
|
});
|
|
1987
1130
|
return this;
|
|
1988
1131
|
}
|
|
1989
|
-
/**
|
|
1990
|
-
* Creates a default Electrical Power Measurement Cluster Server with features AlternatingCurrent.
|
|
1991
|
-
*
|
|
1992
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
1993
|
-
* @param {number} current - The current value in milliamperes.
|
|
1994
|
-
* @param {number} power - The power value in milliwatts.
|
|
1995
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
1996
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1997
|
-
*/
|
|
1998
1132
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1999
1133
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
2000
1134
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -2036,124 +1170,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2036
1170
|
});
|
|
2037
1171
|
return this;
|
|
2038
1172
|
}
|
|
2039
|
-
/**
|
|
2040
|
-
* Creates a default TemperatureMeasurement cluster server.
|
|
2041
|
-
*
|
|
2042
|
-
* @param {number | null} measuredValue - The measured value of the temperature x 100.
|
|
2043
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
|
|
2044
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
|
|
2045
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2046
|
-
*/
|
|
2047
1173
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2048
1174
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2049
1175
|
return this;
|
|
2050
1176
|
}
|
|
2051
|
-
/**
|
|
2052
|
-
* Creates a default RelativeHumidityMeasurement cluster server.
|
|
2053
|
-
*
|
|
2054
|
-
* @param {number | null} measuredValue - The measured value of the relative humidity x 100.
|
|
2055
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
|
|
2056
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
|
|
2057
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2058
|
-
*/
|
|
2059
1177
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2060
1178
|
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2061
1179
|
return this;
|
|
2062
1180
|
}
|
|
2063
|
-
/**
|
|
2064
|
-
* Creates a default PressureMeasurement cluster server.
|
|
2065
|
-
*
|
|
2066
|
-
* @param {number | null} measuredValue - The measured value for the pressure in kPa x 10.
|
|
2067
|
-
* @param {number | null} minMeasuredValue - The minimum measured value for the pressure in kPa x 10.
|
|
2068
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value for the pressure in kPa x 10.
|
|
2069
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2070
|
-
*
|
|
2071
|
-
* @remarks
|
|
2072
|
-
* - MeasuredValue = 10 x Pressure in kPa
|
|
2073
|
-
* - MeasuredValue = 1 x Pressure in hPa
|
|
2074
|
-
* - MeasuredValue = 33.8639 x Pressure in inHg
|
|
2075
|
-
*
|
|
2076
|
-
* Conversion:
|
|
2077
|
-
* - 1 kPa = 10 hPa
|
|
2078
|
-
* - 1 inHg = 33.8639 hPa
|
|
2079
|
-
*/
|
|
2080
1181
|
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2081
1182
|
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2082
1183
|
return this;
|
|
2083
1184
|
}
|
|
2084
|
-
/**
|
|
2085
|
-
* Creates a default IlluminanceMeasurement cluster server.
|
|
2086
|
-
*
|
|
2087
|
-
* @param {number | null} measuredValue - The measured value of illuminance.
|
|
2088
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
|
|
2089
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
|
|
2090
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2091
|
-
*
|
|
2092
|
-
* @remarks The default value for the illuminance measurement is null.
|
|
2093
|
-
* This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
|
|
2094
|
-
* • MeasuredValue = 10,000 x log10(illuminance) + 1,
|
|
2095
|
-
* where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
|
|
2096
|
-
* • 0 indicates a value of illuminance that is too low to be measured
|
|
2097
|
-
* • null indicates that the illuminance measurement is invalid.
|
|
2098
|
-
*
|
|
2099
|
-
* - Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
|
|
2100
|
-
* - Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
|
|
2101
|
-
*/
|
|
2102
1185
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2103
1186
|
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2104
1187
|
return this;
|
|
2105
1188
|
}
|
|
2106
|
-
/**
|
|
2107
|
-
* Creates a default FlowMeasurement cluster server.
|
|
2108
|
-
*
|
|
2109
|
-
* @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
|
|
2110
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
|
|
2111
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
|
|
2112
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2113
|
-
*/
|
|
2114
1189
|
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2115
1190
|
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2116
1191
|
return this;
|
|
2117
1192
|
}
|
|
2118
|
-
/**
|
|
2119
|
-
* Creates a default OccupancySensing cluster server with feature PassiveInfrared.
|
|
2120
|
-
*
|
|
2121
|
-
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
2122
|
-
* @param {number} holdTime - The hold time in seconds. Default is 30.
|
|
2123
|
-
* @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
|
|
2124
|
-
* @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
|
|
2125
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2126
|
-
*
|
|
2127
|
-
* @remarks The default value for the occupancy sensor type is PIR.
|
|
2128
|
-
*/
|
|
2129
1193
|
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
2130
1194
|
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
2131
1195
|
return this;
|
|
2132
1196
|
}
|
|
2133
|
-
/**
|
|
2134
|
-
* Creates a default AirQuality cluster server.
|
|
2135
|
-
*
|
|
2136
|
-
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2137
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2138
|
-
*/
|
|
2139
1197
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
2140
1198
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
2141
1199
|
airQuality,
|
|
2142
1200
|
});
|
|
2143
1201
|
return this;
|
|
2144
1202
|
}
|
|
2145
|
-
/**
|
|
2146
|
-
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2147
|
-
*
|
|
2148
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2149
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2150
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2151
|
-
* @param {number} [uncertainty] - The uncertainty value (optional).
|
|
2152
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2153
|
-
*
|
|
2154
|
-
* @remarks
|
|
2155
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2156
|
-
*/
|
|
2157
1203
|
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
2158
1204
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2159
1205
|
measuredValue,
|
|
@@ -2165,16 +1211,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2165
1211
|
});
|
|
2166
1212
|
return this;
|
|
2167
1213
|
}
|
|
2168
|
-
/**
|
|
2169
|
-
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature LevelIndication.
|
|
2170
|
-
|
|
2171
|
-
* @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
|
|
2172
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2173
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2174
|
-
*
|
|
2175
|
-
* @remarks
|
|
2176
|
-
* The measurementMedium attribute is fixed and cannot be changed after creation.
|
|
2177
|
-
*/
|
|
2178
1214
|
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2179
1215
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
2180
1216
|
levelValue,
|
|
@@ -2182,17 +1218,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2182
1218
|
});
|
|
2183
1219
|
return this;
|
|
2184
1220
|
}
|
|
2185
|
-
/**
|
|
2186
|
-
* Create a default CarbonMonoxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2187
|
-
*
|
|
2188
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2189
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2190
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2191
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2192
|
-
*
|
|
2193
|
-
* @remarks
|
|
2194
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2195
|
-
*/
|
|
2196
1221
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2197
1222
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2198
1223
|
measuredValue,
|
|
@@ -2204,17 +1229,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2204
1229
|
});
|
|
2205
1230
|
return this;
|
|
2206
1231
|
}
|
|
2207
|
-
/**
|
|
2208
|
-
* Create a default CarbonDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2209
|
-
*
|
|
2210
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2211
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2212
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2213
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2214
|
-
*
|
|
2215
|
-
* @remarks
|
|
2216
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2217
|
-
*/
|
|
2218
1232
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2219
1233
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2220
1234
|
measuredValue,
|
|
@@ -2226,17 +1240,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2226
1240
|
});
|
|
2227
1241
|
return this;
|
|
2228
1242
|
}
|
|
2229
|
-
/**
|
|
2230
|
-
* Create a default FormaldehydeConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2231
|
-
*
|
|
2232
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2233
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2234
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2235
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2236
|
-
*
|
|
2237
|
-
* @remarks
|
|
2238
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2239
|
-
*/
|
|
2240
1243
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2241
1244
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2242
1245
|
measuredValue,
|
|
@@ -2248,17 +1251,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2248
1251
|
});
|
|
2249
1252
|
return this;
|
|
2250
1253
|
}
|
|
2251
|
-
/**
|
|
2252
|
-
* Create a default Pm1ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2253
|
-
*
|
|
2254
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2255
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2256
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2257
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2258
|
-
*
|
|
2259
|
-
* @remarks
|
|
2260
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2261
|
-
*/
|
|
2262
1254
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2263
1255
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2264
1256
|
measuredValue,
|
|
@@ -2270,17 +1262,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2270
1262
|
});
|
|
2271
1263
|
return this;
|
|
2272
1264
|
}
|
|
2273
|
-
/**
|
|
2274
|
-
* Create a default Pm25ConcentrationMeasurement 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.Ppm).
|
|
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
|
-
* @remarks
|
|
2282
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2283
|
-
*/
|
|
2284
1265
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2285
1266
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2286
1267
|
measuredValue,
|
|
@@ -2292,17 +1273,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2292
1273
|
});
|
|
2293
1274
|
return this;
|
|
2294
1275
|
}
|
|
2295
|
-
/**
|
|
2296
|
-
* Create a default Pm10ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2297
|
-
*
|
|
2298
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2299
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2300
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2301
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2302
|
-
*
|
|
2303
|
-
* @remarks
|
|
2304
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2305
|
-
*/
|
|
2306
1276
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2307
1277
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2308
1278
|
measuredValue,
|
|
@@ -2314,17 +1284,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2314
1284
|
});
|
|
2315
1285
|
return this;
|
|
2316
1286
|
}
|
|
2317
|
-
/**
|
|
2318
|
-
* Create a default OzoneConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2319
|
-
*
|
|
2320
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2321
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2322
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2323
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2324
|
-
*
|
|
2325
|
-
* @remarks
|
|
2326
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2327
|
-
*/
|
|
2328
1287
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2329
1288
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2330
1289
|
measuredValue,
|
|
@@ -2336,17 +1295,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2336
1295
|
});
|
|
2337
1296
|
return this;
|
|
2338
1297
|
}
|
|
2339
|
-
/**
|
|
2340
|
-
* Create a default RadonConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2341
|
-
*
|
|
2342
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2343
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2344
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2345
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2346
|
-
*
|
|
2347
|
-
* @remarks
|
|
2348
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2349
|
-
*/
|
|
2350
1298
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2351
1299
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2352
1300
|
measuredValue,
|
|
@@ -2358,17 +1306,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2358
1306
|
});
|
|
2359
1307
|
return this;
|
|
2360
1308
|
}
|
|
2361
|
-
/**
|
|
2362
|
-
* Create a default NitrogenDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2363
|
-
*
|
|
2364
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2365
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2366
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2367
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2368
|
-
*
|
|
2369
|
-
* @remarks
|
|
2370
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2371
|
-
*/
|
|
2372
1309
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2373
1310
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2374
1311
|
measuredValue,
|
|
@@ -2381,4 +1318,3 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2381
1318
|
return this;
|
|
2382
1319
|
}
|
|
2383
1320
|
}
|
|
2384
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|