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