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