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