matterbridge 3.1.7-dev-20250724-c3522e6 → 3.1.7
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 +6 -15
- package/README-SERVICE.md +1 -0
- package/dist/cli.d.ts +26 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +91 -2
- package/dist/cli.js.map +1 -0
- package/dist/cliEmitter.d.ts +34 -0
- package/dist/cliEmitter.d.ts.map +1 -0
- package/dist/cliEmitter.js +30 -0
- package/dist/cliEmitter.js.map +1 -0
- package/dist/clusters/export.d.ts +2 -0
- package/dist/clusters/export.d.ts.map +1 -0
- package/dist/clusters/export.js +2 -0
- package/dist/clusters/export.js.map +1 -0
- package/dist/defaultConfigSchema.d.ts +28 -0
- package/dist/defaultConfigSchema.d.ts.map +1 -0
- package/dist/defaultConfigSchema.js +24 -0
- package/dist/defaultConfigSchema.js.map +1 -0
- package/dist/deviceManager.d.ts +112 -0
- package/dist/deviceManager.d.ts.map +1 -0
- package/dist/deviceManager.js +94 -1
- package/dist/deviceManager.js.map +1 -0
- package/dist/devices/batteryStorage.d.ts +48 -0
- package/dist/devices/batteryStorage.d.ts.map +1 -0
- package/dist/devices/batteryStorage.js +48 -1
- package/dist/devices/batteryStorage.js.map +1 -0
- package/dist/devices/dishwasher.d.ts +91 -0
- package/dist/devices/dishwasher.d.ts.map +1 -0
- package/dist/devices/dishwasher.js +78 -3
- package/dist/devices/dishwasher.js.map +1 -0
- package/dist/devices/evse.d.ts +75 -0
- package/dist/devices/evse.d.ts.map +1 -0
- package/dist/devices/evse.js +74 -10
- package/dist/devices/evse.js.map +1 -0
- package/dist/devices/export.d.ts +11 -0
- package/dist/devices/export.d.ts.map +1 -0
- package/dist/devices/export.js +2 -0
- package/dist/devices/export.js.map +1 -0
- package/dist/devices/extractorHood.d.ts +46 -0
- package/dist/devices/extractorHood.d.ts.map +1 -0
- package/dist/devices/extractorHood.js +42 -0
- package/dist/devices/extractorHood.js.map +1 -0
- package/dist/devices/heatPump.d.ts +47 -0
- package/dist/devices/heatPump.d.ts.map +1 -0
- package/dist/devices/heatPump.js +50 -2
- package/dist/devices/heatPump.js.map +1 -0
- package/dist/devices/laundryDryer.d.ts +87 -0
- package/dist/devices/laundryDryer.d.ts.map +1 -0
- package/dist/devices/laundryDryer.js +83 -6
- package/dist/devices/laundryDryer.js.map +1 -0
- package/dist/devices/laundryWasher.d.ts +242 -0
- package/dist/devices/laundryWasher.d.ts.map +1 -0
- package/dist/devices/laundryWasher.js +91 -7
- package/dist/devices/laundryWasher.js.map +1 -0
- package/dist/devices/roboticVacuumCleaner.d.ts +112 -0
- package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
- package/dist/devices/roboticVacuumCleaner.js +93 -7
- package/dist/devices/roboticVacuumCleaner.js.map +1 -0
- package/dist/devices/solarPower.d.ts +40 -0
- package/dist/devices/solarPower.d.ts.map +1 -0
- package/dist/devices/solarPower.js +38 -0
- package/dist/devices/solarPower.js.map +1 -0
- package/dist/devices/waterHeater.d.ts +111 -0
- package/dist/devices/waterHeater.d.ts.map +1 -0
- package/dist/devices/waterHeater.js +82 -2
- package/dist/devices/waterHeater.js.map +1 -0
- package/dist/dgram/coap.d.ts +205 -0
- package/dist/dgram/coap.d.ts.map +1 -0
- package/dist/dgram/coap.js +126 -13
- package/dist/dgram/coap.js.map +1 -0
- package/dist/dgram/dgram.d.ts +140 -0
- package/dist/dgram/dgram.d.ts.map +1 -0
- package/dist/dgram/dgram.js +113 -2
- package/dist/dgram/dgram.js.map +1 -0
- package/dist/dgram/mb_coap.d.ts +24 -0
- package/dist/dgram/mb_coap.d.ts.map +1 -0
- package/dist/dgram/mb_coap.js +41 -3
- package/dist/dgram/mb_coap.js.map +1 -0
- package/dist/dgram/mb_mdns.d.ts +24 -0
- package/dist/dgram/mb_mdns.d.ts.map +1 -0
- package/dist/dgram/mb_mdns.js +51 -13
- package/dist/dgram/mb_mdns.js.map +1 -0
- package/dist/dgram/mdns.d.ts +288 -0
- package/dist/dgram/mdns.d.ts.map +1 -0
- package/dist/dgram/mdns.js +300 -135
- package/dist/dgram/mdns.js.map +1 -0
- package/dist/dgram/multicast.d.ts +65 -0
- package/dist/dgram/multicast.d.ts.map +1 -0
- package/dist/dgram/multicast.js +60 -1
- package/dist/dgram/multicast.js.map +1 -0
- package/dist/dgram/unicast.d.ts +56 -0
- package/dist/dgram/unicast.d.ts.map +1 -0
- package/dist/dgram/unicast.js +54 -0
- package/dist/dgram/unicast.js.map +1 -0
- package/dist/frontend.d.ts +304 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/frontend.js +435 -21
- package/dist/frontend.js.map +1 -0
- package/dist/globalMatterbridge.d.ts +59 -0
- package/dist/globalMatterbridge.d.ts.map +1 -0
- package/dist/globalMatterbridge.js +47 -0
- package/dist/globalMatterbridge.js.map +1 -0
- package/dist/helpers.d.ts +48 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +53 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -0
- package/dist/logger/export.d.ts +2 -0
- package/dist/logger/export.d.ts.map +1 -0
- package/dist/logger/export.js +1 -0
- package/dist/logger/export.js.map +1 -0
- package/dist/matter/behaviors.d.ts +2 -0
- package/dist/matter/behaviors.d.ts.map +1 -0
- package/dist/matter/behaviors.js +2 -0
- package/dist/matter/behaviors.js.map +1 -0
- package/dist/matter/clusters.d.ts +2 -0
- package/dist/matter/clusters.d.ts.map +1 -0
- package/dist/matter/clusters.js +2 -0
- package/dist/matter/clusters.js.map +1 -0
- package/dist/matter/devices.d.ts +2 -0
- package/dist/matter/devices.d.ts.map +1 -0
- package/dist/matter/devices.js +2 -0
- package/dist/matter/devices.js.map +1 -0
- package/dist/matter/endpoints.d.ts +2 -0
- package/dist/matter/endpoints.d.ts.map +1 -0
- package/dist/matter/endpoints.js +2 -0
- package/dist/matter/endpoints.js.map +1 -0
- package/dist/matter/export.d.ts +5 -0
- package/dist/matter/export.d.ts.map +1 -0
- package/dist/matter/export.js +3 -0
- package/dist/matter/export.js.map +1 -0
- package/dist/matter/types.d.ts +3 -0
- package/dist/matter/types.d.ts.map +1 -0
- package/dist/matter/types.js +3 -0
- package/dist/matter/types.js.map +1 -0
- package/dist/matterbridge.d.ts +463 -0
- package/dist/matterbridge.d.ts.map +1 -0
- package/dist/matterbridge.js +843 -58
- package/dist/matterbridge.js.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts +42 -0
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -0
- package/dist/matterbridgeAccessoryPlatform.js +36 -0
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -0
- package/dist/matterbridgeBehaviors.d.ts +1351 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +65 -5
- package/dist/matterbridgeBehaviors.js.map +1 -0
- package/dist/matterbridgeDeviceTypes.d.ts +709 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +579 -15
- package/dist/matterbridgeDeviceTypes.js.map +1 -0
- package/dist/matterbridgeDynamicPlatform.d.ts +42 -0
- package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -0
- package/dist/matterbridgeDynamicPlatform.js +36 -0
- package/dist/matterbridgeDynamicPlatform.js.map +1 -0
- package/dist/matterbridgeEndpoint.d.ts +1348 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +1220 -51
- package/dist/matterbridgeEndpoint.js.map +1 -0
- package/dist/matterbridgeEndpointHelpers.d.ts +406 -0
- package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
- package/dist/matterbridgeEndpointHelpers.js +350 -18
- package/dist/matterbridgeEndpointHelpers.js.map +1 -0
- package/dist/matterbridgePlatform.d.ts +310 -0
- package/dist/matterbridgePlatform.d.ts.map +1 -0
- package/dist/matterbridgePlatform.js +233 -0
- package/dist/matterbridgePlatform.js.map +1 -0
- package/dist/matterbridgeTypes.d.ts +195 -0
- package/dist/matterbridgeTypes.d.ts.map +1 -0
- package/dist/matterbridgeTypes.js +25 -0
- package/dist/matterbridgeTypes.js.map +1 -0
- package/dist/pluginManager.d.ts +270 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +249 -3
- package/dist/pluginManager.js.map +1 -0
- package/dist/shelly.d.ts +174 -0
- package/dist/shelly.d.ts.map +1 -0
- package/dist/shelly.js +168 -7
- package/dist/shelly.js.map +1 -0
- package/dist/storage/export.d.ts +2 -0
- package/dist/storage/export.d.ts.map +1 -0
- package/dist/storage/export.js +1 -0
- package/dist/storage/export.js.map +1 -0
- package/dist/update.d.ts +59 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +54 -0
- package/dist/update.js.map +1 -0
- package/dist/utils/colorUtils.d.ts +117 -0
- package/dist/utils/colorUtils.d.ts.map +1 -0
- package/dist/utils/colorUtils.js +263 -2
- package/dist/utils/colorUtils.js.map +1 -0
- package/dist/utils/commandLine.d.ts +59 -0
- package/dist/utils/commandLine.d.ts.map +1 -0
- package/dist/utils/commandLine.js +54 -0
- package/dist/utils/commandLine.js.map +1 -0
- package/dist/utils/copyDirectory.d.ts +33 -0
- package/dist/utils/copyDirectory.d.ts.map +1 -0
- package/dist/utils/copyDirectory.js +38 -1
- package/dist/utils/copyDirectory.js.map +1 -0
- package/dist/utils/createDirectory.d.ts +34 -0
- package/dist/utils/createDirectory.d.ts.map +1 -0
- package/dist/utils/createDirectory.js +33 -0
- package/dist/utils/createDirectory.js.map +1 -0
- package/dist/utils/createZip.d.ts +39 -0
- package/dist/utils/createZip.d.ts.map +1 -0
- package/dist/utils/createZip.js +47 -2
- package/dist/utils/createZip.js.map +1 -0
- package/dist/utils/deepCopy.d.ts +32 -0
- package/dist/utils/deepCopy.d.ts.map +1 -0
- package/dist/utils/deepCopy.js +39 -0
- package/dist/utils/deepCopy.js.map +1 -0
- package/dist/utils/deepEqual.d.ts +54 -0
- package/dist/utils/deepEqual.d.ts.map +1 -0
- package/dist/utils/deepEqual.js +72 -1
- package/dist/utils/deepEqual.js.map +1 -0
- package/dist/utils/error.d.ts +44 -0
- package/dist/utils/error.d.ts.map +1 -0
- package/dist/utils/error.js +41 -0
- package/dist/utils/error.js.map +1 -0
- package/dist/utils/export.d.ts +12 -0
- package/dist/utils/export.d.ts.map +1 -0
- package/dist/utils/export.js +1 -0
- package/dist/utils/export.js.map +1 -0
- package/dist/utils/hex.d.ts +49 -0
- package/dist/utils/hex.d.ts.map +1 -0
- package/dist/utils/hex.js +58 -0
- package/dist/utils/hex.js.map +1 -0
- package/dist/utils/isvalid.d.ts +103 -0
- package/dist/utils/isvalid.d.ts.map +1 -0
- package/dist/utils/isvalid.js +101 -0
- package/dist/utils/isvalid.js.map +1 -0
- package/dist/utils/network.d.ts +74 -0
- package/dist/utils/network.d.ts.map +1 -0
- package/dist/utils/network.js +81 -5
- package/dist/utils/network.js.map +1 -0
- package/dist/utils/spawn.d.ts +33 -0
- package/dist/utils/spawn.d.ts.map +1 -0
- package/dist/utils/spawn.js +40 -0
- package/dist/utils/spawn.js.map +1 -0
- package/dist/utils/wait.d.ts +56 -0
- package/dist/utils/wait.d.ts.map +1 -0
- package/dist/utils/wait.js +62 -9
- package/dist/utils/wait.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
|
@@ -1,5 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the class MatterbridgeEndpoint that extends the Endpoint class from the Matter.js library.
|
|
3
|
+
*
|
|
4
|
+
* @file matterbridgeEndpoint.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @created 2024-10-01
|
|
7
|
+
* @version 2.1.1
|
|
8
|
+
* @license Apache-2.0
|
|
9
|
+
*
|
|
10
|
+
* Copyright 2024, 2025, 2026 Luca Liguori.
|
|
11
|
+
*
|
|
12
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13
|
+
* you may not use this file except in compliance with the License.
|
|
14
|
+
* You may obtain a copy of the License at
|
|
15
|
+
*
|
|
16
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
17
|
+
*
|
|
18
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
19
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
20
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
21
|
+
* See the License for the specific language governing permissions and
|
|
22
|
+
* limitations under the License.
|
|
23
|
+
*/
|
|
24
|
+
// @matter
|
|
1
25
|
import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, UINT16_MAX, UINT32_MAX, VendorId } from '@matter/main';
|
|
2
26
|
import { getClusterNameById, MeasurementType } from '@matter/main/types';
|
|
27
|
+
// @matter clusters
|
|
3
28
|
import { Descriptor } from '@matter/main/clusters/descriptor';
|
|
4
29
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
5
30
|
import { BridgedDeviceBasicInformation } from '@matter/main/clusters/bridged-device-basic-information';
|
|
@@ -26,6 +51,7 @@ import { ThermostatUserInterfaceConfiguration } from '@matter/main/clusters/ther
|
|
|
26
51
|
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
27
52
|
import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
|
|
28
53
|
import { DeviceEnergyManagementMode } from '@matter/main/clusters/device-energy-management-mode';
|
|
54
|
+
// @matter behaviors
|
|
29
55
|
import { DescriptorServer } from '@matter/main/behaviors/descriptor';
|
|
30
56
|
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
31
57
|
import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
|
|
@@ -57,18 +83,39 @@ import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@ma
|
|
|
57
83
|
import { FanControlServer } from '@matter/main/behaviors/fan-control';
|
|
58
84
|
import { ResourceMonitoring } from '@matter/main/clusters/resource-monitoring';
|
|
59
85
|
import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behaviors/thermostat-user-interface-configuration';
|
|
86
|
+
// AnsiLogger module
|
|
60
87
|
import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
|
|
88
|
+
// Matterbridge
|
|
61
89
|
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
62
90
|
import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
|
|
63
91
|
import { MatterbridgeServer, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, MatterbridgeDeviceEnergyManagementServer, MatterbridgeActivatedCarbonFilterMonitoringServer, MatterbridgeHepaFilterMonitoringServer, } from './matterbridgeBehaviors.js';
|
|
64
92
|
import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultOperationalStateClusterServer, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, invokeBehaviorCommand, triggerEvent, } from './matterbridgeEndpointHelpers.js';
|
|
65
93
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
94
|
+
/** The bridge mode of Matterbridge */
|
|
66
95
|
static bridgeMode = '';
|
|
67
|
-
|
|
96
|
+
/** The default log level of the new MatterbridgeEndpoints */
|
|
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
|
+
*/
|
|
68
111
|
mode = undefined;
|
|
112
|
+
/** The server node of the endpoint, if it is a single not bridged endpoint */
|
|
69
113
|
serverNode;
|
|
114
|
+
/** The logger instance for the MatterbridgeEndpoint */
|
|
70
115
|
log;
|
|
116
|
+
/** The plugin name this MatterbridgeEndpoint belongs to */
|
|
71
117
|
plugin = undefined;
|
|
118
|
+
/** The configuration URL of the device, if available */
|
|
72
119
|
configUrl = undefined;
|
|
73
120
|
deviceName = undefined;
|
|
74
121
|
serialNumber = undefined;
|
|
@@ -82,14 +129,28 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
82
129
|
hardwareVersion = undefined;
|
|
83
130
|
hardwareVersionString = undefined;
|
|
84
131
|
productUrl = 'https://www.npmjs.com/package/matterbridge';
|
|
132
|
+
/** The name of the first device type of the endpoint (old api compatibility) */
|
|
85
133
|
name = undefined;
|
|
134
|
+
/** The code of the first device type of the endpoint (old api compatibility) */
|
|
86
135
|
deviceType = undefined;
|
|
136
|
+
/** The original id (with spaces and .) of the endpoint (old api compatibility) */
|
|
87
137
|
uniqueStorageKey = undefined;
|
|
88
138
|
tagList = undefined;
|
|
139
|
+
/** Maps the DeviceTypeDefinitions with their code */
|
|
89
140
|
deviceTypes = new Map();
|
|
141
|
+
/** Command handler for the MatterbridgeEndpoint commands */
|
|
90
142
|
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
|
+
*/
|
|
91
151
|
constructor(definition, options = {}, debug = false) {
|
|
92
152
|
let deviceTypeList = [];
|
|
153
|
+
// Get the first DeviceTypeDefinition
|
|
93
154
|
let firstDefinition;
|
|
94
155
|
if (Array.isArray(definition)) {
|
|
95
156
|
firstDefinition = definition[0];
|
|
@@ -102,6 +163,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
102
163
|
firstDefinition = definition;
|
|
103
164
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
104
165
|
}
|
|
166
|
+
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
105
167
|
const deviceTypeDefinitionV8 = {
|
|
106
168
|
name: firstDefinition.name.replace('-', '_'),
|
|
107
169
|
deviceType: firstDefinition.code,
|
|
@@ -120,17 +182,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
120
182
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : {},
|
|
121
183
|
};
|
|
122
184
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
185
|
+
// Check if the uniqueStorageKey is valid
|
|
123
186
|
if (options.uniqueStorageKey && checkNotLatinCharacters(options.uniqueStorageKey)) {
|
|
124
187
|
options.uniqueStorageKey = generateUniqueId(options.uniqueStorageKey);
|
|
125
188
|
}
|
|
126
189
|
if (options.id && checkNotLatinCharacters(options.id)) {
|
|
127
190
|
options.id = generateUniqueId(options.id);
|
|
128
191
|
}
|
|
192
|
+
// Convert the options to an Endpoint.Options
|
|
129
193
|
const optionsV8 = {
|
|
130
194
|
id: options.uniqueStorageKey?.replace(/[ .]/g, ''),
|
|
131
195
|
number: options.endpointId,
|
|
132
196
|
descriptor: options.tagList ? { tagList: options.tagList, deviceTypeList } : { deviceTypeList },
|
|
133
197
|
};
|
|
198
|
+
// Override the deprecated uniqueStorageKey && endpointId with id and number if provided
|
|
134
199
|
if (options.id !== undefined) {
|
|
135
200
|
optionsV8.id = options.id.replace(/[ .]/g, '');
|
|
136
201
|
}
|
|
@@ -150,16 +215,40 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
150
215
|
}
|
|
151
216
|
else
|
|
152
217
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
153
|
-
|
|
218
|
+
// console.log('MatterbridgeEndpoint.option', options);
|
|
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 });
|
|
154
223
|
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
|
|
155
225
|
this.behaviors.require(MatterbridgeServer, { log: this.log, commandHandler: this.commandHandler });
|
|
156
226
|
}
|
|
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
|
+
*/
|
|
157
235
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
158
236
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
159
237
|
}
|
|
238
|
+
/**
|
|
239
|
+
* Get all the device types of this endpoint.
|
|
240
|
+
*
|
|
241
|
+
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
|
|
242
|
+
*/
|
|
160
243
|
getDeviceTypes() {
|
|
161
244
|
return Array.from(this.deviceTypes.values());
|
|
162
245
|
}
|
|
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
|
+
*/
|
|
163
252
|
hasClusterServer(cluster) {
|
|
164
253
|
const behavior = getBehavior(this, cluster);
|
|
165
254
|
if (behavior)
|
|
@@ -167,6 +256,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
167
256
|
else
|
|
168
257
|
return false;
|
|
169
258
|
}
|
|
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
|
+
*/
|
|
170
266
|
hasAttributeServer(cluster, attribute) {
|
|
171
267
|
const behavior = getBehavior(this, cluster);
|
|
172
268
|
if (!behavior || !this.behaviors.supported[behavior.id])
|
|
@@ -175,82 +271,239 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
175
271
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
176
272
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
177
273
|
}
|
|
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
|
+
*/
|
|
178
280
|
getClusterServerOptions(cluster) {
|
|
179
281
|
const behavior = getBehavior(this, cluster);
|
|
180
282
|
if (!behavior)
|
|
181
283
|
return undefined;
|
|
182
284
|
return this.behaviors.optionsFor(behavior);
|
|
183
285
|
}
|
|
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
|
|
184
295
|
getAttribute(cluster, attribute, log) {
|
|
185
296
|
return getAttribute(this, cluster, attribute, log);
|
|
186
297
|
}
|
|
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
|
+
*/
|
|
187
307
|
async setAttribute(clusterId, attribute, value, log) {
|
|
188
308
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
189
309
|
}
|
|
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
|
+
*/
|
|
190
319
|
async updateAttribute(cluster, attribute, value, log) {
|
|
191
320
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
192
321
|
}
|
|
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
|
|
193
337
|
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
194
338
|
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
195
339
|
}
|
|
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
|
+
*/
|
|
196
349
|
async triggerEvent(cluster, event, payload, log) {
|
|
197
350
|
return await triggerEvent(this, cluster, event, payload, log);
|
|
198
351
|
}
|
|
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
|
+
*/
|
|
199
358
|
addClusterServers(serverList) {
|
|
200
359
|
addClusterServers(this, serverList);
|
|
201
360
|
return this;
|
|
202
361
|
}
|
|
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
|
+
*/
|
|
203
369
|
async addFixedLabel(label, value) {
|
|
204
370
|
await addFixedLabel(this, label, value);
|
|
205
371
|
return this;
|
|
206
372
|
}
|
|
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
|
+
*/
|
|
207
380
|
async addUserLabel(label, value) {
|
|
208
381
|
await addUserLabel(this, label, value);
|
|
209
382
|
return this;
|
|
210
383
|
}
|
|
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
|
+
*/
|
|
211
398
|
addCommandHandler(command, handler) {
|
|
212
399
|
this.commandHandler.addHandler(command, handler);
|
|
213
400
|
return this;
|
|
214
401
|
}
|
|
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
|
+
*/
|
|
215
413
|
async executeCommandHandler(command, request, cluster, attributes, endpoint) {
|
|
216
414
|
await this.commandHandler.executeHandler(command, { request, cluster, attributes, endpoint });
|
|
217
415
|
}
|
|
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
|
+
*/
|
|
218
425
|
async invokeBehaviorCommand(cluster, command, params) {
|
|
219
426
|
await invokeBehaviorCommand(this, cluster, command, params);
|
|
220
427
|
}
|
|
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
|
+
*/
|
|
221
433
|
addRequiredClusterServers() {
|
|
222
434
|
addRequiredClusterServers(this);
|
|
223
435
|
return this;
|
|
224
436
|
}
|
|
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
|
+
*/
|
|
225
442
|
addOptionalClusterServers() {
|
|
226
443
|
addOptionalClusterServers(this);
|
|
227
444
|
return this;
|
|
228
445
|
}
|
|
446
|
+
/**
|
|
447
|
+
* Retrieves all cluster servers.
|
|
448
|
+
*
|
|
449
|
+
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
450
|
+
*/
|
|
229
451
|
getAllClusterServers() {
|
|
230
452
|
return Object.values(this.behaviors.supported);
|
|
231
453
|
}
|
|
454
|
+
/**
|
|
455
|
+
* Retrieves the names of all cluster servers.
|
|
456
|
+
*
|
|
457
|
+
* @returns {string[]} An array of all cluster server names.
|
|
458
|
+
*/
|
|
232
459
|
getAllClusterServerNames() {
|
|
233
460
|
return Object.keys(this.behaviors.supported);
|
|
234
461
|
}
|
|
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
|
+
*/
|
|
235
467
|
forEachAttribute(callback) {
|
|
236
468
|
if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
|
|
237
469
|
return;
|
|
238
470
|
for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
|
|
471
|
+
// Skip if the key / cluster name is a number, cause they are double indexed.
|
|
239
472
|
if (!isNaN(Number(clusterName)))
|
|
240
473
|
continue;
|
|
241
474
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
475
|
+
// Skip if the behavior has no associated cluster (i.e. matterbridge server)
|
|
242
476
|
const clusterId = getClusterId(this, clusterName);
|
|
243
477
|
if (clusterId === undefined) {
|
|
478
|
+
// this.log.debug(`***forEachAttribute: cluster ${clusterName} not found`);
|
|
244
479
|
continue;
|
|
245
480
|
}
|
|
481
|
+
// Skip if the attribute is not present in the ClusterBehavior.Type. Also skip if the attribute it is an internal state.
|
|
246
482
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
247
483
|
if (attributeId === undefined) {
|
|
484
|
+
// this.log.debug(`***forEachAttribute: attribute ${clusterName}.${attributeName} not found`);
|
|
248
485
|
continue;
|
|
249
486
|
}
|
|
250
487
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
251
488
|
}
|
|
252
489
|
}
|
|
253
490
|
}
|
|
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
|
+
*/
|
|
254
507
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
255
508
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
256
509
|
let alreadyAdded = false;
|
|
@@ -290,6 +543,23 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
290
543
|
}
|
|
291
544
|
return child;
|
|
292
545
|
}
|
|
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
|
+
*/
|
|
293
563
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
294
564
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
295
565
|
let alreadyAdded = false;
|
|
@@ -352,15 +622,39 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
352
622
|
}
|
|
353
623
|
return child;
|
|
354
624
|
}
|
|
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
|
+
*/
|
|
355
631
|
getChildEndpointByName(endpointName) {
|
|
356
632
|
return this.parts.find((part) => part.id === endpointName);
|
|
357
633
|
}
|
|
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
|
+
*/
|
|
358
640
|
getChildEndpoint(endpointNumber) {
|
|
359
641
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
360
642
|
}
|
|
643
|
+
/**
|
|
644
|
+
* Get all the child endpoints of this endpoint.
|
|
645
|
+
*
|
|
646
|
+
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
647
|
+
*/
|
|
361
648
|
getChildEndpoints() {
|
|
362
649
|
return Array.from(this.parts);
|
|
363
650
|
}
|
|
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
|
+
*/
|
|
364
658
|
static serialize(device) {
|
|
365
659
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId)
|
|
366
660
|
return;
|
|
@@ -383,9 +677,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
383
677
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
384
678
|
if (behaviorName === 'powerSource')
|
|
385
679
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
680
|
+
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
386
681
|
});
|
|
387
682
|
return serialized;
|
|
388
683
|
}
|
|
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
|
+
*/
|
|
389
690
|
static deserialize(serializedDevice) {
|
|
390
691
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { uniqueStorageKey: serializedDevice.endpointName, endpointId: serializedDevice.endpoint }, false);
|
|
391
692
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -401,55 +702,122 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
401
702
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
402
703
|
else if (clusterId === PowerSource.Cluster.id)
|
|
403
704
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
705
|
+
// else addClusterServerFromList(device, [clusterId]);
|
|
404
706
|
}
|
|
405
707
|
return device;
|
|
406
708
|
}
|
|
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
|
+
*/
|
|
407
720
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
408
721
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Wired), {
|
|
722
|
+
// Base attributes
|
|
409
723
|
status: PowerSource.PowerSourceStatus.Active,
|
|
410
724
|
order: 0,
|
|
411
725
|
description: wiredCurrentType === PowerSource.WiredCurrentType.Ac ? 'AC Power' : 'DC Power',
|
|
412
726
|
endpointList: [],
|
|
727
|
+
// Wired feature attributes
|
|
413
728
|
wiredCurrentType,
|
|
414
729
|
});
|
|
415
730
|
return this;
|
|
416
731
|
}
|
|
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
|
+
*/
|
|
417
750
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1, batReplaceability = PowerSource.BatReplaceability.UserReplaceable) {
|
|
418
751
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), {
|
|
752
|
+
// Base attributes
|
|
419
753
|
status: PowerSource.PowerSourceStatus.Active,
|
|
420
754
|
order: 0,
|
|
421
755
|
description: 'Primary battery',
|
|
422
756
|
endpointList: [],
|
|
757
|
+
// Battery feature attributes
|
|
423
758
|
batVoltage,
|
|
424
759
|
batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
|
|
425
760
|
batChargeLevel,
|
|
426
761
|
batReplacementNeeded: false,
|
|
427
762
|
batReplaceability,
|
|
428
763
|
activeBatFaults: undefined,
|
|
764
|
+
// Replaceable feature attributes
|
|
429
765
|
batReplacementDescription,
|
|
430
766
|
batQuantity,
|
|
431
767
|
});
|
|
432
768
|
return this;
|
|
433
769
|
}
|
|
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
|
+
*/
|
|
434
784
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplaceability = PowerSource.BatReplaceability.Unspecified) {
|
|
435
785
|
this.behaviors.require(PowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), {
|
|
786
|
+
// Base attributes
|
|
436
787
|
status: PowerSource.PowerSourceStatus.Active,
|
|
437
788
|
order: 0,
|
|
438
789
|
description: 'Primary battery',
|
|
439
790
|
endpointList: [],
|
|
791
|
+
// Battery feature attributes
|
|
440
792
|
batVoltage,
|
|
441
793
|
batPercentRemaining: Math.min(Math.max(batPercentRemaining * 2, 0), 200),
|
|
442
|
-
batTimeRemaining: null,
|
|
794
|
+
batTimeRemaining: null, // Indicates the estimated time in seconds before the battery will no longer be able to provide power to the Node
|
|
443
795
|
batChargeLevel,
|
|
444
796
|
batReplacementNeeded: false,
|
|
445
797
|
batReplaceability,
|
|
446
798
|
batPresent: true,
|
|
447
799
|
activeBatFaults: [],
|
|
800
|
+
// Rechargeable feature attributes
|
|
448
801
|
batChargeState: PowerSource.BatChargeState.IsNotCharging,
|
|
449
802
|
batFunctionalWhileCharging: true,
|
|
450
803
|
});
|
|
451
804
|
return this;
|
|
452
805
|
}
|
|
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
|
+
*/
|
|
453
821
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productId = 0x8000, productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
454
822
|
this.log.logName = deviceName;
|
|
455
823
|
this.deviceName = deviceName;
|
|
@@ -473,6 +841,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
473
841
|
}
|
|
474
842
|
return this;
|
|
475
843
|
}
|
|
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
|
+
*/
|
|
476
860
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
477
861
|
this.log.logName = deviceName;
|
|
478
862
|
this.deviceName = deviceName;
|
|
@@ -505,6 +889,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
505
889
|
});
|
|
506
890
|
return this;
|
|
507
891
|
}
|
|
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
|
+
*/
|
|
508
899
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
509
900
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
510
901
|
identifyTime,
|
|
@@ -512,14 +903,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
512
903
|
});
|
|
513
904
|
return this;
|
|
514
905
|
}
|
|
906
|
+
/**
|
|
907
|
+
* Creates a default groups cluster server.
|
|
908
|
+
*
|
|
909
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
910
|
+
*/
|
|
515
911
|
createDefaultGroupsClusterServer() {
|
|
516
912
|
this.behaviors.require(GroupsServer);
|
|
517
913
|
return this;
|
|
518
914
|
}
|
|
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
|
+
*/
|
|
519
922
|
createDefaultScenesClusterServer() {
|
|
520
923
|
this.behaviors.require(ScenesManagementServer);
|
|
521
924
|
return this;
|
|
522
925
|
}
|
|
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
|
+
*/
|
|
523
936
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
524
937
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
525
938
|
onOff,
|
|
@@ -530,24 +943,52 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
530
943
|
});
|
|
531
944
|
return this;
|
|
532
945
|
}
|
|
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
|
+
*/
|
|
533
952
|
createOnOffClusterServer(onOff = false) {
|
|
534
953
|
this.behaviors.require(MatterbridgeOnOffServer, {
|
|
535
954
|
onOff,
|
|
536
955
|
});
|
|
537
956
|
return this;
|
|
538
957
|
}
|
|
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
|
+
*/
|
|
539
964
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
540
965
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
541
966
|
onOff,
|
|
542
967
|
});
|
|
543
968
|
return this;
|
|
544
969
|
}
|
|
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
|
+
*/
|
|
545
976
|
createOffOnlyOnOffClusterServer(onOff = false) {
|
|
546
977
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
|
|
547
978
|
onOff,
|
|
548
979
|
});
|
|
549
980
|
return this;
|
|
550
981
|
}
|
|
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
|
+
*/
|
|
551
992
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
552
993
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
553
994
|
currentLevel,
|
|
@@ -563,6 +1004,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
563
1004
|
});
|
|
564
1005
|
return this;
|
|
565
1006
|
}
|
|
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
|
+
*/
|
|
566
1014
|
createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
|
|
567
1015
|
this.behaviors.require(MatterbridgeLevelControlServer, {
|
|
568
1016
|
currentLevel,
|
|
@@ -574,6 +1022,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
574
1022
|
});
|
|
575
1023
|
return this;
|
|
576
1024
|
}
|
|
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
|
+
*/
|
|
577
1044
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
578
1045
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
579
1046
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -596,6 +1063,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
596
1063
|
});
|
|
597
1064
|
return this;
|
|
598
1065
|
}
|
|
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
|
+
*/
|
|
599
1085
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
600
1086
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
601
1087
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -616,6 +1102,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
616
1102
|
});
|
|
617
1103
|
return this;
|
|
618
1104
|
}
|
|
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
|
+
*/
|
|
619
1121
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
620
1122
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
621
1123
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -636,6 +1138,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
636
1138
|
});
|
|
637
1139
|
return this;
|
|
638
1140
|
}
|
|
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
|
+
*/
|
|
639
1155
|
createCtColorControlClusterServer(colorTemperatureMireds = 250, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
640
1156
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
641
1157
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -654,15 +1170,34 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
654
1170
|
});
|
|
655
1171
|
return this;
|
|
656
1172
|
}
|
|
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
|
+
*/
|
|
657
1180
|
async configureColorControlMode(colorMode) {
|
|
658
1181
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
659
1182
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
660
1183
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
661
1184
|
}
|
|
662
1185
|
}
|
|
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
|
+
*/
|
|
663
1198
|
createDefaultWindowCoveringClusterServer(positionPercent100ths, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade) {
|
|
664
1199
|
this.behaviors.require(MatterbridgeLiftWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
665
|
-
type,
|
|
1200
|
+
type, // Must support feature Lift
|
|
666
1201
|
numberOfActuationsLift: 0,
|
|
667
1202
|
configStatus: {
|
|
668
1203
|
operational: true,
|
|
@@ -670,20 +1205,33 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
670
1205
|
liftMovementReversed: false,
|
|
671
1206
|
liftPositionAware: true,
|
|
672
1207
|
tiltPositionAware: false,
|
|
673
|
-
liftEncoderControlled: false,
|
|
674
|
-
tiltEncoderControlled: false,
|
|
1208
|
+
liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
1209
|
+
tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
675
1210
|
},
|
|
676
1211
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
677
|
-
endProductType,
|
|
1212
|
+
endProductType, // Must support feature Lift
|
|
678
1213
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
679
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
680
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1214
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1215
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
681
1216
|
});
|
|
682
1217
|
return this;
|
|
683
1218
|
}
|
|
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
|
+
*/
|
|
684
1232
|
createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind) {
|
|
685
1233
|
this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt), {
|
|
686
|
-
type,
|
|
1234
|
+
type, // Must support features Lift and Tilt
|
|
687
1235
|
numberOfActuationsLift: 0,
|
|
688
1236
|
numberOfActuationsTilt: 0,
|
|
689
1237
|
configStatus: {
|
|
@@ -692,19 +1240,23 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
692
1240
|
liftMovementReversed: false,
|
|
693
1241
|
liftPositionAware: true,
|
|
694
1242
|
tiltPositionAware: true,
|
|
695
|
-
liftEncoderControlled: false,
|
|
696
|
-
tiltEncoderControlled: false,
|
|
1243
|
+
liftEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
1244
|
+
tiltEncoderControlled: false, // 0 = Timer Controlled 1 = Encoder Controlled
|
|
697
1245
|
},
|
|
698
1246
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
699
|
-
endProductType,
|
|
1247
|
+
endProductType, // Must support features Lift and Tilt
|
|
700
1248
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
701
|
-
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
702
|
-
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
703
|
-
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
704
|
-
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
1249
|
+
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1250
|
+
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1251
|
+
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
1252
|
+
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0, // 0 Fully open 10000 fully closed
|
|
705
1253
|
});
|
|
706
1254
|
return this;
|
|
707
1255
|
}
|
|
1256
|
+
/**
|
|
1257
|
+
* Sets the window covering lift target position as the current position and stops the movement.
|
|
1258
|
+
*
|
|
1259
|
+
*/
|
|
708
1260
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
709
1261
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
710
1262
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -724,6 +1276,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
724
1276
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
725
1277
|
}
|
|
726
1278
|
}
|
|
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
|
+
*/
|
|
727
1286
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
728
1287
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
729
1288
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -734,6 +1293,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
734
1293
|
}, this.log);
|
|
735
1294
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
736
1295
|
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Sets the status of the window covering.
|
|
1298
|
+
*
|
|
1299
|
+
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1300
|
+
*/
|
|
737
1301
|
async setWindowCoveringStatus(status) {
|
|
738
1302
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
739
1303
|
global: status,
|
|
@@ -742,6 +1306,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
742
1306
|
}, this.log);
|
|
743
1307
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
744
1308
|
}
|
|
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
|
+
*/
|
|
745
1314
|
getWindowCoveringStatus() {
|
|
746
1315
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
747
1316
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -749,6 +1318,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
749
1318
|
return status.global;
|
|
750
1319
|
}
|
|
751
1320
|
}
|
|
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
|
+
*/
|
|
752
1327
|
async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
|
|
753
1328
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', liftPosition, this.log);
|
|
754
1329
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', liftPosition, this.log);
|
|
@@ -759,31 +1334,57 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
759
1334
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
|
|
760
1335
|
}
|
|
761
1336
|
}
|
|
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
|
+
*/
|
|
762
1350
|
createDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
763
1351
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
764
1352
|
localTemperature: localTemperature * 100,
|
|
765
1353
|
systemMode: Thermostat.SystemMode.Auto,
|
|
766
1354
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1355
|
+
// Thermostat.Feature.Heating
|
|
767
1356
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
768
1357
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
769
1358
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
770
1359
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
771
1360
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1361
|
+
// Thermostat.Feature.Cooling
|
|
772
1362
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
773
1363
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
774
1364
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
775
1365
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
776
1366
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1367
|
+
// Thermostat.Feature.AutoMode
|
|
777
1368
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
778
1369
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
779
1370
|
});
|
|
780
1371
|
return this;
|
|
781
1372
|
}
|
|
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
|
+
*/
|
|
782
1382
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
783
1383
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating), {
|
|
784
1384
|
localTemperature: localTemperature * 100,
|
|
785
1385
|
systemMode: Thermostat.SystemMode.Heat,
|
|
786
1386
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1387
|
+
// Thermostat.Feature.Heating
|
|
787
1388
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
788
1389
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
789
1390
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
@@ -792,11 +1393,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
792
1393
|
});
|
|
793
1394
|
return this;
|
|
794
1395
|
}
|
|
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
|
+
*/
|
|
795
1405
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
796
1406
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling), {
|
|
797
1407
|
localTemperature: localTemperature * 100,
|
|
798
1408
|
systemMode: Thermostat.SystemMode.Cool,
|
|
799
1409
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1410
|
+
// Thermostat.Feature.Cooling
|
|
800
1411
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
801
1412
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
802
1413
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
@@ -805,6 +1416,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
805
1416
|
});
|
|
806
1417
|
return this;
|
|
807
1418
|
}
|
|
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
|
+
*/
|
|
808
1429
|
createDefaultThermostatUserInterfaceConfigurationClusterServer() {
|
|
809
1430
|
this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
|
|
810
1431
|
temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius,
|
|
@@ -813,86 +1434,273 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
813
1434
|
});
|
|
814
1435
|
return this;
|
|
815
1436
|
}
|
|
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
|
+
*/
|
|
816
1451
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0) {
|
|
817
1452
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
1453
|
+
// Base fan control attributes
|
|
1454
|
+
fanMode, // Writable and persistent attribute
|
|
1455
|
+
fanModeSequence, // Fixed attribute
|
|
1456
|
+
percentSetting, // Writable attribute
|
|
821
1457
|
percentCurrent,
|
|
822
1458
|
});
|
|
823
1459
|
return this;
|
|
824
1460
|
}
|
|
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
|
+
createOnOffFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1473
|
+
this.behaviors.require(FanControlServer, {
|
|
1474
|
+
// Base fan control attributes
|
|
1475
|
+
fanMode, // Writable and persistent attribute
|
|
1476
|
+
fanModeSequence: FanControl.FanModeSequence.OffHigh, // Fixed attribute
|
|
1477
|
+
percentSetting: 0, // Writable attribute
|
|
1478
|
+
percentCurrent: 0,
|
|
1479
|
+
});
|
|
1480
|
+
return this;
|
|
1481
|
+
}
|
|
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
|
+
*/
|
|
825
1496
|
createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHigh, percentSetting = 0, percentCurrent = 0) {
|
|
826
1497
|
this.behaviors.require(FanControlServer, {
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
1498
|
+
// Base fan control attributes
|
|
1499
|
+
fanMode, // Writable and persistent attribute
|
|
1500
|
+
fanModeSequence, // Fixed attribute
|
|
1501
|
+
percentSetting, // Writable attribute
|
|
830
1502
|
percentCurrent,
|
|
831
1503
|
});
|
|
832
1504
|
return this;
|
|
833
1505
|
}
|
|
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
|
+
*/
|
|
834
1525
|
createMultiSpeedFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0, speedMax = 10, speedSetting = 0, speedCurrent = 0) {
|
|
835
1526
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
1527
|
+
// Base fan control attributes
|
|
1528
|
+
fanMode, // Writable and persistent attribute
|
|
1529
|
+
fanModeSequence, // Fixed attribute
|
|
1530
|
+
percentSetting, // Writable attribute
|
|
839
1531
|
percentCurrent,
|
|
840
|
-
|
|
841
|
-
|
|
1532
|
+
// MultiSpeed feature
|
|
1533
|
+
speedMax, // Fixed attribute
|
|
1534
|
+
speedSetting, // Writable attribute
|
|
842
1535
|
speedCurrent,
|
|
843
1536
|
});
|
|
844
1537
|
return this;
|
|
845
1538
|
}
|
|
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
|
+
*/
|
|
846
1578
|
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) {
|
|
847
1579
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step, FanControl.Feature.Rocking, FanControl.Feature.Wind, FanControl.Feature.AirflowDirection), {
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
1580
|
+
// Base fan control attributes
|
|
1581
|
+
fanMode, // Writable and persistent attribute
|
|
1582
|
+
fanModeSequence, // Fixed attribute
|
|
1583
|
+
percentSetting, // Writable attribute
|
|
851
1584
|
percentCurrent,
|
|
852
|
-
|
|
853
|
-
|
|
1585
|
+
// MultiSpeed feature
|
|
1586
|
+
speedMax, // Fixed attribute
|
|
1587
|
+
speedSetting, // Writable attribute
|
|
854
1588
|
speedCurrent,
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
1589
|
+
// Rocking feature
|
|
1590
|
+
rockSupport, // Fixed attribute
|
|
1591
|
+
rockSetting, // Writable attribute
|
|
1592
|
+
// Wind feature
|
|
1593
|
+
windSupport, // Fixed attribute
|
|
1594
|
+
windSetting, // Writable attribute
|
|
1595
|
+
// AirflowDirection feature
|
|
1596
|
+
airflowDirection, // Writable attribute
|
|
860
1597
|
});
|
|
861
1598
|
return this;
|
|
862
1599
|
}
|
|
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
|
+
*/
|
|
863
1621
|
createDefaultHepaFilterMonitoringClusterServer(condition = 100, changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = true, lastChangedTime = null, replacementProductList = []) {
|
|
864
1622
|
this.behaviors.require(MatterbridgeHepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1623
|
+
// Feature.Condition
|
|
865
1624
|
condition,
|
|
866
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
867
|
-
|
|
1625
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down, // Fixed attribute
|
|
1626
|
+
// Feature.ReplacementProductList
|
|
1627
|
+
replacementProductList, // Fixed attribute
|
|
1628
|
+
// Base attributes
|
|
868
1629
|
changeIndication,
|
|
869
1630
|
inPlaceIndicator,
|
|
870
|
-
lastChangedTime,
|
|
1631
|
+
lastChangedTime, // Writable and persistent across restarts
|
|
871
1632
|
});
|
|
872
1633
|
return this;
|
|
873
1634
|
}
|
|
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
|
+
*/
|
|
874
1656
|
createDefaultActivatedCarbonFilterMonitoringClusterServer(condition = 100, changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = true, lastChangedTime = null, replacementProductList = []) {
|
|
875
1657
|
this.behaviors.require(MatterbridgeActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
1658
|
+
// Feature.Condition
|
|
876
1659
|
condition,
|
|
877
1660
|
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
878
|
-
|
|
1661
|
+
// Feature.ReplacementProductList
|
|
1662
|
+
replacementProductList, // Fixed attribute
|
|
1663
|
+
// Base attributes
|
|
879
1664
|
changeIndication,
|
|
880
1665
|
inPlaceIndicator,
|
|
881
|
-
lastChangedTime,
|
|
1666
|
+
lastChangedTime, // Writable and persistent across restarts
|
|
882
1667
|
});
|
|
883
1668
|
return this;
|
|
884
1669
|
}
|
|
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
|
+
*/
|
|
885
1680
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
886
1681
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
887
1682
|
lockState,
|
|
888
1683
|
lockType,
|
|
889
1684
|
actuatorEnabled: false,
|
|
890
1685
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
1686
|
+
// Special case of inverted bitmap: add also alwaysSet = 2047
|
|
891
1687
|
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: true, passage: true, alwaysSet: 2047 },
|
|
892
1688
|
alarmMask: { lockJammed: false, lockFactoryReset: false, lockRadioPowerCycled: false, wrongCodeEntryLimit: false, frontEscutcheonRemoved: false, doorForcedOpen: false },
|
|
893
1689
|
});
|
|
894
1690
|
return this;
|
|
895
1691
|
}
|
|
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
|
+
*/
|
|
896
1704
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
897
1705
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
898
1706
|
description: description,
|
|
@@ -903,21 +1711,35 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
903
1711
|
});
|
|
904
1712
|
return this;
|
|
905
1713
|
}
|
|
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
|
+
*/
|
|
906
1721
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
907
1722
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
908
1723
|
currentState: valveState,
|
|
909
1724
|
targetState: valveState,
|
|
910
1725
|
openDuration: null,
|
|
911
|
-
defaultOpenDuration: null,
|
|
1726
|
+
defaultOpenDuration: null, // Writable and persistent across restarts
|
|
912
1727
|
remainingDuration: null,
|
|
913
1728
|
valveFault: { generalFault: false, blocked: false, leaking: false, notConnected: false, shortCircuit: false, currentExceeded: false },
|
|
1729
|
+
// Feature.Level
|
|
914
1730
|
currentLevel: valveLevel,
|
|
915
1731
|
targetLevel: valveLevel,
|
|
916
|
-
defaultOpenLevel: 100,
|
|
917
|
-
levelStep: 1,
|
|
1732
|
+
defaultOpenLevel: 100, // Writable and persistent across restarts
|
|
1733
|
+
levelStep: 1, // Fixed
|
|
918
1734
|
});
|
|
919
1735
|
return this;
|
|
920
1736
|
}
|
|
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
|
+
*/
|
|
921
1743
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
922
1744
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
923
1745
|
minConstSpeed: null,
|
|
@@ -932,6 +1754,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
932
1754
|
});
|
|
933
1755
|
return this;
|
|
934
1756
|
}
|
|
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
|
+
*/
|
|
935
1764
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
936
1765
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
937
1766
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -947,6 +1776,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
947
1776
|
});
|
|
948
1777
|
return this;
|
|
949
1778
|
}
|
|
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
|
+
*/
|
|
950
1785
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
951
1786
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
952
1787
|
events: { smokeAlarm: true, interconnectSmokeAlarm: false, coAlarm: false, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -961,6 +1796,12 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
961
1796
|
});
|
|
962
1797
|
return this;
|
|
963
1798
|
}
|
|
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
|
+
*/
|
|
964
1805
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
965
1806
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
966
1807
|
events: { smokeAlarm: false, interconnectSmokeAlarm: false, coAlarm: true, interconnectCoAlarm: false, lowBattery: true, hardwareFault: true, endOfService: true, selfTestComplete: true, alarmMuted: true, muteEnded: true, allClear: true },
|
|
@@ -975,6 +1816,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
975
1816
|
});
|
|
976
1817
|
return this;
|
|
977
1818
|
}
|
|
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
|
+
*/
|
|
978
1828
|
createDefaultSwitchClusterServer() {
|
|
979
1829
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
980
1830
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -985,6 +1835,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
985
1835
|
});
|
|
986
1836
|
return this;
|
|
987
1837
|
}
|
|
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
|
+
*/
|
|
988
1847
|
createDefaultMomentarySwitchClusterServer() {
|
|
989
1848
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch).enable({
|
|
990
1849
|
events: { initialPress: true },
|
|
@@ -994,6 +1853,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
994
1853
|
});
|
|
995
1854
|
return this;
|
|
996
1855
|
}
|
|
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
|
+
*/
|
|
997
1864
|
createDefaultLatchingSwitchClusterServer() {
|
|
998
1865
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
999
1866
|
events: { switchLatched: true },
|
|
@@ -1003,6 +1870,13 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1003
1870
|
});
|
|
1004
1871
|
return this;
|
|
1005
1872
|
}
|
|
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
|
+
*/
|
|
1006
1880
|
async triggerSwitchEvent(event, log) {
|
|
1007
1881
|
if (this.maybeNumber === undefined) {
|
|
1008
1882
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -1062,10 +1936,37 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1062
1936
|
}
|
|
1063
1937
|
return true;
|
|
1064
1938
|
}
|
|
1939
|
+
/**
|
|
1940
|
+
* Creates a default OperationalState Cluster Server.
|
|
1941
|
+
*
|
|
1942
|
+
* @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state id.
|
|
1943
|
+
*
|
|
1944
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1945
|
+
*
|
|
1946
|
+
* @remarks
|
|
1947
|
+
* This method adds a cluster server with a default operational state configuration:
|
|
1948
|
+
* - { operationalStateId: OperationalState.OperationalStateEnum.Stopped, operationalStateLabel: 'Stopped' },
|
|
1949
|
+
* - { operationalStateId: OperationalState.OperationalStateEnum.Running, operationalStateLabel: 'Running' },
|
|
1950
|
+
* - { operationalStateId: OperationalState.OperationalStateEnum.Paused, operationalStateLabel: 'Paused' },
|
|
1951
|
+
* - { operationalStateId: OperationalState.OperationalStateEnum.Error, operationalStateLabel: 'Error' },
|
|
1952
|
+
*/
|
|
1065
1953
|
createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
|
1066
1954
|
this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
|
|
1067
1955
|
return this;
|
|
1068
1956
|
}
|
|
1957
|
+
/**
|
|
1958
|
+
* Creates a default boolean state cluster server.
|
|
1959
|
+
* The stateChange event is enabled.
|
|
1960
|
+
*
|
|
1961
|
+
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
|
|
1962
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1963
|
+
*
|
|
1964
|
+
* @remarks
|
|
1965
|
+
* Water Leak Detector: true = leak, false = no leak
|
|
1966
|
+
* Water Freeze Detector: true = freeze, false = no freeze
|
|
1967
|
+
* Rain Sensor: true = rain, false = no rain
|
|
1968
|
+
* Contact Sensor: true = closed or contact, false = open or no contact
|
|
1969
|
+
*/
|
|
1069
1970
|
createDefaultBooleanStateClusterServer(contact) {
|
|
1070
1971
|
this.behaviors.require(BooleanStateServer.enable({
|
|
1071
1972
|
events: { stateChange: true },
|
|
@@ -1074,6 +1975,22 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1074
1975
|
});
|
|
1075
1976
|
return this;
|
|
1076
1977
|
}
|
|
1978
|
+
/**
|
|
1979
|
+
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
|
|
1980
|
+
*
|
|
1981
|
+
* Features:
|
|
1982
|
+
* - Visual
|
|
1983
|
+
* - Audible
|
|
1984
|
+
* - SensitivityLevel
|
|
1985
|
+
*
|
|
1986
|
+
* @remarks Supports the enableDisableAlarm command.
|
|
1987
|
+
*
|
|
1988
|
+
* @param {boolean} [sensorFault] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
1989
|
+
* @param {number} [currentSensitivityLevel] - The current sensitivity level. Defaults to `0` if not provided.
|
|
1990
|
+
* @param {number} [supportedSensitivityLevels] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
|
|
1991
|
+
* @param {number} [defaultSensitivityLevel] - The default sensitivity level. Defaults to `0` if not provided.
|
|
1992
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1993
|
+
*/
|
|
1077
1994
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
1078
1995
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
1079
1996
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -1088,18 +2005,51 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1088
2005
|
});
|
|
1089
2006
|
return this;
|
|
1090
2007
|
}
|
|
2008
|
+
/**
|
|
2009
|
+
* Creates a default Device Energy Management Cluster Server with feature PowerForecastReporting and with the specified ESA type, ESA canGenerate, ESA state, and power limits.
|
|
2010
|
+
*
|
|
2011
|
+
* @param {DeviceEnergyManagement.EsaType} [esaType] - The ESA type. Defaults to `DeviceEnergyManagement.EsaType.Other`.
|
|
2012
|
+
* @param {boolean} [esaCanGenerate] - Indicates if the ESA can generate energy. Defaults to `false`.
|
|
2013
|
+
* @param {DeviceEnergyManagement.EsaState} [esaState] - The ESA state. Defaults to `DeviceEnergyManagement.EsaState.Online`.
|
|
2014
|
+
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
2015
|
+
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
2016
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2017
|
+
*
|
|
2018
|
+
* @remarks
|
|
2019
|
+
* - The forecast attribute is set to null, indicating that there is no forecast currently available.
|
|
2020
|
+
* - The ESA type and canGenerate attributes are fixed and cannot be changed after creation.
|
|
2021
|
+
* - The ESA state is set to Online by default.
|
|
2022
|
+
* - The absolute minimum and maximum power attributes are set to 0 by default.
|
|
2023
|
+
* - For example, a battery storage inverter that can charge its battery at a maximum power of 2000W and can
|
|
2024
|
+
* discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
|
|
2025
|
+
*/
|
|
1091
2026
|
createDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
|
|
1092
2027
|
this.behaviors.require(MatterbridgeDeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.PowerAdjustment), {
|
|
1093
|
-
forecast: null,
|
|
1094
|
-
powerAdjustmentCapability: null,
|
|
1095
|
-
esaType,
|
|
1096
|
-
esaCanGenerate,
|
|
2028
|
+
forecast: null, // A null value indicates that there is no forecast currently available
|
|
2029
|
+
powerAdjustmentCapability: null, // A null value indicates that no power adjustment is currently possible, and nor is any adjustment currently active
|
|
2030
|
+
esaType, // Fixed attribute
|
|
2031
|
+
esaCanGenerate, // Fixed attribute
|
|
1097
2032
|
esaState,
|
|
1098
2033
|
absMinPower,
|
|
1099
2034
|
absMaxPower,
|
|
1100
2035
|
});
|
|
1101
2036
|
return this;
|
|
1102
2037
|
}
|
|
2038
|
+
/**
|
|
2039
|
+
* Creates a default EnergyManagementMode Cluster Server.
|
|
2040
|
+
*
|
|
2041
|
+
* @param {number} [currentMode] - The current mode of the EnergyManagementMode cluster. Defaults to mode 1 (DeviceEnergyManagementMode.ModeTag.NoOptimization).
|
|
2042
|
+
* @param {EnergyManagementMode.ModeOption[]} [supportedModes] - The supported modes for the DeviceEnergyManagementMode cluster. The attribute is fixed and defaults to a predefined set of cluster modes.
|
|
2043
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2044
|
+
*
|
|
2045
|
+
* @remarks
|
|
2046
|
+
* A few examples of Device Energy Management modes and their mode tags are provided below.
|
|
2047
|
+
* - For the "No Energy Management (Forecast reporting only)" mode, tags: 0x4000 (NoOptimization).
|
|
2048
|
+
* - For the "Device Energy Management" mode, tags: 0x4001 (DeviceOptimization).
|
|
2049
|
+
* - For the "Home Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization).
|
|
2050
|
+
* - For the "Grid Energy Management" mode, tags: 0x4003 (GridOptimization).
|
|
2051
|
+
* - For the "Full Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization), 0x4003 (GridOptimization).
|
|
2052
|
+
*/
|
|
1103
2053
|
createDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
|
|
1104
2054
|
this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, {
|
|
1105
2055
|
supportedModes: supportedModes ?? [
|
|
@@ -1120,15 +2070,27 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1120
2070
|
mode: 5,
|
|
1121
2071
|
modeTags: [{ value: DeviceEnergyManagementMode.ModeTag.DeviceOptimization }, { value: DeviceEnergyManagementMode.ModeTag.LocalOptimization }, { value: DeviceEnergyManagementMode.ModeTag.GridOptimization }],
|
|
1122
2072
|
},
|
|
1123
|
-
],
|
|
2073
|
+
], // Fixed attribute
|
|
1124
2074
|
currentMode: currentMode ?? 1,
|
|
1125
2075
|
});
|
|
1126
2076
|
return this;
|
|
1127
2077
|
}
|
|
2078
|
+
/**
|
|
2079
|
+
* 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.
|
|
2080
|
+
*
|
|
2081
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2082
|
+
*/
|
|
1128
2083
|
createDefaultPowerTopologyClusterServer() {
|
|
1129
2084
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1130
2085
|
return this;
|
|
1131
2086
|
}
|
|
2087
|
+
/**
|
|
2088
|
+
* Creates a default Electrical Energy Measurement Cluster Server with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
|
|
2089
|
+
*
|
|
2090
|
+
* @param {number} energyImported - The total consumption value in mW/h.
|
|
2091
|
+
* @param {number} energyExported - The total production value in mW/h.
|
|
2092
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2093
|
+
*/
|
|
1132
2094
|
createDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
|
|
1133
2095
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
1134
2096
|
accuracy: {
|
|
@@ -1144,6 +2106,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1144
2106
|
});
|
|
1145
2107
|
return this;
|
|
1146
2108
|
}
|
|
2109
|
+
/**
|
|
2110
|
+
* Creates a default Electrical Power Measurement Cluster Server with features AlternatingCurrent.
|
|
2111
|
+
*
|
|
2112
|
+
* @param {number} voltage - The voltage value in millivolts.
|
|
2113
|
+
* @param {number} current - The current value in milliamperes.
|
|
2114
|
+
* @param {number} power - The power value in milliwatts.
|
|
2115
|
+
* @param {number} frequency - The frequency value in millihertz.
|
|
2116
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2117
|
+
*/
|
|
1147
2118
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1148
2119
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1149
2120
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1185,36 +2156,124 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1185
2156
|
});
|
|
1186
2157
|
return this;
|
|
1187
2158
|
}
|
|
2159
|
+
/**
|
|
2160
|
+
* Creates a default TemperatureMeasurement cluster server.
|
|
2161
|
+
*
|
|
2162
|
+
* @param {number | null} measuredValue - The measured value of the temperature x 100.
|
|
2163
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
|
|
2164
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
|
|
2165
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2166
|
+
*/
|
|
1188
2167
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1189
2168
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1190
2169
|
return this;
|
|
1191
2170
|
}
|
|
2171
|
+
/**
|
|
2172
|
+
* Creates a default RelativeHumidityMeasurement cluster server.
|
|
2173
|
+
*
|
|
2174
|
+
* @param {number | null} measuredValue - The measured value of the relative humidity x 100.
|
|
2175
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
|
|
2176
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
|
|
2177
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2178
|
+
*/
|
|
1192
2179
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1193
2180
|
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1194
2181
|
return this;
|
|
1195
2182
|
}
|
|
2183
|
+
/**
|
|
2184
|
+
* Creates a default PressureMeasurement cluster server.
|
|
2185
|
+
*
|
|
2186
|
+
* @param {number | null} measuredValue - The measured value for the pressure in kPa x 10.
|
|
2187
|
+
* @param {number | null} minMeasuredValue - The minimum measured value for the pressure in kPa x 10.
|
|
2188
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value for the pressure in kPa x 10.
|
|
2189
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2190
|
+
*
|
|
2191
|
+
* @remarks
|
|
2192
|
+
* - MeasuredValue = 10 x Pressure in kPa
|
|
2193
|
+
* - MeasuredValue = 1 x Pressure in hPa
|
|
2194
|
+
* - MeasuredValue = 33.8639 x Pressure in inHg
|
|
2195
|
+
*
|
|
2196
|
+
* Conversion:
|
|
2197
|
+
* - 1 kPa = 10 hPa
|
|
2198
|
+
* - 1 inHg = 33.8639 hPa
|
|
2199
|
+
*/
|
|
1196
2200
|
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1197
2201
|
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1198
2202
|
return this;
|
|
1199
2203
|
}
|
|
2204
|
+
/**
|
|
2205
|
+
* Creates a default IlluminanceMeasurement cluster server.
|
|
2206
|
+
*
|
|
2207
|
+
* @param {number | null} measuredValue - The measured value of illuminance.
|
|
2208
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
|
|
2209
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
|
|
2210
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2211
|
+
*
|
|
2212
|
+
* @remarks The default value for the illuminance measurement is null.
|
|
2213
|
+
* This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
|
|
2214
|
+
* • MeasuredValue = 10,000 x log10(illuminance) + 1,
|
|
2215
|
+
* where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
|
|
2216
|
+
* • 0 indicates a value of illuminance that is too low to be measured
|
|
2217
|
+
* • null indicates that the illuminance measurement is invalid.
|
|
2218
|
+
*
|
|
2219
|
+
* - Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
|
|
2220
|
+
* - Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
|
|
2221
|
+
*/
|
|
1200
2222
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1201
2223
|
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1202
2224
|
return this;
|
|
1203
2225
|
}
|
|
2226
|
+
/**
|
|
2227
|
+
* Creates a default FlowMeasurement cluster server.
|
|
2228
|
+
*
|
|
2229
|
+
* @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
|
|
2230
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
|
|
2231
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
|
|
2232
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2233
|
+
*/
|
|
1204
2234
|
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
1205
2235
|
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
1206
2236
|
return this;
|
|
1207
2237
|
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Creates a default OccupancySensing cluster server with feature PassiveInfrared.
|
|
2240
|
+
*
|
|
2241
|
+
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
2242
|
+
* @param {number} holdTime - The hold time in seconds. Default is 30.
|
|
2243
|
+
* @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
|
|
2244
|
+
* @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
|
|
2245
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2246
|
+
*
|
|
2247
|
+
* @remarks The default value for the occupancy sensor type is PIR.
|
|
2248
|
+
*/
|
|
1208
2249
|
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
1209
2250
|
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
1210
2251
|
return this;
|
|
1211
2252
|
}
|
|
2253
|
+
/**
|
|
2254
|
+
* Creates a default AirQuality cluster server.
|
|
2255
|
+
*
|
|
2256
|
+
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2257
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2258
|
+
*/
|
|
1212
2259
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
1213
2260
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
1214
2261
|
airQuality,
|
|
1215
2262
|
});
|
|
1216
2263
|
return this;
|
|
1217
2264
|
}
|
|
2265
|
+
/**
|
|
2266
|
+
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2267
|
+
*
|
|
2268
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2269
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2270
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2271
|
+
* @param {number} [uncertainty] - The uncertainty value (optional).
|
|
2272
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2273
|
+
*
|
|
2274
|
+
* @remarks
|
|
2275
|
+
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2276
|
+
*/
|
|
1218
2277
|
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
1219
2278
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1220
2279
|
measuredValue,
|
|
@@ -1226,6 +2285,16 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1226
2285
|
});
|
|
1227
2286
|
return this;
|
|
1228
2287
|
}
|
|
2288
|
+
/**
|
|
2289
|
+
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature LevelIndication.
|
|
2290
|
+
|
|
2291
|
+
* @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
|
|
2292
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2293
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2294
|
+
*
|
|
2295
|
+
* @remarks
|
|
2296
|
+
* The measurementMedium attribute is fixed and cannot be changed after creation.
|
|
2297
|
+
*/
|
|
1229
2298
|
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1230
2299
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
1231
2300
|
levelValue,
|
|
@@ -1233,6 +2302,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1233
2302
|
});
|
|
1234
2303
|
return this;
|
|
1235
2304
|
}
|
|
2305
|
+
/**
|
|
2306
|
+
* Create a default CarbonMonoxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2307
|
+
*
|
|
2308
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2309
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2310
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2311
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2312
|
+
*
|
|
2313
|
+
* @remarks
|
|
2314
|
+
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2315
|
+
*/
|
|
1236
2316
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1237
2317
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1238
2318
|
measuredValue,
|
|
@@ -1244,6 +2324,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1244
2324
|
});
|
|
1245
2325
|
return this;
|
|
1246
2326
|
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Create a default CarbonDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2329
|
+
*
|
|
2330
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2331
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2332
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2333
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2334
|
+
*
|
|
2335
|
+
* @remarks
|
|
2336
|
+
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2337
|
+
*/
|
|
1247
2338
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1248
2339
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1249
2340
|
measuredValue,
|
|
@@ -1255,6 +2346,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1255
2346
|
});
|
|
1256
2347
|
return this;
|
|
1257
2348
|
}
|
|
2349
|
+
/**
|
|
2350
|
+
* Create a default FormaldehydeConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2351
|
+
*
|
|
2352
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2353
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2354
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2355
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2356
|
+
*
|
|
2357
|
+
* @remarks
|
|
2358
|
+
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2359
|
+
*/
|
|
1258
2360
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1259
2361
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1260
2362
|
measuredValue,
|
|
@@ -1266,6 +2368,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1266
2368
|
});
|
|
1267
2369
|
return this;
|
|
1268
2370
|
}
|
|
2371
|
+
/**
|
|
2372
|
+
* Create a default Pm1ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2373
|
+
*
|
|
2374
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2375
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2376
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2377
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2378
|
+
*
|
|
2379
|
+
* @remarks
|
|
2380
|
+
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2381
|
+
*/
|
|
1269
2382
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1270
2383
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1271
2384
|
measuredValue,
|
|
@@ -1277,6 +2390,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1277
2390
|
});
|
|
1278
2391
|
return this;
|
|
1279
2392
|
}
|
|
2393
|
+
/**
|
|
2394
|
+
* Create a default Pm25ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2395
|
+
*
|
|
2396
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2397
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2398
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2399
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2400
|
+
*
|
|
2401
|
+
* @remarks
|
|
2402
|
+
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2403
|
+
*/
|
|
1280
2404
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1281
2405
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1282
2406
|
measuredValue,
|
|
@@ -1288,6 +2412,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1288
2412
|
});
|
|
1289
2413
|
return this;
|
|
1290
2414
|
}
|
|
2415
|
+
/**
|
|
2416
|
+
* Create a default Pm10ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2417
|
+
*
|
|
2418
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2419
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2420
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2421
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2422
|
+
*
|
|
2423
|
+
* @remarks
|
|
2424
|
+
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2425
|
+
*/
|
|
1291
2426
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1292
2427
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1293
2428
|
measuredValue,
|
|
@@ -1299,6 +2434,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1299
2434
|
});
|
|
1300
2435
|
return this;
|
|
1301
2436
|
}
|
|
2437
|
+
/**
|
|
2438
|
+
* Create a default OzoneConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2439
|
+
*
|
|
2440
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2441
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2442
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2443
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2444
|
+
*
|
|
2445
|
+
* @remarks
|
|
2446
|
+
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2447
|
+
*/
|
|
1302
2448
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1303
2449
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1304
2450
|
measuredValue,
|
|
@@ -1310,6 +2456,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1310
2456
|
});
|
|
1311
2457
|
return this;
|
|
1312
2458
|
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Create a default RadonConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2461
|
+
*
|
|
2462
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2463
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2464
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2465
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2466
|
+
*
|
|
2467
|
+
* @remarks
|
|
2468
|
+
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2469
|
+
*/
|
|
1313
2470
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1314
2471
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1315
2472
|
measuredValue,
|
|
@@ -1321,6 +2478,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1321
2478
|
});
|
|
1322
2479
|
return this;
|
|
1323
2480
|
}
|
|
2481
|
+
/**
|
|
2482
|
+
* Create a default NitrogenDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2483
|
+
*
|
|
2484
|
+
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2485
|
+
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2486
|
+
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2487
|
+
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2488
|
+
*
|
|
2489
|
+
* @remarks
|
|
2490
|
+
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2491
|
+
*/
|
|
1324
2492
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1325
2493
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
1326
2494
|
measuredValue,
|
|
@@ -1333,3 +2501,4 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1333
2501
|
return this;
|
|
1334
2502
|
}
|
|
1335
2503
|
}
|
|
2504
|
+
//# sourceMappingURL=matterbridgeEndpoint.js.map
|