matterbridge 3.1.2-dev-20250707-800ff6d → 3.1.2
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 +0 -1
- package/dist/cli.d.ts +26 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +91 -2
- package/dist/cli.js.map +1 -0
- package/dist/cliEmitter.d.ts +34 -0
- package/dist/cliEmitter.d.ts.map +1 -0
- package/dist/cliEmitter.js +30 -0
- package/dist/cliEmitter.js.map +1 -0
- package/dist/clusters/export.d.ts +2 -0
- package/dist/clusters/export.d.ts.map +1 -0
- package/dist/clusters/export.js +2 -0
- package/dist/clusters/export.js.map +1 -0
- package/dist/defaultConfigSchema.d.ts +28 -0
- package/dist/defaultConfigSchema.d.ts.map +1 -0
- package/dist/defaultConfigSchema.js +24 -0
- package/dist/defaultConfigSchema.js.map +1 -0
- package/dist/deviceManager.d.ts +112 -0
- package/dist/deviceManager.d.ts.map +1 -0
- package/dist/deviceManager.js +94 -1
- package/dist/deviceManager.js.map +1 -0
- package/dist/devices/batteryStorage.d.ts +48 -0
- package/dist/devices/batteryStorage.d.ts.map +1 -0
- package/dist/devices/batteryStorage.js +48 -1
- package/dist/devices/batteryStorage.js.map +1 -0
- package/dist/devices/evse.d.ts +75 -0
- package/dist/devices/evse.d.ts.map +1 -0
- package/dist/devices/evse.js +74 -10
- package/dist/devices/evse.js.map +1 -0
- package/dist/devices/export.d.ts +9 -0
- package/dist/devices/export.d.ts.map +1 -0
- package/dist/devices/export.js +2 -0
- package/dist/devices/export.js.map +1 -0
- package/dist/devices/heatPump.d.ts +47 -0
- package/dist/devices/heatPump.d.ts.map +1 -0
- package/dist/devices/heatPump.js +50 -2
- package/dist/devices/heatPump.js.map +1 -0
- package/dist/devices/laundryDryer.d.ts +87 -0
- package/dist/devices/laundryDryer.d.ts.map +1 -0
- package/dist/devices/laundryDryer.js +83 -6
- package/dist/devices/laundryDryer.js.map +1 -0
- package/dist/devices/laundryWasher.d.ts +242 -0
- package/dist/devices/laundryWasher.d.ts.map +1 -0
- package/dist/devices/laundryWasher.js +91 -7
- package/dist/devices/laundryWasher.js.map +1 -0
- package/dist/devices/roboticVacuumCleaner.d.ts +110 -0
- package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
- package/dist/devices/roboticVacuumCleaner.js +89 -6
- package/dist/devices/roboticVacuumCleaner.js.map +1 -0
- package/dist/devices/solarPower.d.ts +40 -0
- package/dist/devices/solarPower.d.ts.map +1 -0
- package/dist/devices/solarPower.js +38 -0
- package/dist/devices/solarPower.js.map +1 -0
- package/dist/devices/waterHeater.d.ts +111 -0
- package/dist/devices/waterHeater.d.ts.map +1 -0
- package/dist/devices/waterHeater.js +82 -2
- package/dist/devices/waterHeater.js.map +1 -0
- package/dist/frontend.d.ts +303 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/frontend.js +417 -16
- package/dist/frontend.js.map +1 -0
- package/dist/globalMatterbridge.d.ts +59 -0
- package/dist/globalMatterbridge.d.ts.map +1 -0
- package/dist/globalMatterbridge.js +47 -0
- package/dist/globalMatterbridge.js.map +1 -0
- package/dist/helpers.d.ts +48 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +53 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -0
- package/dist/logger/export.d.ts +2 -0
- package/dist/logger/export.d.ts.map +1 -0
- package/dist/logger/export.js +1 -0
- package/dist/logger/export.js.map +1 -0
- package/dist/matter/behaviors.d.ts +2 -0
- package/dist/matter/behaviors.d.ts.map +1 -0
- package/dist/matter/behaviors.js +2 -0
- package/dist/matter/behaviors.js.map +1 -0
- package/dist/matter/clusters.d.ts +2 -0
- package/dist/matter/clusters.d.ts.map +1 -0
- package/dist/matter/clusters.js +2 -0
- package/dist/matter/clusters.js.map +1 -0
- package/dist/matter/devices.d.ts +2 -0
- package/dist/matter/devices.d.ts.map +1 -0
- package/dist/matter/devices.js +2 -0
- package/dist/matter/devices.js.map +1 -0
- package/dist/matter/endpoints.d.ts +2 -0
- package/dist/matter/endpoints.d.ts.map +1 -0
- package/dist/matter/endpoints.js +2 -0
- package/dist/matter/endpoints.js.map +1 -0
- package/dist/matter/export.d.ts +5 -0
- package/dist/matter/export.d.ts.map +1 -0
- package/dist/matter/export.js +3 -0
- package/dist/matter/export.js.map +1 -0
- package/dist/matter/types.d.ts +3 -0
- package/dist/matter/types.d.ts.map +1 -0
- package/dist/matter/types.js +3 -0
- package/dist/matter/types.js.map +1 -0
- package/dist/matterbridge.d.ts +450 -0
- package/dist/matterbridge.d.ts.map +1 -0
- package/dist/matterbridge.js +802 -50
- package/dist/matterbridge.js.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts +42 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.js +36 -0
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
- package/dist/matterbridgeBehaviors.d.ts +1340 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +61 -1
- package/dist/matterbridgeBehaviors.js.map +1 -0
- package/dist/matterbridgeDeviceTypes.d.ts +709 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +579 -15
- package/dist/matterbridgeDeviceTypes.js.map +1 -0
- package/dist/matterbridgeDynamicPlatform.d.ts +42 -0
- package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
- package/dist/matterbridgeDynamicPlatform.js +36 -0
- package/dist/matterbridgeDynamicPlatform.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +1196 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +1053 -42
- package/dist/matterbridgeEndpoint.js.map +1 -0
- package/dist/matterbridgeEndpointHelpers.d.ts +3198 -0
- package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
- package/dist/matterbridgeEndpointHelpers.js +322 -12
- package/dist/matterbridgeEndpointHelpers.js.map +1 -0
- package/dist/matterbridgePlatform.d.ts +310 -0
- package/dist/matterbridgePlatform.d.ts.map +1 -0
- package/dist/matterbridgePlatform.js +233 -0
- package/dist/matterbridgePlatform.js.map +1 -0
- package/dist/matterbridgeTypes.d.ts +192 -0
- package/dist/matterbridgeTypes.d.ts.map +1 -0
- package/dist/matterbridgeTypes.js +25 -0
- package/dist/matterbridgeTypes.js.map +1 -0
- package/dist/pluginManager.d.ts +291 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +269 -3
- package/dist/pluginManager.js.map +1 -0
- package/dist/shelly.d.ts +174 -0
- package/dist/shelly.d.ts.map +1 -0
- package/dist/shelly.js +168 -7
- package/dist/shelly.js.map +1 -0
- package/dist/storage/export.d.ts +2 -0
- package/dist/storage/export.d.ts.map +1 -0
- package/dist/storage/export.js +1 -0
- package/dist/storage/export.js.map +1 -0
- package/dist/update.d.ts +59 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +54 -0
- package/dist/update.js.map +1 -0
- package/dist/utils/colorUtils.d.ts +117 -0
- package/dist/utils/colorUtils.d.ts.map +1 -0
- package/dist/utils/colorUtils.js +263 -2
- package/dist/utils/colorUtils.js.map +1 -0
- package/dist/utils/commandLine.d.ts +59 -0
- package/dist/utils/commandLine.d.ts.map +1 -0
- package/dist/utils/commandLine.js +54 -0
- package/dist/utils/commandLine.js.map +1 -0
- package/dist/utils/copyDirectory.d.ts +33 -0
- package/dist/utils/copyDirectory.d.ts.map +1 -0
- package/dist/utils/copyDirectory.js +38 -1
- package/dist/utils/copyDirectory.js.map +1 -0
- package/dist/utils/createDirectory.d.ts +34 -0
- package/dist/utils/createDirectory.d.ts.map +1 -0
- package/dist/utils/createDirectory.js +33 -0
- package/dist/utils/createDirectory.js.map +1 -0
- package/dist/utils/createZip.d.ts +39 -0
- package/dist/utils/createZip.d.ts.map +1 -0
- package/dist/utils/createZip.js +47 -2
- package/dist/utils/createZip.js.map +1 -0
- package/dist/utils/deepCopy.d.ts +32 -0
- package/dist/utils/deepCopy.d.ts.map +1 -0
- package/dist/utils/deepCopy.js +39 -0
- package/dist/utils/deepCopy.js.map +1 -0
- package/dist/utils/deepEqual.d.ts +54 -0
- package/dist/utils/deepEqual.d.ts.map +1 -0
- package/dist/utils/deepEqual.js +72 -1
- package/dist/utils/deepEqual.js.map +1 -0
- package/dist/utils/export.d.ts +12 -0
- package/dist/utils/export.d.ts.map +1 -0
- package/dist/utils/export.js +1 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/hex.d.ts +49 -0
- package/dist/utils/hex.d.ts.map +1 -0
- package/dist/utils/hex.js +58 -0
- package/dist/utils/hex.js.map +1 -0
- package/dist/utils/isvalid.d.ts +103 -0
- package/dist/utils/isvalid.d.ts.map +1 -0
- package/dist/utils/isvalid.js +101 -0
- package/dist/utils/isvalid.js.map +1 -0
- package/dist/utils/network.d.ts +76 -0
- package/dist/utils/network.d.ts.map +1 -0
- package/dist/utils/network.js +83 -5
- package/dist/utils/network.js.map +1 -0
- package/dist/utils/spawn.d.ts +11 -0
- package/dist/utils/spawn.d.ts.map +1 -0
- package/dist/utils/spawn.js +18 -0
- package/dist/utils/spawn.js.map +1 -0
- package/dist/utils/wait.d.ts +56 -0
- package/dist/utils/wait.d.ts.map +1 -0
- package/dist/utils/wait.js +62 -9
- package/dist/utils/wait.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
|
@@ -1,5 +1,30 @@
|
|
|
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
|
|
1
25
|
import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, UINT16_MAX, UINT32_MAX, VendorId } from '@matter/main';
|
|
2
26
|
import { getClusterNameById, MeasurementType } from '@matter/main/types';
|
|
27
|
+
// @matter clusters
|
|
3
28
|
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
4
29
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
5
30
|
import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
|
|
@@ -26,6 +51,7 @@ import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/ther
|
|
|
26
51
|
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
27
52
|
import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
|
|
28
53
|
import { DeviceEnergyManagementMode } from '@matter/main/clusters/device-energy-management-mode';
|
|
54
|
+
// @matter behaviors
|
|
29
55
|
import { DescriptorServer } from '@matter/main/behaviors/descriptor';
|
|
30
56
|
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
31
57
|
import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
|
|
@@ -59,18 +85,39 @@ import { ResourceMonitoring } from '@matter/main/clusters/resource-monitoring';
|
|
|
59
85
|
import { HepaFilterMonitoringServer } from '@matter/main/behaviors/hepa-filter-monitoring';
|
|
60
86
|
import { ActivatedCarbonFilterMonitoringServer } from '@matter/main/behaviors/activated-carbon-filter-monitoring';
|
|
61
87
|
import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behaviors/thermostat-user-interface-configuration';
|
|
88
|
+
// AnsiLogger module
|
|
62
89
|
import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
|
|
90
|
+
// Matterbridge
|
|
63
91
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
64
92
|
import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
|
|
65
93
|
import { MatterbridgeServer, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, MatterbridgeDeviceEnergyManagementServer, } from './matterbridgeBehaviors.js';
|
|
66
94
|
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';
|
|
67
95
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
96
|
+
/** The bridge mode of Matterbridge */
|
|
68
97
|
static bridgeMode = '';
|
|
69
|
-
|
|
98
|
+
/** The default log level of the new MatterbridgeEndpoints */
|
|
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
|
+
*/
|
|
70
113
|
mode = undefined;
|
|
114
|
+
/** The server node of the endpoint, if it is a single not bridged endpoint */
|
|
71
115
|
serverNode;
|
|
116
|
+
/** The logger instance for the MatterbridgeEndpoint */
|
|
72
117
|
log;
|
|
118
|
+
/** The plugin name this MatterbridgeEndpoint belongs to */
|
|
73
119
|
plugin = undefined;
|
|
120
|
+
/** The configuration URL of the device, if available */
|
|
74
121
|
configUrl = undefined;
|
|
75
122
|
deviceName = undefined;
|
|
76
123
|
serialNumber = undefined;
|
|
@@ -84,14 +131,28 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
84
131
|
hardwareVersion = undefined;
|
|
85
132
|
hardwareVersionString = undefined;
|
|
86
133
|
productUrl = 'https://www.npmjs.com/package/matterbridge';
|
|
134
|
+
/** The name of the first device type of the endpoint (old api compatibility) */
|
|
87
135
|
name = undefined;
|
|
136
|
+
/** The code of the first device type of the endpoint (old api compatibility) */
|
|
88
137
|
deviceType = undefined;
|
|
138
|
+
/** The original id (with spaces and .) of the endpoint (old api compatibility) */
|
|
89
139
|
uniqueStorageKey = undefined;
|
|
90
140
|
tagList = undefined;
|
|
141
|
+
/** Maps the DeviceTypeDefinitions with their code */
|
|
91
142
|
deviceTypes = new Map();
|
|
143
|
+
/** Command handler for the MatterbridgeEndpoint commands */
|
|
92
144
|
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
|
+
*/
|
|
93
153
|
constructor(definition, options = {}, debug = false) {
|
|
94
154
|
let deviceTypeList = [];
|
|
155
|
+
// Get the first DeviceTypeDefinition
|
|
95
156
|
let firstDefinition;
|
|
96
157
|
if (Array.isArray(definition)) {
|
|
97
158
|
firstDefinition = definition[0];
|
|
@@ -104,6 +165,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
104
165
|
firstDefinition = definition;
|
|
105
166
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
106
167
|
}
|
|
168
|
+
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
107
169
|
const deviceTypeDefinitionV8 = {
|
|
108
170
|
name: firstDefinition.name.replace('-', '_'),
|
|
109
171
|
deviceType: firstDefinition.code,
|
|
@@ -122,17 +184,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
122
184
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
123
185
|
};
|
|
124
186
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
187
|
+
// Check if the uniqueStorageKey is valid
|
|
125
188
|
if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
|
|
126
189
|
options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
|
|
127
190
|
}
|
|
128
191
|
if (options.id && checkNotLatinCharacters(options.id)) {
|
|
129
192
|
options.id = generateUniqueId(options.id);
|
|
130
193
|
}
|
|
194
|
+
// Convert the options to an Endpoint.Options
|
|
131
195
|
const optionsV8 = {
|
|
132
196
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
133
197
|
number: options.endpointId,
|
|
134
198
|
descriptor: options.tagList ? { tagList: options.tagList, deviceTypeList } : { deviceTypeList },
|
|
135
199
|
};
|
|
200
|
+
// Override the deprecated uniqueStorageKey && endpointId with id and number if provided
|
|
136
201
|
if (options.id !== undefined) {
|
|
137
202
|
optionsV8.id = options.id.replace(/[ .]/g, '');
|
|
138
203
|
}
|
|
@@ -152,16 +217,40 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
152
217
|
}
|
|
153
218
|
else
|
|
154
219
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
155
|
-
|
|
220
|
+
// console.log('MatterbridgeEndpoint.option', options);
|
|
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 });
|
|
156
225
|
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
|
|
157
227
|
this.behaviors.require(MatterbridgeServer, { log: this.log, commandHandler: this.commandHandler });
|
|
158
228
|
}
|
|
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
|
+
*/
|
|
159
237
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
160
238
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
161
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Get all the device types of this endpoint.
|
|
242
|
+
*
|
|
243
|
+
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
|
|
244
|
+
*/
|
|
162
245
|
getDeviceTypes() {
|
|
163
246
|
return Array.from(this.deviceTypes.values());
|
|
164
247
|
}
|
|
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
|
+
*/
|
|
165
254
|
hasClusterServer(cluster) {
|
|
166
255
|
const behavior = getBehavior(this, cluster);
|
|
167
256
|
if (behavior)
|
|
@@ -169,6 +258,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
169
258
|
else
|
|
170
259
|
return false;
|
|
171
260
|
}
|
|
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
|
+
*/
|
|
172
268
|
hasAttributeServer(cluster, attribute) {
|
|
173
269
|
const behavior = getBehavior(this, cluster);
|
|
174
270
|
if (!behavior || !this.behaviors.supported[behavior.id])
|
|
@@ -177,82 +273,239 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
177
273
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
178
274
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
179
275
|
}
|
|
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
|
+
*/
|
|
180
282
|
getClusterServerOptions(cluster) {
|
|
181
283
|
const behavior = getBehavior(this, cluster);
|
|
182
284
|
if (!behavior)
|
|
183
285
|
return undefined;
|
|
184
286
|
return this.behaviors.optionsFor(behavior);
|
|
185
287
|
}
|
|
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
|
|
186
297
|
getAttribute(cluster, attribute, log) {
|
|
187
298
|
return getAttribute(this, cluster, attribute, log);
|
|
188
299
|
}
|
|
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
|
+
*/
|
|
189
309
|
async setAttribute(clusterId, attribute, value, log) {
|
|
190
310
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
191
311
|
}
|
|
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
|
+
*/
|
|
192
321
|
async updateAttribute(cluster, attribute, value, log) {
|
|
193
322
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
194
323
|
}
|
|
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
|
|
195
339
|
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
196
340
|
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
197
341
|
}
|
|
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
|
+
*/
|
|
198
351
|
async triggerEvent(cluster, event, payload, log) {
|
|
199
352
|
return await triggerEvent(this, cluster, event, payload, log);
|
|
200
353
|
}
|
|
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
|
+
*/
|
|
201
360
|
addClusterServers(serverList) {
|
|
202
361
|
addClusterServers(this, serverList);
|
|
203
362
|
return this;
|
|
204
363
|
}
|
|
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
|
+
*/
|
|
205
371
|
async addFixedLabel(label, value) {
|
|
206
372
|
await addFixedLabel(this, label, value);
|
|
207
373
|
return this;
|
|
208
374
|
}
|
|
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
|
+
*/
|
|
209
382
|
async addUserLabel(label, value) {
|
|
210
383
|
await addUserLabel(this, label, value);
|
|
211
384
|
return this;
|
|
212
385
|
}
|
|
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
|
+
*/
|
|
213
400
|
addCommandHandler(command, handler) {
|
|
214
401
|
this.commandHandler.addHandler(command, handler);
|
|
215
402
|
return this;
|
|
216
403
|
}
|
|
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
|
+
*/
|
|
217
415
|
async executeCommandHandler(command, request, cluster, attributes, endpoint) {
|
|
218
416
|
await this.commandHandler.executeHandler(command, { request, cluster, attributes, endpoint });
|
|
219
417
|
}
|
|
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
|
+
*/
|
|
220
427
|
async invokeBehaviorCommand(cluster, command, params) {
|
|
221
428
|
await invokeBehaviorCommand(this, cluster, command, params);
|
|
222
429
|
}
|
|
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
|
+
*/
|
|
223
435
|
addRequiredClusterServers() {
|
|
224
436
|
addRequiredClusterServers(this);
|
|
225
437
|
return this;
|
|
226
438
|
}
|
|
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
|
+
*/
|
|
227
444
|
addOptionalClusterServers() {
|
|
228
445
|
addOptionalClusterServers(this);
|
|
229
446
|
return this;
|
|
230
447
|
}
|
|
448
|
+
/**
|
|
449
|
+
* Retrieves all cluster servers.
|
|
450
|
+
*
|
|
451
|
+
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
452
|
+
*/
|
|
231
453
|
getAllClusterServers() {
|
|
232
454
|
return Object.values(this.behaviors.supported);
|
|
233
455
|
}
|
|
456
|
+
/**
|
|
457
|
+
* Retrieves the names of all cluster servers.
|
|
458
|
+
*
|
|
459
|
+
* @returns {string[]} An array of all cluster server names.
|
|
460
|
+
*/
|
|
234
461
|
getAllClusterServerNames() {
|
|
235
462
|
return Object.keys(this.behaviors.supported);
|
|
236
463
|
}
|
|
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
|
+
*/
|
|
237
469
|
forEachAttribute(callback) {
|
|
238
470
|
if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
|
|
239
471
|
return;
|
|
240
472
|
for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
|
|
473
|
+
// Skip if the key / cluster name is a number, cause they are double indexed.
|
|
241
474
|
if (!isNaN(Number(clusterName)))
|
|
242
475
|
continue;
|
|
243
476
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
477
|
+
// Skip if the behavior has no associated cluster (i.e. matterbridge server)
|
|
244
478
|
const clusterId = getClusterId(this, clusterName);
|
|
245
479
|
if (clusterId === undefined) {
|
|
480
|
+
// this.log.debug(`***forEachAttribute: cluster ${clusterName} not found`);
|
|
246
481
|
continue;
|
|
247
482
|
}
|
|
483
|
+
// Skip if the attribute is not present in the ClusterBehavior.Type. Also skip if the attribute it is an internal state.
|
|
248
484
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
249
485
|
if (attributeId === undefined) {
|
|
486
|
+
// this.log.debug(`***forEachAttribute: attribute ${clusterName}.${attributeName} not found`);
|
|
250
487
|
continue;
|
|
251
488
|
}
|
|
252
489
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
253
490
|
}
|
|
254
491
|
}
|
|
255
492
|
}
|
|
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
|
+
*/
|
|
256
509
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
257
510
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
258
511
|
let alreadyAdded = false;
|
|
@@ -292,6 +545,23 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
292
545
|
}
|
|
293
546
|
return child;
|
|
294
547
|
}
|
|
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
|
+
*/
|
|
295
565
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
296
566
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
297
567
|
let alreadyAdded = false;
|
|
@@ -354,15 +624,39 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
354
624
|
}
|
|
355
625
|
return child;
|
|
356
626
|
}
|
|
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
|
+
*/
|
|
357
633
|
getChildEndpointByName(endpointName) {
|
|
358
634
|
return this.parts.find((part) => part.id === endpointName);
|
|
359
635
|
}
|
|
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
|
+
*/
|
|
360
642
|
getChildEndpoint(endpointNumber) {
|
|
361
643
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
362
644
|
}
|
|
645
|
+
/**
|
|
646
|
+
* Get all the child endpoints of this endpoint.
|
|
647
|
+
*
|
|
648
|
+
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
649
|
+
*/
|
|
363
650
|
getChildEndpoints() {
|
|
364
651
|
return Array.from(this.parts);
|
|
365
652
|
}
|
|
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
|
+
*/
|
|
366
660
|
static serialize(device) {
|
|
367
661
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId)
|
|
368
662
|
return;
|
|
@@ -385,9 +679,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
385
679
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
386
680
|
if (behaviorName === 'powerSource')
|
|
387
681
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
682
|
+
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
388
683
|
});
|
|
389
684
|
return serialized;
|
|
390
685
|
}
|
|
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
|
+
*/
|
|
391
692
|
static deserialize(serializedDevice) {
|
|
392
693
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
|
|
393
694
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -403,55 +704,122 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
403
704
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
404
705
|
else if (clusterId === PowerSource.Cluster.id)
|
|
405
706
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
707
|
+
// else addClusterServerFromList(device, [clusterId]);
|
|
406
708
|
}
|
|
407
709
|
return device;
|
|
408
710
|
}
|
|
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
|
+
*/
|
|
409
722
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
410
723
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
|
|
724
|
+
// Base attributes
|
|
411
725
|
status: PowerSource.PowerSourceStatus.Active,
|
|
412
726
|
order: 0,
|
|
413
727
|
description: wiredCurrentType === PowerSource.WiredCurrentType.Ac ? 'AC Power' : 'DC Power',
|
|
414
728
|
endpointList: [],
|
|
729
|
+
// Wired feature attributes
|
|
415
730
|
wiredCurrentType,
|
|
416
731
|
});
|
|
417
732
|
return this;
|
|
418
733
|
}
|
|
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
|
+
*/
|
|
419
752
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1, batReplaceability = PowerSource.BatReplaceability.UserReplaceable) {
|
|
420
753
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
754
|
+
// Base attributes
|
|
421
755
|
status: PowerSource.PowerSourceStatus.Active,
|
|
422
756
|
order: 0,
|
|
423
757
|
description: 'Primary battery',
|
|
424
758
|
endpointList: [],
|
|
759
|
+
// Battery feature attributes
|
|
425
760
|
batVoltage,
|
|
426
761
|
batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
|
|
427
762
|
batChargeLevel,
|
|
428
763
|
batReplacementNeeded: false,
|
|
429
764
|
batReplaceability,
|
|
430
765
|
activeBatFaults: undefined,
|
|
766
|
+
// Replaceable feature attributes
|
|
431
767
|
batReplacementDescription,
|
|
432
768
|
batQuantity,
|
|
433
769
|
});
|
|
434
770
|
return this;
|
|
435
771
|
}
|
|
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
|
+
*/
|
|
436
786
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplaceability = PowerSource.BatReplaceability.Unspecified) {
|
|
437
787
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
788
|
+
// Base attributes
|
|
438
789
|
status: PowerSource.PowerSourceStatus.Active,
|
|
439
790
|
order: 0,
|
|
440
791
|
description: 'Primary battery',
|
|
441
792
|
endpointList: [],
|
|
793
|
+
// Battery feature attributes
|
|
442
794
|
batVoltage,
|
|
443
795
|
batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
|
|
444
|
-
batTimeRemaining: null,
|
|
796
|
+
batTimeRemaining: null, // Indicates the estimated time in seconds before the battery will no longer be able to provide power to the Node
|
|
445
797
|
batChargeLevel,
|
|
446
798
|
batReplacementNeeded: false,
|
|
447
799
|
batReplaceability,
|
|
448
800
|
batPresent: true,
|
|
449
801
|
activeBatFaults: [],
|
|
802
|
+
// Rechargeable feature attributes
|
|
450
803
|
batChargeState: PowerSource.BatChargeState.IsNotCharging,
|
|
451
804
|
batFunctionalWhileCharging: true,
|
|
452
805
|
});
|
|
453
806
|
return this;
|
|
454
807
|
}
|
|
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
|
+
*/
|
|
455
823
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productId = 0x8000, productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
456
824
|
this.log.logName = deviceName;
|
|
457
825
|
this.deviceName = deviceName;
|
|
@@ -475,6 +843,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
475
843
|
}
|
|
476
844
|
return this;
|
|
477
845
|
}
|
|
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
|
+
*/
|
|
478
862
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
479
863
|
this.log.logName = deviceName;
|
|
480
864
|
this.deviceName = deviceName;
|
|
@@ -507,6 +891,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
507
891
|
});
|
|
508
892
|
return this;
|
|
509
893
|
}
|
|
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
|
+
*/
|
|
510
901
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
511
902
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
512
903
|
identifyTime,
|
|
@@ -514,14 +905,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
514
905
|
});
|
|
515
906
|
return this;
|
|
516
907
|
}
|
|
908
|
+
/**
|
|
909
|
+
* Creates a default groups cluster server.
|
|
910
|
+
*
|
|
911
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
912
|
+
*/
|
|
517
913
|
createDefaultGroupsClusterServer() {
|
|
518
914
|
this.behaviors.require(GroupsServer);
|
|
519
915
|
return this;
|
|
520
916
|
}
|
|
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
|
+
*/
|
|
521
924
|
createDefaultScenesClusterServer() {
|
|
522
925
|
this.behaviors.require(ScenesManagementServer);
|
|
523
926
|
return this;
|
|
524
927
|
}
|
|
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
|
+
*/
|
|
525
938
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
526
939
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
527
940
|
onOff,
|
|
@@ -532,24 +945,52 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
532
945
|
});
|
|
533
946
|
return this;
|
|
534
947
|
}
|
|
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
|
+
*/
|
|
535
954
|
createOnOffClusterServer(onOff = false) {
|
|
536
955
|
this.behaviors.require(MatterbridgeOnOffServer, {
|
|
537
956
|
onOff,
|
|
538
957
|
});
|
|
539
958
|
return this;
|
|
540
959
|
}
|
|
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
|
+
*/
|
|
541
966
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
542
967
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
543
968
|
onOff,
|
|
544
969
|
});
|
|
545
970
|
return this;
|
|
546
971
|
}
|
|
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
|
+
*/
|
|
547
978
|
createOffOnlyOnOffClusterServer(onOff = false) {
|
|
548
979
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
|
|
549
980
|
onOff,
|
|
550
981
|
});
|
|
551
982
|
return this;
|
|
552
983
|
}
|
|
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
|
+
*/
|
|
553
994
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
554
995
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
555
996
|
currentLevel,
|
|
@@ -565,6 +1006,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
565
1006
|
});
|
|
566
1007
|
return this;
|
|
567
1008
|
}
|
|
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
|
+
*/
|
|
568
1016
|
createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
|
|
569
1017
|
this.behaviors.require(MatterbridgeLevelControlServer, {
|
|
570
1018
|
currentLevel,
|
|
@@ -576,6 +1024,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
576
1024
|
});
|
|
577
1025
|
return this;
|
|
578
1026
|
}
|
|
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
|
+
*/
|
|
579
1046
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
580
1047
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
581
1048
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -598,6 +1065,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
598
1065
|
});
|
|
599
1066
|
return this;
|
|
600
1067
|
}
|
|
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
|
+
*/
|
|
601
1087
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
602
1088
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
603
1089
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -618,6 +1104,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
618
1104
|
});
|
|
619
1105
|
return this;
|
|
620
1106
|
}
|
|
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
|
+
*/
|
|
621
1123
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
622
1124
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
623
1125
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -638,6 +1140,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
638
1140
|
});
|
|
639
1141
|
return this;
|
|
640
1142
|
}
|
|
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
|
+
*/
|
|
641
1157
|
createCtColorControlClusterServer(colorTemperatureMireds = 250, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
642
1158
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
643
1159
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -656,15 +1172,34 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
656
1172
|
});
|
|
657
1173
|
return this;
|
|
658
1174
|
}
|
|
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
|
+
*/
|
|
659
1182
|
async configureColorControlMode(colorMode) {
|
|
660
1183
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
661
1184
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
662
1185
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
663
1186
|
}
|
|
664
1187
|
}
|
|
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
|
+
*/
|
|
665
1200
|
createDefaultWindowCoveringClusterServer(positionPercent100ths, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade) {
|
|
666
1201
|
this.behaviors.require(MatterbridgeLiftWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
667
|
-
type,
|
|
1202
|
+
type, // Must support feature Lift
|
|
668
1203
|
numberOfActuationsLift: 0,
|
|
669
1204
|
configStatus: {
|
|
670
1205
|
operational: true,
|
|
@@ -672,20 +1207,33 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
672
1207
|
liftMovementReversed: false,
|
|
673
1208
|
liftPositionAware: true,
|
|
674
1209
|
tiltPositionAware: false,
|
|
675
|
-
liftEncoderControlled: false,
|
|
676
|
-
tiltEncoderControlled: false,
|
|
1210
|
+
liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
1211
|
+
tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
677
1212
|
},
|
|
678
1213
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
679
|
-
endProductType,
|
|
1214
|
+
endProductType, // Must support feature Lift
|
|
680
1215
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
681
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
682
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1216
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1217
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
683
1218
|
});
|
|
684
1219
|
return this;
|
|
685
1220
|
}
|
|
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
|
+
*/
|
|
686
1234
|
createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind) {
|
|
687
1235
|
this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt), {
|
|
688
|
-
type,
|
|
1236
|
+
type, // Must support features Lift and Tilt
|
|
689
1237
|
numberOfActuationsLift: 0,
|
|
690
1238
|
numberOfActuationsTilt: 0,
|
|
691
1239
|
configStatus: {
|
|
@@ -694,19 +1242,23 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
694
1242
|
liftMovementReversed: false,
|
|
695
1243
|
liftPositionAware: true,
|
|
696
1244
|
tiltPositionAware: true,
|
|
697
|
-
liftEncoderControlled: false,
|
|
698
|
-
tiltEncoderControlled: false,
|
|
1245
|
+
liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
1246
|
+
tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
699
1247
|
},
|
|
700
1248
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
701
|
-
endProductType,
|
|
1249
|
+
endProductType, // Must support features Lift and Tilt
|
|
702
1250
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
703
|
-
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
704
|
-
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
705
|
-
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
706
|
-
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
1251
|
+
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1252
|
+
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1253
|
+
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1254
|
+
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
707
1255
|
});
|
|
708
1256
|
return this;
|
|
709
1257
|
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Sets the window covering lift target position as the current position and stops the movement.
|
|
1260
|
+
*
|
|
1261
|
+
*/
|
|
710
1262
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
711
1263
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
712
1264
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -726,6 +1278,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
726
1278
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
727
1279
|
}
|
|
728
1280
|
}
|
|
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
|
+
*/
|
|
729
1288
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
730
1289
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
731
1290
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -736,6 +1295,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
736
1295
|
}, this.log);
|
|
737
1296
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
738
1297
|
}
|
|
1298
|
+
/**
|
|
1299
|
+
* Sets the status of the window covering.
|
|
1300
|
+
*
|
|
1301
|
+
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1302
|
+
*/
|
|
739
1303
|
async setWindowCoveringStatus(status) {
|
|
740
1304
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
741
1305
|
global: status,
|
|
@@ -744,6 +1308,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
744
1308
|
}, this.log);
|
|
745
1309
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
746
1310
|
}
|
|
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
|
+
*/
|
|
747
1316
|
getWindowCoveringStatus() {
|
|
748
1317
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
749
1318
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -751,6 +1320,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
751
1320
|
return status.global;
|
|
752
1321
|
}
|
|
753
1322
|
}
|
|
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
|
+
*/
|
|
754
1329
|
async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
|
|
755
1330
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', liftPosition, this.log);
|
|
756
1331
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', liftPosition, this.log);
|
|
@@ -761,31 +1336,57 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
761
1336
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
|
|
762
1337
|
}
|
|
763
1338
|
}
|
|
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
|
+
*/
|
|
764
1352
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
765
1353
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
766
1354
|
localTemperature: localTemperature * 100,
|
|
767
1355
|
systemMode: Thermostat.SystemMode.Auto,
|
|
768
1356
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1357
|
+
// Thermostat.Feature.Heating
|
|
769
1358
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
770
1359
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
771
1360
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
772
1361
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
773
1362
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1363
|
+
// Thermostat.Feature.Cooling
|
|
774
1364
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
775
1365
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
776
1366
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
777
1367
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
778
1368
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1369
|
+
// Thermostat.Feature.AutoMode
|
|
779
1370
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
780
1371
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
781
1372
|
});
|
|
782
1373
|
return this;
|
|
783
1374
|
}
|
|
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
|
+
*/
|
|
784
1384
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
785
1385
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
|
|
786
1386
|
localTemperature: localTemperature * 100,
|
|
787
1387
|
systemMode: Thermostat.SystemMode.Heat,
|
|
788
1388
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1389
|
+
// Thermostat.Feature.Heating
|
|
789
1390
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
790
1391
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
791
1392
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -794,11 +1395,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
794
1395
|
});
|
|
795
1396
|
return this;
|
|
796
1397
|
}
|
|
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
|
+
*/
|
|
797
1407
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
798
1408
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
|
|
799
1409
|
localTemperature: localTemperature * 100,
|
|
800
1410
|
systemMode: Thermostat.SystemMode.Cool,
|
|
801
1411
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1412
|
+
// Thermostat.Feature.Cooling
|
|
802
1413
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
803
1414
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
804
1415
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -807,6 +1418,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
807
1418
|
});
|
|
808
1419
|
return this;
|
|
809
1420
|
}
|
|
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
|
+
*/
|
|
810
1431
|
createDefaultThermostatUserInterfaceConfigurationClusterServer() {
|
|
811
1432
|
this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
|
|
812
1433
|
temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
|
|
@@ -815,69 +1436,159 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
815
1436
|
});
|
|
816
1437
|
return this;
|
|
817
1438
|
}
|
|
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
|
+
*/
|
|
818
1453
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0) {
|
|
819
1454
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
820
|
-
fanMode,
|
|
821
|
-
fanModeSequence,
|
|
822
|
-
percentSetting,
|
|
1455
|
+
fanMode, // Writable and persistent attribute
|
|
1456
|
+
fanModeSequence, // Fixed attribute
|
|
1457
|
+
percentSetting, // Writable attribute
|
|
823
1458
|
percentCurrent,
|
|
824
1459
|
});
|
|
825
1460
|
return this;
|
|
826
1461
|
}
|
|
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
|
+
*/
|
|
827
1481
|
createMultiSpeedFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0, speedMax = 10, speedSetting = 0, speedCurrent = 0) {
|
|
828
1482
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
829
|
-
fanMode,
|
|
830
|
-
fanModeSequence,
|
|
831
|
-
percentSetting,
|
|
1483
|
+
fanMode, // Writable and persistent attribute
|
|
1484
|
+
fanModeSequence, // Fixed attribute
|
|
1485
|
+
percentSetting, // Writable attribute
|
|
832
1486
|
percentCurrent,
|
|
833
|
-
|
|
834
|
-
|
|
1487
|
+
// MultiSpeed feature
|
|
1488
|
+
speedMax, // Fixed attribute
|
|
1489
|
+
speedSetting, // Writable attribute
|
|
835
1490
|
speedCurrent,
|
|
836
1491
|
});
|
|
837
1492
|
return this;
|
|
838
1493
|
}
|
|
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
|
+
*/
|
|
839
1508
|
createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHigh, percentSetting = 0, percentCurrent = 0) {
|
|
840
1509
|
this.behaviors.require(FanControlServer, {
|
|
841
|
-
fanMode,
|
|
842
|
-
fanModeSequence,
|
|
843
|
-
percentSetting,
|
|
1510
|
+
fanMode, // Writable and persistent attribute
|
|
1511
|
+
fanModeSequence, // Fixed attribute
|
|
1512
|
+
percentSetting, // Writable attribute
|
|
844
1513
|
percentCurrent,
|
|
845
1514
|
});
|
|
846
1515
|
return this;
|
|
847
1516
|
}
|
|
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
|
+
*/
|
|
848
1527
|
createDefaultHepaFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
849
1528
|
this.behaviors.require(HepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
850
|
-
condition: 100,
|
|
851
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1529
|
+
condition: 100, // Feature.Condition
|
|
1530
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
|
|
852
1531
|
changeIndication,
|
|
853
1532
|
inPlaceIndicator,
|
|
854
1533
|
lastChangedTime,
|
|
855
|
-
replacementProductList: [],
|
|
1534
|
+
replacementProductList: [], // Feature.ReplacementProductList
|
|
856
1535
|
});
|
|
857
1536
|
return this;
|
|
858
1537
|
}
|
|
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
|
+
*/
|
|
859
1547
|
createDefaultActivatedCarbonFilterMonitoringClusterServer(changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = undefined, lastChangedTime = undefined) {
|
|
860
1548
|
this.behaviors.require(ActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
861
|
-
condition: 100,
|
|
862
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1549
|
+
condition: 100, // Feature.Condition
|
|
1550
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Feature.Condition
|
|
863
1551
|
changeIndication,
|
|
864
1552
|
inPlaceIndicator,
|
|
865
1553
|
lastChangedTime,
|
|
866
|
-
replacementProductList: [],
|
|
1554
|
+
replacementProductList: [], // Feature.ReplacementProductList
|
|
867
1555
|
});
|
|
868
1556
|
return this;
|
|
869
1557
|
}
|
|
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
|
+
*/
|
|
870
1568
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
871
1569
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
872
1570
|
lockState,
|
|
873
1571
|
lockType,
|
|
874
1572
|
actuatorEnabled: false,
|
|
875
1573
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
1574
|
+
// Special case of inverted bitmap: add also alwaysSet = 2047
|
|
876
1575
|
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
|
|
877
1576
|
alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
|
|
878
1577
|
});
|
|
879
1578
|
return this;
|
|
880
1579
|
}
|
|
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
|
+
*/
|
|
881
1592
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
882
1593
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
883
1594
|
description: description,
|
|
@@ -888,21 +1599,35 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
888
1599
|
});
|
|
889
1600
|
return this;
|
|
890
1601
|
}
|
|
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
|
+
*/
|
|
891
1609
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
892
1610
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
893
1611
|
currentState: valveState,
|
|
894
1612
|
targetState: valveState,
|
|
895
1613
|
openDuration: null,
|
|
896
|
-
defaultOpenDuration: null,
|
|
1614
|
+
defaultOpenDuration: null, // Writable and persistent across restarts
|
|
897
1615
|
remainingDuration: null,
|
|
898
1616
|
valveFault: { generalFault: false, blocked: false, leaking: false, notConnected: false, shortCircuit: false, currentExceeded: false },
|
|
1617
|
+
// Feature.Level
|
|
899
1618
|
currentLevel: valveLevel,
|
|
900
1619
|
targetLevel: valveLevel,
|
|
901
|
-
defaultOpenLevel: 100,
|
|
902
|
-
levelStep: 1,
|
|
1620
|
+
defaultOpenLevel: 100, // Writable and persistent across restarts
|
|
1621
|
+
levelStep: 1, // Fixed
|
|
903
1622
|
});
|
|
904
1623
|
return this;
|
|
905
1624
|
}
|
|
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
|
+
*/
|
|
906
1631
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
907
1632
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
908
1633
|
minConstSpeed: null,
|
|
@@ -917,6 +1642,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
917
1642
|
});
|
|
918
1643
|
return this;
|
|
919
1644
|
}
|
|
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
|
+
*/
|
|
920
1652
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
921
1653
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
922
1654
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -932,6 +1664,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
932
1664
|
});
|
|
933
1665
|
return this;
|
|
934
1666
|
}
|
|
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
|
+
*/
|
|
935
1673
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
936
1674
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
937
1675
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -946,6 +1684,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
946
1684
|
});
|
|
947
1685
|
return this;
|
|
948
1686
|
}
|
|
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
|
+
*/
|
|
949
1693
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
950
1694
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
951
1695
|
events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -960,6 +1704,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
960
1704
|
});
|
|
961
1705
|
return this;
|
|
962
1706
|
}
|
|
1707
|
+
/**
|
|
1708
|
+
* Creates a default momentary switch cluster server with features MomentarySwitch, MomentarySwitchRelease, MomentarySwitchLongPress and MomentarySwitchMultiPress.
|
|
1709
|
+
*
|
|
1710
|
+
* @remarks
|
|
1711
|
+
* This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
|
|
1712
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1713
|
+
*/
|
|
963
1714
|
createDefaultSwitchClusterServer() {
|
|
964
1715
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
965
1716
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -970,6 +1721,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
970
1721
|
});
|
|
971
1722
|
return this;
|
|
972
1723
|
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Creates a default latching switch cluster server with features LatchingSwitch.
|
|
1726
|
+
*
|
|
1727
|
+
* @remarks
|
|
1728
|
+
* This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
|
|
1729
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1730
|
+
*/
|
|
973
1731
|
createDefaultLatchingSwitchClusterServer() {
|
|
974
1732
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
975
1733
|
events: { switchLatched: true },
|
|
@@ -979,6 +1737,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
979
1737
|
});
|
|
980
1738
|
return this;
|
|
981
1739
|
}
|
|
1740
|
+
/**
|
|
1741
|
+
* Triggers a switch event on the specified endpoint.
|
|
1742
|
+
*
|
|
1743
|
+
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1744
|
+
* @param {AnsiLogger} log - Optional logger to log the event.
|
|
1745
|
+
* @returns {boolean} - A boolean indicating whether the event was successfully triggered.
|
|
1746
|
+
*/
|
|
982
1747
|
async triggerSwitchEvent(event, log) {
|
|
983
1748
|
if (this.maybeNumber === undefined) {
|
|
984
1749
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1038,10 +1803,30 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1038
1803
|
}
|
|
1039
1804
|
return true;
|
|
1040
1805
|
}
|
|
1806
|
+
/**
|
|
1807
|
+
* Creates a default OperationalState Cluster Server.
|
|
1808
|
+
*
|
|
1809
|
+
* @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state.
|
|
1810
|
+
*
|
|
1811
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1812
|
+
*/
|
|
1041
1813
|
createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
|
1042
1814
|
this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
|
|
1043
1815
|
return this;
|
|
1044
1816
|
}
|
|
1817
|
+
/**
|
|
1818
|
+
* Creates a default boolean state cluster server.
|
|
1819
|
+
* The stateChange event is enabled.
|
|
1820
|
+
*
|
|
1821
|
+
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
|
|
1822
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1823
|
+
*
|
|
1824
|
+
* @remarks
|
|
1825
|
+
* Water Leak Detector: true = leak, false = no leak
|
|
1826
|
+
* Water Freeze Detector: true = freeze, false = no freeze
|
|
1827
|
+
* Rain Sensor: true = rain, false = no rain
|
|
1828
|
+
* Contact Sensor: true = closed or contact, false = open or no contact
|
|
1829
|
+
*/
|
|
1045
1830
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1046
1831
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1047
1832
|
events: { stateChange: true },
|
|
@@ -1050,6 +1835,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1050
1835
|
});
|
|
1051
1836
|
return this;
|
|
1052
1837
|
}
|
|
1838
|
+
/**
|
|
1839
|
+
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
|
|
1840
|
+
*
|
|
1841
|
+
* Features:
|
|
1842
|
+
* - Visual
|
|
1843
|
+
* - Audible
|
|
1844
|
+
* - SensitivityLevel
|
|
1845
|
+
*
|
|
1846
|
+
* @remarks Supports the enableDisableAlarm command.
|
|
1847
|
+
*
|
|
1848
|
+
* @param {boolean} [sensorFault] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1849
|
+
* @param {number} [currentSensitivityLevel] - The current sensitivity level. Defaults to `0` if not provided.
|
|
1850
|
+
* @param {number} [supportedSensitivityLevels] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
|
|
1851
|
+
* @param {number} [defaultSensitivityLevel] - The default sensitivity level. Defaults to `0` if not provided.
|
|
1852
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1853
|
+
*/
|
|
1053
1854
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1054
1855
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1055
1856
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -1064,18 +1865,51 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1064
1865
|
});
|
|
1065
1866
|
return this;
|
|
1066
1867
|
}
|
|
1868
|
+
/**
|
|
1869
|
+
* Creates a default Device Energy Management Cluster Server with feature PowerForecastReporting and with the specified ESA type, ESA canGenerate, ESA state, and power limits.
|
|
1870
|
+
*
|
|
1871
|
+
* @param {DeviceEnergyManagement.EsaType} [esaType] - The ESA type. Defaults to `DeviceEnergyManagement.EsaType.Other`.
|
|
1872
|
+
* @param {boolean} [esaCanGenerate] - Indicates if the ESA can generate energy. Defaults to `false`.
|
|
1873
|
+
* @param {DeviceEnergyManagement.EsaState} [esaState] - The ESA state. Defaults to `DeviceEnergyManagement.EsaState.Online`.
|
|
1874
|
+
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
1875
|
+
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
1876
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1877
|
+
*
|
|
1878
|
+
* @remarks
|
|
1879
|
+
* - The forecast attribute is set to null, indicating that there is no forecast currently available.
|
|
1880
|
+
* - The ESA type and canGenerate attributes are fixed and cannot be changed after creation.
|
|
1881
|
+
* - The ESA state is set to Online by default.
|
|
1882
|
+
* - The absolute minimum and maximum power attributes are set to 0 by default.
|
|
1883
|
+
* - For example, a battery storage inverter that can charge its battery at a maximum power of 2000W and can
|
|
1884
|
+
* discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
|
|
1885
|
+
*/
|
|
1067
1886
|
createDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
|
|
1068
1887
|
this.behaviors.require(MatterbridgeDeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.PowerAdjustment), {
|
|
1069
|
-
forecast: null,
|
|
1070
|
-
powerAdjustmentCapability: null,
|
|
1071
|
-
esaType,
|
|
1072
|
-
esaCanGenerate,
|
|
1888
|
+
forecast: null, // A null value indicates that there is no forecast currently available
|
|
1889
|
+
powerAdjustmentCapability: null, // A null value indicates that no power adjustment is currently possible, and nor is any adjustment currently active
|
|
1890
|
+
esaType, // Fixed attribute
|
|
1891
|
+
esaCanGenerate, // Fixed attribute
|
|
1073
1892
|
esaState,
|
|
1074
1893
|
absMinPower,
|
|
1075
1894
|
absMaxPower,
|
|
1076
1895
|
});
|
|
1077
1896
|
return this;
|
|
1078
1897
|
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Creates a default EnergyManagementMode Cluster Server.
|
|
1900
|
+
*
|
|
1901
|
+
* @param {number} [currentMode] - The current mode of the EnergyManagementMode cluster. Defaults to mode 1 (DeviceEnergyManagementMode.ModeTag.NoOptimization).
|
|
1902
|
+
* @param {EnergyManagementMode.ModeOption[]} [supportedModes] - The supported modes for the DeviceEnergyManagementMode cluster. The attribute is fixed and defaults to a predefined set of cluster modes.
|
|
1903
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1904
|
+
*
|
|
1905
|
+
* @remarks
|
|
1906
|
+
* A few examples of Device Energy Management modes and their mode tags are provided below.
|
|
1907
|
+
* - For the "No Energy Management (Forecast reporting only)" mode, tags: 0x4000 (NoOptimization).
|
|
1908
|
+
* - For the "Device Energy Management" mode, tags: 0x4001 (DeviceOptimization).
|
|
1909
|
+
* - For the "Home Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization).
|
|
1910
|
+
* - For the "Grid Energy Management" mode, tags: 0x4003 (GridOptimization).
|
|
1911
|
+
* - For the "Full Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization), 0x4003 (GridOptimization).
|
|
1912
|
+
*/
|
|
1079
1913
|
createDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
|
|
1080
1914
|
this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, {
|
|
1081
1915
|
supportedModes: supportedModes ?? [
|
|
@@ -1096,15 +1930,27 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1096
1930
|
mode: 5,
|
|
1097
1931
|
modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.DeviceOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }, { value: DeviceEnergyManagementMode.ModeTag.GridOptimization }],
|
|
1098
1932
|
},
|
|
1099
|
-
],
|
|
1933
|
+
], // Fixed attribute
|
|
1100
1934
|
currentMode: currentMode ?? 1,
|
|
1101
1935
|
});
|
|
1102
1936
|
return this;
|
|
1103
1937
|
}
|
|
1938
|
+
/**
|
|
1939
|
+
* 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.
|
|
1940
|
+
*
|
|
1941
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1942
|
+
*/
|
|
1104
1943
|
createDefaultPowerTopologyClusterServer() {
|
|
1105
1944
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1106
1945
|
return this;
|
|
1107
1946
|
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Creates a default Electrical Energy Measurement Cluster Server with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
|
|
1949
|
+
*
|
|
1950
|
+
* @param {number} energyImported - The total consumption value in mW/h.
|
|
1951
|
+
* @param {number} energyExported - The total production value in mW/h.
|
|
1952
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1953
|
+
*/
|
|
1108
1954
|
createDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
|
|
1109
1955
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1110
1956
|
accuracy: {
|
|
@@ -1120,6 +1966,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1120
1966
|
});
|
|
1121
1967
|
return this;
|
|
1122
1968
|
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Creates a default Electrical Power Measurement Cluster Server with features AlternatingCurrent.
|
|
1971
|
+
*
|
|
1972
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
1973
|
+
* @param {number} current - The current value in milliamperes.
|
|
1974
|
+
* @param {number} power - The power value in milliwatts.
|
|
1975
|
+
* @param {number} frequency - The frequency value in millihertz.
|
|
1976
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1977
|
+
*/
|
|
1123
1978
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1124
1979
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1125
1980
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1161,36 +2016,112 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1161
2016
|
});
|
|
1162
2017
|
return this;
|
|
1163
2018
|
}
|
|
2019
|
+
/**
|
|
2020
|
+
* Creates a default TemperatureMeasurement cluster server.
|
|
2021
|
+
*
|
|
2022
|
+
* @param {number | null} measuredValue - The measured value of the temperature x 100.
|
|
2023
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
|
|
2024
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
|
|
2025
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2026
|
+
*/
|
|
1164
2027
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1165
2028
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1166
2029
|
return this;
|
|
1167
2030
|
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Creates a default RelativeHumidityMeasurement cluster server.
|
|
2033
|
+
*
|
|
2034
|
+
* @param {number | null} measuredValue - The measured value of the relative humidity x 100.
|
|
2035
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
|
|
2036
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
|
|
2037
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2038
|
+
*/
|
|
1168
2039
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1169
2040
|
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1170
2041
|
return this;
|
|
1171
2042
|
}
|
|
2043
|
+
/**
|
|
2044
|
+
* Creates a default PressureMeasurement cluster server.
|
|
2045
|
+
*
|
|
2046
|
+
* @param {number | null} measuredValue - The measured value for the pressure.
|
|
2047
|
+
* @param {number | null} minMeasuredValue - The minimum measured value for the pressure.
|
|
2048
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value for the pressure.
|
|
2049
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2050
|
+
*/
|
|
1172
2051
|
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1173
2052
|
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1174
2053
|
return this;
|
|
1175
2054
|
}
|
|
2055
|
+
/**
|
|
2056
|
+
* Creates a default IlluminanceMeasurement cluster server.
|
|
2057
|
+
*
|
|
2058
|
+
* @param {number | null} measuredValue - The measured value of illuminance.
|
|
2059
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
|
|
2060
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
|
|
2061
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2062
|
+
*
|
|
2063
|
+
* @remarks The default value for the illuminance measurement is null.
|
|
2064
|
+
* This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
|
|
2065
|
+
* • MeasuredValue = 10,000 x log10(illuminance) + 1,
|
|
2066
|
+
* where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
|
|
2067
|
+
* • 0 indicates a value of illuminance that is too low to be measured
|
|
2068
|
+
* • null indicates that the illuminance measurement is invalid.
|
|
2069
|
+
*
|
|
2070
|
+
* - Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
|
|
2071
|
+
* - Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
|
|
2072
|
+
*/
|
|
1176
2073
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1177
2074
|
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1178
2075
|
return this;
|
|
1179
2076
|
}
|
|
2077
|
+
/**
|
|
2078
|
+
* Creates a default FlowMeasurement cluster server.
|
|
2079
|
+
*
|
|
2080
|
+
* @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
|
|
2081
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
|
|
2082
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
|
|
2083
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2084
|
+
*/
|
|
1180
2085
|
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1181
2086
|
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1182
2087
|
return this;
|
|
1183
2088
|
}
|
|
2089
|
+
/**
|
|
2090
|
+
* Creates a default OccupancySensing cluster server with feature PassiveInfrared.
|
|
2091
|
+
*
|
|
2092
|
+
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
2093
|
+
* @param {number} holdTime - The hold time in seconds. Default is 30.
|
|
2094
|
+
* @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
|
|
2095
|
+
* @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
|
|
2096
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2097
|
+
*
|
|
2098
|
+
* @remarks The default value for the occupancy sensor type is PIR.
|
|
2099
|
+
*/
|
|
1184
2100
|
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
1185
2101
|
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
1186
2102
|
return this;
|
|
1187
2103
|
}
|
|
2104
|
+
/**
|
|
2105
|
+
* Creates a default AirQuality cluster server.
|
|
2106
|
+
*
|
|
2107
|
+
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2108
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2109
|
+
*/
|
|
1188
2110
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1189
2111
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1190
2112
|
airQuality,
|
|
1191
2113
|
});
|
|
1192
2114
|
return this;
|
|
1193
2115
|
}
|
|
2116
|
+
/**
|
|
2117
|
+
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2118
|
+
*
|
|
2119
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2120
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2121
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2122
|
+
* @param {number} [uncertainty] - The uncertainty value (optional).
|
|
2123
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2124
|
+
*/
|
|
1194
2125
|
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
1195
2126
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1196
2127
|
measuredValue,
|
|
@@ -1202,6 +2133,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1202
2133
|
});
|
|
1203
2134
|
return this;
|
|
1204
2135
|
}
|
|
2136
|
+
/**
|
|
2137
|
+
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature LevelIndication.
|
|
2138
|
+
|
|
2139
|
+
* @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
|
|
2140
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2141
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2142
|
+
*/
|
|
1205
2143
|
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1206
2144
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
1207
2145
|
levelValue,
|
|
@@ -1209,6 +2147,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1209
2147
|
});
|
|
1210
2148
|
return this;
|
|
1211
2149
|
}
|
|
2150
|
+
/**
|
|
2151
|
+
* Create a default CarbonMonoxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2152
|
+
*
|
|
2153
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2154
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2155
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2156
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2157
|
+
*/
|
|
1212
2158
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1213
2159
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1214
2160
|
measuredValue,
|
|
@@ -1220,6 +2166,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1220
2166
|
});
|
|
1221
2167
|
return this;
|
|
1222
2168
|
}
|
|
2169
|
+
/**
|
|
2170
|
+
* Create a default CarbonDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2171
|
+
*
|
|
2172
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2173
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2174
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2175
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2176
|
+
*/
|
|
1223
2177
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1224
2178
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1225
2179
|
measuredValue,
|
|
@@ -1231,6 +2185,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1231
2185
|
});
|
|
1232
2186
|
return this;
|
|
1233
2187
|
}
|
|
2188
|
+
/**
|
|
2189
|
+
* Create a default FormaldehydeConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2190
|
+
*
|
|
2191
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2192
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2193
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2194
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2195
|
+
*/
|
|
1234
2196
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1235
2197
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1236
2198
|
measuredValue,
|
|
@@ -1242,6 +2204,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1242
2204
|
});
|
|
1243
2205
|
return this;
|
|
1244
2206
|
}
|
|
2207
|
+
/**
|
|
2208
|
+
* Create a default Pm1ConcentrationMeasurement 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
|
+
*/
|
|
1245
2215
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1246
2216
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1247
2217
|
measuredValue,
|
|
@@ -1253,6 +2223,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1253
2223
|
});
|
|
1254
2224
|
return this;
|
|
1255
2225
|
}
|
|
2226
|
+
/**
|
|
2227
|
+
* Create a default Pm25ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2228
|
+
*
|
|
2229
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2230
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2231
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2232
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2233
|
+
*/
|
|
1256
2234
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1257
2235
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1258
2236
|
measuredValue,
|
|
@@ -1264,6 +2242,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1264
2242
|
});
|
|
1265
2243
|
return this;
|
|
1266
2244
|
}
|
|
2245
|
+
/**
|
|
2246
|
+
* Create a default Pm10ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2247
|
+
*
|
|
2248
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2249
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2250
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2251
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2252
|
+
*/
|
|
1267
2253
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1268
2254
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1269
2255
|
measuredValue,
|
|
@@ -1275,6 +2261,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1275
2261
|
});
|
|
1276
2262
|
return this;
|
|
1277
2263
|
}
|
|
2264
|
+
/**
|
|
2265
|
+
* Create a default OzoneConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2266
|
+
*
|
|
2267
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2268
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2269
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2270
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2271
|
+
*/
|
|
1278
2272
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1279
2273
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1280
2274
|
measuredValue,
|
|
@@ -1286,6 +2280,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1286
2280
|
});
|
|
1287
2281
|
return this;
|
|
1288
2282
|
}
|
|
2283
|
+
/**
|
|
2284
|
+
* Create a default RadonConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2285
|
+
*
|
|
2286
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2287
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2288
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2289
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2290
|
+
*/
|
|
1289
2291
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1290
2292
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1291
2293
|
measuredValue,
|
|
@@ -1297,6 +2299,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1297
2299
|
});
|
|
1298
2300
|
return this;
|
|
1299
2301
|
}
|
|
2302
|
+
/**
|
|
2303
|
+
* Create a default NitrogenDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2304
|
+
*
|
|
2305
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2306
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2307
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2308
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2309
|
+
*/
|
|
1300
2310
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1301
2311
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1302
2312
|
measuredValue,
|
|
@@ -1309,3 +2319,4 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1309
2319
|
return this;
|
|
1310
2320
|
}
|
|
1311
2321
|
}
|
|
2322
|
+
//# sourceMappingURL=matterbridgeEndpoint.js.map
|