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