matterbridge 3.1.8 → 3.1.9-dev-20250729-d64715f
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 +13 -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 +13 -126
- package/dist/dgram/dgram.js +2 -113
- package/dist/dgram/mb_coap.js +3 -41
- package/dist/dgram/mb_mdns.js +13 -51
- package/dist/dgram/mdns.js +137 -298
- package/dist/dgram/multicast.js +1 -60
- package/dist/dgram/unicast.js +0 -54
- package/dist/frontend.js +23 -449
- 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 -803
- 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 +55 -1215
- package/dist/matterbridgeEndpointHelpers.js +12 -344
- 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 -63
- 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 -123
- 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 +48 -48
- package/package.json +2 -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/coap.d.ts +0 -205
- package/dist/dgram/coap.d.ts.map +0 -1
- package/dist/dgram/coap.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/mb_coap.d.ts +0 -24
- package/dist/dgram/mb_coap.d.ts.map +0 -1
- package/dist/dgram/mb_coap.js.map +0 -1
- package/dist/dgram/mb_mdns.d.ts +0 -24
- package/dist/dgram/mb_mdns.d.ts.map +0 -1
- package/dist/dgram/mb_mdns.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 -313
- 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 -463
- 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 -1348
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -406
- 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 -197
- 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 -68
- 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 -89
- 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, featuresFor, } 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,
|
|
@@ -179,23 +117,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
179
117
|
optional: SupportedBehaviors(...getBehaviourTypesFromClusterClientIds(firstDefinition.optionalClientClusters)),
|
|
180
118
|
},
|
|
181
119
|
},
|
|
182
|
-
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) :
|
|
120
|
+
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : SupportedBehaviors(DescriptorServer),
|
|
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,273 +813,95 @@ 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 and mode Off Low Med High Auto.
|
|
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 an On Off fan control cluster server without features and mode Off High.
|
|
1463
|
-
*
|
|
1464
|
-
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1465
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1466
|
-
*
|
|
1467
|
-
* @remarks
|
|
1468
|
-
* fanmode is writable and persists across reboots.
|
|
1469
|
-
* fanModeSequence is fixed.
|
|
1470
|
-
* percentSetting is writable.
|
|
1471
|
-
*/
|
|
1472
825
|
createOnOffFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1473
826
|
this.behaviors.require(FanControlServer, {
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
percentSetting: 0, // Writable attribute
|
|
827
|
+
fanMode,
|
|
828
|
+
fanModeSequence: FanControl.FanModeSequence.OffHigh,
|
|
829
|
+
percentSetting: 0,
|
|
1478
830
|
percentCurrent: 0,
|
|
1479
831
|
});
|
|
1480
832
|
return this;
|
|
1481
833
|
}
|
|
1482
|
-
/**
|
|
1483
|
-
* Creates a base fan control cluster server without features and mode Off Low Med High.
|
|
1484
|
-
*
|
|
1485
|
-
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1486
|
-
* @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHigh`.
|
|
1487
|
-
* @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
|
|
1488
|
-
* @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
|
|
1489
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1490
|
-
*
|
|
1491
|
-
* @remarks
|
|
1492
|
-
* fanmode is writable and persists across reboots.
|
|
1493
|
-
* fanModeSequence is fixed.
|
|
1494
|
-
* percentSetting is writable.
|
|
1495
|
-
*/
|
|
1496
834
|
createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHigh, percentSetting = 0, percentCurrent = 0) {
|
|
1497
835
|
this.behaviors.require(FanControlServer, {
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
percentSetting, // Writable attribute
|
|
836
|
+
fanMode,
|
|
837
|
+
fanModeSequence,
|
|
838
|
+
percentSetting,
|
|
1502
839
|
percentCurrent,
|
|
1503
840
|
});
|
|
1504
841
|
return this;
|
|
1505
842
|
}
|
|
1506
|
-
/**
|
|
1507
|
-
* Creates a fan control cluster server with features MultiSpeed, Auto, and Step and mode Off Low Med High Auto.
|
|
1508
|
-
*
|
|
1509
|
-
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1510
|
-
* @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
|
|
1511
|
-
* @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
|
|
1512
|
-
* @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
|
|
1513
|
-
* @param {number} [speedMax] - The maximum speed setting. Defaults to 10.
|
|
1514
|
-
* @param {number} [speedSetting] - The initial speed setting. Defaults to 0.
|
|
1515
|
-
* @param {number} [speedCurrent] - The initial speed current. Defaults to 0.
|
|
1516
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1517
|
-
*
|
|
1518
|
-
* @remarks
|
|
1519
|
-
* - fanmode is writable and persists across reboots.
|
|
1520
|
-
* - fanModeSequence is fixed.
|
|
1521
|
-
* - percentSetting is writable.
|
|
1522
|
-
* - speedMax is fixed.
|
|
1523
|
-
* - speedSetting is writable.
|
|
1524
|
-
*/
|
|
1525
843
|
createMultiSpeedFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0, speedMax = 10, speedSetting = 0, speedCurrent = 0) {
|
|
1526
844
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
percentSetting, // Writable attribute
|
|
845
|
+
fanMode,
|
|
846
|
+
fanModeSequence,
|
|
847
|
+
percentSetting,
|
|
1531
848
|
percentCurrent,
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
speedSetting, // Writable attribute
|
|
849
|
+
speedMax,
|
|
850
|
+
speedSetting,
|
|
1535
851
|
speedCurrent,
|
|
1536
852
|
});
|
|
1537
853
|
return this;
|
|
1538
854
|
}
|
|
1539
|
-
/**
|
|
1540
|
-
* Creates a fan control cluster server with features MultiSpeed, Auto, Step, Rock, Wind and AirflowDirection and mode Off Low Med High Auto.
|
|
1541
|
-
*
|
|
1542
|
-
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1543
|
-
* @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
|
|
1544
|
-
* @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
|
|
1545
|
-
* @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
|
|
1546
|
-
* @param {number} [speedMax] - The maximum speed setting. Defaults to 10.
|
|
1547
|
-
* @param {number} [speedSetting] - The initial speed setting. Defaults to 0.
|
|
1548
|
-
* @param {number} [speedCurrent] - The initial speed current. Defaults to 0.
|
|
1549
|
-
* @param {object} [rockSupport] - The rock support configuration.
|
|
1550
|
-
* @param {boolean} rockSupport.rockLeftRight - Indicates support for rocking left to right. Defaults to true.
|
|
1551
|
-
* @param {boolean} rockSupport.rockUpDown - Indicates support for rocking up and down. Defaults to true.
|
|
1552
|
-
* @param {boolean} rockSupport.rockRound - Indicates support for round rocking. Defaults to true.
|
|
1553
|
-
* @param {object} [rockSetting] - The rock setting configuration.
|
|
1554
|
-
* @param {boolean} rockSetting.rockLeftRight - Indicates the current setting for rocking left to right. Defaults to true.
|
|
1555
|
-
* @param {boolean} rockSetting.rockUpDown - Indicates the current setting for rocking up and down. Defaults to true.
|
|
1556
|
-
* @param {boolean} rockSetting.rockRound - Indicates the current setting for round rocking. Defaults to true.
|
|
1557
|
-
* @param {object} [windSupport] - The wind support configuration.
|
|
1558
|
-
* @param {boolean} windSupport.sleepWind - Indicates support for sleep wind. Defaults to true.
|
|
1559
|
-
* @param {boolean} windSupport.naturalWind - Indicates support for natural wind. Defaults to true.
|
|
1560
|
-
* @param {object} [windSetting] - The wind setting configuration.
|
|
1561
|
-
* @param {boolean} windSetting.sleepWind - Indicates the current setting for sleep wind. Defaults to false.
|
|
1562
|
-
* @param {boolean} windSetting.naturalWind - Indicates the current setting for natural wind. Defaults to true.
|
|
1563
|
-
* @param {FanControl.AirflowDirection} [airflowDirection] - The airflow direction. Defaults to `FanControl.AirflowDirection.Forward`.
|
|
1564
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1565
|
-
*
|
|
1566
|
-
* @remarks
|
|
1567
|
-
* - fanmode is writable and persists across reboots.
|
|
1568
|
-
* - fanModeSequence is fixed.
|
|
1569
|
-
* - percentSetting is writable.
|
|
1570
|
-
* - speedMax is fixed.
|
|
1571
|
-
* - speedSetting is writable.
|
|
1572
|
-
* - rockSupport is fixed.
|
|
1573
|
-
* - rockSetting is writable.
|
|
1574
|
-
* - windSupport is fixed.
|
|
1575
|
-
* - windSetting is writable.
|
|
1576
|
-
* - airflowDirection is writable.
|
|
1577
|
-
*/
|
|
1578
855
|
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) {
|
|
1579
856
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step, FanControl.Feature.Rocking, FanControl.Feature.Wind, FanControl.Feature.AirflowDirection), {
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
percentSetting, // Writable attribute
|
|
857
|
+
fanMode,
|
|
858
|
+
fanModeSequence,
|
|
859
|
+
percentSetting,
|
|
1584
860
|
percentCurrent,
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
speedSetting, // Writable attribute
|
|
861
|
+
speedMax,
|
|
862
|
+
speedSetting,
|
|
1588
863
|
speedCurrent,
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
windSetting, // Writable attribute
|
|
1595
|
-
// AirflowDirection feature
|
|
1596
|
-
airflowDirection, // Writable attribute
|
|
864
|
+
rockSupport,
|
|
865
|
+
rockSetting,
|
|
866
|
+
windSupport,
|
|
867
|
+
windSetting,
|
|
868
|
+
airflowDirection,
|
|
1597
869
|
});
|
|
1598
870
|
return this;
|
|
1599
871
|
}
|
|
1600
|
-
/**
|
|
1601
|
-
* Creates a default HEPA Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
|
|
1602
|
-
* It supports ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, and ResourceMonitoring.Feature.ReplacementProductList.
|
|
1603
|
-
*
|
|
1604
|
-
* @param {number} condition - The initial condition value (range 0-100). Default is 100.
|
|
1605
|
-
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
1606
|
-
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is true.
|
|
1607
|
-
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is null.
|
|
1608
|
-
* @param {ResourceMonitoring.ReplacementProduct[]} replacementProductList - The list of replacement products. Default is an empty array. It is a fixed attribute.
|
|
1609
|
-
*
|
|
1610
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1611
|
-
*
|
|
1612
|
-
* @remarks
|
|
1613
|
-
* The HEPA Filter Monitoring Cluster Server is used to monitor the status of HEPA filters.
|
|
1614
|
-
* It provides information about the condition of the filter, whether it is in place, and the last time it was changed.
|
|
1615
|
-
* The change indication can be used to indicate if the filter needs to be replaced or serviced.
|
|
1616
|
-
* The replacement product list can be used to provide a list of replacement products for the filter.
|
|
1617
|
-
* The condition attribute is fixed at 100, indicating a healthy filter.
|
|
1618
|
-
* The degradation direction is fixed at ResourceMonitoring.DegradationDirection.Down, indicating that a lower value indicates a worse condition.
|
|
1619
|
-
* The replacement product list is initialized as an empty array.
|
|
1620
|
-
*/
|
|
1621
872
|
createDefaultHepaFilterMonitoringClusterServer(condition = 100, changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = true, lastChangedTime = null, replacementProductList = []) {
|
|
1622
873
|
this.behaviors.require(MatterbridgeHepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1623
|
-
// Feature.Condition
|
|
1624
874
|
condition,
|
|
1625
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1626
|
-
|
|
1627
|
-
replacementProductList, // Fixed attribute
|
|
1628
|
-
// Base attributes
|
|
875
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
876
|
+
replacementProductList,
|
|
1629
877
|
changeIndication,
|
|
1630
878
|
inPlaceIndicator,
|
|
1631
|
-
lastChangedTime,
|
|
879
|
+
lastChangedTime,
|
|
1632
880
|
});
|
|
1633
881
|
return this;
|
|
1634
882
|
}
|
|
1635
|
-
/**
|
|
1636
|
-
* Creates a default Activated Carbon Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
|
|
1637
|
-
* It supports ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, and ResourceMonitoring.Feature.ReplacementProductList.
|
|
1638
|
-
*
|
|
1639
|
-
* @param {number} condition - The initial condition value (range 0-100). Default is 100.
|
|
1640
|
-
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
1641
|
-
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
|
|
1642
|
-
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
|
|
1643
|
-
* @param {ResourceMonitoring.ReplacementProduct[]} replacementProductList - The list of replacement products. Default is an empty array. It is a fixed attribute.
|
|
1644
|
-
*
|
|
1645
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1646
|
-
*
|
|
1647
|
-
* @remarks
|
|
1648
|
-
* The Activated Carbon Filter Monitoring Cluster Server is used to monitor the status of activated carbon filters.
|
|
1649
|
-
* It provides information about the condition of the filter, whether it is in place, and the last time it was changed.
|
|
1650
|
-
* The change indication can be used to indicate if the filter needs to be replaced or serviced.
|
|
1651
|
-
* The replacement product list can be used to provide a list of replacement products for the filter.
|
|
1652
|
-
* The condition attribute is fixed at 100, indicating a healthy filter.
|
|
1653
|
-
* The degradation direction is fixed at ResourceMonitoring.DegradationDirection.Down, indicating that a lower value indicates a worse condition.
|
|
1654
|
-
* The replacement product list is initialized as an empty array.
|
|
1655
|
-
*/
|
|
1656
883
|
createDefaultActivatedCarbonFilterMonitoringClusterServer(condition = 100, changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = true, lastChangedTime = null, replacementProductList = []) {
|
|
1657
884
|
this.behaviors.require(MatterbridgeActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1658
|
-
// Feature.Condition
|
|
1659
885
|
condition,
|
|
1660
886
|
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1661
|
-
|
|
1662
|
-
replacementProductList, // Fixed attribute
|
|
1663
|
-
// Base attributes
|
|
887
|
+
replacementProductList,
|
|
1664
888
|
changeIndication,
|
|
1665
889
|
inPlaceIndicator,
|
|
1666
|
-
lastChangedTime,
|
|
890
|
+
lastChangedTime,
|
|
1667
891
|
});
|
|
1668
892
|
return this;
|
|
1669
893
|
}
|
|
1670
|
-
/**
|
|
1671
|
-
* Creates a default door lock cluster server.
|
|
1672
|
-
*
|
|
1673
|
-
* @param {DoorLock.LockState} [lockState] - The initial state of the lock (default: Locked).
|
|
1674
|
-
* @param {DoorLock.LockType} [lockType] - The type of the lock (default: DeadBolt).
|
|
1675
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1676
|
-
*
|
|
1677
|
-
* @remarks
|
|
1678
|
-
* 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.
|
|
1679
|
-
*/
|
|
1680
894
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
1681
895
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
1682
896
|
lockState,
|
|
1683
897
|
lockType,
|
|
1684
898
|
actuatorEnabled: false,
|
|
1685
899
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
1686
|
-
// Special case of inverted bitmap: add also alwaysSet = 2047
|
|
1687
900
|
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
|
|
1688
901
|
alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
|
|
1689
902
|
});
|
|
1690
903
|
return this;
|
|
1691
904
|
}
|
|
1692
|
-
/**
|
|
1693
|
-
* Creates a default Mode Select cluster server.
|
|
1694
|
-
*
|
|
1695
|
-
* @param {string} description - The description of the mode select cluster.
|
|
1696
|
-
* @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
|
|
1697
|
-
* @param {number} [currentMode] - The current mode (default: 0).
|
|
1698
|
-
* @param {number} [startUpMode] - The startup mode (default: 0).
|
|
1699
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1700
|
-
*
|
|
1701
|
-
* @remarks
|
|
1702
|
-
* endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
|
|
1703
|
-
*/
|
|
1704
905
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
1705
906
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
1706
907
|
description: description,
|
|
@@ -1711,35 +912,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1711
912
|
});
|
|
1712
913
|
return this;
|
|
1713
914
|
}
|
|
1714
|
-
/**
|
|
1715
|
-
* Creates the default Valve Configuration And Control cluster server with features Level.
|
|
1716
|
-
*
|
|
1717
|
-
* @param {ValveConfigurationAndControl.ValveState} [valveState] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
1718
|
-
* @param {number} [valveLevel] - The valve level to set. Defaults to 0.
|
|
1719
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1720
|
-
*/
|
|
1721
915
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
1722
916
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
1723
917
|
currentState: valveState,
|
|
1724
918
|
targetState: valveState,
|
|
1725
919
|
openDuration: null,
|
|
1726
|
-
defaultOpenDuration: null,
|
|
920
|
+
defaultOpenDuration: null,
|
|
1727
921
|
remainingDuration: null,
|
|
1728
922
|
valveFault: { generalFault: false, blocked: false, leaking: false, notConnected: false, shortCircuit: false, currentExceeded: false },
|
|
1729
|
-
// Feature.Level
|
|
1730
923
|
currentLevel: valveLevel,
|
|
1731
924
|
targetLevel: valveLevel,
|
|
1732
|
-
defaultOpenLevel: 100,
|
|
1733
|
-
levelStep: 1,
|
|
925
|
+
defaultOpenLevel: 100,
|
|
926
|
+
levelStep: 1,
|
|
1734
927
|
});
|
|
1735
928
|
return this;
|
|
1736
929
|
}
|
|
1737
|
-
/**
|
|
1738
|
-
* Creates the default PumpConfigurationAndControl cluster server with features ConstantSpeed.
|
|
1739
|
-
*
|
|
1740
|
-
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
1741
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1742
|
-
*/
|
|
1743
930
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
1744
931
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
1745
932
|
minConstSpeed: null,
|
|
@@ -1754,13 +941,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1754
941
|
});
|
|
1755
942
|
return this;
|
|
1756
943
|
}
|
|
1757
|
-
/**
|
|
1758
|
-
* Creates the default SmokeCOAlarm Cluster Server with features SmokeAlarm and CoAlarm.
|
|
1759
|
-
*
|
|
1760
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1761
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1762
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1763
|
-
*/
|
|
1764
944
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1765
945
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1766
946
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1776,12 +956,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1776
956
|
});
|
|
1777
957
|
return this;
|
|
1778
958
|
}
|
|
1779
|
-
/**
|
|
1780
|
-
* Creates a smoke only SmokeCOAlarm Cluster Server with features SmokeAlarm.
|
|
1781
|
-
*
|
|
1782
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1783
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1784
|
-
*/
|
|
1785
959
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1786
960
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
1787
961
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1796,12 +970,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1796
970
|
});
|
|
1797
971
|
return this;
|
|
1798
972
|
}
|
|
1799
|
-
/**
|
|
1800
|
-
* Creates a co only SmokeCOAlarm Cluster Server with features CoAlarm.
|
|
1801
|
-
*
|
|
1802
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
1803
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1804
|
-
*/
|
|
1805
973
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
1806
974
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
1807
975
|
events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -1816,15 +984,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1816
984
|
});
|
|
1817
985
|
return this;
|
|
1818
986
|
}
|
|
1819
|
-
/**
|
|
1820
|
-
* Creates a default momentary switch cluster server with features MomentarySwitch, MomentarySwitchRelease, MomentarySwitchLongPress and MomentarySwitchMultiPress
|
|
1821
|
-
* and events initialPress, longPress, shortRelease, longRelease, multiPressOngoing, multiPressComplete.
|
|
1822
|
-
*
|
|
1823
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1824
|
-
*
|
|
1825
|
-
* @remarks
|
|
1826
|
-
* This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
|
|
1827
|
-
*/
|
|
1828
987
|
createDefaultSwitchClusterServer() {
|
|
1829
988
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
1830
989
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -1835,15 +994,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1835
994
|
});
|
|
1836
995
|
return this;
|
|
1837
996
|
}
|
|
1838
|
-
/**
|
|
1839
|
-
* Creates a default momentary switch cluster server with feature MomentarySwitch and event initialPress.
|
|
1840
|
-
*
|
|
1841
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1842
|
-
*
|
|
1843
|
-
* @remarks
|
|
1844
|
-
* This method adds a cluster server with default momentary switch features and configuration suitable for a Single press automations.
|
|
1845
|
-
* It is supported by the Home app.
|
|
1846
|
-
*/
|
|
1847
997
|
createDefaultMomentarySwitchClusterServer() {
|
|
1848
998
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch).enable({
|
|
1849
999
|
events: { initialPress: true },
|
|
@@ -1853,14 +1003,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1853
1003
|
});
|
|
1854
1004
|
return this;
|
|
1855
1005
|
}
|
|
1856
|
-
/**
|
|
1857
|
-
* Creates a default latching switch cluster server with features LatchingSwitch.
|
|
1858
|
-
*
|
|
1859
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1860
|
-
*
|
|
1861
|
-
* @remarks
|
|
1862
|
-
* This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
|
|
1863
|
-
*/
|
|
1864
1006
|
createDefaultLatchingSwitchClusterServer() {
|
|
1865
1007
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
1866
1008
|
events: { switchLatched: true },
|
|
@@ -1870,13 +1012,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1870
1012
|
});
|
|
1871
1013
|
return this;
|
|
1872
1014
|
}
|
|
1873
|
-
/**
|
|
1874
|
-
* Triggers a switch event on the specified endpoint.
|
|
1875
|
-
*
|
|
1876
|
-
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
1877
|
-
* @param {AnsiLogger} log - Optional logger to log the event.
|
|
1878
|
-
* @returns {boolean} - A boolean indicating whether the event was successfully triggered.
|
|
1879
|
-
*/
|
|
1880
1015
|
async triggerSwitchEvent(event, log) {
|
|
1881
1016
|
if (this.maybeNumber === undefined) {
|
|
1882
1017
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1938,37 +1073,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1938
1073
|
}
|
|
1939
1074
|
return true;
|
|
1940
1075
|
}
|
|
1941
|
-
/**
|
|
1942
|
-
* Creates a default OperationalState Cluster Server.
|
|
1943
|
-
*
|
|
1944
|
-
* @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state id.
|
|
1945
|
-
*
|
|
1946
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1947
|
-
*
|
|
1948
|
-
* @remarks
|
|
1949
|
-
* This method adds a cluster server with a default operational state configuration:
|
|
1950
|
-
* - { operationalStateId: OperationalState.OperationalStateEnum.Stopped, operationalStateLabel: 'Stopped' },
|
|
1951
|
-
* - { operationalStateId: OperationalState.OperationalStateEnum.Running, operationalStateLabel: 'Running' },
|
|
1952
|
-
* - { operationalStateId: OperationalState.OperationalStateEnum.Paused, operationalStateLabel: 'Paused' },
|
|
1953
|
-
* - { operationalStateId: OperationalState.OperationalStateEnum.Error, operationalStateLabel: 'Error' },
|
|
1954
|
-
*/
|
|
1955
1076
|
createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
|
1956
1077
|
this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
|
|
1957
1078
|
return this;
|
|
1958
1079
|
}
|
|
1959
|
-
/**
|
|
1960
|
-
* Creates a default boolean state cluster server.
|
|
1961
|
-
* The stateChange event is enabled.
|
|
1962
|
-
*
|
|
1963
|
-
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
|
|
1964
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1965
|
-
*
|
|
1966
|
-
* @remarks
|
|
1967
|
-
* Water Leak Detector: true = leak, false = no leak
|
|
1968
|
-
* Water Freeze Detector: true = freeze, false = no freeze
|
|
1969
|
-
* Rain Sensor: true = rain, false = no rain
|
|
1970
|
-
* Contact Sensor: true = closed or contact, false = open or no contact
|
|
1971
|
-
*/
|
|
1972
1080
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1973
1081
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1974
1082
|
events: { stateChange: true },
|
|
@@ -1977,22 +1085,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1977
1085
|
});
|
|
1978
1086
|
return this;
|
|
1979
1087
|
}
|
|
1980
|
-
/**
|
|
1981
|
-
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
|
|
1982
|
-
*
|
|
1983
|
-
* Features:
|
|
1984
|
-
* - Visual
|
|
1985
|
-
* - Audible
|
|
1986
|
-
* - SensitivityLevel
|
|
1987
|
-
*
|
|
1988
|
-
* @remarks Supports the enableDisableAlarm command.
|
|
1989
|
-
*
|
|
1990
|
-
* @param {boolean} [sensorFault] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1991
|
-
* @param {number} [currentSensitivityLevel] - The current sensitivity level. Defaults to `0` if not provided.
|
|
1992
|
-
* @param {number} [supportedSensitivityLevels] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
|
|
1993
|
-
* @param {number} [defaultSensitivityLevel] - The default sensitivity level. Defaults to `0` if not provided.
|
|
1994
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1995
|
-
*/
|
|
1996
1088
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1997
1089
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1998
1090
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -2007,51 +1099,18 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2007
1099
|
});
|
|
2008
1100
|
return this;
|
|
2009
1101
|
}
|
|
2010
|
-
/**
|
|
2011
|
-
* Creates a default Device Energy Management Cluster Server with feature PowerForecastReporting and with the specified ESA type, ESA canGenerate, ESA state, and power limits.
|
|
2012
|
-
*
|
|
2013
|
-
* @param {DeviceEnergyManagement.EsaType} [esaType] - The ESA type. Defaults to `DeviceEnergyManagement.EsaType.Other`.
|
|
2014
|
-
* @param {boolean} [esaCanGenerate] - Indicates if the ESA can generate energy. Defaults to `false`.
|
|
2015
|
-
* @param {DeviceEnergyManagement.EsaState} [esaState] - The ESA state. Defaults to `DeviceEnergyManagement.EsaState.Online`.
|
|
2016
|
-
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
2017
|
-
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
2018
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2019
|
-
*
|
|
2020
|
-
* @remarks
|
|
2021
|
-
* - The forecast attribute is set to null, indicating that there is no forecast currently available.
|
|
2022
|
-
* - The ESA type and canGenerate attributes are fixed and cannot be changed after creation.
|
|
2023
|
-
* - The ESA state is set to Online by default.
|
|
2024
|
-
* - The absolute minimum and maximum power attributes are set to 0 by default.
|
|
2025
|
-
* - For example, a battery storage inverter that can charge its battery at a maximum power of 2000W and can
|
|
2026
|
-
* discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
|
|
2027
|
-
*/
|
|
2028
1102
|
createDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
|
|
2029
1103
|
this.behaviors.require(MatterbridgeDeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.PowerAdjustment), {
|
|
2030
|
-
forecast: null,
|
|
2031
|
-
powerAdjustmentCapability: null,
|
|
2032
|
-
esaType,
|
|
2033
|
-
esaCanGenerate,
|
|
1104
|
+
forecast: null,
|
|
1105
|
+
powerAdjustmentCapability: null,
|
|
1106
|
+
esaType,
|
|
1107
|
+
esaCanGenerate,
|
|
2034
1108
|
esaState,
|
|
2035
1109
|
absMinPower,
|
|
2036
1110
|
absMaxPower,
|
|
2037
1111
|
});
|
|
2038
1112
|
return this;
|
|
2039
1113
|
}
|
|
2040
|
-
/**
|
|
2041
|
-
* Creates a default EnergyManagementMode Cluster Server.
|
|
2042
|
-
*
|
|
2043
|
-
* @param {number} [currentMode] - The current mode of the EnergyManagementMode cluster. Defaults to mode 1 (DeviceEnergyManagementMode.ModeTag.NoOptimization).
|
|
2044
|
-
* @param {EnergyManagementMode.ModeOption[]} [supportedModes] - The supported modes for the DeviceEnergyManagementMode cluster. The attribute is fixed and defaults to a predefined set of cluster modes.
|
|
2045
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2046
|
-
*
|
|
2047
|
-
* @remarks
|
|
2048
|
-
* A few examples of Device Energy Management modes and their mode tags are provided below.
|
|
2049
|
-
* - For the "No Energy Management (Forecast reporting only)" mode, tags: 0x4000 (NoOptimization).
|
|
2050
|
-
* - For the "Device Energy Management" mode, tags: 0x4001 (DeviceOptimization).
|
|
2051
|
-
* - For the "Home Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization).
|
|
2052
|
-
* - For the "Grid Energy Management" mode, tags: 0x4003 (GridOptimization).
|
|
2053
|
-
* - For the "Full Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization), 0x4003 (GridOptimization).
|
|
2054
|
-
*/
|
|
2055
1114
|
createDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
|
|
2056
1115
|
this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, {
|
|
2057
1116
|
supportedModes: supportedModes ?? [
|
|
@@ -2072,27 +1131,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2072
1131
|
mode: 5,
|
|
2073
1132
|
modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.DeviceOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }, { value: DeviceEnergyManagementMode.ModeTag.GridOptimization }],
|
|
2074
1133
|
},
|
|
2075
|
-
],
|
|
1134
|
+
],
|
|
2076
1135
|
currentMode: currentMode ?? 1,
|
|
2077
1136
|
});
|
|
2078
1137
|
return this;
|
|
2079
1138
|
}
|
|
2080
|
-
/**
|
|
2081
|
-
* 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.
|
|
2082
|
-
*
|
|
2083
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2084
|
-
*/
|
|
2085
1139
|
createDefaultPowerTopologyClusterServer() {
|
|
2086
1140
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
2087
1141
|
return this;
|
|
2088
1142
|
}
|
|
2089
|
-
/**
|
|
2090
|
-
* Creates a default Electrical Energy Measurement Cluster Server with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
|
|
2091
|
-
*
|
|
2092
|
-
* @param {number} energyImported - The total consumption value in mW/h.
|
|
2093
|
-
* @param {number} energyExported - The total production value in mW/h.
|
|
2094
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2095
|
-
*/
|
|
2096
1143
|
createDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
|
|
2097
1144
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
2098
1145
|
accuracy: {
|
|
@@ -2108,15 +1155,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2108
1155
|
});
|
|
2109
1156
|
return this;
|
|
2110
1157
|
}
|
|
2111
|
-
/**
|
|
2112
|
-
* Creates a default Electrical Power Measurement Cluster Server with features AlternatingCurrent.
|
|
2113
|
-
*
|
|
2114
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
2115
|
-
* @param {number} current - The current value in milliamperes.
|
|
2116
|
-
* @param {number} power - The power value in milliwatts.
|
|
2117
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
2118
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2119
|
-
*/
|
|
2120
1158
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
2121
1159
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
2122
1160
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -2158,124 +1196,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2158
1196
|
});
|
|
2159
1197
|
return this;
|
|
2160
1198
|
}
|
|
2161
|
-
/**
|
|
2162
|
-
* Creates a default TemperatureMeasurement cluster server.
|
|
2163
|
-
*
|
|
2164
|
-
* @param {number | null} measuredValue - The measured value of the temperature x 100.
|
|
2165
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
|
|
2166
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
|
|
2167
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2168
|
-
*/
|
|
2169
1199
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2170
1200
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2171
1201
|
return this;
|
|
2172
1202
|
}
|
|
2173
|
-
/**
|
|
2174
|
-
* Creates a default RelativeHumidityMeasurement cluster server.
|
|
2175
|
-
*
|
|
2176
|
-
* @param {number | null} measuredValue - The measured value of the relative humidity x 100.
|
|
2177
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
|
|
2178
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
|
|
2179
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2180
|
-
*/
|
|
2181
1203
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2182
1204
|
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2183
1205
|
return this;
|
|
2184
1206
|
}
|
|
2185
|
-
/**
|
|
2186
|
-
* Creates a default PressureMeasurement cluster server.
|
|
2187
|
-
*
|
|
2188
|
-
* @param {number | null} measuredValue - The measured value for the pressure in kPa x 10.
|
|
2189
|
-
* @param {number | null} minMeasuredValue - The minimum measured value for the pressure in kPa x 10.
|
|
2190
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value for the pressure in kPa x 10.
|
|
2191
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2192
|
-
*
|
|
2193
|
-
* @remarks
|
|
2194
|
-
* - MeasuredValue = 10 x Pressure in kPa
|
|
2195
|
-
* - MeasuredValue = 1 x Pressure in hPa
|
|
2196
|
-
* - MeasuredValue = 33.8639 x Pressure in inHg
|
|
2197
|
-
*
|
|
2198
|
-
* Conversion:
|
|
2199
|
-
* - 1 kPa = 10 hPa
|
|
2200
|
-
* - 1 inHg = 33.8639 hPa
|
|
2201
|
-
*/
|
|
2202
1207
|
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2203
1208
|
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2204
1209
|
return this;
|
|
2205
1210
|
}
|
|
2206
|
-
/**
|
|
2207
|
-
* Creates a default IlluminanceMeasurement cluster server.
|
|
2208
|
-
*
|
|
2209
|
-
* @param {number | null} measuredValue - The measured value of illuminance.
|
|
2210
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
|
|
2211
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
|
|
2212
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2213
|
-
*
|
|
2214
|
-
* @remarks The default value for the illuminance measurement is null.
|
|
2215
|
-
* This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
|
|
2216
|
-
* • MeasuredValue = 10,000 x log10(illuminance) + 1,
|
|
2217
|
-
* where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
|
|
2218
|
-
* • 0 indicates a value of illuminance that is too low to be measured
|
|
2219
|
-
* • null indicates that the illuminance measurement is invalid.
|
|
2220
|
-
*
|
|
2221
|
-
* - Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
|
|
2222
|
-
* - Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
|
|
2223
|
-
*/
|
|
2224
1211
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2225
1212
|
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2226
1213
|
return this;
|
|
2227
1214
|
}
|
|
2228
|
-
/**
|
|
2229
|
-
* Creates a default FlowMeasurement cluster server.
|
|
2230
|
-
*
|
|
2231
|
-
* @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
|
|
2232
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
|
|
2233
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
|
|
2234
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2235
|
-
*/
|
|
2236
1215
|
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2237
1216
|
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2238
1217
|
return this;
|
|
2239
1218
|
}
|
|
2240
|
-
/**
|
|
2241
|
-
* Creates a default OccupancySensing cluster server with feature PassiveInfrared.
|
|
2242
|
-
*
|
|
2243
|
-
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
2244
|
-
* @param {number} holdTime - The hold time in seconds. Default is 30.
|
|
2245
|
-
* @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
|
|
2246
|
-
* @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
|
|
2247
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2248
|
-
*
|
|
2249
|
-
* @remarks The default value for the occupancy sensor type is PIR.
|
|
2250
|
-
*/
|
|
2251
1219
|
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
2252
1220
|
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
2253
1221
|
return this;
|
|
2254
1222
|
}
|
|
2255
|
-
/**
|
|
2256
|
-
* Creates a default AirQuality cluster server.
|
|
2257
|
-
*
|
|
2258
|
-
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2259
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2260
|
-
*/
|
|
2261
1223
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
2262
1224
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
2263
1225
|
airQuality,
|
|
2264
1226
|
});
|
|
2265
1227
|
return this;
|
|
2266
1228
|
}
|
|
2267
|
-
/**
|
|
2268
|
-
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2269
|
-
*
|
|
2270
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2271
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2272
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2273
|
-
* @param {number} [uncertainty] - The uncertainty value (optional).
|
|
2274
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2275
|
-
*
|
|
2276
|
-
* @remarks
|
|
2277
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2278
|
-
*/
|
|
2279
1229
|
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
2280
1230
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2281
1231
|
measuredValue,
|
|
@@ -2287,16 +1237,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2287
1237
|
});
|
|
2288
1238
|
return this;
|
|
2289
1239
|
}
|
|
2290
|
-
/**
|
|
2291
|
-
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature LevelIndication.
|
|
2292
|
-
|
|
2293
|
-
* @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
|
|
2294
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2295
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2296
|
-
*
|
|
2297
|
-
* @remarks
|
|
2298
|
-
* The measurementMedium attribute is fixed and cannot be changed after creation.
|
|
2299
|
-
*/
|
|
2300
1240
|
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2301
1241
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
2302
1242
|
levelValue,
|
|
@@ -2304,17 +1244,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2304
1244
|
});
|
|
2305
1245
|
return this;
|
|
2306
1246
|
}
|
|
2307
|
-
/**
|
|
2308
|
-
* Create a default CarbonMonoxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2309
|
-
*
|
|
2310
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2311
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2312
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2313
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2314
|
-
*
|
|
2315
|
-
* @remarks
|
|
2316
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2317
|
-
*/
|
|
2318
1247
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2319
1248
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2320
1249
|
measuredValue,
|
|
@@ -2326,17 +1255,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2326
1255
|
});
|
|
2327
1256
|
return this;
|
|
2328
1257
|
}
|
|
2329
|
-
/**
|
|
2330
|
-
* Create a default CarbonDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2331
|
-
*
|
|
2332
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2333
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2334
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2335
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2336
|
-
*
|
|
2337
|
-
* @remarks
|
|
2338
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2339
|
-
*/
|
|
2340
1258
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2341
1259
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2342
1260
|
measuredValue,
|
|
@@ -2348,17 +1266,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2348
1266
|
});
|
|
2349
1267
|
return this;
|
|
2350
1268
|
}
|
|
2351
|
-
/**
|
|
2352
|
-
* Create a default FormaldehydeConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2353
|
-
*
|
|
2354
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2355
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2356
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2357
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2358
|
-
*
|
|
2359
|
-
* @remarks
|
|
2360
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2361
|
-
*/
|
|
2362
1269
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2363
1270
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2364
1271
|
measuredValue,
|
|
@@ -2370,17 +1277,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2370
1277
|
});
|
|
2371
1278
|
return this;
|
|
2372
1279
|
}
|
|
2373
|
-
/**
|
|
2374
|
-
* Create a default Pm1ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2375
|
-
*
|
|
2376
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2377
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2378
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2379
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2380
|
-
*
|
|
2381
|
-
* @remarks
|
|
2382
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2383
|
-
*/
|
|
2384
1280
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2385
1281
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2386
1282
|
measuredValue,
|
|
@@ -2392,17 +1288,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2392
1288
|
});
|
|
2393
1289
|
return this;
|
|
2394
1290
|
}
|
|
2395
|
-
/**
|
|
2396
|
-
* Create a default Pm25ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2397
|
-
*
|
|
2398
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2399
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2400
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2401
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2402
|
-
*
|
|
2403
|
-
* @remarks
|
|
2404
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2405
|
-
*/
|
|
2406
1291
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2407
1292
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2408
1293
|
measuredValue,
|
|
@@ -2414,17 +1299,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2414
1299
|
});
|
|
2415
1300
|
return this;
|
|
2416
1301
|
}
|
|
2417
|
-
/**
|
|
2418
|
-
* Create a default Pm10ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2419
|
-
*
|
|
2420
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2421
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2422
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2423
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2424
|
-
*
|
|
2425
|
-
* @remarks
|
|
2426
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2427
|
-
*/
|
|
2428
1302
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2429
1303
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2430
1304
|
measuredValue,
|
|
@@ -2436,17 +1310,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2436
1310
|
});
|
|
2437
1311
|
return this;
|
|
2438
1312
|
}
|
|
2439
|
-
/**
|
|
2440
|
-
* Create a default OzoneConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2441
|
-
*
|
|
2442
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2443
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2444
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2445
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2446
|
-
*
|
|
2447
|
-
* @remarks
|
|
2448
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2449
|
-
*/
|
|
2450
1313
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2451
1314
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2452
1315
|
measuredValue,
|
|
@@ -2458,17 +1321,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2458
1321
|
});
|
|
2459
1322
|
return this;
|
|
2460
1323
|
}
|
|
2461
|
-
/**
|
|
2462
|
-
* Create a default RadonConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2463
|
-
*
|
|
2464
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2465
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2466
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2467
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2468
|
-
*
|
|
2469
|
-
* @remarks
|
|
2470
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2471
|
-
*/
|
|
2472
1324
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2473
1325
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2474
1326
|
measuredValue,
|
|
@@ -2480,17 +1332,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2480
1332
|
});
|
|
2481
1333
|
return this;
|
|
2482
1334
|
}
|
|
2483
|
-
/**
|
|
2484
|
-
* Create a default NitrogenDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2485
|
-
*
|
|
2486
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2487
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2488
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2489
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2490
|
-
*
|
|
2491
|
-
* @remarks
|
|
2492
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2493
|
-
*/
|
|
2494
1335
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2495
1336
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2496
1337
|
measuredValue,
|
|
@@ -2503,4 +1344,3 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2503
1344
|
return this;
|
|
2504
1345
|
}
|
|
2505
1346
|
}
|
|
2506
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|