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