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