@matterbridge/core 3.5.3 → 3.5.4-dev-20260211-c4f9359
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/README.md +1 -1
- package/dist/cli.d.ts +0 -24
- package/dist/cli.js +1 -97
- package/dist/cliEmitter.d.ts +0 -36
- package/dist/cliEmitter.js +0 -37
- package/dist/cliHistory.d.ts +0 -42
- package/dist/cliHistory.js +0 -38
- package/dist/clusters/export.d.ts +0 -1
- package/dist/clusters/export.js +0 -2
- package/dist/deviceManager.d.ts +0 -108
- package/dist/deviceManager.js +1 -114
- package/dist/devices/airConditioner.d.ts +0 -75
- package/dist/devices/airConditioner.js +0 -57
- package/dist/devices/basicVideoPlayer.d.ts +0 -58
- package/dist/devices/basicVideoPlayer.js +1 -56
- package/dist/devices/batteryStorage.d.ts +0 -43
- package/dist/devices/batteryStorage.js +1 -48
- package/dist/devices/castingVideoPlayer.d.ts +0 -63
- package/dist/devices/castingVideoPlayer.js +2 -65
- package/dist/devices/cooktop.d.ts +0 -55
- package/dist/devices/cooktop.js +0 -56
- package/dist/devices/dishwasher.d.ts +0 -55
- package/dist/devices/dishwasher.js +0 -57
- package/dist/devices/evse.d.ts +0 -57
- package/dist/devices/evse.js +10 -74
- package/dist/devices/export.d.ts +0 -1
- package/dist/devices/export.js +0 -5
- package/dist/devices/extractorHood.d.ts +0 -41
- package/dist/devices/extractorHood.js +0 -43
- package/dist/devices/heatPump.d.ts +0 -43
- package/dist/devices/heatPump.js +2 -50
- package/dist/devices/laundryDryer.d.ts +0 -58
- package/dist/devices/laundryDryer.js +3 -62
- package/dist/devices/laundryWasher.d.ts +0 -64
- package/dist/devices/laundryWasher.js +4 -70
- package/dist/devices/microwaveOven.d.ts +1 -77
- package/dist/devices/microwaveOven.js +5 -88
- package/dist/devices/oven.d.ts +0 -82
- package/dist/devices/oven.js +0 -85
- package/dist/devices/refrigerator.d.ts +0 -100
- package/dist/devices/refrigerator.js +0 -102
- package/dist/devices/roboticVacuumCleaner.d.ts +0 -83
- package/dist/devices/roboticVacuumCleaner.js +9 -100
- package/dist/devices/solarPower.d.ts +0 -36
- package/dist/devices/solarPower.js +0 -38
- package/dist/devices/speaker.d.ts +0 -79
- package/dist/devices/speaker.js +0 -84
- package/dist/devices/temperatureControl.d.ts +0 -21
- package/dist/devices/temperatureControl.js +3 -24
- package/dist/devices/waterHeater.d.ts +0 -74
- package/dist/devices/waterHeater.js +2 -82
- package/dist/dgram/export.d.ts +0 -1
- package/dist/dgram/export.js +0 -1
- package/dist/export.d.ts +0 -23
- package/dist/export.js +0 -28
- package/dist/frontend.d.ts +0 -187
- package/dist/frontend.js +38 -539
- package/dist/helpers.d.ts +0 -43
- package/dist/helpers.js +0 -86
- package/dist/jestutils/export.d.ts +0 -1
- package/dist/jestutils/export.js +0 -1
- package/dist/jestutils/jestHelpers.d.ts +0 -259
- package/dist/jestutils/jestHelpers.js +14 -395
- package/dist/matter/behaviors.d.ts +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.d.ts +0 -1
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.d.ts +0 -1
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.d.ts +0 -1
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.d.ts +0 -1
- package/dist/matter/export.js +0 -2
- package/dist/matter/types.d.ts +0 -1
- package/dist/matter/types.js +0 -2
- package/dist/matterNode.d.ts +0 -258
- package/dist/matterNode.js +8 -356
- package/dist/matterbridge.d.ts +0 -389
- package/dist/matterbridge.js +48 -878
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -42
- package/dist/matterbridgeAccessoryPlatform.js +0 -50
- package/dist/matterbridgeBehaviors.d.ts +0 -24
- package/dist/matterbridgeBehaviors.js +5 -65
- package/dist/matterbridgeDeviceTypes.d.ts +0 -649
- package/dist/matterbridgeDeviceTypes.js +6 -673
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -42
- package/dist/matterbridgeDynamicPlatform.js +0 -50
- package/dist/matterbridgeEndpoint.d.ts +0 -1369
- package/dist/matterbridgeEndpoint.js +56 -1514
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -425
- package/dist/matterbridgeEndpointHelpers.js +20 -483
- package/dist/matterbridgeEndpointTypes.d.ts +0 -70
- package/dist/matterbridgeEndpointTypes.js +0 -25
- package/dist/matterbridgePlatform.d.ts +0 -434
- package/dist/matterbridgePlatform.js +1 -473
- package/dist/mb_coap.d.ts +0 -23
- package/dist/mb_coap.js +3 -41
- package/dist/mb_health.d.ts +0 -67
- package/dist/mb_health.js +0 -70
- package/dist/mb_mdns.d.ts +0 -23
- package/dist/mb_mdns.js +36 -94
- package/dist/pluginManager.d.ts +0 -307
- package/dist/pluginManager.js +6 -346
- package/dist/spawn.d.ts +0 -32
- package/dist/spawn.js +1 -71
- package/dist/utils/export.d.ts +0 -1
- package/dist/utils/export.js +0 -1
- package/package.json +27 -6
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cliEmitter.d.ts.map +0 -1
- package/dist/cliEmitter.js.map +0 -1
- package/dist/cliHistory.d.ts.map +0 -1
- package/dist/cliHistory.js.map +0 -1
- package/dist/clusters/export.d.ts.map +0 -1
- package/dist/clusters/export.js.map +0 -1
- package/dist/crypto/attestationDecoder.d.ts +0 -180
- package/dist/crypto/attestationDecoder.d.ts.map +0 -1
- package/dist/crypto/attestationDecoder.js +0 -176
- package/dist/crypto/attestationDecoder.js.map +0 -1
- package/dist/crypto/declarationDecoder.d.ts +0 -72
- package/dist/crypto/declarationDecoder.d.ts.map +0 -1
- package/dist/crypto/declarationDecoder.js +0 -241
- package/dist/crypto/declarationDecoder.js.map +0 -1
- package/dist/crypto/extract/342/200/220cert/342/200/220extensions.d.ts +0 -9
- package/dist/crypto/extract/342/200/220cert/342/200/220extensions.d.ts.map +0 -1
- package/dist/crypto/extract/342/200/220cert/342/200/220extensions.js +0 -120
- package/dist/crypto/extract/342/200/220cert/342/200/220extensions.js.map +0 -1
- package/dist/crypto/read-extensions.d.ts +0 -2
- package/dist/crypto/read-extensions.d.ts.map +0 -1
- package/dist/crypto/read-extensions.js +0 -81
- package/dist/crypto/read-extensions.js.map +0 -1
- package/dist/crypto/testData.d.ts +0 -31
- package/dist/crypto/testData.d.ts.map +0 -1
- package/dist/crypto/testData.js +0 -131
- package/dist/crypto/testData.js.map +0 -1
- package/dist/crypto/walk-der.d.ts +0 -2
- package/dist/crypto/walk-der.d.ts.map +0 -1
- package/dist/crypto/walk-der.js +0 -165
- package/dist/crypto/walk-der.js.map +0 -1
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/devices/airConditioner.d.ts.map +0 -1
- package/dist/devices/airConditioner.js.map +0 -1
- package/dist/devices/basicVideoPlayer.d.ts.map +0 -1
- package/dist/devices/basicVideoPlayer.js.map +0 -1
- package/dist/devices/batteryStorage.d.ts.map +0 -1
- package/dist/devices/batteryStorage.js.map +0 -1
- package/dist/devices/castingVideoPlayer.d.ts.map +0 -1
- package/dist/devices/castingVideoPlayer.js.map +0 -1
- package/dist/devices/cooktop.d.ts.map +0 -1
- package/dist/devices/cooktop.js.map +0 -1
- package/dist/devices/dishwasher.d.ts.map +0 -1
- package/dist/devices/dishwasher.js.map +0 -1
- package/dist/devices/evse.d.ts.map +0 -1
- package/dist/devices/evse.js.map +0 -1
- package/dist/devices/export.d.ts.map +0 -1
- package/dist/devices/export.js.map +0 -1
- package/dist/devices/extractorHood.d.ts.map +0 -1
- package/dist/devices/extractorHood.js.map +0 -1
- package/dist/devices/heatPump.d.ts.map +0 -1
- package/dist/devices/heatPump.js.map +0 -1
- package/dist/devices/laundryDryer.d.ts.map +0 -1
- package/dist/devices/laundryDryer.js.map +0 -1
- package/dist/devices/laundryWasher.d.ts.map +0 -1
- package/dist/devices/laundryWasher.js.map +0 -1
- package/dist/devices/microwaveOven.d.ts.map +0 -1
- package/dist/devices/microwaveOven.js.map +0 -1
- package/dist/devices/oven.d.ts.map +0 -1
- package/dist/devices/oven.js.map +0 -1
- package/dist/devices/refrigerator.d.ts.map +0 -1
- package/dist/devices/refrigerator.js.map +0 -1
- package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
- package/dist/devices/roboticVacuumCleaner.js.map +0 -1
- package/dist/devices/solarPower.d.ts.map +0 -1
- package/dist/devices/solarPower.js.map +0 -1
- package/dist/devices/speaker.d.ts.map +0 -1
- package/dist/devices/speaker.js.map +0 -1
- package/dist/devices/temperatureControl.d.ts.map +0 -1
- package/dist/devices/temperatureControl.js.map +0 -1
- package/dist/devices/waterHeater.d.ts.map +0 -1
- package/dist/devices/waterHeater.js.map +0 -1
- package/dist/dgram/export.d.ts.map +0 -1
- package/dist/dgram/export.js.map +0 -1
- package/dist/export.d.ts.map +0 -1
- package/dist/export.js.map +0 -1
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/jestutils/export.d.ts.map +0 -1
- package/dist/jestutils/export.js.map +0 -1
- package/dist/jestutils/jestHelpers.d.ts.map +0 -1
- package/dist/jestutils/jestHelpers.js.map +0 -1
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterNode.d.ts.map +0 -1
- package/dist/matterNode.js.map +0 -1
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgeEndpointTypes.d.ts.map +0 -1
- package/dist/matterbridgeEndpointTypes.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/mb_coap.d.ts.map +0 -1
- package/dist/mb_coap.js.map +0 -1
- package/dist/mb_health.d.ts.map +0 -1
- package/dist/mb_health.js.map +0 -1
- package/dist/mb_mdns.d.ts.map +0 -1
- package/dist/mb_mdns.js.map +0 -1
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/spawn.d.ts.map +0 -1
- package/dist/spawn.js.map +0 -1
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/workers/brand.d.ts +0 -25
- package/dist/workers/brand.d.ts.map +0 -1
- package/dist/workers/brand.extend.d.ts +0 -10
- package/dist/workers/brand.extend.d.ts.map +0 -1
- package/dist/workers/brand.extend.js +0 -15
- package/dist/workers/brand.extend.js.map +0 -1
- package/dist/workers/brand.invalid.d.ts +0 -9
- package/dist/workers/brand.invalid.d.ts.map +0 -1
- package/dist/workers/brand.invalid.js +0 -19
- package/dist/workers/brand.invalid.js.map +0 -1
- package/dist/workers/brand.js +0 -67
- package/dist/workers/brand.js.map +0 -1
- package/dist/workers/clusterTypes.d.ts +0 -47
- package/dist/workers/clusterTypes.d.ts.map +0 -1
- package/dist/workers/clusterTypes.js +0 -57
- package/dist/workers/clusterTypes.js.map +0 -1
- package/dist/workers/frontendWorker.d.ts +0 -2
- package/dist/workers/frontendWorker.d.ts.map +0 -1
- package/dist/workers/frontendWorker.js +0 -90
- package/dist/workers/frontendWorker.js.map +0 -1
- package/dist/workers/helloWorld.d.ts +0 -2
- package/dist/workers/helloWorld.d.ts.map +0 -1
- package/dist/workers/helloWorld.js +0 -135
- package/dist/workers/helloWorld.js.map +0 -1
- package/dist/workers/matterWorker.d.ts +0 -2
- package/dist/workers/matterWorker.d.ts.map +0 -1
- package/dist/workers/matterWorker.js +0 -104
- package/dist/workers/matterWorker.js.map +0 -1
- package/dist/workers/matterbridgeWorker.d.ts +0 -2
- package/dist/workers/matterbridgeWorker.d.ts.map +0 -1
- package/dist/workers/matterbridgeWorker.js +0 -75
- package/dist/workers/matterbridgeWorker.js.map +0 -1
- package/dist/workers/messageLab.d.ts +0 -134
- package/dist/workers/messageLab.d.ts.map +0 -1
- package/dist/workers/messageLab.js +0 -129
- package/dist/workers/messageLab.js.map +0 -1
- package/dist/workers/testWorker.d.ts +0 -2
- package/dist/workers/testWorker.d.ts.map +0 -1
- package/dist/workers/testWorker.js +0 -45
- package/dist/workers/testWorker.js.map +0 -1
- package/dist/workers/usage.d.ts +0 -19
- package/dist/workers/usage.d.ts.map +0 -1
- package/dist/workers/usage.js +0 -140
- package/dist/workers/usage.js.map +0 -1
- package/dist/workers/workerManager.d.ts +0 -115
- package/dist/workers/workerManager.d.ts.map +0 -1
- package/dist/workers/workerManager.js +0 -464
- package/dist/workers/workerManager.js.map +0 -1
- package/dist/workers/workerServer.d.ts +0 -126
- package/dist/workers/workerServer.d.ts.map +0 -1
- package/dist/workers/workerServer.js +0 -340
- package/dist/workers/workerServer.js.map +0 -1
- package/dist/workers/workerTypes.d.ts +0 -23
- package/dist/workers/workerTypes.d.ts.map +0 -1
- package/dist/workers/workerTypes.js +0 -3
- package/dist/workers/workerTypes.js.map +0 -1
|
@@ -1,41 +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 jsdoc/reject-any-type */
|
|
25
|
-
/* eslint-disable jsdoc/reject-function-type */
|
|
26
|
-
// eslint-disable-next-line no-console
|
|
27
1
|
if (process.argv.includes('--loader') || process.argv.includes('-loader'))
|
|
28
2
|
console.log('\u001B[32mMatterbridgeEndpoint loaded.\u001B[40;0m');
|
|
29
|
-
// AnsiLogger module
|
|
30
3
|
import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from 'node-ansi-logger';
|
|
31
|
-
// @matter/general
|
|
32
4
|
import { Lifecycle, NamedHandler, UINT16_MAX, UINT32_MAX } from '@matter/general';
|
|
33
|
-
// @matter/node
|
|
34
5
|
import { Endpoint, MutableEndpoint, SupportedBehaviors } from '@matter/node';
|
|
35
|
-
// @matter/types
|
|
36
6
|
import { getClusterNameById } from '@matter/types/cluster';
|
|
37
7
|
import { VendorId } from '@matter/types/datatype';
|
|
38
|
-
// @matter clusters
|
|
39
8
|
import { Descriptor } from '@matter/types/clusters/descriptor';
|
|
40
9
|
import { PowerSource } from '@matter/types/clusters/power-source';
|
|
41
10
|
import { BridgedDeviceBasicInformation } from '@matter/types/clusters/bridged-device-basic-information';
|
|
@@ -62,7 +31,6 @@ import { ThermostatUserInterfaceConfiguration } from '@matter/types/clusters/the
|
|
|
62
31
|
import { OperationalState } from '@matter/types/clusters/operational-state';
|
|
63
32
|
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
64
33
|
import { ResourceMonitoring } from '@matter/types/clusters/resource-monitoring';
|
|
65
|
-
// @matter behaviors
|
|
66
34
|
import { DescriptorServer } from '@matter/node/behaviors/descriptor';
|
|
67
35
|
import { BridgedDeviceBasicInformationServer } from '@matter/node/behaviors/bridged-device-basic-information';
|
|
68
36
|
import { GroupsServer } from '@matter/node/behaviors/groups';
|
|
@@ -92,68 +60,31 @@ import { RadonConcentrationMeasurementServer } from '@matter/node/behaviors/rado
|
|
|
92
60
|
import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/node/behaviors/total-volatile-organic-compounds-concentration-measurement';
|
|
93
61
|
import { FanControlServer } from '@matter/node/behaviors/fan-control';
|
|
94
62
|
import { ThermostatUserInterfaceConfigurationServer } from '@matter/node/behaviors/thermostat-user-interface-configuration';
|
|
95
|
-
// Matterbridge
|
|
96
63
|
import { inspectError, isValidNumber, isValidObject, isValidString } from '@matterbridge/utils';
|
|
97
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';
|
|
98
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, getDefaultPowerSourceBatteryClusterServer, } from './matterbridgeEndpointHelpers.js';
|
|
99
|
-
// Module-private brand
|
|
100
66
|
const MATTERBRIDGE_ENDPOINT_BRAND = Symbol('MatterbridgeEndpoint.brand');
|
|
101
|
-
/**
|
|
102
|
-
* Type guard to check whether a value is a MatterbridgeEndpoint instance.
|
|
103
|
-
*
|
|
104
|
-
* @param {unknown} value - the value to check
|
|
105
|
-
* @returns { value is MatterbridgeEndpoint } - true if the value is a MatterbridgeEndpoint instance
|
|
106
|
-
*/
|
|
107
67
|
export function isMatterbridgeEndpoint(value) {
|
|
108
68
|
if (!value || typeof value !== 'object')
|
|
109
69
|
return false;
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
111
70
|
const v = value;
|
|
112
|
-
// 1. Brand: must be branded by *this* module instance.
|
|
113
71
|
if (v[MATTERBRIDGE_ENDPOINT_BRAND] !== true)
|
|
114
72
|
return false;
|
|
115
|
-
// 2. instanceof: strengthen guarantee when there aren't multiple copies of the package.
|
|
116
73
|
if (!(v instanceof MatterbridgeEndpoint))
|
|
117
74
|
return false;
|
|
118
75
|
return true;
|
|
119
76
|
}
|
|
120
|
-
/**
|
|
121
|
-
* Assert that a value is a MatterbridgeEndpoint instance.
|
|
122
|
-
*
|
|
123
|
-
* @param {unknown} value - the value to check
|
|
124
|
-
* @param {string} [context] - optional context for error message
|
|
125
|
-
* @returns {asserts value is MatterbridgeEndpoint} - asserts that the value is a MatterbridgeEndpoint instance
|
|
126
|
-
* @throws {TypeError} - if the value is not a MatterbridgeEndpoint instance
|
|
127
|
-
*/
|
|
128
77
|
export function assertMatterbridgeEndpoint(value, context) {
|
|
129
78
|
if (isMatterbridgeEndpoint(value))
|
|
130
79
|
return;
|
|
131
80
|
throw new TypeError(`Invalid MatterbridgeEndpoint received${context ? ` in ${context}` : ''}`);
|
|
132
81
|
}
|
|
133
82
|
export class MatterbridgeEndpoint extends Endpoint {
|
|
134
|
-
|
|
135
|
-
static logLevel = "info" /* LogLevel.INFO */;
|
|
136
|
-
/**
|
|
137
|
-
* Activates a special mode for this endpoint.
|
|
138
|
-
* - 'server': it creates the device server node and add the device as Matter device that needs to be paired individually.
|
|
139
|
-
* 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.
|
|
140
|
-
*
|
|
141
|
-
* - 'matter': it adds the device directly to the bridge server node as Matter device. In this case the implementation must respect
|
|
142
|
-
* the 9.2.3. Disambiguation rule (i.e. use taglist if needed cause the device doesn't have nodeLabel).
|
|
143
|
-
* Furthermore the device will be a part of the bridge (i.e. will have the same name and will be in the same room).
|
|
144
|
-
* See 9.12.2.2. Native Matter functionality in Bridge.
|
|
145
|
-
*
|
|
146
|
-
* @remarks
|
|
147
|
-
* Always use createDefaultBasicInformationClusterServer() to create the BasicInformation cluster server.
|
|
148
|
-
*/
|
|
83
|
+
static logLevel = "info";
|
|
149
84
|
mode = undefined;
|
|
150
|
-
/** The server node of the endpoint, if it is a single not bridged endpoint */
|
|
151
85
|
serverNode;
|
|
152
|
-
/** The logger instance for the MatterbridgeEndpoint */
|
|
153
86
|
log;
|
|
154
|
-
/** The plugin name this MatterbridgeEndpoint belongs to */
|
|
155
87
|
plugin = undefined;
|
|
156
|
-
/** The configuration URL of the device, if available */
|
|
157
88
|
configUrl = undefined;
|
|
158
89
|
deviceName = undefined;
|
|
159
90
|
serialNumber = undefined;
|
|
@@ -167,30 +98,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
167
98
|
hardwareVersion = undefined;
|
|
168
99
|
hardwareVersionString = undefined;
|
|
169
100
|
productUrl = 'https://www.npmjs.com/package/matterbridge';
|
|
170
|
-
/** The tagList of the descriptor cluster of the MatterbridgeEndpoint */
|
|
171
101
|
tagList = undefined;
|
|
172
|
-
/** The original id (with spaces and .) of the MatterbridgeEndpoint constructor options */
|
|
173
102
|
originalId = undefined;
|
|
174
|
-
/** The name of the first device type of the MatterbridgeEndpoint */
|
|
175
103
|
name = undefined;
|
|
176
|
-
/** The code of the first device type of the MatterbridgeEndpoint */
|
|
177
104
|
deviceType = undefined;
|
|
178
|
-
/** Maps the DeviceTypeDefinitions of the MatterbridgeEndpoint keyed by their code */
|
|
179
105
|
deviceTypes = new Map();
|
|
180
|
-
/** Command handler for the MatterbridgeEndpoint commands */
|
|
181
106
|
commandHandler = new NamedHandler();
|
|
182
|
-
/**
|
|
183
|
-
* Represents a MatterbridgeEndpoint.
|
|
184
|
-
*
|
|
185
|
-
* @class MatterbridgeEndpoint
|
|
186
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the endpoint.
|
|
187
|
-
* @param {MatterbridgeEndpointOptions} [options] - The options for the device.
|
|
188
|
-
* @param {boolean} [debug] - Debug flag.
|
|
189
|
-
*/
|
|
190
107
|
constructor(definition, options = {}, debug = false) {
|
|
191
108
|
let deviceTypeList = [];
|
|
192
109
|
const originalId = options.id;
|
|
193
|
-
// Get the first DeviceTypeDefinition
|
|
194
110
|
let firstDefinition;
|
|
195
111
|
if (Array.isArray(definition)) {
|
|
196
112
|
firstDefinition = definition[0];
|
|
@@ -203,12 +119,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
203
119
|
firstDefinition = definition;
|
|
204
120
|
deviceTypeList = [{ deviceType: firstDefinition.code, revision: firstDefinition.revision }];
|
|
205
121
|
}
|
|
206
|
-
// Convert the first DeviceTypeDefinition to an EndpointType.Options
|
|
207
122
|
const deviceTypeDefinitionV8 = {
|
|
208
123
|
name: firstDefinition.name.replace('-', '_'),
|
|
209
124
|
deviceType: firstDefinition.code,
|
|
210
125
|
deviceRevision: firstDefinition.revision,
|
|
211
|
-
// @ts-expect-error we don't import an entire module for DeviceClassification
|
|
212
126
|
deviceClass: firstDefinition.deviceClass.toLowerCase(),
|
|
213
127
|
requirements: {
|
|
214
128
|
server: {
|
|
@@ -223,18 +137,15 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
223
137
|
behaviors: options.tagList ? SupportedBehaviors(DescriptorServer.with(Descriptor.Feature.TagList)) : SupportedBehaviors(DescriptorServer),
|
|
224
138
|
};
|
|
225
139
|
const endpointV8 = MutableEndpoint(deviceTypeDefinitionV8);
|
|
226
|
-
// Check if the options.id is valid
|
|
227
140
|
if (options.id && checkNotLatinCharacters(options.id)) {
|
|
228
141
|
options.id = generateUniqueId(options.id);
|
|
229
142
|
}
|
|
230
|
-
// Convert the options to an Endpoint.Options
|
|
231
143
|
const optionsV8 = {
|
|
232
144
|
id: options.id?.replace(/[ .]/g, ''),
|
|
233
145
|
number: options.number,
|
|
234
146
|
descriptor: options.tagList ? { tagList: options.tagList, deviceTypeList } : { deviceTypeList },
|
|
235
147
|
};
|
|
236
148
|
super(endpointV8, optionsV8);
|
|
237
|
-
// Set the brand
|
|
238
149
|
Object.defineProperty(this, MATTERBRIDGE_ENDPOINT_BRAND, {
|
|
239
150
|
value: true,
|
|
240
151
|
writable: false,
|
|
@@ -253,57 +164,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
253
164
|
}
|
|
254
165
|
else
|
|
255
166
|
this.deviceTypes.set(firstDefinition.code, firstDefinition);
|
|
256
|
-
// console.log('MatterbridgeEndpoint.option', options);
|
|
257
|
-
// console.log('MatterbridgeEndpoint.endpointV8', endpointV8);
|
|
258
|
-
// console.log('MatterbridgeEndpoint.optionsV8', optionsV8);
|
|
259
|
-
// Create the logger. Temporarly uses the originalId if available or 'MatterbridgeEndpoint' as fallback. The logName will be set by createDefaultBasicInformationClusterServer() and createDefaultBridgedDeviceBasicInformationClusterServer() with deviceName.
|
|
260
167
|
this.log = new AnsiLogger({
|
|
261
168
|
logName: this.originalId ?? 'MatterbridgeEndpoint',
|
|
262
|
-
logTimestampFormat: 4
|
|
263
|
-
logLevel: debug === true ? "debug"
|
|
169
|
+
logTimestampFormat: 4,
|
|
170
|
+
logLevel: debug === true ? "debug" : MatterbridgeEndpoint.logLevel,
|
|
264
171
|
});
|
|
265
172
|
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}`);
|
|
266
|
-
// Add MatterbridgeServer
|
|
267
173
|
this.behaviors.require(MatterbridgeServer, { log: this.log, commandHandler: this.commandHandler });
|
|
268
174
|
}
|
|
269
|
-
/**
|
|
270
|
-
* Loads an instance of the MatterbridgeEndpoint class.
|
|
271
|
-
*
|
|
272
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The DeviceTypeDefinition(s) of the device.
|
|
273
|
-
* @param {MatterbridgeEndpointOptions} [options] - The options for the device.
|
|
274
|
-
* @param {boolean} [debug] - Debug flag.
|
|
275
|
-
* @returns {Promise<MatterbridgeEndpoint>} MatterbridgeEndpoint instance.
|
|
276
|
-
*/
|
|
277
175
|
static async loadInstance(definition, options = {}, debug = false) {
|
|
278
176
|
return new MatterbridgeEndpoint(definition, options, debug);
|
|
279
177
|
}
|
|
280
|
-
/**
|
|
281
|
-
* Get all the device types of this endpoint.
|
|
282
|
-
*
|
|
283
|
-
* @returns {DeviceTypeDefinition[]} The device types of this endpoint.
|
|
284
|
-
*/
|
|
285
178
|
getDeviceTypes() {
|
|
286
179
|
return Array.from(this.deviceTypes.values());
|
|
287
180
|
}
|
|
288
|
-
/**
|
|
289
|
-
* Checks if the provided cluster server is supported by this endpoint.
|
|
290
|
-
*
|
|
291
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
292
|
-
* @returns {boolean} True if the cluster server is supported, false otherwise.
|
|
293
|
-
*
|
|
294
|
-
* @example
|
|
295
|
-
*
|
|
296
|
-
* The following examples are all valid ways to check if the 'OnOff' cluster server is supported by the endpoint:
|
|
297
|
-
* ```typescript
|
|
298
|
-
* if(device.hasClusterServer(OnOffBehavior)) ...
|
|
299
|
-
* if(device.hasClusterServer(OnOffServer)) ...
|
|
300
|
-
* if(device.hasClusterServer(OnOffCluster)) ...
|
|
301
|
-
* if(device.hasClusterServer(OnOff.Cluster)) ...
|
|
302
|
-
* if(device.hasClusterServer(OnOff.Cluster.id)) ...
|
|
303
|
-
* if(device.hasClusterServer('OnOff')) ...
|
|
304
|
-
* ```
|
|
305
|
-
* The last has the advantage of being able to check for clusters without imports. Just use the name found in the Matter specs.
|
|
306
|
-
*/
|
|
307
181
|
hasClusterServer(cluster) {
|
|
308
182
|
const behavior = getBehavior(this, cluster);
|
|
309
183
|
if (behavior)
|
|
@@ -311,26 +185,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
311
185
|
else
|
|
312
186
|
return false;
|
|
313
187
|
}
|
|
314
|
-
/**
|
|
315
|
-
* Checks if the provided attribute server is supported for a given cluster of this endpoint.
|
|
316
|
-
*
|
|
317
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to check.
|
|
318
|
-
* @param {string} attribute - The attribute name to check.
|
|
319
|
-
* @returns {boolean} True if the attribute server is supported, false otherwise.
|
|
320
|
-
*
|
|
321
|
-
* @example
|
|
322
|
-
*
|
|
323
|
-
* The following examples are all valid ways to check if the 'onOff' attribute of the 'OnOff' cluster server is supported by the endpoint:
|
|
324
|
-
* ```typescript
|
|
325
|
-
* if(device.hasAttributeServer(OnOffBehavior, 'onOff')) ...
|
|
326
|
-
* if(device.hasAttributeServer(OnOffServer, 'onOff')) ...
|
|
327
|
-
* if(device.hasAttributeServer(OnOffCluster, 'onOff')) ...
|
|
328
|
-
* if(device.hasAttributeServer(OnOff.Cluster, 'onOff')) ...
|
|
329
|
-
* if(device.hasAttributeServer(OnOff.Cluster.id, 'onOff')) ...
|
|
330
|
-
* if(device.hasAttributeServer('OnOff', 'onOff')) ...
|
|
331
|
-
* ```
|
|
332
|
-
* The last has the advantage of being able to check for clusters attributes without imports. Just use the names found in the Matter specs.
|
|
333
|
-
*/
|
|
334
188
|
hasAttributeServer(cluster, attribute) {
|
|
335
189
|
const behavior = getBehavior(this, cluster);
|
|
336
190
|
if (!behavior || !this.behaviors.supported[behavior.id])
|
|
@@ -339,280 +193,82 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
339
193
|
const defaults = this.behaviors.defaultsFor(behavior);
|
|
340
194
|
return lowercaseFirstLetter(attribute) in options || lowercaseFirstLetter(attribute) in defaults;
|
|
341
195
|
}
|
|
342
|
-
/**
|
|
343
|
-
* Retrieves the initial options for the provided cluster server.
|
|
344
|
-
*
|
|
345
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to get options for.
|
|
346
|
-
* @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.
|
|
347
|
-
*/
|
|
348
196
|
getClusterServerOptions(cluster) {
|
|
349
197
|
const behavior = getBehavior(this, cluster);
|
|
350
198
|
if (!behavior)
|
|
351
199
|
return undefined;
|
|
352
200
|
return this.behaviors.optionsFor(behavior);
|
|
353
201
|
}
|
|
354
|
-
/**
|
|
355
|
-
* Retrieves the value of the provided attribute from the given cluster.
|
|
356
|
-
*
|
|
357
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
358
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
359
|
-
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
360
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
361
|
-
*
|
|
362
|
-
* @example
|
|
363
|
-
*
|
|
364
|
-
* The following examples are all valid ways to retrieve the 'onOff' attribute of the 'OnOff' cluster server:
|
|
365
|
-
* ```typescript
|
|
366
|
-
* device.getAttribute(OnOffBehavior, 'onOff')
|
|
367
|
-
* device.getAttribute(OnOffServer, 'onOff')
|
|
368
|
-
* device.getAttribute(OnOffCluster, 'onOff')
|
|
369
|
-
* device.getAttribute(OnOff.Cluster, 'onOff')
|
|
370
|
-
* device.getAttribute(OnOff.Cluster.id, 'onOff')
|
|
371
|
-
* device.getAttribute('OnOff', 'onOff')
|
|
372
|
-
* ```
|
|
373
|
-
* The last has the advantage of being able to retrieve cluster attributes without imports. Just use the names found in the Matter specs.
|
|
374
|
-
*/
|
|
375
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
376
202
|
getAttribute(cluster, attribute, log) {
|
|
377
203
|
return getAttribute(this, cluster, attribute, log);
|
|
378
204
|
}
|
|
379
|
-
/**
|
|
380
|
-
* Sets the value of an attribute on a cluster server.
|
|
381
|
-
*
|
|
382
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} clusterId - The ID of the cluster.
|
|
383
|
-
* @param {string} attribute - The name of the attribute.
|
|
384
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
385
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging errors and information.
|
|
386
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
387
|
-
*
|
|
388
|
-
* @example
|
|
389
|
-
*
|
|
390
|
-
* The following examples are all valid ways to set the 'onOff' attribute of the 'OnOff' cluster server:
|
|
391
|
-
* ```typescript
|
|
392
|
-
* await device.setAttribute(OnOffBehavior, 'onOff', true)
|
|
393
|
-
* await device.setAttribute(OnOffServer, 'onOff', true)
|
|
394
|
-
* await device.setAttribute(OnOffCluster, 'onOff', true)
|
|
395
|
-
* await device.setAttribute(OnOff.Cluster, 'onOff', true)
|
|
396
|
-
* await device.setAttribute(OnOff.Cluster.id, 'onOff', true)
|
|
397
|
-
* await device.setAttribute('OnOff', 'onOff', true)
|
|
398
|
-
* ```
|
|
399
|
-
* The last has the advantage of being able to set cluster attributes without imports. Just use the names found in the Matter specs.
|
|
400
|
-
*/
|
|
401
205
|
async setAttribute(clusterId, attribute, value, log) {
|
|
402
206
|
return await setAttribute(this, clusterId, attribute, value, log);
|
|
403
207
|
}
|
|
404
|
-
/**
|
|
405
|
-
* Update the value of an attribute on a cluster server only if the value is different.
|
|
406
|
-
*
|
|
407
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
408
|
-
* @param {string} attribute - The name of the attribute.
|
|
409
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
410
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
|
|
411
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
412
|
-
*
|
|
413
|
-
* @example
|
|
414
|
-
*
|
|
415
|
-
* The following examples are all valid ways to update the 'onOff' attribute of the 'OnOff' cluster server:
|
|
416
|
-
* ```typescript
|
|
417
|
-
* await device.updateAttribute(OnOffBehavior, 'onOff', true)
|
|
418
|
-
* await device.updateAttribute(OnOffServer, 'onOff', true)
|
|
419
|
-
* await device.updateAttribute(OnOffCluster, 'onOff', true)
|
|
420
|
-
* await device.updateAttribute(OnOff.Cluster, 'onOff', true)
|
|
421
|
-
* await device.updateAttribute(OnOff.Cluster.id, 'onOff', true)
|
|
422
|
-
* await device.updateAttribute('OnOff', 'onOff', true)
|
|
423
|
-
* ```
|
|
424
|
-
* The last has the advantage of being able to update cluster attributes without imports. Just use the names found in the Matter specs.
|
|
425
|
-
*/
|
|
426
208
|
async updateAttribute(cluster, attribute, value, log) {
|
|
427
209
|
return await updateAttribute(this, cluster, attribute, value, log);
|
|
428
210
|
}
|
|
429
|
-
|
|
430
|
-
* Subscribes to the provided attribute on a cluster.
|
|
431
|
-
*
|
|
432
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
|
|
433
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
434
|
-
* @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.
|
|
435
|
-
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
436
|
-
* @returns {Promise<boolean>} - A boolean indicating whether the subscription was successful.
|
|
437
|
-
*
|
|
438
|
-
* @remarks
|
|
439
|
-
* The listener function (cannot be async!) will receive three parameters:
|
|
440
|
-
* - `newValue`: The new value of the attribute.
|
|
441
|
-
* - `oldValue`: The old value of the attribute.
|
|
442
|
-
* - `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.
|
|
443
|
-
*/
|
|
444
|
-
async subscribeAttribute(cluster, attribute,
|
|
445
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
446
|
-
listener, log) {
|
|
211
|
+
async subscribeAttribute(cluster, attribute, listener, log) {
|
|
447
212
|
return await subscribeAttribute(this, cluster, attribute, listener, log);
|
|
448
213
|
}
|
|
449
|
-
/**
|
|
450
|
-
* Triggers an event on the specified cluster.
|
|
451
|
-
*
|
|
452
|
-
* @param {ClusterId} cluster - The ID of the cluster.
|
|
453
|
-
* @param {string} event - The name of the event to trigger.
|
|
454
|
-
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
455
|
-
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
456
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
457
|
-
*/
|
|
458
214
|
async triggerEvent(cluster, event, payload, log) {
|
|
459
215
|
return await triggerEvent(this, cluster, event, payload, log);
|
|
460
216
|
}
|
|
461
|
-
/**
|
|
462
|
-
* Adds cluster servers from the provided server list.
|
|
463
|
-
*
|
|
464
|
-
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
465
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
466
|
-
*/
|
|
467
217
|
addClusterServers(serverList) {
|
|
468
218
|
addClusterServers(this, serverList);
|
|
469
219
|
return this;
|
|
470
220
|
}
|
|
471
|
-
/**
|
|
472
|
-
* Adds a fixed label to the FixedLabel cluster. If the cluster server is not present, it will be added.
|
|
473
|
-
*
|
|
474
|
-
* @param {string} label - The label to add.
|
|
475
|
-
* @param {string} value - The value of the label.
|
|
476
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
477
|
-
*/
|
|
478
221
|
async addFixedLabel(label, value) {
|
|
479
222
|
await addFixedLabel(this, label, value);
|
|
480
223
|
return this;
|
|
481
224
|
}
|
|
482
|
-
/**
|
|
483
|
-
* Adds a user label to the UserLabel cluster. If the cluster server is not present, it will be added.
|
|
484
|
-
*
|
|
485
|
-
* @param {string} label - The label to add.
|
|
486
|
-
* @param {string} value - The value of the label.
|
|
487
|
-
* @returns {Promise<this>} The current MatterbridgeEndpoint instance for chaining.
|
|
488
|
-
*/
|
|
489
225
|
async addUserLabel(label, value) {
|
|
490
226
|
await addUserLabel(this, label, value);
|
|
491
227
|
return this;
|
|
492
228
|
}
|
|
493
|
-
/**
|
|
494
|
-
* Adds a command handler for the specified command.
|
|
495
|
-
*
|
|
496
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to add the handler for.
|
|
497
|
-
* @param {CommandHandlerFunction} handler - The handler function to execute when the command is received.
|
|
498
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
499
|
-
*
|
|
500
|
-
* @remarks
|
|
501
|
-
* The handler function will receive an object with the following properties:
|
|
502
|
-
* - `request`: The request object sent with the command.
|
|
503
|
-
* - `cluster`: The id of the cluster that received the command (i.e. "onOff").
|
|
504
|
-
* - `attributes`: The current attributes of the cluster that received the command (i.e. { onOff: true}).
|
|
505
|
-
* - `endpoint`: The MatterbridgeEndpoint instance that received the command.
|
|
506
|
-
*/
|
|
507
229
|
addCommandHandler(command, handler) {
|
|
508
230
|
this.commandHandler.addHandler(command, handler);
|
|
509
231
|
return this;
|
|
510
232
|
}
|
|
511
|
-
/**
|
|
512
|
-
* Execute the command handler for the specified command. Used ONLY in Jest tests.
|
|
513
|
-
*
|
|
514
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to execute.
|
|
515
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} [request] - The optional request to pass to the handler function.
|
|
516
|
-
* @param {string} [cluster] - The optional cluster to pass to the handler function.
|
|
517
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} [attributes] - The optional attributes to pass to the handler function.
|
|
518
|
-
* @param {MatterbridgeEndpoint} [endpoint] - The optional MatterbridgeEndpoint instance to pass to the handler function
|
|
519
|
-
*
|
|
520
|
-
* @deprecated Used ONLY in Jest tests.
|
|
521
|
-
*/
|
|
522
233
|
async executeCommandHandler(command, request, cluster, attributes, endpoint) {
|
|
523
234
|
await this.commandHandler.executeHandler(command, { request, cluster, attributes, endpoint });
|
|
524
235
|
}
|
|
525
|
-
/**
|
|
526
|
-
* Invokes a behavior command on the specified cluster. Used ONLY in Jest tests.
|
|
527
|
-
*
|
|
528
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
|
|
529
|
-
* @param {string} command - The command to invoke.
|
|
530
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The optional parameters to pass to the command.
|
|
531
|
-
*
|
|
532
|
-
* @deprecated Used ONLY in Jest tests.
|
|
533
|
-
*/
|
|
534
236
|
async invokeBehaviorCommand(cluster, command, params) {
|
|
535
237
|
await invokeBehaviorCommand(this, cluster, command, params);
|
|
536
238
|
}
|
|
537
|
-
/**
|
|
538
|
-
* Adds the required cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
539
|
-
*
|
|
540
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
541
|
-
*/
|
|
542
239
|
addRequiredClusterServers() {
|
|
543
240
|
addRequiredClusterServers(this);
|
|
544
241
|
return this;
|
|
545
242
|
}
|
|
546
|
-
/**
|
|
547
|
-
* Adds the optional cluster servers (only if they are not present) for the device types of the specified endpoint.
|
|
548
|
-
*
|
|
549
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
550
|
-
*/
|
|
551
243
|
addOptionalClusterServers() {
|
|
552
244
|
addOptionalClusterServers(this);
|
|
553
245
|
return this;
|
|
554
246
|
}
|
|
555
|
-
/**
|
|
556
|
-
* Retrieves all cluster servers.
|
|
557
|
-
*
|
|
558
|
-
* @returns {Behavior.Type[]} An array of all cluster servers.
|
|
559
|
-
*/
|
|
560
247
|
getAllClusterServers() {
|
|
561
248
|
return Object.values(this.behaviors.supported);
|
|
562
249
|
}
|
|
563
|
-
/**
|
|
564
|
-
* Retrieves the names of all cluster servers.
|
|
565
|
-
*
|
|
566
|
-
* @returns {string[]} An array of all cluster server names.
|
|
567
|
-
*/
|
|
568
250
|
getAllClusterServerNames() {
|
|
569
251
|
return Object.keys(this.behaviors.supported);
|
|
570
252
|
}
|
|
571
|
-
/**
|
|
572
|
-
* Iterates over each attribute of each cluster server of the device state and calls the provided callback function.
|
|
573
|
-
*
|
|
574
|
-
* @param {Function} callback - The callback function to call with the cluster name, cluster id, attribute name, attribute id and attribute value.
|
|
575
|
-
*/
|
|
576
253
|
forEachAttribute(callback) {
|
|
577
254
|
if (!this.lifecycle.isReady || this.construction.status !== Lifecycle.Status.Active)
|
|
578
255
|
return;
|
|
579
256
|
for (const [clusterName, clusterAttributes] of Object.entries(this.state)) {
|
|
580
|
-
// Skip if the key / cluster name is a number, cause they are double indexed.
|
|
581
257
|
if (!isNaN(Number(clusterName)))
|
|
582
258
|
continue;
|
|
583
259
|
for (const [attributeName, attributeValue] of Object.entries(clusterAttributes)) {
|
|
584
|
-
// Skip if the behavior has no associated cluster (i.e. matterbridge server)
|
|
585
260
|
const clusterId = getClusterId(this, clusterName);
|
|
586
261
|
if (clusterId === undefined) {
|
|
587
|
-
// this.log.debug(`***forEachAttribute: cluster ${clusterName} not found`);
|
|
588
262
|
continue;
|
|
589
263
|
}
|
|
590
|
-
// Skip if the attribute is not present in the ClusterBehavior.Type. Also skip if the attribute it is an internal state.
|
|
591
264
|
const attributeId = getAttributeId(this, clusterName, attributeName);
|
|
592
265
|
if (attributeId === undefined) {
|
|
593
|
-
// this.log.debug(`***forEachAttribute: attribute ${clusterName}.${attributeName} not found`);
|
|
594
266
|
continue;
|
|
595
267
|
}
|
|
596
268
|
callback(clusterName, clusterId, attributeName, attributeId, attributeValue);
|
|
597
269
|
}
|
|
598
270
|
}
|
|
599
271
|
}
|
|
600
|
-
/**
|
|
601
|
-
* Adds a child endpoint with the specified device types and options.
|
|
602
|
-
* If the child endpoint is not already present, it will be created and added.
|
|
603
|
-
* If the child endpoint is already present, the existing child endpoint will be returned.
|
|
604
|
-
*
|
|
605
|
-
* @param {string} endpointName - The name of the new endpoint to add.
|
|
606
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
607
|
-
* @param {MatterbridgeEndpointOptions} [options] - The options for the endpoint.
|
|
608
|
-
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
609
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
610
|
-
*
|
|
611
|
-
* @example
|
|
612
|
-
* ```typescript
|
|
613
|
-
* const endpoint = device.addChildDeviceType('Temperature', [temperatureSensor], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
614
|
-
* ```
|
|
615
|
-
*/
|
|
616
272
|
addChildDeviceType(endpointName, definition, options = {}, debug = false) {
|
|
617
273
|
this.log.debug(`addChildDeviceType: ${CYAN}${endpointName}${db}`);
|
|
618
274
|
let alreadyAdded = false;
|
|
@@ -648,7 +304,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
648
304
|
this.add(child);
|
|
649
305
|
}
|
|
650
306
|
catch (error) {
|
|
651
|
-
// istanbul ignore next cause is only a safety check
|
|
652
307
|
inspectError(this.log, `addChildDeviceType: error adding (with lifecycle installed) child endpoint ${CYAN}${endpointName}${db}`, error);
|
|
653
308
|
}
|
|
654
309
|
}
|
|
@@ -658,29 +313,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
658
313
|
this.parts.add(child);
|
|
659
314
|
}
|
|
660
315
|
catch (error) {
|
|
661
|
-
// istanbul ignore next cause is only a safety check
|
|
662
316
|
inspectError(this.log, `addChildDeviceType: error adding (with lifecycle NOT installed) child endpoint ${CYAN}${endpointName}${db}`, error);
|
|
663
317
|
}
|
|
664
318
|
}
|
|
665
319
|
return child;
|
|
666
320
|
}
|
|
667
|
-
/**
|
|
668
|
-
* Adds a child endpoint with one or more device types with the required cluster servers and the specified cluster servers.
|
|
669
|
-
* If the child endpoint is not already present in the childEndpoints, it will be added.
|
|
670
|
-
* If the child endpoint is already present in the childEndpoints, the device types and cluster servers will be added to the existing child endpoint.
|
|
671
|
-
*
|
|
672
|
-
* @param {string} endpointName - The name of the new enpoint to add.
|
|
673
|
-
* @param {DeviceTypeDefinition | AtLeastOne<DeviceTypeDefinition>} definition - The device types to add.
|
|
674
|
-
* @param {ClusterId[]} [serverList] - The list of cluster IDs to include.
|
|
675
|
-
* @param {MatterbridgeEndpointOptions} [options] - The options for the device.
|
|
676
|
-
* @param {boolean} [debug] - Whether to enable debug logging.
|
|
677
|
-
* @returns {MatterbridgeEndpoint} - The child endpoint that was found or added.
|
|
678
|
-
*
|
|
679
|
-
* @example
|
|
680
|
-
* ```typescript
|
|
681
|
-
* const endpoint = device.addChildDeviceTypeWithClusterServer('Temperature', [temperatureSensor], [], { tagList: [{ mfgCode: null, namespaceId: LocationTag.Indoor.namespaceId, tag: LocationTag.Indoor.tag, label: null }] }, true);
|
|
682
|
-
* ```
|
|
683
|
-
*/
|
|
684
321
|
addChildDeviceTypeWithClusterServer(endpointName, definition, serverList = [], options = {}, debug = false) {
|
|
685
322
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
686
323
|
let alreadyAdded = false;
|
|
@@ -739,7 +376,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
739
376
|
this.add(child);
|
|
740
377
|
}
|
|
741
378
|
catch (error) {
|
|
742
|
-
// istanbul ignore next cause is only a safety check
|
|
743
379
|
inspectError(this.log, `addChildDeviceType: error adding (with lifecycle installed) child endpoint ${CYAN}${endpointName}${db}`, error);
|
|
744
380
|
}
|
|
745
381
|
}
|
|
@@ -749,68 +385,26 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
749
385
|
this.parts.add(child);
|
|
750
386
|
}
|
|
751
387
|
catch (error) {
|
|
752
|
-
// istanbul ignore next cause is only a safety check
|
|
753
388
|
inspectError(this.log, `addChildDeviceType: error adding (with lifecycle NOT installed) child endpoint ${CYAN}${endpointName}${db}`, error);
|
|
754
389
|
}
|
|
755
390
|
}
|
|
756
391
|
return child;
|
|
757
392
|
}
|
|
758
|
-
/**
|
|
759
|
-
* Retrieves a child endpoint by its name (id).
|
|
760
|
-
* Since the name is stored like id, the endpointName should be without spaces and dots.
|
|
761
|
-
* If case of not latin characters, the endpointName should be the generated unique id.
|
|
762
|
-
*
|
|
763
|
-
* @param {string} endpointName - The name of the endpoint to retrieve.
|
|
764
|
-
* @returns {Endpoint | undefined} The child endpoint with the specified name, or undefined if not found.
|
|
765
|
-
* @deprecated Use getChildEndpointById() or getChildEndpointByOriginalId() instead.
|
|
766
|
-
*/
|
|
767
393
|
getChildEndpointByName(endpointName) {
|
|
768
394
|
return this.parts.find((part) => part.id === endpointName);
|
|
769
395
|
}
|
|
770
|
-
/**
|
|
771
|
-
* Retrieves a child endpoint by its id.
|
|
772
|
-
* Since the id of a child endpoint is the endpointName passed in the constructor, the id to retrieve it should be without spaces and dots.
|
|
773
|
-
* If case of not latin characters, the id is a generated unique id.
|
|
774
|
-
*
|
|
775
|
-
* @param {string} id - The id of the endpoint to retrieve.
|
|
776
|
-
* @returns {Endpoint | undefined} The child endpoint with the specified id, or undefined if not found.
|
|
777
|
-
*/
|
|
778
396
|
getChildEndpointById(id) {
|
|
779
397
|
return this.parts.find((part) => part.id === id);
|
|
780
398
|
}
|
|
781
|
-
/**
|
|
782
|
-
* Retrieves a child endpoint by its original id (the id of MatterbridgeEndpointOptions).
|
|
783
|
-
*
|
|
784
|
-
* @param {string} originalId - The original id of the endpoint to retrieve.
|
|
785
|
-
* @returns {Endpoint | undefined} The child endpoint with the specified originalId, or undefined if not found.
|
|
786
|
-
*/
|
|
787
399
|
getChildEndpointByOriginalId(originalId) {
|
|
788
400
|
return this.parts.find((part) => part.originalId === originalId);
|
|
789
401
|
}
|
|
790
|
-
/**
|
|
791
|
-
* Retrieves a child endpoint by its EndpointNumber.
|
|
792
|
-
*
|
|
793
|
-
* @param {EndpointNumber} endpointNumber - The EndpointNumber of the endpoint to retrieve.
|
|
794
|
-
* @returns {MatterbridgeEndpoint | undefined} The child endpoint with the specified EndpointNumber, or undefined if not found.
|
|
795
|
-
*/
|
|
796
402
|
getChildEndpoint(endpointNumber) {
|
|
797
403
|
return this.parts.find((part) => part.number === endpointNumber);
|
|
798
404
|
}
|
|
799
|
-
/**
|
|
800
|
-
* Get all the child endpoints of this endpoint.
|
|
801
|
-
*
|
|
802
|
-
* @returns {MatterbridgeEndpoint[]} The child endpoints.
|
|
803
|
-
*/
|
|
804
405
|
getChildEndpoints() {
|
|
805
406
|
return Array.from(this.parts);
|
|
806
407
|
}
|
|
807
|
-
/**
|
|
808
|
-
* Serializes the Matterbridge device into a serialized object.
|
|
809
|
-
*
|
|
810
|
-
* @param {MatterbridgeEndpoint} device - The Matterbridge device to serialize.
|
|
811
|
-
*
|
|
812
|
-
* @returns {SerializedMatterbridgeEndpoint | undefined} The serialized Matterbridge device object.
|
|
813
|
-
*/
|
|
814
408
|
static serialize(device) {
|
|
815
409
|
if (!device.serialNumber || !device.deviceName || !device.uniqueId || !device.maybeId || !device.maybeNumber)
|
|
816
410
|
return;
|
|
@@ -833,16 +427,9 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
833
427
|
serialized.clusterServersId.push(BridgedDeviceBasicInformation.Cluster.id);
|
|
834
428
|
if (behaviorName === 'powerSource')
|
|
835
429
|
serialized.clusterServersId.push(PowerSource.Cluster.id);
|
|
836
|
-
// serialized.clusterServersId.push(this.behaviors.supported[behaviorName]cluster.id);
|
|
837
430
|
});
|
|
838
431
|
return serialized;
|
|
839
432
|
}
|
|
840
|
-
/**
|
|
841
|
-
* Deserializes the device into a serialized object.
|
|
842
|
-
*
|
|
843
|
-
* @param {SerializedMatterbridgeEndpoint} serializedDevice - The serialized Matterbridge device object.
|
|
844
|
-
* @returns {MatterbridgeEndpoint | undefined} The deserialized Matterbridge device.
|
|
845
|
-
*/
|
|
846
433
|
static deserialize(serializedDevice) {
|
|
847
434
|
const device = new MatterbridgeEndpoint(serializedDevice.deviceTypes, { id: serializedDevice.id, number: serializedDevice.number }, false);
|
|
848
435
|
device.plugin = serializedDevice.pluginName;
|
|
@@ -858,103 +445,25 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
858
445
|
device.createDefaultBridgedDeviceBasicInformationClusterServer(serializedDevice.deviceName, serializedDevice.serialNumber, serializedDevice.vendorId ?? 0xfff1, serializedDevice.vendorName ?? 'Matterbridge', serializedDevice.productName ?? 'Matterbridge device');
|
|
859
446
|
else if (clusterId === PowerSource.Cluster.id)
|
|
860
447
|
device.createDefaultPowerSourceWiredClusterServer();
|
|
861
|
-
// else addClusterServerFromList(device, [clusterId]);
|
|
862
448
|
}
|
|
863
449
|
return device;
|
|
864
450
|
}
|
|
865
|
-
/** Utility Cluster Helpers */
|
|
866
|
-
/**
|
|
867
|
-
* Creates a default power source wired cluster server.
|
|
868
|
-
*
|
|
869
|
-
* @param {PowerSource.WiredCurrentType} wiredCurrentType - The type of wired current (default: PowerSource.WiredCurrentType.Ac)
|
|
870
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
871
|
-
*
|
|
872
|
-
* @remarks
|
|
873
|
-
* - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
|
|
874
|
-
* - description: The description of the power source is a fixed attribute that describes the power source type.
|
|
875
|
-
* - 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).
|
|
876
|
-
*/
|
|
877
451
|
createDefaultPowerSourceWiredClusterServer(wiredCurrentType = PowerSource.WiredCurrentType.Ac) {
|
|
878
452
|
this.behaviors.require(MatterbridgePowerSourceServer.with(PowerSource.Feature.Wired), getDefaultPowerSourceWiredClusterServer(wiredCurrentType));
|
|
879
453
|
return this;
|
|
880
454
|
}
|
|
881
|
-
/**
|
|
882
|
-
* Creates a default power source battery cluster server.
|
|
883
|
-
*
|
|
884
|
-
* @param {null | number} batPercentRemaining - The remaining battery percentage (default: null). The attribute is in the range 0-200.
|
|
885
|
-
* @param {PowerSource.BatChargeLevel} batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
886
|
-
* @param {null | number} batVoltage - The battery voltage (default: null).
|
|
887
|
-
* @param {PowerSource.BatReplaceability} batReplaceability - The replaceability of the battery (default: PowerSource.BatReplaceability.Unspecified).
|
|
888
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
889
|
-
*
|
|
890
|
-
* @remarks
|
|
891
|
-
* - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
|
|
892
|
-
* - description: The description of the power source is a fixed attribute that describes the power source type.
|
|
893
|
-
* - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
|
|
894
|
-
*/
|
|
895
455
|
createDefaultPowerSourceBatteryClusterServer(batPercentRemaining = null, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = null, batReplaceability = PowerSource.BatReplaceability.Unspecified) {
|
|
896
456
|
this.behaviors.require(MatterbridgePowerSourceServer.with(PowerSource.Feature.Battery), getDefaultPowerSourceBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplaceability));
|
|
897
457
|
return this;
|
|
898
458
|
}
|
|
899
|
-
/**
|
|
900
|
-
* Creates a default power source replaceable battery cluster server.
|
|
901
|
-
*
|
|
902
|
-
* @param {number} batPercentRemaining - The remaining battery percentage (default: 100). The attribute is in the range 0-200.
|
|
903
|
-
* @param {PowerSource.BatChargeLevel} batChargeLevel - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
904
|
-
* @param {number} batVoltage - The battery voltage (default: 1500).
|
|
905
|
-
* @param {string} batReplacementDescription - The description of the battery replacement (default: 'Battery type').
|
|
906
|
-
* @param {number} batQuantity - The quantity of the battery (default: 1).
|
|
907
|
-
* @param {PowerSource.BatReplaceability} batReplaceability - The replaceability of the battery (default: PowerSource.BatReplaceability.UserReplaceable).
|
|
908
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
909
|
-
*
|
|
910
|
-
* @remarks
|
|
911
|
-
* - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
|
|
912
|
-
* - description: The description of the power source is a fixed attribute that describes the power source type.
|
|
913
|
-
* - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
|
|
914
|
-
* - batReplacementDescription: The description of the battery replacement is a fixed attribute that describes the battery type.
|
|
915
|
-
* - batQuantity: The quantity of the battery is a fixed attribute that indicates how many batteries are present in the device.
|
|
916
|
-
*/
|
|
917
459
|
createDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplacementDescription = 'Battery type', batQuantity = 1, batReplaceability = PowerSource.BatReplaceability.UserReplaceable) {
|
|
918
460
|
this.behaviors.require(MatterbridgePowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Replaceable), getDefaultPowerSourceReplaceableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplacementDescription, batQuantity, batReplaceability));
|
|
919
461
|
return this;
|
|
920
462
|
}
|
|
921
|
-
/**
|
|
922
|
-
* Creates a default power source rechargeable battery cluster server.
|
|
923
|
-
*
|
|
924
|
-
* @param {number} [batPercentRemaining] - The remaining battery percentage (default: 100). The attribute is in the range 0-200.
|
|
925
|
-
* @param {PowerSource.BatChargeLevel} [batChargeLevel] - The battery charge level (default: PowerSource.BatChargeLevel.Ok).
|
|
926
|
-
* @param {number} [batVoltage] - The battery voltage in mV (default: 1500).
|
|
927
|
-
* @param {PowerSource.BatReplaceability} [batReplaceability] - The replaceability of the battery (default: PowerSource.BatReplaceability.Unspecified).
|
|
928
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
929
|
-
*
|
|
930
|
-
* @remarks
|
|
931
|
-
* - order: The order of the power source is a persisted attribute that indicates the order in which the power sources are used.
|
|
932
|
-
* - description: The description of the power source is a fixed attribute that describes the power source type.
|
|
933
|
-
* - batReplaceability: The replaceability of the battery is a fixed attribute that indicates whether the battery is user-replaceable or not.
|
|
934
|
-
*/
|
|
935
463
|
createDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining = 100, batChargeLevel = PowerSource.BatChargeLevel.Ok, batVoltage = 1500, batReplaceability = PowerSource.BatReplaceability.Unspecified) {
|
|
936
464
|
this.behaviors.require(MatterbridgePowerSourceServer.with(PowerSource.Feature.Battery, PowerSource.Feature.Rechargeable), getDefaultPowerSourceRechargeableBatteryClusterServer(batPercentRemaining, batChargeLevel, batVoltage, batReplaceability));
|
|
937
465
|
return this;
|
|
938
466
|
}
|
|
939
|
-
/**
|
|
940
|
-
* Setup the default Basic Information Cluster Server attributes for the server node.
|
|
941
|
-
*
|
|
942
|
-
* 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.
|
|
943
|
-
*
|
|
944
|
-
* The actual BasicInformationClusterServer is created by the Matterbridge class for device.mode = 'server' and for the device of an AccessoryPlatform.
|
|
945
|
-
*
|
|
946
|
-
* @param {string} deviceName - The name of the device.
|
|
947
|
-
* @param {string} serialNumber - The serial number of the device.
|
|
948
|
-
* @param {number} [vendorId] - The vendor ID of the device. Default is 0xfff1 (Matter Test VendorId).
|
|
949
|
-
* @param {string} [vendorName] - The name of the vendor. Default is 'Matterbridge'.
|
|
950
|
-
* @param {number} [productId] - The product ID of the device. Default is 0x8000 (Matter Test ProductId).
|
|
951
|
-
* @param {string} [productName] - The name of the product. Default is 'Matterbridge device'.
|
|
952
|
-
* @param {number} [softwareVersion] - The software version of the device. Default is 1.
|
|
953
|
-
* @param {string} [softwareVersionString] - The software version string of the device. Default is '1.0.0'.
|
|
954
|
-
* @param {number} [hardwareVersion] - The hardware version of the device. Default is 1.
|
|
955
|
-
* @param {string} [hardwareVersionString] - The hardware version string of the device. Default is '1.0.0'.
|
|
956
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
957
|
-
*/
|
|
958
467
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productId = 0x8000, productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
959
468
|
this.log.logName = deviceName;
|
|
960
469
|
this.deviceName = deviceName;
|
|
@@ -970,26 +479,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
970
479
|
this.hardwareVersionString = hardwareVersionString;
|
|
971
480
|
return this;
|
|
972
481
|
}
|
|
973
|
-
/**
|
|
974
|
-
* Creates a default BridgedDeviceBasicInformationClusterServer for the aggregator endpoints.
|
|
975
|
-
*
|
|
976
|
-
* 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.
|
|
977
|
-
*
|
|
978
|
-
* @param {string} deviceName - The name of the device.
|
|
979
|
-
* @param {string} serialNumber - The serial number of the device.
|
|
980
|
-
* @param {number} [vendorId] - The vendor ID of the device. Default is 0xfff1 (Matter Test VendorId).
|
|
981
|
-
* @param {string} [vendorName] - The name of the vendor. Default is 'Matterbridge'.
|
|
982
|
-
* @param {string} [productName] - The name of the product. Default is 'Matterbridge device'.
|
|
983
|
-
* @param {number} [softwareVersion] - The software version of the device. Default is 1.
|
|
984
|
-
* @param {string} [softwareVersionString] - The software version string of the device. Default is '1.0.0'.
|
|
985
|
-
* @param {number} [hardwareVersion] - The hardware version of the device. Default is 1.
|
|
986
|
-
* @param {string} [hardwareVersionString] - The hardware version string of the device. Default is '1.0.0'.
|
|
987
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
988
|
-
*
|
|
989
|
-
* @remarks
|
|
990
|
-
* - The productId doesn't exist on the BridgedDeviceBasicInformation cluster.
|
|
991
|
-
* - The bridgedNode device type must be added to the deviceTypeList of the Descriptor cluster.
|
|
992
|
-
*/
|
|
993
482
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId = 0xfff1, vendorName = 'Matterbridge', productName = 'Matterbridge device', softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
994
483
|
this.log.logName = deviceName;
|
|
995
484
|
this.deviceName = deviceName;
|
|
@@ -1022,101 +511,30 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1022
511
|
});
|
|
1023
512
|
return this;
|
|
1024
513
|
}
|
|
1025
|
-
/**
|
|
1026
|
-
* 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.
|
|
1027
|
-
*
|
|
1028
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1029
|
-
*/
|
|
1030
514
|
createDefaultPowerTopologyClusterServer() {
|
|
1031
515
|
this.behaviors.require(PowerTopologyServer.with(PowerTopology.Feature.TreeTopology));
|
|
1032
516
|
return this;
|
|
1033
517
|
}
|
|
1034
|
-
/**
|
|
1035
|
-
* Creates a default Electrical Energy Measurement Cluster Server with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
|
|
1036
|
-
*
|
|
1037
|
-
* @param {number} energyImported - The total consumption value in mW/h.
|
|
1038
|
-
* @param {number} energyExported - The total production value in mW/h.
|
|
1039
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1040
|
-
*/
|
|
1041
518
|
createDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
|
|
1042
519
|
this.behaviors.require(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), getDefaultElectricalEnergyMeasurementClusterServer(energyImported, energyExported));
|
|
1043
520
|
return this;
|
|
1044
521
|
}
|
|
1045
|
-
/**
|
|
1046
|
-
* Creates a default Electrical Power Measurement Cluster Server with features AlternatingCurrent.
|
|
1047
|
-
*
|
|
1048
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
1049
|
-
* @param {number} current - The current value in milliamperes.
|
|
1050
|
-
* @param {number} power - The power value in milliwatts.
|
|
1051
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
1052
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1053
|
-
*/
|
|
1054
522
|
createDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
1055
523
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), getDefaultElectricalPowerMeasurementClusterServer(voltage, current, power, frequency));
|
|
1056
524
|
return this;
|
|
1057
525
|
}
|
|
1058
|
-
/**
|
|
1059
|
-
* Creates a default Electrical Apparent Power Measurement Cluster Server with features AlternatingCurrent.
|
|
1060
|
-
*
|
|
1061
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
1062
|
-
* @param {number} apparentCurrent - The current value in milliamperes.
|
|
1063
|
-
* @param {number} apparentPower - The apparent power value in millivoltamperes.
|
|
1064
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
1065
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1066
|
-
*/
|
|
1067
526
|
createApparentElectricalPowerMeasurementClusterServer(voltage = null, apparentCurrent = null, apparentPower = null, frequency = null) {
|
|
1068
527
|
this.behaviors.require(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), getApparentElectricalPowerMeasurementClusterServer(voltage, apparentCurrent, apparentPower, frequency));
|
|
1069
528
|
return this;
|
|
1070
529
|
}
|
|
1071
|
-
/**
|
|
1072
|
-
* Creates a default Device Energy Management Cluster Server with feature PowerForecastReporting and with the specified ESA type, ESA canGenerate, ESA state, and power limits.
|
|
1073
|
-
*
|
|
1074
|
-
* @param {DeviceEnergyManagement.EsaType} [esaType] - The ESA type. Defaults to `DeviceEnergyManagement.EsaType.Other`.
|
|
1075
|
-
* @param {boolean} [esaCanGenerate] - Indicates if the ESA can generate energy. Defaults to `false`.
|
|
1076
|
-
* @param {DeviceEnergyManagement.EsaState} [esaState] - The ESA state. Defaults to `DeviceEnergyManagement.EsaState.Online`.
|
|
1077
|
-
* @param {number} [absMinPower] - Indicate the minimum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
1078
|
-
* @param {number} [absMaxPower] - Indicate the maximum electrical power in mw that the ESA can consume when switched on. Defaults to `0` if not provided.
|
|
1079
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1080
|
-
*
|
|
1081
|
-
* @remarks
|
|
1082
|
-
* - The forecast attribute is set to null, indicating that there is no forecast currently available.
|
|
1083
|
-
* - The ESA type and canGenerate attributes are fixed and cannot be changed after creation.
|
|
1084
|
-
* - The ESA state is set to Online by default.
|
|
1085
|
-
* - The absolute minimum and maximum power attributes are set to 0 by default.
|
|
1086
|
-
* - For example, a battery storage inverter that can charge its battery at a maximum power of 2000W and can
|
|
1087
|
-
* discharge the battery at a maximum power of 3000W, would have a absMinPower: -3000W, absMaxPower: 2000W.
|
|
1088
|
-
*/
|
|
1089
530
|
createDefaultDeviceEnergyManagementClusterServer(esaType = DeviceEnergyManagement.EsaType.Other, esaCanGenerate = false, esaState = DeviceEnergyManagement.EsaState.Online, absMinPower = 0, absMaxPower = 0) {
|
|
1090
531
|
this.behaviors.require(MatterbridgeDeviceEnergyManagementServer.with(DeviceEnergyManagement.Feature.PowerForecastReporting, DeviceEnergyManagement.Feature.PowerAdjustment), getDefaultDeviceEnergyManagementClusterServer(esaType, esaCanGenerate, esaState, absMinPower, absMaxPower));
|
|
1091
532
|
return this;
|
|
1092
533
|
}
|
|
1093
|
-
/**
|
|
1094
|
-
* Creates a default EnergyManagementMode Cluster Server.
|
|
1095
|
-
*
|
|
1096
|
-
* @param {number} [currentMode] - The current mode of the EnergyManagementMode cluster. Defaults to mode 1 (DeviceEnergyManagementMode.ModeTag.NoOptimization).
|
|
1097
|
-
* @param {EnergyManagementMode.ModeOption[]} [supportedModes] - The supported modes for the DeviceEnergyManagementMode cluster. The attribute is fixed and defaults to a predefined set of cluster modes.
|
|
1098
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1099
|
-
*
|
|
1100
|
-
* @remarks
|
|
1101
|
-
* A few examples of Device Energy Management modes and their mode tags are provided below.
|
|
1102
|
-
* - For the "No Energy Management (Forecast reporting only)" mode, tags: 0x4000 (NoOptimization).
|
|
1103
|
-
* - For the "Device Energy Management" mode, tags: 0x4001 (DeviceOptimization).
|
|
1104
|
-
* - For the "Home Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization).
|
|
1105
|
-
* - For the "Grid Energy Management" mode, tags: 0x4003 (GridOptimization).
|
|
1106
|
-
* - For the "Full Energy Management" mode, tags: 0x4001 (DeviceOptimization), 0x4002 (LocalOptimization), 0x4003 (GridOptimization).
|
|
1107
|
-
*/
|
|
1108
534
|
createDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes) {
|
|
1109
535
|
this.behaviors.require(MatterbridgeDeviceEnergyManagementModeServer, getDefaultDeviceEnergyManagementModeClusterServer(currentMode, supportedModes));
|
|
1110
536
|
return this;
|
|
1111
537
|
}
|
|
1112
|
-
/** Application Cluster Helpers */
|
|
1113
|
-
/**
|
|
1114
|
-
* Creates a default identify cluster server with the specified identify time and type.
|
|
1115
|
-
*
|
|
1116
|
-
* @param {number} [identifyTime] - The time to identify the server. Defaults to 0.
|
|
1117
|
-
* @param {Identify.IdentifyType} [identifyType] - The type of identification. Defaults to Identify.IdentifyType.None.
|
|
1118
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1119
|
-
*/
|
|
1120
538
|
createDefaultIdentifyClusterServer(identifyTime = 0, identifyType = Identify.IdentifyType.None) {
|
|
1121
539
|
this.behaviors.require(MatterbridgeIdentifyServer, {
|
|
1122
540
|
identifyTime,
|
|
@@ -1124,36 +542,14 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1124
542
|
});
|
|
1125
543
|
return this;
|
|
1126
544
|
}
|
|
1127
|
-
/**
|
|
1128
|
-
* Creates a default groups cluster server.
|
|
1129
|
-
*
|
|
1130
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1131
|
-
*/
|
|
1132
545
|
createDefaultGroupsClusterServer() {
|
|
1133
546
|
this.behaviors.require(GroupsServer);
|
|
1134
547
|
return this;
|
|
1135
548
|
}
|
|
1136
|
-
/**
|
|
1137
|
-
* Creates a default scenes management cluster server.
|
|
1138
|
-
*
|
|
1139
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1140
|
-
*
|
|
1141
|
-
* @remarks The scenes management cluster server is mandatory since Matter 1.4.2.
|
|
1142
|
-
*/
|
|
1143
549
|
createDefaultScenesManagementClusterServer() {
|
|
1144
550
|
this.behaviors.require(ScenesManagementServer);
|
|
1145
551
|
return this;
|
|
1146
552
|
}
|
|
1147
|
-
/**
|
|
1148
|
-
* Creates a default OnOff cluster server for light devices with feature Lighting.
|
|
1149
|
-
*
|
|
1150
|
-
* @param {boolean} [onOff] - The initial state of the OnOff cluster.
|
|
1151
|
-
* @param {boolean} [globalSceneControl] - The global scene control state.
|
|
1152
|
-
* @param {number} [onTime] - The on time value.
|
|
1153
|
-
* @param {number} [offWaitTime] - The off wait time value.
|
|
1154
|
-
* @param {OnOff.StartUpOnOff | null} [startUpOnOff] - The start-up OnOff state. Null means previous state.
|
|
1155
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1156
|
-
*/
|
|
1157
553
|
createDefaultOnOffClusterServer(onOff = false, globalSceneControl = false, onTime = 0, offWaitTime = 0, startUpOnOff = null) {
|
|
1158
554
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.Lighting), {
|
|
1159
555
|
onOff,
|
|
@@ -1164,73 +560,24 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1164
560
|
});
|
|
1165
561
|
return this;
|
|
1166
562
|
}
|
|
1167
|
-
/**
|
|
1168
|
-
* Creates an OnOff cluster server without features.
|
|
1169
|
-
*
|
|
1170
|
-
* @param {boolean} [onOff] - The initial state of the OnOff cluster.
|
|
1171
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1172
|
-
*/
|
|
1173
563
|
createOnOffClusterServer(onOff = false) {
|
|
1174
564
|
this.behaviors.require(MatterbridgeOnOffServer, {
|
|
1175
565
|
onOff,
|
|
1176
566
|
});
|
|
1177
567
|
return this;
|
|
1178
568
|
}
|
|
1179
|
-
/**
|
|
1180
|
-
* Creates a DeadFront OnOff cluster server with feature DeadFrontBehavior.
|
|
1181
|
-
*
|
|
1182
|
-
* The "dead front" state is linked to the OnOff attribute
|
|
1183
|
-
* in the On/Off cluster having the value False. Thus, the Off command of the On/Off cluster SHALL
|
|
1184
|
-
* move the device into the "dead front" state, the On command of the On/Off cluster SHALL bring the
|
|
1185
|
-
* device out of the "dead front" state, and the device SHALL adhere with the associated requirements
|
|
1186
|
-
* on subscription handling and event reporting.
|
|
1187
|
-
*
|
|
1188
|
-
* @param {boolean} [onOff] - The initial state of the OnOff cluster.
|
|
1189
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1190
|
-
*/
|
|
1191
569
|
createDeadFrontOnOffClusterServer(onOff = false) {
|
|
1192
570
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.DeadFrontBehavior), {
|
|
1193
571
|
onOff,
|
|
1194
572
|
});
|
|
1195
573
|
return this;
|
|
1196
574
|
}
|
|
1197
|
-
/**
|
|
1198
|
-
* Creates an OffOnly OnOff cluster server with feature OffOnly.
|
|
1199
|
-
*
|
|
1200
|
-
* @param {boolean} [onOff] - The initial state of the OnOff cluster.
|
|
1201
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1202
|
-
*/
|
|
1203
575
|
createOffOnlyOnOffClusterServer(onOff = false) {
|
|
1204
576
|
this.behaviors.require(MatterbridgeOnOffServer.with(OnOff.Feature.OffOnly), {
|
|
1205
577
|
onOff,
|
|
1206
578
|
});
|
|
1207
579
|
return this;
|
|
1208
580
|
}
|
|
1209
|
-
/**
|
|
1210
|
-
* Creates a default level control cluster server for light devices with feature OnOff and Lighting.
|
|
1211
|
-
*
|
|
1212
|
-
* @param {number} [currentLevel] - The current level (default: 254).
|
|
1213
|
-
* @param {number} [minLevel] - The minimum level (default: 1).
|
|
1214
|
-
* @param {number} [maxLevel] - The maximum level (default: 254).
|
|
1215
|
-
* @param {number | null} [onLevel] - The on level (default: null).
|
|
1216
|
-
* @param {number | null} [startUpCurrentLevel] - The startUp on level (default: null).
|
|
1217
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1218
|
-
*
|
|
1219
|
-
* @remarks OptionMasks and OptionOverride fields of moveToLevel and moveToLevelWithOnOff commands requests
|
|
1220
|
-
*
|
|
1221
|
-
* Each bit in the Options attribute SHALL determine the corresponding bit in the temporary Options
|
|
1222
|
-
* bitmap, unless the OptionsMask field is present and has the corresponding bit set to 1, in which
|
|
1223
|
-
* case the corresponding bit in the OptionsOverride field SHALL determine the corresponding bit in
|
|
1224
|
-
* the temporary Options bitmap.
|
|
1225
|
-
*
|
|
1226
|
-
* @remarks 'With On/Off' Commands
|
|
1227
|
-
*
|
|
1228
|
-
* Before commencing any command that has the effect of setting the CurrentLevel attribute above
|
|
1229
|
-
* 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’).
|
|
1230
|
-
*
|
|
1231
|
-
* If any command that has the effect of setting the CurrentLevel attribute to the minimum level
|
|
1232
|
-
* allowed by the device, the OnOff attribute of the On/Off cluster on the same endpoint, if implemented, SHALL be set to FALSE (‘Off’).
|
|
1233
|
-
*/
|
|
1234
581
|
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 1, maxLevel = 254, onLevel = null, startUpCurrentLevel = null) {
|
|
1235
582
|
this.behaviors.require(MatterbridgeLevelControlServer.with(LevelControl.Feature.OnOff, LevelControl.Feature.Lighting), {
|
|
1236
583
|
currentLevel,
|
|
@@ -1246,13 +593,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1246
593
|
});
|
|
1247
594
|
return this;
|
|
1248
595
|
}
|
|
1249
|
-
/**
|
|
1250
|
-
* Creates a level control cluster server without features.
|
|
1251
|
-
*
|
|
1252
|
-
* @param {number} [currentLevel] - The current level (default: 254).
|
|
1253
|
-
* @param {number | null} [onLevel] - The on level (default: null).
|
|
1254
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1255
|
-
*/
|
|
1256
596
|
createLevelControlClusterServer(currentLevel = 254, onLevel = null) {
|
|
1257
597
|
this.behaviors.require(MatterbridgeLevelControlServer, {
|
|
1258
598
|
currentLevel,
|
|
@@ -1264,40 +604,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1264
604
|
});
|
|
1265
605
|
return this;
|
|
1266
606
|
}
|
|
1267
|
-
/**
|
|
1268
|
-
* Creates a default color control cluster server with features Xy, HueSaturation and ColorTemperature.
|
|
1269
|
-
*
|
|
1270
|
-
* @param {number} currentX - The current X value (range 0-65279).
|
|
1271
|
-
* @param {number} currentY - The current Y value (range 0-65279).
|
|
1272
|
-
* @param {number} currentHue - The current hue value (range: 0-254).
|
|
1273
|
-
* @param {number} currentSaturation - The current saturation value (range: 0-254).
|
|
1274
|
-
* @param {number} colorTemperatureMireds - The color temperature in mireds (range colorTempPhysicalMinMireds-colorTempPhysicalMaxMireds).
|
|
1275
|
-
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default 147).
|
|
1276
|
-
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default 500).
|
|
1277
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1278
|
-
*
|
|
1279
|
-
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1280
|
-
* @remarks currentHue and currentSaturation persist across restarts.
|
|
1281
|
-
* @remarks currentX and currentY persist across restarts.
|
|
1282
|
-
* @remarks colorTemperatureMireds persists across restarts.
|
|
1283
|
-
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1284
|
-
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1285
|
-
*
|
|
1286
|
-
* @remarks OptionMasks and OptionOverride fields of color control commands requests
|
|
1287
|
-
*
|
|
1288
|
-
* Each bit in the Options attribute SHALL determine the corresponding bit in the temporary Options
|
|
1289
|
-
* bitmap, unless the OptionsMask field is present and has the corresponding bit set to 1, in which
|
|
1290
|
-
* case the corresponding bit in the OptionsOverride field SHALL determine the corresponding bit in
|
|
1291
|
-
* the temporary Options bitmap.
|
|
1292
|
-
*
|
|
1293
|
-
* @remarks CoupleColorTempToLevel
|
|
1294
|
-
*
|
|
1295
|
-
* If the CoupleColorTempToLevel bit of the Options attribute of the Level Control cluster is equal to 1
|
|
1296
|
-
* and the ColorMode or EnhancedColorMode attribute is set to 2 (ColorTemperatureMireds) then a
|
|
1297
|
-
* change in the CurrentLevel attribute SHALL affect the ColorTemperatureMireds attribute.
|
|
1298
|
-
* This relationship is manufacturer specific, with the qualification that the maximum value of the CurrentLevel attribute
|
|
1299
|
-
* SHALL correspond to a ColorTemperatureMired attribute value equal to the CoupleColorTempToLevelMinMireds attribute.
|
|
1300
|
-
*/
|
|
1301
607
|
createDefaultColorControlClusterServer(currentX = 0, currentY = 0, currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1302
608
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1303
609
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1320,40 +626,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1320
626
|
});
|
|
1321
627
|
return this;
|
|
1322
628
|
}
|
|
1323
|
-
/**
|
|
1324
|
-
* Creates a default color control cluster server with features Xy, HueSaturation, EnhancedHueSaturation and ColorTemperature.
|
|
1325
|
-
*
|
|
1326
|
-
* @param {number} currentX - The current X value (range 0-65279).
|
|
1327
|
-
* @param {number} currentY - The current Y value (range 0-65279).
|
|
1328
|
-
* @param {number} enhancedCurrentHue - The enhanced current hue value (range: 0-65535).
|
|
1329
|
-
* @param {number} currentSaturation - The current saturation value (range: 0-254).
|
|
1330
|
-
* @param {number} colorTemperatureMireds - The color temperature in mireds (range colorTempPhysicalMinMireds-colorTempPhysicalMaxMireds).
|
|
1331
|
-
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default 147).
|
|
1332
|
-
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default 500).
|
|
1333
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1334
|
-
*
|
|
1335
|
-
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1336
|
-
* @remarks currentHue and currentSaturation persist across restarts.
|
|
1337
|
-
* @remarks currentX and currentY persist across restarts.
|
|
1338
|
-
* @remarks colorTemperatureMireds persists across restarts.
|
|
1339
|
-
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1340
|
-
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1341
|
-
*
|
|
1342
|
-
* @remarks OptionMasks and OptionOverride field
|
|
1343
|
-
*
|
|
1344
|
-
* Each bit in the Options attribute SHALL determine the corresponding bit in the temporary Options
|
|
1345
|
-
* bitmap, unless the OptionsMask field is present and has the corresponding bit set to 1, in which
|
|
1346
|
-
* case the corresponding bit in the OptionsOverride field SHALL determine the corresponding bit in
|
|
1347
|
-
* the temporary Options bitmap.
|
|
1348
|
-
*
|
|
1349
|
-
* @remarks CoupleColorTempToLevel
|
|
1350
|
-
*
|
|
1351
|
-
* If the CoupleColorTempToLevel bit of the Options attribute of the Level Control cluster is equal to 1
|
|
1352
|
-
* and the ColorMode or EnhancedColorMode attribute is set to 2 (ColorTemperatureMireds) then a
|
|
1353
|
-
* change in the CurrentLevel attribute SHALL affect the ColorTemperatureMireds attribute.
|
|
1354
|
-
* This relationship is manufacturer specific, with the qualification that the maximum value of the CurrentLevel attribute
|
|
1355
|
-
* SHALL correspond to a ColorTemperatureMired attribute value equal to the CoupleColorTempToLevelMinMireds attribute.
|
|
1356
|
-
*/
|
|
1357
629
|
createEnhancedColorControlClusterServer(currentX = 0, currentY = 0, enhancedCurrentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1358
630
|
this.behaviors.require(MatterbridgeEnhancedColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.HueSaturation, ColorControl.Feature.EnhancedHue, ColorControl.Feature.ColorTemperature), {
|
|
1359
631
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1365,7 +637,7 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1365
637
|
numberOfPrimaries: null,
|
|
1366
638
|
currentX,
|
|
1367
639
|
currentY,
|
|
1368
|
-
currentHue: Math.round((enhancedCurrentHue / 65535) * 254),
|
|
640
|
+
currentHue: Math.round((enhancedCurrentHue / 65535) * 254),
|
|
1369
641
|
enhancedCurrentHue,
|
|
1370
642
|
currentSaturation,
|
|
1371
643
|
colorTemperatureMireds,
|
|
@@ -1377,25 +649,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1377
649
|
});
|
|
1378
650
|
return this;
|
|
1379
651
|
}
|
|
1380
|
-
/**
|
|
1381
|
-
* Creates a Xy color control cluster server with feature Xy and ColorTemperature.
|
|
1382
|
-
*
|
|
1383
|
-
* @param {number} currentX - The current X value (range 0-65279).
|
|
1384
|
-
* @param {number} currentY - The current Y value (range 0-65279).
|
|
1385
|
-
* @param {number} colorTemperatureMireds - The color temperature in mireds (range colorTempPhysicalMinMireds-colorTempPhysicalMaxMireds).
|
|
1386
|
-
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default 147).
|
|
1387
|
-
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default 500).
|
|
1388
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1389
|
-
*
|
|
1390
|
-
* @remarks
|
|
1391
|
-
* From zigbee to matter = Math.max(Math.min(Math.round(x * 65536), 65279), 0)
|
|
1392
|
-
*
|
|
1393
|
-
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1394
|
-
* @remarks currentX and currentY persist across restarts.
|
|
1395
|
-
* @remarks colorTemperatureMireds persists across restarts.
|
|
1396
|
-
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1397
|
-
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1398
|
-
*/
|
|
1399
652
|
createXyColorControlClusterServer(currentX = 0, currentY = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1400
653
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.Xy, ColorControl.Feature.ColorTemperature), {
|
|
1401
654
|
colorMode: ColorControl.ColorMode.CurrentXAndCurrentY,
|
|
@@ -1416,22 +669,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1416
669
|
});
|
|
1417
670
|
return this;
|
|
1418
671
|
}
|
|
1419
|
-
/**
|
|
1420
|
-
* Creates a default hue and saturation control cluster server with feature HueSaturation and ColorTemperature.
|
|
1421
|
-
*
|
|
1422
|
-
* @param {number} currentHue - The current hue value (range: 0-254).
|
|
1423
|
-
* @param {number} currentSaturation - The current saturation value (range: 0-254).
|
|
1424
|
-
* @param {number} colorTemperatureMireds - The color temperature in mireds (range colorTempPhysicalMinMireds-colorTempPhysicalMaxMireds).
|
|
1425
|
-
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default 147).
|
|
1426
|
-
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default 500).
|
|
1427
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1428
|
-
*
|
|
1429
|
-
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1430
|
-
* @remarks currentHue and currentSaturation persist across restarts.
|
|
1431
|
-
* @remarks colorTemperatureMireds persists across restarts.
|
|
1432
|
-
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1433
|
-
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1434
|
-
*/
|
|
1435
672
|
createHsColorControlClusterServer(currentHue = 0, currentSaturation = 0, colorTemperatureMireds = 500, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1436
673
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.HueSaturation, ColorControl.Feature.ColorTemperature), {
|
|
1437
674
|
colorMode: ColorControl.ColorMode.CurrentHueAndCurrentSaturation,
|
|
@@ -1452,20 +689,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1452
689
|
});
|
|
1453
690
|
return this;
|
|
1454
691
|
}
|
|
1455
|
-
/**
|
|
1456
|
-
* Creates a color temperature color control cluster server with feature ColorTemperature.
|
|
1457
|
-
* This cluster server is used for devices that only support color temperature control.
|
|
1458
|
-
*
|
|
1459
|
-
* @param {number} colorTemperatureMireds - The color temperature in mireds (range colorTempPhysicalMinMireds-colorTempPhysicalMaxMireds).
|
|
1460
|
-
* @param {number} colorTempPhysicalMinMireds - The physical minimum color temperature in mireds (default 147).
|
|
1461
|
-
* @param {number} colorTempPhysicalMaxMireds - The physical maximum color temperature in mireds (default 500).
|
|
1462
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1463
|
-
*
|
|
1464
|
-
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1465
|
-
* @remarks colorTemperatureMireds persists across restarts.
|
|
1466
|
-
* @remarks startUpColorTemperatureMireds persists across restarts.
|
|
1467
|
-
* @remarks coupleColorTempToLevelMinMireds persists across restarts.
|
|
1468
|
-
*/
|
|
1469
692
|
createCtColorControlClusterServer(colorTemperatureMireds = 250, colorTempPhysicalMinMireds = 147, colorTempPhysicalMaxMireds = 500) {
|
|
1470
693
|
this.behaviors.require(MatterbridgeColorControlServer.with(ColorControl.Feature.ColorTemperature), {
|
|
1471
694
|
colorMode: ColorControl.ColorMode.ColorTemperatureMireds,
|
|
@@ -1484,47 +707,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1484
707
|
});
|
|
1485
708
|
return this;
|
|
1486
709
|
}
|
|
1487
|
-
/**
|
|
1488
|
-
* Configures the color control mode for the device.
|
|
1489
|
-
*
|
|
1490
|
-
* @param {ColorControl.ColorMode} colorMode - The color mode to set.
|
|
1491
|
-
*
|
|
1492
|
-
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1493
|
-
*/
|
|
1494
710
|
async configureColorControlMode(colorMode) {
|
|
1495
711
|
if (isValidNumber(colorMode, ColorControl.ColorMode.CurrentHueAndCurrentSaturation, ColorControl.ColorMode.ColorTemperatureMireds)) {
|
|
1496
712
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode, this.log);
|
|
1497
713
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
1498
714
|
}
|
|
1499
715
|
}
|
|
1500
|
-
/**
|
|
1501
|
-
* Configures the enhanced color control mode for the device.
|
|
1502
|
-
*
|
|
1503
|
-
* @param {ColorControl.EnhancedColorMode} colorMode - The enhanced color mode to set.
|
|
1504
|
-
*
|
|
1505
|
-
* @remarks colorMode and enhancedColorMode persist across restarts.
|
|
1506
|
-
*/
|
|
1507
716
|
async configureEnhancedColorControlMode(colorMode) {
|
|
1508
717
|
if (isValidNumber(colorMode, ColorControl.EnhancedColorMode.CurrentHueAndCurrentSaturation, ColorControl.EnhancedColorMode.EnhancedCurrentHueAndCurrentSaturation)) {
|
|
1509
718
|
await this.setAttribute(ColorControl.Cluster.id, 'colorMode', colorMode === ColorControl.EnhancedColorMode.EnhancedCurrentHueAndCurrentSaturation ? ColorControl.ColorMode.CurrentHueAndCurrentSaturation : colorMode, this.log);
|
|
1510
719
|
await this.setAttribute(ColorControl.Cluster.id, 'enhancedColorMode', colorMode, this.log);
|
|
1511
720
|
}
|
|
1512
721
|
}
|
|
1513
|
-
/**
|
|
1514
|
-
* Creates a default window covering cluster server with feature Lift and PositionAwareLift.
|
|
1515
|
-
*
|
|
1516
|
-
* @param {number} positionPercent100ths - The position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1517
|
-
* @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.Rollershade). Must support feature Lift.
|
|
1518
|
-
* @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.RollerShade). Must support feature Lift.
|
|
1519
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1520
|
-
*
|
|
1521
|
-
* @remarks mode attributes is writable and persists across restarts.
|
|
1522
|
-
* currentPositionLiftPercent100ths persists across restarts.
|
|
1523
|
-
* configStatus attributes persists across restarts.
|
|
1524
|
-
*/
|
|
1525
722
|
createDefaultWindowCoveringClusterServer(positionPercent100ths, type = WindowCovering.WindowCoveringType.Rollershade, endProductType = WindowCovering.EndProductType.RollerShade) {
|
|
1526
723
|
this.behaviors.require(MatterbridgeLiftWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift), {
|
|
1527
|
-
type,
|
|
724
|
+
type,
|
|
1528
725
|
numberOfActuationsLift: 0,
|
|
1529
726
|
configStatus: {
|
|
1530
727
|
operational: true,
|
|
@@ -1532,33 +729,20 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1532
729
|
liftMovementReversed: false,
|
|
1533
730
|
liftPositionAware: true,
|
|
1534
731
|
tiltPositionAware: false,
|
|
1535
|
-
liftEncoderControlled: false,
|
|
1536
|
-
tiltEncoderControlled: false,
|
|
732
|
+
liftEncoderControlled: false,
|
|
733
|
+
tiltEncoderControlled: false,
|
|
1537
734
|
},
|
|
1538
735
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1539
|
-
endProductType,
|
|
736
|
+
endProductType,
|
|
1540
737
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1541
|
-
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1542
|
-
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
738
|
+
targetPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
739
|
+
currentPositionLiftPercent100ths: positionPercent100ths ?? 0,
|
|
1543
740
|
});
|
|
1544
741
|
return this;
|
|
1545
742
|
}
|
|
1546
|
-
/**
|
|
1547
|
-
* Creates a default window covering cluster server with features Lift, PositionAwareLift, Tilt, PositionAwareTilt.
|
|
1548
|
-
*
|
|
1549
|
-
* @param {number} positionLiftPercent100ths - The lift position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1550
|
-
* @param {number} positionTiltPercent100ths - The tilt position percentage in 100ths (0-10000). Defaults to 0. Matter uses 10000 = fully closed 0 = fully opened.
|
|
1551
|
-
* @param {WindowCovering.WindowCoveringType} type - The type of window covering (default: WindowCovering.WindowCoveringType.TiltBlindLift). Must support features Lift and Tilt.
|
|
1552
|
-
* @param {WindowCovering.EndProductType} endProductType - The end product type (default: WindowCovering.EndProductType.InteriorBlind). Must support features Lift and Tilt.
|
|
1553
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1554
|
-
*
|
|
1555
|
-
* @remarks mode attributes is writable and persists across restarts.
|
|
1556
|
-
* currentPositionTiltPercent100ths persists across restarts.
|
|
1557
|
-
* configStatus attributes persists across restarts.
|
|
1558
|
-
*/
|
|
1559
743
|
createDefaultLiftTiltWindowCoveringClusterServer(positionLiftPercent100ths, positionTiltPercent100ths, type = WindowCovering.WindowCoveringType.TiltBlindLift, endProductType = WindowCovering.EndProductType.InteriorBlind) {
|
|
1560
744
|
this.behaviors.require(MatterbridgeLiftTiltWindowCoveringServer.with(WindowCovering.Feature.Lift, WindowCovering.Feature.PositionAwareLift, WindowCovering.Feature.Tilt, WindowCovering.Feature.PositionAwareTilt), {
|
|
1561
|
-
type,
|
|
745
|
+
type,
|
|
1562
746
|
numberOfActuationsLift: 0,
|
|
1563
747
|
numberOfActuationsTilt: 0,
|
|
1564
748
|
configStatus: {
|
|
@@ -1567,23 +751,19 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1567
751
|
liftMovementReversed: false,
|
|
1568
752
|
liftPositionAware: true,
|
|
1569
753
|
tiltPositionAware: true,
|
|
1570
|
-
liftEncoderControlled: false,
|
|
1571
|
-
tiltEncoderControlled: false,
|
|
754
|
+
liftEncoderControlled: false,
|
|
755
|
+
tiltEncoderControlled: false,
|
|
1572
756
|
},
|
|
1573
757
|
operationalStatus: { global: WindowCovering.MovementStatus.Stopped, lift: WindowCovering.MovementStatus.Stopped, tilt: WindowCovering.MovementStatus.Stopped },
|
|
1574
|
-
endProductType,
|
|
758
|
+
endProductType,
|
|
1575
759
|
mode: { motorDirectionReversed: false, calibrationMode: false, maintenanceMode: false, ledFeedback: false },
|
|
1576
|
-
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
1577
|
-
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
1578
|
-
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
1579
|
-
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
760
|
+
targetPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
761
|
+
currentPositionLiftPercent100ths: positionLiftPercent100ths ?? 0,
|
|
762
|
+
targetPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
763
|
+
currentPositionTiltPercent100ths: positionTiltPercent100ths ?? 0,
|
|
1580
764
|
});
|
|
1581
765
|
return this;
|
|
1582
766
|
}
|
|
1583
|
-
/**
|
|
1584
|
-
* Sets the window covering lift target position as the current position and stops the movement.
|
|
1585
|
-
*
|
|
1586
|
-
*/
|
|
1587
767
|
async setWindowCoveringTargetAsCurrentAndStopped() {
|
|
1588
768
|
const position = this.getAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', this.log);
|
|
1589
769
|
if (isValidNumber(position, 0, 10000)) {
|
|
@@ -1603,13 +783,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1603
783
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths and targetPositionTiltPercent100ths to ${position} and operationalStatus to Stopped.`);
|
|
1604
784
|
}
|
|
1605
785
|
}
|
|
1606
|
-
/**
|
|
1607
|
-
* Sets the lift current and target position and the status of a window covering.
|
|
1608
|
-
*
|
|
1609
|
-
* @param {number} current - The current position of the window covering.
|
|
1610
|
-
* @param {number} target - The target position of the window covering.
|
|
1611
|
-
* @param {WindowCovering.MovementStatus} status - The movement status of the window covering.
|
|
1612
|
-
*/
|
|
1613
786
|
async setWindowCoveringCurrentTargetStatus(current, target, status) {
|
|
1614
787
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', current, this.log);
|
|
1615
788
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', target, this.log);
|
|
@@ -1620,11 +793,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1620
793
|
}, this.log);
|
|
1621
794
|
this.log.debug(`Set WindowCovering currentPositionLiftPercent100ths: ${current}, targetPositionLiftPercent100ths: ${target} and operationalStatus: ${status}.`);
|
|
1622
795
|
}
|
|
1623
|
-
/**
|
|
1624
|
-
* Sets the status of the window covering.
|
|
1625
|
-
*
|
|
1626
|
-
* @param {WindowCovering.MovementStatus} status - The movement status to set.
|
|
1627
|
-
*/
|
|
1628
796
|
async setWindowCoveringStatus(status) {
|
|
1629
797
|
await this.setAttribute(WindowCovering.Cluster.id, 'operationalStatus', {
|
|
1630
798
|
global: status,
|
|
@@ -1633,11 +801,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1633
801
|
}, this.log);
|
|
1634
802
|
this.log.debug(`Set WindowCovering operationalStatus: ${status}`);
|
|
1635
803
|
}
|
|
1636
|
-
/**
|
|
1637
|
-
* Retrieves the status of the window covering.
|
|
1638
|
-
*
|
|
1639
|
-
* @returns {WindowCovering.MovementStatus | undefined} The movement status of the window covering, or undefined if not available.
|
|
1640
|
-
*/
|
|
1641
804
|
getWindowCoveringStatus() {
|
|
1642
805
|
const status = this.getAttribute(WindowCovering.Cluster.id, 'operationalStatus', this.log);
|
|
1643
806
|
if (isValidObject(status, 3) && 'global' in status && typeof status.global === 'number') {
|
|
@@ -1645,12 +808,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1645
808
|
return status.global;
|
|
1646
809
|
}
|
|
1647
810
|
}
|
|
1648
|
-
/**
|
|
1649
|
-
* Sets the lift target and current position of the window covering.
|
|
1650
|
-
*
|
|
1651
|
-
* @param {number} liftPosition - The position to set, specified as a number.
|
|
1652
|
-
* @param {number} [tiltPosition] - The tilt position to set, specified as a number.
|
|
1653
|
-
*/
|
|
1654
811
|
async setWindowCoveringTargetAndCurrentPosition(liftPosition, tiltPosition) {
|
|
1655
812
|
await this.setAttribute(WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', liftPosition, this.log);
|
|
1656
813
|
await this.setAttribute(WindowCovering.Cluster.id, 'targetPositionLiftPercent100ths', liftPosition, this.log);
|
|
@@ -1661,32 +818,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1661
818
|
this.log.debug(`Set WindowCovering currentPositionTiltPercent100ths: ${tiltPosition} and targetPositionTiltPercent100ths: ${tiltPosition}.`);
|
|
1662
819
|
}
|
|
1663
820
|
}
|
|
1664
|
-
/**
|
|
1665
|
-
* Creates a default thermostat cluster server with features **Heating**, **Cooling** and **AutoMode**.
|
|
1666
|
-
*
|
|
1667
|
-
* - When the occupied parameter is provided (either false or true), the **Occupancy** feature is also added (defaults to undefined).
|
|
1668
|
-
* - When the outdoorTemperature parameter is provided (either null or a number), the outdoorTemperature attribute is also added (defaults to undefined).
|
|
1669
|
-
*
|
|
1670
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1671
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1672
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1673
|
-
* @param {number} [minSetpointDeadBand] - The minimum setpoint dead band value. Defaults to 1°.
|
|
1674
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1675
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1676
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1677
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1678
|
-
* @param {number | undefined} [unoccupiedHeatingSetpoint] - The unoccupied heating setpoint value in degrees Celsius. Defaults to 19° (it will be ignored if occupied is not provided).
|
|
1679
|
-
* @param {number | undefined} [unoccupiedCoolingSetpoint] - The unoccupied cooling setpoint value in degrees Celsius. Defaults to 27° (it will be ignored if occupied is not provided).
|
|
1680
|
-
* @param {boolean | undefined} [occupied] - The occupancy status. Defaults to undefined (it will be ignored).
|
|
1681
|
-
* @param {number | null | undefined} [outdoorTemperature] - The outdoor temperature value in degrees Celsius. Defaults to undefined (it will be ignored).
|
|
1682
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1683
|
-
*/
|
|
1684
821
|
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) {
|
|
1685
822
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode, ...(occupied !== undefined ? [Thermostat.Feature.Occupancy] : [])), {
|
|
1686
|
-
// Common attributes
|
|
1687
823
|
localTemperature: localTemperature * 100,
|
|
1688
824
|
externalMeasuredIndoorTemperature: localTemperature * 100,
|
|
1689
|
-
...(outdoorTemperature !== undefined ? { outdoorTemperature: outdoorTemperature !== null ? outdoorTemperature * 100 : outdoorTemperature } : {}),
|
|
825
|
+
...(outdoorTemperature !== undefined ? { outdoorTemperature: outdoorTemperature !== null ? outdoorTemperature * 100 : outdoorTemperature } : {}),
|
|
1690
826
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1691
827
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1692
828
|
thermostatRunningState: {
|
|
@@ -1698,22 +834,18 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1698
834
|
fanStage2: false,
|
|
1699
835
|
fanStage3: false,
|
|
1700
836
|
},
|
|
1701
|
-
// Thermostat.Feature.Heating
|
|
1702
837
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1703
838
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1704
839
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1705
840
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1706
841
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1707
|
-
// Thermostat.Feature.Cooling
|
|
1708
842
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1709
843
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1710
844
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1711
845
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1712
846
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1713
|
-
// Thermostat.Feature.AutoMode
|
|
1714
847
|
minSetpointDeadBand: minSetpointDeadBand * 10,
|
|
1715
848
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1716
|
-
// Thermostat.Feature.Occupancy
|
|
1717
849
|
...(occupied !== undefined ? { unoccupiedHeatingSetpoint: unoccupiedHeatingSetpoint !== undefined ? unoccupiedHeatingSetpoint * 100 : 1900 } : {}),
|
|
1718
850
|
...(occupied !== undefined ? { unoccupiedCoolingSetpoint: unoccupiedCoolingSetpoint !== undefined ? unoccupiedCoolingSetpoint * 100 : 2700 } : {}),
|
|
1719
851
|
...(occupied !== undefined ? { occupancy: { occupied } } : {}),
|
|
@@ -1721,27 +853,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1721
853
|
});
|
|
1722
854
|
return this;
|
|
1723
855
|
}
|
|
1724
|
-
/**
|
|
1725
|
-
* Creates a default heating thermostat cluster server with feature **Heating**.
|
|
1726
|
-
*
|
|
1727
|
-
* - When the occupied parameter is provided (either false or true), the **Occupancy** feature is also added (defaults to undefined).
|
|
1728
|
-
* - When the outdoorTemperature parameter is provided (either null or a number), the outdoorTemperature attribute is also added (defaults to undefined).
|
|
1729
|
-
*
|
|
1730
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1731
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1732
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1733
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1734
|
-
* @param {number | undefined} [unoccupiedHeatingSetpoint] - The unoccupied heating setpoint value in degrees Celsius. Defaults to 19° (it will be ignored if occupied is not provided).
|
|
1735
|
-
* @param {boolean | undefined} [occupied] - The occupancy status. Defaults to undefined (it will be ignored).
|
|
1736
|
-
* @param {number | null | undefined} [outdoorTemperature] - The outdoor temperature value in degrees Celsius. Defaults to undefined (it will be ignored).
|
|
1737
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1738
|
-
*/
|
|
1739
856
|
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, unoccupiedHeatingSetpoint = undefined, occupied = undefined, outdoorTemperature = undefined) {
|
|
1740
857
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, ...(occupied !== undefined ? [Thermostat.Feature.Occupancy] : [])), {
|
|
1741
|
-
// Common attributes
|
|
1742
858
|
localTemperature: localTemperature * 100,
|
|
1743
859
|
externalMeasuredIndoorTemperature: localTemperature * 100,
|
|
1744
|
-
...(outdoorTemperature !== undefined ? { outdoorTemperature: outdoorTemperature !== null ? outdoorTemperature * 100 : outdoorTemperature } : {}),
|
|
860
|
+
...(outdoorTemperature !== undefined ? { outdoorTemperature: outdoorTemperature !== null ? outdoorTemperature * 100 : outdoorTemperature } : {}),
|
|
1745
861
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1746
862
|
systemMode: Thermostat.SystemMode.Heat,
|
|
1747
863
|
thermostatRunningState: {
|
|
@@ -1753,73 +869,42 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1753
869
|
fanStage2: false,
|
|
1754
870
|
fanStage3: false,
|
|
1755
871
|
},
|
|
1756
|
-
// Thermostat.Feature.Heating
|
|
1757
872
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1758
873
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1759
874
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1760
875
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1761
876
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1762
|
-
// Thermostat.Feature.Occupancy
|
|
1763
877
|
...(occupied !== undefined ? { unoccupiedHeatingSetpoint: unoccupiedHeatingSetpoint !== undefined ? unoccupiedHeatingSetpoint * 100 : 1900 } : {}),
|
|
1764
878
|
...(occupied !== undefined ? { occupancy: { occupied } } : {}),
|
|
1765
879
|
...(occupied !== undefined ? { externallyMeasuredOccupancy: true } : {}),
|
|
1766
880
|
});
|
|
1767
881
|
return this;
|
|
1768
882
|
}
|
|
1769
|
-
/**
|
|
1770
|
-
* Creates a default thermostat cluster server with features **Heating**, **Cooling**, **AutoMode** and **Presets**.
|
|
1771
|
-
*
|
|
1772
|
-
* - When the occupied parameter is provided (either false or true), the **Occupancy** feature is also added (defaults to undefined).
|
|
1773
|
-
* - When the outdoorTemperature parameter is provided (either null or a number), the outdoorTemperature attribute is also added (defaults to undefined).
|
|
1774
|
-
*
|
|
1775
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1776
|
-
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1777
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1778
|
-
* @param {number} [minSetpointDeadBand] - The minimum setpoint dead band value. Defaults to 2°.
|
|
1779
|
-
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1780
|
-
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1781
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1782
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1783
|
-
* @param {number | undefined} [unoccupiedHeatingSetpoint] - The unoccupied heating setpoint value in degrees Celsius. Defaults to 19° (it will be ignored if occupied is not provided).
|
|
1784
|
-
* @param {number | undefined} [unoccupiedCoolingSetpoint] - The unoccupied cooling setpoint value in degrees Celsius. Defaults to 27° (it will be ignored if occupied is not provided).
|
|
1785
|
-
* @param {boolean | undefined} [occupied] - The occupancy status. Defaults to undefined (it will be ignored).
|
|
1786
|
-
* @param {number | null | undefined} [outdoorTemperature] - The outdoor temperature value in degrees Celsius. Defaults to undefined (it will be ignored).
|
|
1787
|
-
* @param {number | undefined} [activePresetHandle] - The active preset handle. Defaults to undefined.
|
|
1788
|
-
* @param {Thermostat.Preset[] | null | undefined} [presetsList] - The list of thermostat presets. Defaults to undefined.
|
|
1789
|
-
* @param {Thermostat.PresetType[] | null | undefined} [presetTypes] - The list of thermostat preset types. Defaults to undefined.
|
|
1790
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1791
|
-
*/
|
|
1792
883
|
createDefaultPresetsThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 2, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50, unoccupiedHeatingSetpoint = undefined, unoccupiedCoolingSetpoint = undefined, occupied = undefined, outdoorTemperature = undefined, activePresetHandle = undefined, presetsList = undefined, presetTypes = undefined) {
|
|
1793
884
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode, ...(occupied !== undefined ? [Thermostat.Feature.Occupancy] : []), ...(presetsList !== undefined || presetTypes !== undefined ? [Thermostat.Feature.Presets] : [])), {
|
|
1794
885
|
localTemperature: localTemperature * 100,
|
|
1795
886
|
externalMeasuredIndoorTemperature: localTemperature * 100,
|
|
1796
|
-
...(outdoorTemperature !== undefined ? { outdoorTemperature: outdoorTemperature !== null ? outdoorTemperature * 100 : outdoorTemperature } : {}),
|
|
887
|
+
...(outdoorTemperature !== undefined ? { outdoorTemperature: outdoorTemperature !== null ? outdoorTemperature * 100 : outdoorTemperature } : {}),
|
|
1797
888
|
systemMode: Thermostat.SystemMode.Auto,
|
|
1798
889
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1799
|
-
// Thermostat.Feature.Heating
|
|
1800
890
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1801
891
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1802
892
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1803
893
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1804
894
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1805
|
-
// Thermostat.Feature.Cooling
|
|
1806
895
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1807
896
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1808
897
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1809
898
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1810
899
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1811
|
-
// Thermostat.Feature.AutoMode
|
|
1812
900
|
minSetpointDeadBand: minSetpointDeadBand * 10,
|
|
1813
901
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1814
|
-
// Thermostat.Feature.Occupancy
|
|
1815
902
|
...(occupied !== undefined ? { unoccupiedHeatingSetpoint: unoccupiedHeatingSetpoint !== undefined ? unoccupiedHeatingSetpoint * 100 : 1900 } : {}),
|
|
1816
903
|
...(occupied !== undefined ? { unoccupiedCoolingSetpoint: unoccupiedCoolingSetpoint !== undefined ? unoccupiedCoolingSetpoint * 100 : 2700 } : {}),
|
|
1817
904
|
...(occupied !== undefined ? { occupancy: { occupied } } : {}),
|
|
1818
905
|
...(occupied !== undefined ? { externallyMeasuredOccupancy: true } : {}),
|
|
1819
|
-
// Thermostat.Feature.Presets
|
|
1820
906
|
numberOfPresets: Array.isArray(presetsList) ? presetsList.length : 0,
|
|
1821
907
|
activePresetHandle: activePresetHandle !== undefined ? Uint8Array.from([activePresetHandle]) : null,
|
|
1822
|
-
// Ensure presetHandle is a proper Uint8Array by creating a new instance
|
|
1823
908
|
presets: (presetsList ?? []).map((p) => ({
|
|
1824
909
|
presetHandle: Uint8Array.from(p.presetHandle || [0]),
|
|
1825
910
|
presetScenario: p.presetScenario,
|
|
@@ -1836,27 +921,11 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1836
921
|
});
|
|
1837
922
|
return this;
|
|
1838
923
|
}
|
|
1839
|
-
/**
|
|
1840
|
-
* Creates a default cooling thermostat cluster server with feature **Cooling**.
|
|
1841
|
-
*
|
|
1842
|
-
* - When the occupied parameter is provided (either false or true), the **Occupancy** feature is also added (defaults to undefined).
|
|
1843
|
-
* - When the outdoorTemperature parameter is provided (either null or a number), the outdoorTemperature attribute is also added (defaults to undefined).
|
|
1844
|
-
*
|
|
1845
|
-
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1846
|
-
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1847
|
-
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1848
|
-
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1849
|
-
* @param {number | undefined} [unoccupiedCoolingSetpoint] - The unoccupied cooling setpoint value in degrees Celsius. Defaults to 27° (it will be ignored if occupied is not provided).
|
|
1850
|
-
* @param {boolean | undefined} [occupied] - The occupancy status. Defaults to undefined (it will be ignored).
|
|
1851
|
-
* @param {number | null | undefined} [outdoorTemperature] - The outdoor temperature value in degrees Celsius. Defaults to undefined (it will be ignored).
|
|
1852
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1853
|
-
*/
|
|
1854
924
|
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50, unoccupiedCoolingSetpoint = undefined, occupied = undefined, outdoorTemperature = undefined) {
|
|
1855
925
|
this.behaviors.require(MatterbridgeThermostatServer.with(Thermostat.Feature.Cooling, ...(occupied !== undefined ? [Thermostat.Feature.Occupancy] : [])), {
|
|
1856
|
-
// Common attributes
|
|
1857
926
|
localTemperature: localTemperature * 100,
|
|
1858
927
|
externalMeasuredIndoorTemperature: localTemperature * 100,
|
|
1859
|
-
...(outdoorTemperature !== undefined ? { outdoorTemperature: outdoorTemperature !== null ? outdoorTemperature * 100 : outdoorTemperature } : {}),
|
|
928
|
+
...(outdoorTemperature !== undefined ? { outdoorTemperature: outdoorTemperature !== null ? outdoorTemperature * 100 : outdoorTemperature } : {}),
|
|
1860
929
|
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1861
930
|
systemMode: Thermostat.SystemMode.Cool,
|
|
1862
931
|
thermostatRunningState: {
|
|
@@ -1868,33 +937,17 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1868
937
|
fanStage2: false,
|
|
1869
938
|
fanStage3: false,
|
|
1870
939
|
},
|
|
1871
|
-
// Thermostat.Feature.Cooling
|
|
1872
940
|
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1873
941
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1874
942
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1875
943
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1876
944
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1877
|
-
// Thermostat.Feature.Occupancy
|
|
1878
945
|
...(occupied !== undefined ? { unoccupiedCoolingSetpoint: unoccupiedCoolingSetpoint !== undefined ? unoccupiedCoolingSetpoint * 100 : 2700 } : {}),
|
|
1879
946
|
...(occupied !== undefined ? { occupancy: { occupied } } : {}),
|
|
1880
947
|
...(occupied !== undefined ? { externallyMeasuredOccupancy: true } : {}),
|
|
1881
948
|
});
|
|
1882
949
|
return this;
|
|
1883
950
|
}
|
|
1884
|
-
/**
|
|
1885
|
-
* Creates a default thermostat user interface configuration cluster server.
|
|
1886
|
-
*
|
|
1887
|
-
* @param {ThermostatUserInterfaceConfiguration.TemperatureDisplayMode} [temperatureDisplayMode] - The temperature display mode to set. Defaults to `ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius`.
|
|
1888
|
-
* @param {ThermostatUserInterfaceConfiguration.KeypadLockout} [keypadLockout] - The keypad lockout mode. Defaults to `ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout`.
|
|
1889
|
-
* @param {ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility} [scheduleProgrammingVisibility] - The schedule programming visibility. Defaults to `ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted`.
|
|
1890
|
-
*
|
|
1891
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1892
|
-
* @remarks
|
|
1893
|
-
* The default values are:
|
|
1894
|
-
* - temperatureDisplayMode: ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius (writable).
|
|
1895
|
-
* - keypadLockout: ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout (writable).
|
|
1896
|
-
* - scheduleProgrammingVisibility: ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility.ScheduleProgrammingPermitted (writable).
|
|
1897
|
-
*/
|
|
1898
951
|
createDefaultThermostatUserInterfaceConfigurationClusterServer(temperatureDisplayMode = ThermostatUserInterfaceConfiguration.TemperatureDisplayMode.Celsius, keypadLockout = ThermostatUserInterfaceConfiguration.KeypadLockout.NoLockout, scheduleProgrammingVisibility = ThermostatUserInterfaceConfiguration.ScheduleProgrammingVisibility
|
|
1899
952
|
.ScheduleProgrammingPermitted) {
|
|
1900
953
|
this.behaviors.require(ThermostatUserInterfaceConfigurationServer, {
|
|
@@ -1904,288 +957,95 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
1904
957
|
});
|
|
1905
958
|
return this;
|
|
1906
959
|
}
|
|
1907
|
-
/**
|
|
1908
|
-
* Creates a default fan control cluster server with features Auto, and Step and mode Off Low Med High Auto.
|
|
1909
|
-
*
|
|
1910
|
-
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1911
|
-
* @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
|
|
1912
|
-
* @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
|
|
1913
|
-
* @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
|
|
1914
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1915
|
-
*
|
|
1916
|
-
* @remarks
|
|
1917
|
-
* - fanmode is writable and persists across reboots.
|
|
1918
|
-
* - fanModeSequence is fixed.
|
|
1919
|
-
* - percentSetting is writable.
|
|
1920
|
-
*/
|
|
1921
960
|
createDefaultFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0) {
|
|
1922
961
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
percentSetting, // Writable attribute
|
|
962
|
+
fanMode,
|
|
963
|
+
fanModeSequence,
|
|
964
|
+
percentSetting,
|
|
1927
965
|
percentCurrent,
|
|
1928
966
|
});
|
|
1929
967
|
return this;
|
|
1930
968
|
}
|
|
1931
|
-
/**
|
|
1932
|
-
* Creates an On Off fan control cluster server without features and mode Off High.
|
|
1933
|
-
*
|
|
1934
|
-
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1935
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1936
|
-
*
|
|
1937
|
-
* @remarks
|
|
1938
|
-
* fanmode is writable and persists across reboots.
|
|
1939
|
-
* fanModeSequence is fixed.
|
|
1940
|
-
* percentSetting is writable.
|
|
1941
|
-
*/
|
|
1942
969
|
createOnOffFanControlClusterServer(fanMode = FanControl.FanMode.Off) {
|
|
1943
970
|
this.behaviors.require(FanControlServer, {
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
percentSetting: 0, // Writable attribute
|
|
971
|
+
fanMode,
|
|
972
|
+
fanModeSequence: FanControl.FanModeSequence.OffHigh,
|
|
973
|
+
percentSetting: 0,
|
|
1948
974
|
percentCurrent: 0,
|
|
1949
975
|
});
|
|
1950
976
|
return this;
|
|
1951
977
|
}
|
|
1952
|
-
/**
|
|
1953
|
-
* Creates a base fan control cluster server without features and mode Off Low Med High.
|
|
1954
|
-
*
|
|
1955
|
-
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1956
|
-
* @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHigh`.
|
|
1957
|
-
* @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
|
|
1958
|
-
* @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
|
|
1959
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1960
|
-
*
|
|
1961
|
-
* @remarks
|
|
1962
|
-
* fanmode is writable and persists across reboots.
|
|
1963
|
-
* fanModeSequence is fixed.
|
|
1964
|
-
* percentSetting is writable.
|
|
1965
|
-
*/
|
|
1966
978
|
createBaseFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHigh, percentSetting = 0, percentCurrent = 0) {
|
|
1967
979
|
this.behaviors.require(FanControlServer, {
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
percentSetting, // Writable attribute
|
|
980
|
+
fanMode,
|
|
981
|
+
fanModeSequence,
|
|
982
|
+
percentSetting,
|
|
1972
983
|
percentCurrent,
|
|
1973
984
|
});
|
|
1974
985
|
return this;
|
|
1975
986
|
}
|
|
1976
|
-
/**
|
|
1977
|
-
* Creates a fan control cluster server with features MultiSpeed, Auto, and Step and mode Off Low Med High Auto.
|
|
1978
|
-
*
|
|
1979
|
-
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
1980
|
-
* @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
|
|
1981
|
-
* @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
|
|
1982
|
-
* @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
|
|
1983
|
-
* @param {number} [speedMax] - The maximum speed setting. Defaults to 10.
|
|
1984
|
-
* @param {number} [speedSetting] - The initial speed setting. Defaults to 0.
|
|
1985
|
-
* @param {number} [speedCurrent] - The initial speed current. Defaults to 0.
|
|
1986
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
1987
|
-
*
|
|
1988
|
-
* @remarks
|
|
1989
|
-
* - fanmode is writable and persists across reboots.
|
|
1990
|
-
* - fanModeSequence is fixed.
|
|
1991
|
-
* - percentSetting is writable.
|
|
1992
|
-
* - speedMax is fixed.
|
|
1993
|
-
* - speedSetting is writable.
|
|
1994
|
-
*/
|
|
1995
987
|
createMultiSpeedFanControlClusterServer(fanMode = FanControl.FanMode.Off, fanModeSequence = FanControl.FanModeSequence.OffLowMedHighAuto, percentSetting = 0, percentCurrent = 0, speedMax = 10, speedSetting = 0, speedCurrent = 0) {
|
|
1996
988
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step), {
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
percentSetting, // Writable attribute
|
|
989
|
+
fanMode,
|
|
990
|
+
fanModeSequence,
|
|
991
|
+
percentSetting,
|
|
2001
992
|
percentCurrent,
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
speedSetting, // Writable attribute
|
|
993
|
+
speedMax,
|
|
994
|
+
speedSetting,
|
|
2005
995
|
speedCurrent,
|
|
2006
996
|
});
|
|
2007
997
|
return this;
|
|
2008
998
|
}
|
|
2009
|
-
/**
|
|
2010
|
-
* Creates a fan control cluster server with features MultiSpeed, Auto, Step, Rock, Wind and AirflowDirection and mode Off Low Med High Auto.
|
|
2011
|
-
*
|
|
2012
|
-
* @param {FanControl.FanMode} [fanMode] - The fan mode to set. Defaults to `FanControl.FanMode.Off`.
|
|
2013
|
-
* @param {FanControl.FanModeSequence} [fanModeSequence] - The fan mode sequence to set. Defaults to `FanControl.FanModeSequence.OffLowMedHighAuto`.
|
|
2014
|
-
* @param {number} [percentSetting] - The initial percent setting. Defaults to 0.
|
|
2015
|
-
* @param {number} [percentCurrent] - The initial percent current. Defaults to 0.
|
|
2016
|
-
* @param {number} [speedMax] - The maximum speed setting. Defaults to 10.
|
|
2017
|
-
* @param {number} [speedSetting] - The initial speed setting. Defaults to 0.
|
|
2018
|
-
* @param {number} [speedCurrent] - The initial speed current. Defaults to 0.
|
|
2019
|
-
* @param {object} [rockSupport] - The rock support configuration.
|
|
2020
|
-
* @param {boolean} rockSupport.rockLeftRight - Indicates support for rocking left to right. Defaults to true.
|
|
2021
|
-
* @param {boolean} rockSupport.rockUpDown - Indicates support for rocking up and down. Defaults to true.
|
|
2022
|
-
* @param {boolean} rockSupport.rockRound - Indicates support for round rocking. Defaults to true.
|
|
2023
|
-
* @param {object} [rockSetting] - The rock setting configuration.
|
|
2024
|
-
* @param {boolean} rockSetting.rockLeftRight - Indicates the current setting for rocking left to right. Defaults to true.
|
|
2025
|
-
* @param {boolean} rockSetting.rockUpDown - Indicates the current setting for rocking up and down. Defaults to true.
|
|
2026
|
-
* @param {boolean} rockSetting.rockRound - Indicates the current setting for round rocking. Defaults to true.
|
|
2027
|
-
* @param {object} [windSupport] - The wind support configuration.
|
|
2028
|
-
* @param {boolean} windSupport.sleepWind - Indicates support for sleep wind. Defaults to true.
|
|
2029
|
-
* @param {boolean} windSupport.naturalWind - Indicates support for natural wind. Defaults to true.
|
|
2030
|
-
* @param {object} [windSetting] - The wind setting configuration.
|
|
2031
|
-
* @param {boolean} windSetting.sleepWind - Indicates the current setting for sleep wind. Defaults to false.
|
|
2032
|
-
* @param {boolean} windSetting.naturalWind - Indicates the current setting for natural wind. Defaults to true.
|
|
2033
|
-
* @param {FanControl.AirflowDirection} [airflowDirection] - The airflow direction. Defaults to `FanControl.AirflowDirection.Forward`.
|
|
2034
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2035
|
-
*
|
|
2036
|
-
* @remarks
|
|
2037
|
-
* - fanmode is writable and persists across reboots.
|
|
2038
|
-
* - fanModeSequence is fixed.
|
|
2039
|
-
* - percentSetting is writable.
|
|
2040
|
-
* - speedMax is fixed.
|
|
2041
|
-
* - speedSetting is writable.
|
|
2042
|
-
* - rockSupport is fixed.
|
|
2043
|
-
* - rockSetting is writable.
|
|
2044
|
-
* - windSupport is fixed.
|
|
2045
|
-
* - windSetting is writable.
|
|
2046
|
-
* - airflowDirection is writable.
|
|
2047
|
-
*/
|
|
2048
999
|
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) {
|
|
2049
1000
|
this.behaviors.require(MatterbridgeFanControlServer.with(FanControl.Feature.MultiSpeed, FanControl.Feature.Auto, FanControl.Feature.Step, FanControl.Feature.Rocking, FanControl.Feature.Wind, FanControl.Feature.AirflowDirection), {
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
percentSetting, // Writable attribute
|
|
1001
|
+
fanMode,
|
|
1002
|
+
fanModeSequence,
|
|
1003
|
+
percentSetting,
|
|
2054
1004
|
percentCurrent,
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
speedSetting, // Writable attribute
|
|
1005
|
+
speedMax,
|
|
1006
|
+
speedSetting,
|
|
2058
1007
|
speedCurrent,
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
windSetting, // Writable attribute
|
|
2065
|
-
// AirflowDirection feature
|
|
2066
|
-
airflowDirection, // Writable attribute
|
|
1008
|
+
rockSupport,
|
|
1009
|
+
rockSetting,
|
|
1010
|
+
windSupport,
|
|
1011
|
+
windSetting,
|
|
1012
|
+
airflowDirection,
|
|
2067
1013
|
});
|
|
2068
1014
|
return this;
|
|
2069
1015
|
}
|
|
2070
|
-
/**
|
|
2071
|
-
* Creates a default HEPA Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
|
|
2072
|
-
* It supports ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, and ResourceMonitoring.Feature.ReplacementProductList.
|
|
2073
|
-
*
|
|
2074
|
-
* @param {number} condition - The initial condition value (range 0-100). Default is 100.
|
|
2075
|
-
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
2076
|
-
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is true.
|
|
2077
|
-
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is null.
|
|
2078
|
-
* @param {ResourceMonitoring.ReplacementProduct[]} replacementProductList - The list of replacement products. Default is an empty array. It is a fixed attribute.
|
|
2079
|
-
*
|
|
2080
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2081
|
-
*
|
|
2082
|
-
* @remarks
|
|
2083
|
-
* The HEPA Filter Monitoring Cluster Server is used to monitor the status of HEPA filters.
|
|
2084
|
-
* It provides information about the condition of the filter, whether it is in place, and the last time it was changed.
|
|
2085
|
-
* The change indication can be used to indicate if the filter needs to be replaced or serviced.
|
|
2086
|
-
* The replacement product list can be used to provide a list of replacement products for the filter.
|
|
2087
|
-
* The condition attribute is fixed at 100, indicating a healthy filter.
|
|
2088
|
-
* The degradation direction is fixed at ResourceMonitoring.DegradationDirection.Down, indicating that a lower value indicates a worse condition.
|
|
2089
|
-
* The replacement product list is initialized as an empty array.
|
|
2090
|
-
*/
|
|
2091
1016
|
createDefaultHepaFilterMonitoringClusterServer(condition = 100, changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = true, lastChangedTime = null, replacementProductList = []) {
|
|
2092
1017
|
this.behaviors.require(MatterbridgeHepaFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
2093
|
-
// Feature.Condition
|
|
2094
1018
|
condition,
|
|
2095
|
-
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
2096
|
-
|
|
2097
|
-
replacementProductList, // Fixed attribute
|
|
2098
|
-
// Base attributes
|
|
1019
|
+
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
1020
|
+
replacementProductList,
|
|
2099
1021
|
changeIndication,
|
|
2100
1022
|
inPlaceIndicator,
|
|
2101
|
-
lastChangedTime,
|
|
1023
|
+
lastChangedTime,
|
|
2102
1024
|
});
|
|
2103
1025
|
return this;
|
|
2104
1026
|
}
|
|
2105
|
-
/**
|
|
2106
|
-
* Creates a default Activated Carbon Filter Monitoring Cluster Server with features Condition and ReplacementProductList.
|
|
2107
|
-
* It supports ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, and ResourceMonitoring.Feature.ReplacementProductList.
|
|
2108
|
-
*
|
|
2109
|
-
* @param {number} condition - The initial condition value (range 0-100). Default is 100.
|
|
2110
|
-
* @param {ResourceMonitoring.ChangeIndication} changeIndication - The initial change indication. Default is ResourceMonitoring.ChangeIndication.Ok.
|
|
2111
|
-
* @param {boolean | undefined} inPlaceIndicator - The in-place indicator. Default is undefined.
|
|
2112
|
-
* @param {number | undefined} lastChangedTime - The last changed time (EpochS). Default is undefined.
|
|
2113
|
-
* @param {ResourceMonitoring.ReplacementProduct[]} replacementProductList - The list of replacement products. Default is an empty array. It is a fixed attribute.
|
|
2114
|
-
*
|
|
2115
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2116
|
-
*
|
|
2117
|
-
* @remarks
|
|
2118
|
-
* The Activated Carbon Filter Monitoring Cluster Server is used to monitor the status of activated carbon filters.
|
|
2119
|
-
* It provides information about the condition of the filter, whether it is in place, and the last time it was changed.
|
|
2120
|
-
* The change indication can be used to indicate if the filter needs to be replaced or serviced.
|
|
2121
|
-
* The replacement product list can be used to provide a list of replacement products for the filter.
|
|
2122
|
-
* The condition attribute is fixed at 100, indicating a healthy filter.
|
|
2123
|
-
* The degradation direction is fixed at ResourceMonitoring.DegradationDirection.Down, indicating that a lower value indicates a worse condition.
|
|
2124
|
-
* The replacement product list is initialized as an empty array.
|
|
2125
|
-
*/
|
|
2126
1027
|
createDefaultActivatedCarbonFilterMonitoringClusterServer(condition = 100, changeIndication = ResourceMonitoring.ChangeIndication.Ok, inPlaceIndicator = true, lastChangedTime = null, replacementProductList = []) {
|
|
2127
1028
|
this.behaviors.require(MatterbridgeActivatedCarbonFilterMonitoringServer.with(ResourceMonitoring.Feature.Condition, ResourceMonitoring.Feature.Warning, ResourceMonitoring.Feature.ReplacementProductList), {
|
|
2128
|
-
// Feature.Condition
|
|
2129
1029
|
condition,
|
|
2130
1030
|
degradationDirection: ResourceMonitoring.DegradationDirection.Down,
|
|
2131
|
-
|
|
2132
|
-
replacementProductList, // Fixed attribute
|
|
2133
|
-
// Base attributes
|
|
1031
|
+
replacementProductList,
|
|
2134
1032
|
changeIndication,
|
|
2135
1033
|
inPlaceIndicator,
|
|
2136
|
-
lastChangedTime,
|
|
1034
|
+
lastChangedTime,
|
|
2137
1035
|
});
|
|
2138
1036
|
return this;
|
|
2139
1037
|
}
|
|
2140
|
-
/**
|
|
2141
|
-
* Creates a default door lock cluster server.
|
|
2142
|
-
*
|
|
2143
|
-
* @param {DoorLock.LockState} [lockState] - The initial state of the lock (default: Locked).
|
|
2144
|
-
* @param {DoorLock.LockType} [lockType] - The type of the lock (default: DeadBolt).
|
|
2145
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2146
|
-
*
|
|
2147
|
-
* @remarks
|
|
2148
|
-
* 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.
|
|
2149
|
-
*/
|
|
2150
1038
|
createDefaultDoorLockClusterServer(lockState = DoorLock.LockState.Locked, lockType = DoorLock.LockType.DeadBolt) {
|
|
2151
1039
|
this.behaviors.require(MatterbridgeDoorLockServer.enable({ events: { doorLockAlarm: true, lockOperation: true, lockOperationError: true } }), {
|
|
2152
1040
|
lockState,
|
|
2153
1041
|
lockType,
|
|
2154
|
-
/** This attribute SHALL indicate if the lock is currently able to (Enabled) or not able to (Disabled) process remote Lock, Unlock, or Unlock with Timeout commands. */
|
|
2155
1042
|
actuatorEnabled: true,
|
|
2156
|
-
/** This attribute SHALL indicate the current operating mode of the lock as defined in OperatingModeEnum */
|
|
2157
1043
|
operatingMode: DoorLock.OperatingMode.Normal,
|
|
2158
|
-
/**
|
|
2159
|
-
* This attribute SHALL contain a bitmap with all operating bits of the OperatingMode attribute supported
|
|
2160
|
-
* by the lock. All operating modes NOT supported by a lock SHALL be set to one. The value of
|
|
2161
|
-
* the OperatingMode enumeration defines the related bit to be set.
|
|
2162
|
-
* OperatingModesBitmap.Normal and OperatingModesBitmap.noRemoteLockUnlock are mandatory and SHALL always be supported.
|
|
2163
|
-
* Default value 0xFFF6 (1111 1111 1111 0110) means:
|
|
2164
|
-
* - normal: false (bit 0)
|
|
2165
|
-
* - vacation: true (bit 1)
|
|
2166
|
-
* - privacy: true (bit 2)
|
|
2167
|
-
* - noRemoteLockUnlock: false (bit 3)
|
|
2168
|
-
* - passage: true (bit 4)
|
|
2169
|
-
* Special case of inverted bitmap: add also alwaysSet = 2047 (0000 0111 1111 1111) to have all bits set except the unsupported ones.
|
|
2170
|
-
* Specs: "Any bit that is not yet defined in OperatingModesBitmap SHALL be set to 1."
|
|
2171
|
-
*/
|
|
2172
1044
|
supportedOperatingModes: { normal: false, vacation: true, privacy: true, noRemoteLockUnlock: false, passage: true, alwaysSet: 2047 },
|
|
2173
|
-
autoRelockTime: 0,
|
|
1045
|
+
autoRelockTime: 0,
|
|
2174
1046
|
});
|
|
2175
1047
|
return this;
|
|
2176
1048
|
}
|
|
2177
|
-
/**
|
|
2178
|
-
* Creates a default Mode Select cluster server.
|
|
2179
|
-
*
|
|
2180
|
-
* @param {string} description - The description of the mode select cluster.
|
|
2181
|
-
* @param {ModeSelect.ModeOption[]} supportedModes - The list of supported modes.
|
|
2182
|
-
* @param {number} [currentMode] - The current mode (default: 0).
|
|
2183
|
-
* @param {number} [startUpMode] - The startup mode (default: 0).
|
|
2184
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2185
|
-
*
|
|
2186
|
-
* @remarks
|
|
2187
|
-
* endpoint.createDefaultModeSelectClusterServer('Night mode', [{ label: 'Led ON', mode: 0, semanticTags: [] }, { label: 'Led OFF', mode: 1, semanticTags: [] }], 0, 0);
|
|
2188
|
-
*/
|
|
2189
1049
|
createDefaultModeSelectClusterServer(description, supportedModes, currentMode = 0, startUpMode = 0) {
|
|
2190
1050
|
this.behaviors.require(MatterbridgeModeSelectServer, {
|
|
2191
1051
|
description: description,
|
|
@@ -2196,35 +1056,21 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2196
1056
|
});
|
|
2197
1057
|
return this;
|
|
2198
1058
|
}
|
|
2199
|
-
/**
|
|
2200
|
-
* Creates the default Valve Configuration And Control cluster server with features Level.
|
|
2201
|
-
*
|
|
2202
|
-
* @param {ValveConfigurationAndControl.ValveState} [valveState] - The valve state to set. Defaults to `ValveConfigurationAndControl.ValveState.Closed`.
|
|
2203
|
-
* @param {number} [valveLevel] - The valve level to set. Defaults to 0.
|
|
2204
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2205
|
-
*/
|
|
2206
1059
|
createDefaultValveConfigurationAndControlClusterServer(valveState = ValveConfigurationAndControl.ValveState.Closed, valveLevel = 0) {
|
|
2207
1060
|
this.behaviors.require(MatterbridgeValveConfigurationAndControlServer.with(ValveConfigurationAndControl.Feature.Level), {
|
|
2208
1061
|
currentState: valveState,
|
|
2209
1062
|
targetState: valveState,
|
|
2210
1063
|
openDuration: null,
|
|
2211
|
-
defaultOpenDuration: null,
|
|
1064
|
+
defaultOpenDuration: null,
|
|
2212
1065
|
remainingDuration: null,
|
|
2213
1066
|
valveFault: { generalFault: false, blocked: false, leaking: false, notConnected: false, shortCircuit: false, currentExceeded: false },
|
|
2214
|
-
// Feature.Level
|
|
2215
1067
|
currentLevel: valveLevel,
|
|
2216
1068
|
targetLevel: valveLevel,
|
|
2217
|
-
defaultOpenLevel: 100,
|
|
2218
|
-
levelStep: 1,
|
|
1069
|
+
defaultOpenLevel: 100,
|
|
1070
|
+
levelStep: 1,
|
|
2219
1071
|
});
|
|
2220
1072
|
return this;
|
|
2221
1073
|
}
|
|
2222
|
-
/**
|
|
2223
|
-
* Creates the default PumpConfigurationAndControl cluster server with features ConstantSpeed.
|
|
2224
|
-
*
|
|
2225
|
-
* @param {PumpConfigurationAndControl.OperationMode} [pumpMode] - The pump mode to set. Defaults to `PumpConfigurationAndControl.OperationMode.Normal`.
|
|
2226
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2227
|
-
*/
|
|
2228
1074
|
createDefaultPumpConfigurationAndControlClusterServer(pumpMode = PumpConfigurationAndControl.OperationMode.Normal) {
|
|
2229
1075
|
this.behaviors.require(PumpConfigurationAndControlServer.with(PumpConfigurationAndControl.Feature.ConstantSpeed), {
|
|
2230
1076
|
minConstSpeed: null,
|
|
@@ -2239,13 +1085,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2239
1085
|
});
|
|
2240
1086
|
return this;
|
|
2241
1087
|
}
|
|
2242
|
-
/**
|
|
2243
|
-
* Creates the default SmokeCOAlarm Cluster Server with features SmokeAlarm and CoAlarm.
|
|
2244
|
-
*
|
|
2245
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2246
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2247
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2248
|
-
*/
|
|
2249
1088
|
createDefaultSmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal, coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
2250
1089
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm, SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
2251
1090
|
events: {
|
|
@@ -2273,12 +1112,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2273
1112
|
});
|
|
2274
1113
|
return this;
|
|
2275
1114
|
}
|
|
2276
|
-
/**
|
|
2277
|
-
* Creates a smoke only SmokeCOAlarm Cluster Server with features SmokeAlarm.
|
|
2278
|
-
*
|
|
2279
|
-
* @param {SmokeCoAlarm.AlarmState} smokeState - The state of the smoke alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2280
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2281
|
-
*/
|
|
2282
1115
|
createSmokeOnlySmokeCOAlarmClusterServer(smokeState = SmokeCoAlarm.AlarmState.Normal) {
|
|
2283
1116
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.SmokeAlarm).enable({
|
|
2284
1117
|
events: {
|
|
@@ -2303,12 +1136,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2303
1136
|
});
|
|
2304
1137
|
return this;
|
|
2305
1138
|
}
|
|
2306
|
-
/**
|
|
2307
|
-
* Creates a co only SmokeCOAlarm Cluster Server with features CoAlarm.
|
|
2308
|
-
*
|
|
2309
|
-
* @param {SmokeCoAlarm.AlarmState} coState - The state of the CO alarm. Defaults to SmokeCoAlarm.AlarmState.Normal.
|
|
2310
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2311
|
-
*/
|
|
2312
1139
|
createCoOnlySmokeCOAlarmClusterServer(coState = SmokeCoAlarm.AlarmState.Normal) {
|
|
2313
1140
|
this.behaviors.require(MatterbridgeSmokeCoAlarmServer.with(SmokeCoAlarm.Feature.CoAlarm).enable({
|
|
2314
1141
|
events: {
|
|
@@ -2333,15 +1160,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2333
1160
|
});
|
|
2334
1161
|
return this;
|
|
2335
1162
|
}
|
|
2336
|
-
/**
|
|
2337
|
-
* Creates a default momentary switch cluster server with features MomentarySwitch, MomentarySwitchRelease, MomentarySwitchLongPress and MomentarySwitchMultiPress
|
|
2338
|
-
* and events initialPress, longPress, shortRelease, longRelease, multiPressOngoing, multiPressComplete.
|
|
2339
|
-
*
|
|
2340
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2341
|
-
*
|
|
2342
|
-
* @remarks
|
|
2343
|
-
* This method adds a cluster server with default momentary switch features and configuration suitable for (AppleHome) Single Double Long automations.
|
|
2344
|
-
*/
|
|
2345
1163
|
createDefaultSwitchClusterServer() {
|
|
2346
1164
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch, Switch.Feature.MomentarySwitchRelease, Switch.Feature.MomentarySwitchLongPress, Switch.Feature.MomentarySwitchMultiPress).enable({
|
|
2347
1165
|
events: { initialPress: true, longPress: true, shortRelease: true, longRelease: true, multiPressOngoing: true, multiPressComplete: true },
|
|
@@ -2352,15 +1170,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2352
1170
|
});
|
|
2353
1171
|
return this;
|
|
2354
1172
|
}
|
|
2355
|
-
/**
|
|
2356
|
-
* Creates a default momentary switch cluster server with feature MomentarySwitch and event initialPress.
|
|
2357
|
-
*
|
|
2358
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2359
|
-
*
|
|
2360
|
-
* @remarks
|
|
2361
|
-
* This method adds a cluster server with default momentary switch features and configuration suitable for a Single press automations.
|
|
2362
|
-
* It is supported by the Home app.
|
|
2363
|
-
*/
|
|
2364
1173
|
createDefaultMomentarySwitchClusterServer() {
|
|
2365
1174
|
this.behaviors.require(MatterbridgeSwitchServer.with(Switch.Feature.MomentarySwitch).enable({
|
|
2366
1175
|
events: { initialPress: true },
|
|
@@ -2370,14 +1179,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2370
1179
|
});
|
|
2371
1180
|
return this;
|
|
2372
1181
|
}
|
|
2373
|
-
/**
|
|
2374
|
-
* Creates a default latching switch cluster server with features LatchingSwitch.
|
|
2375
|
-
*
|
|
2376
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2377
|
-
*
|
|
2378
|
-
* @remarks
|
|
2379
|
-
* This method adds a cluster server with default latching switch features and configuration suitable for a latching switch with 2 positions.
|
|
2380
|
-
*/
|
|
2381
1182
|
createDefaultLatchingSwitchClusterServer() {
|
|
2382
1183
|
this.behaviors.require(SwitchServer.with(Switch.Feature.LatchingSwitch).enable({
|
|
2383
1184
|
events: { switchLatched: true },
|
|
@@ -2387,15 +1188,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2387
1188
|
});
|
|
2388
1189
|
return this;
|
|
2389
1190
|
}
|
|
2390
|
-
/**
|
|
2391
|
-
* Triggers a switch event on the specified endpoint.
|
|
2392
|
-
* We usually use get from real devices something like 'single', 'double', 'long'.
|
|
2393
|
-
* Here we convert it to the Matter sequence of events (taken from Matter specs).
|
|
2394
|
-
*
|
|
2395
|
-
* @param {string} event - The type of event to trigger. Possible values are 'Single', 'Double', 'Long' for momentarySwitch and 'Press', 'Release' for latchingSwitch.
|
|
2396
|
-
* @param {AnsiLogger} log - Optional logger to log the event.
|
|
2397
|
-
* @returns {boolean} - A boolean indicating whether the event was successfully triggered.
|
|
2398
|
-
*/
|
|
2399
1191
|
async triggerSwitchEvent(event, log) {
|
|
2400
1192
|
if (this.maybeNumber === undefined) {
|
|
2401
1193
|
this.log.error(`triggerSwitchEvent ${event} error: Endpoint number not assigned on endpoint ${this.maybeId}:${this.maybeNumber}`);
|
|
@@ -2457,37 +1249,10 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2457
1249
|
}
|
|
2458
1250
|
return true;
|
|
2459
1251
|
}
|
|
2460
|
-
/**
|
|
2461
|
-
* Creates a default OperationalState Cluster Server.
|
|
2462
|
-
*
|
|
2463
|
-
* @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state id.
|
|
2464
|
-
*
|
|
2465
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2466
|
-
*
|
|
2467
|
-
* @remarks
|
|
2468
|
-
* This method adds a cluster server with a default operational state configuration:
|
|
2469
|
-
* - { operationalStateId: OperationalState.OperationalStateEnum.Stopped, operationalStateLabel: 'Stopped' },
|
|
2470
|
-
* - { operationalStateId: OperationalState.OperationalStateEnum.Running, operationalStateLabel: 'Running' },
|
|
2471
|
-
* - { operationalStateId: OperationalState.OperationalStateEnum.Paused, operationalStateLabel: 'Paused' },
|
|
2472
|
-
* - { operationalStateId: OperationalState.OperationalStateEnum.Error, operationalStateLabel: 'Error' },
|
|
2473
|
-
*/
|
|
2474
1252
|
createDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
|
2475
1253
|
this.behaviors.require(MatterbridgeOperationalStateServer, getDefaultOperationalStateClusterServer(operationalState));
|
|
2476
1254
|
return this;
|
|
2477
1255
|
}
|
|
2478
|
-
/**
|
|
2479
|
-
* Creates a default boolean state cluster server.
|
|
2480
|
-
* The stateChange event is enabled.
|
|
2481
|
-
*
|
|
2482
|
-
* @param {boolean} contact - The state of the cluster. Defaults to true (true = contact).
|
|
2483
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2484
|
-
*
|
|
2485
|
-
* @remarks
|
|
2486
|
-
* Water Leak Detector: true = leak, false = no leak
|
|
2487
|
-
* Water Freeze Detector: true = freeze, false = no freeze
|
|
2488
|
-
* Rain Sensor: true = rain, false = no rain
|
|
2489
|
-
* Contact Sensor: true = closed or contact, false = open or no contact
|
|
2490
|
-
*/
|
|
2491
1256
|
createDefaultBooleanStateClusterServer(contact) {
|
|
2492
1257
|
this.behaviors.require(BooleanStateServer.enable({
|
|
2493
1258
|
events: { stateChange: true },
|
|
@@ -2496,22 +1261,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2496
1261
|
});
|
|
2497
1262
|
return this;
|
|
2498
1263
|
}
|
|
2499
|
-
/**
|
|
2500
|
-
* Creates a default boolean state configuration cluster server to be used with the waterFreezeDetector, waterLeakDetector, and rainSensor device types.
|
|
2501
|
-
*
|
|
2502
|
-
* Features:
|
|
2503
|
-
* - Visual
|
|
2504
|
-
* - Audible
|
|
2505
|
-
* - SensitivityLevel
|
|
2506
|
-
*
|
|
2507
|
-
* @remarks Supports the enableDisableAlarm command.
|
|
2508
|
-
*
|
|
2509
|
-
* @param {boolean} [sensorFault] - Optional boolean value indicating the sensor fault state. Defaults to `false` if not provided.
|
|
2510
|
-
* @param {number} [currentSensitivityLevel] - The current sensitivity level. Defaults to `0` if not provided.
|
|
2511
|
-
* @param {number} [supportedSensitivityLevels] - The number of supported sensitivity levels. Defaults to `2` if not provided (min 2, max 10).
|
|
2512
|
-
* @param {number} [defaultSensitivityLevel] - The default sensitivity level. Defaults to `0` if not provided.
|
|
2513
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2514
|
-
*/
|
|
2515
1264
|
createDefaultBooleanStateConfigurationClusterServer(sensorFault = false, currentSensitivityLevel = 0, supportedSensitivityLevels = 2, defaultSensitivityLevel = 0) {
|
|
2516
1265
|
this.behaviors.require(MatterbridgeBooleanStateConfigurationServer.with(BooleanStateConfiguration.Feature.Visual, BooleanStateConfiguration.Feature.Audible, BooleanStateConfiguration.Feature.SensitivityLevel).enable({
|
|
2517
1266
|
events: { alarmsStateChanged: true, sensorFault: true },
|
|
@@ -2526,128 +1275,36 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2526
1275
|
});
|
|
2527
1276
|
return this;
|
|
2528
1277
|
}
|
|
2529
|
-
/**
|
|
2530
|
-
* Creates a default TemperatureMeasurement cluster server.
|
|
2531
|
-
*
|
|
2532
|
-
* @param {number | null} measuredValue - The measured value of the temperature x 100.
|
|
2533
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
|
|
2534
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
|
|
2535
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2536
|
-
*/
|
|
2537
1278
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2538
1279
|
this.behaviors.require(TemperatureMeasurementServer, getDefaultTemperatureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2539
1280
|
return this;
|
|
2540
1281
|
}
|
|
2541
|
-
/**
|
|
2542
|
-
* Creates a default RelativeHumidityMeasurement cluster server.
|
|
2543
|
-
*
|
|
2544
|
-
* @param {number | null} measuredValue - The measured value of the relative humidity x 100.
|
|
2545
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
|
|
2546
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
|
|
2547
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2548
|
-
*/
|
|
2549
1282
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2550
1283
|
this.behaviors.require(RelativeHumidityMeasurementServer, getDefaultRelativeHumidityMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2551
1284
|
return this;
|
|
2552
1285
|
}
|
|
2553
|
-
/**
|
|
2554
|
-
* Creates a default PressureMeasurement cluster server.
|
|
2555
|
-
*
|
|
2556
|
-
* @param {number | null} measuredValue - The measured value for the pressure in kPa x 10.
|
|
2557
|
-
* @param {number | null} minMeasuredValue - The minimum measured value for the pressure in kPa x 10.
|
|
2558
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value for the pressure in kPa x 10.
|
|
2559
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2560
|
-
*
|
|
2561
|
-
* @remarks
|
|
2562
|
-
* - MeasuredValue = 10 x Pressure in kPa
|
|
2563
|
-
* - MeasuredValue = 1 x Pressure in hPa
|
|
2564
|
-
* - MeasuredValue = 33.8639 x Pressure in inHg
|
|
2565
|
-
*
|
|
2566
|
-
* Conversion:
|
|
2567
|
-
* - 1 kPa = 10 hPa
|
|
2568
|
-
* - 1 inHg = 33.8639 hPa
|
|
2569
|
-
*/
|
|
2570
1286
|
createDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2571
1287
|
this.behaviors.require(PressureMeasurementServer, getDefaultPressureMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2572
1288
|
return this;
|
|
2573
1289
|
}
|
|
2574
|
-
/**
|
|
2575
|
-
* Creates a default IlluminanceMeasurement cluster server.
|
|
2576
|
-
*
|
|
2577
|
-
* @param {number | null} measuredValue - The measured value of illuminance.
|
|
2578
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
|
|
2579
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
|
|
2580
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2581
|
-
*
|
|
2582
|
-
* @remarks
|
|
2583
|
-
*
|
|
2584
|
-
* The default value for the illuminance measurement is null.
|
|
2585
|
-
*
|
|
2586
|
-
* This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
|
|
2587
|
-
* • MeasuredValue = 10,000 x log10(illuminance) + 1,
|
|
2588
|
-
* where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
|
|
2589
|
-
* • 0 indicates a value of illuminance that is too low to be measured
|
|
2590
|
-
* • null indicates that the illuminance measurement is invalid.
|
|
2591
|
-
*
|
|
2592
|
-
* - Lux to matter = Math.round(Math.max(Math.min(10000 * Math.log10(lux), 0xfffe), 0))
|
|
2593
|
-
* - Matter to Lux = Math.round(Math.max(Math.pow(10, value / 10000), 0))
|
|
2594
|
-
*/
|
|
2595
1290
|
createDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2596
1291
|
this.behaviors.require(IlluminanceMeasurementServer, getDefaultIlluminanceMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2597
1292
|
return this;
|
|
2598
1293
|
}
|
|
2599
|
-
/**
|
|
2600
|
-
* Creates a default FlowMeasurement cluster server.
|
|
2601
|
-
*
|
|
2602
|
-
* @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
|
|
2603
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
|
|
2604
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
|
|
2605
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2606
|
-
*/
|
|
2607
1294
|
createDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
2608
1295
|
this.behaviors.require(FlowMeasurementServer, getDefaultFlowMeasurementClusterServer(measuredValue, minMeasuredValue, maxMeasuredValue));
|
|
2609
1296
|
return this;
|
|
2610
1297
|
}
|
|
2611
|
-
/**
|
|
2612
|
-
* Creates a default OccupancySensing cluster server with feature PassiveInfrared.
|
|
2613
|
-
*
|
|
2614
|
-
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
2615
|
-
* @param {number} holdTime - The hold time in seconds. Default is 30.
|
|
2616
|
-
* @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
|
|
2617
|
-
* @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
|
|
2618
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2619
|
-
*
|
|
2620
|
-
* @remarks The default value for the occupancy sensor type is PIR.
|
|
2621
|
-
*/
|
|
2622
1298
|
createDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
2623
1299
|
this.behaviors.require(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), getDefaultOccupancySensingClusterServer(occupied, holdTime, holdTimeMin, holdTimeMax));
|
|
2624
1300
|
return this;
|
|
2625
1301
|
}
|
|
2626
|
-
/**
|
|
2627
|
-
* Creates a default AirQuality cluster server.
|
|
2628
|
-
*
|
|
2629
|
-
* @param {AirQuality.AirQualityEnum} airQuality The air quality level. Defaults to `AirQuality.AirQualityType.Unknown`.
|
|
2630
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2631
|
-
*/
|
|
2632
1302
|
createDefaultAirQualityClusterServer(airQuality = AirQuality.AirQualityEnum.Unknown) {
|
|
2633
1303
|
this.behaviors.require(AirQualityServer.with(AirQuality.Feature.Fair, AirQuality.Feature.Moderate, AirQuality.Feature.VeryPoor, AirQuality.Feature.ExtremelyPoor), {
|
|
2634
1304
|
airQuality,
|
|
2635
1305
|
});
|
|
2636
1306
|
return this;
|
|
2637
1307
|
}
|
|
2638
|
-
/**
|
|
2639
|
-
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2640
|
-
*
|
|
2641
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2642
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2643
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2644
|
-
* @param {number} [uncertainty] - The uncertainty value (optional).
|
|
2645
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2646
|
-
*
|
|
2647
|
-
* @remarks
|
|
2648
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2649
|
-
* Apple Home requires Ugm3 for TotalVolatileOrganicCompoundsConcentrationMeasurement cluster.
|
|
2650
|
-
*/
|
|
2651
1308
|
createDefaultTvocMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air, uncertainty) {
|
|
2652
1309
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2653
1310
|
measuredValue,
|
|
@@ -2659,16 +1316,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2659
1316
|
});
|
|
2660
1317
|
return this;
|
|
2661
1318
|
}
|
|
2662
|
-
/**
|
|
2663
|
-
* Creates a default TotalVolatileOrganicCompoundsConcentrationMeasurement cluster server with feature LevelIndication, MediumLevel and CriticalLevel.
|
|
2664
|
-
*
|
|
2665
|
-
* @param {ConcentrationMeasurement.LevelValue} levelValue - The level value of the measurement (default to ConcentrationMeasurement.LevelValue.Unknown).
|
|
2666
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The measurement medium (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2667
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2668
|
-
*
|
|
2669
|
-
* @remarks
|
|
2670
|
-
* The measurementMedium attribute is fixed and cannot be changed after creation.
|
|
2671
|
-
*/
|
|
2672
1319
|
createLevelTvocMeasurementClusterServer(levelValue = ConcentrationMeasurement.LevelValue.Unknown, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2673
1320
|
this.behaviors.require(TotalVolatileOrganicCompoundsConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.LevelIndication, ConcentrationMeasurement.Feature.MediumLevel, ConcentrationMeasurement.Feature.CriticalLevel), {
|
|
2674
1321
|
levelValue,
|
|
@@ -2676,17 +1323,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2676
1323
|
});
|
|
2677
1324
|
return this;
|
|
2678
1325
|
}
|
|
2679
|
-
/**
|
|
2680
|
-
* Create a default CarbonMonoxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2681
|
-
*
|
|
2682
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2683
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2684
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2685
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2686
|
-
*
|
|
2687
|
-
* @remarks
|
|
2688
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2689
|
-
*/
|
|
2690
1326
|
createDefaultCarbonMonoxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2691
1327
|
this.behaviors.require(CarbonMonoxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2692
1328
|
measuredValue,
|
|
@@ -2698,17 +1334,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2698
1334
|
});
|
|
2699
1335
|
return this;
|
|
2700
1336
|
}
|
|
2701
|
-
/**
|
|
2702
|
-
* Create a default CarbonDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2703
|
-
*
|
|
2704
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2705
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ppm).
|
|
2706
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2707
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2708
|
-
*
|
|
2709
|
-
* @remarks
|
|
2710
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2711
|
-
*/
|
|
2712
1337
|
createDefaultCarbonDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2713
1338
|
this.behaviors.require(CarbonDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2714
1339
|
measuredValue,
|
|
@@ -2720,18 +1345,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2720
1345
|
});
|
|
2721
1346
|
return this;
|
|
2722
1347
|
}
|
|
2723
|
-
/**
|
|
2724
|
-
* Create a default FormaldehydeConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2725
|
-
*
|
|
2726
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2727
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Mgm3).
|
|
2728
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2729
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2730
|
-
*
|
|
2731
|
-
* @remarks
|
|
2732
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2733
|
-
* Apple Home doesn't support FormaldehydeConcentrationMeasurement cluster.
|
|
2734
|
-
*/
|
|
2735
1348
|
createDefaultFormaldehydeConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Mgm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2736
1349
|
this.behaviors.require(FormaldehydeConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2737
1350
|
measuredValue,
|
|
@@ -2743,18 +1356,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2743
1356
|
});
|
|
2744
1357
|
return this;
|
|
2745
1358
|
}
|
|
2746
|
-
/**
|
|
2747
|
-
* Create a default Pm1ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2748
|
-
*
|
|
2749
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2750
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2751
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2752
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2753
|
-
*
|
|
2754
|
-
* @remarks
|
|
2755
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2756
|
-
* Apple Home doesn't support Pm1ConcentrationMeasurement cluster.
|
|
2757
|
-
*/
|
|
2758
1359
|
createDefaultPm1ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2759
1360
|
this.behaviors.require(Pm1ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2760
1361
|
measuredValue,
|
|
@@ -2766,18 +1367,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2766
1367
|
});
|
|
2767
1368
|
return this;
|
|
2768
1369
|
}
|
|
2769
|
-
/**
|
|
2770
|
-
* Create a default Pm25ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2771
|
-
*
|
|
2772
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2773
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2774
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2775
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2776
|
-
*
|
|
2777
|
-
* @remarks
|
|
2778
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2779
|
-
* Apple Home requires Ugm3 for Pm25ConcentrationMeasurement cluster.
|
|
2780
|
-
*/
|
|
2781
1370
|
createDefaultPm25ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2782
1371
|
this.behaviors.require(Pm25ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2783
1372
|
measuredValue,
|
|
@@ -2789,18 +1378,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2789
1378
|
});
|
|
2790
1379
|
return this;
|
|
2791
1380
|
}
|
|
2792
|
-
/**
|
|
2793
|
-
* Create a default Pm10ConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2794
|
-
*
|
|
2795
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2796
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2797
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2798
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2799
|
-
*
|
|
2800
|
-
* @remarks
|
|
2801
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2802
|
-
* Apple Home requires Ugm3 for Pm10ConcentrationMeasurement cluster.
|
|
2803
|
-
*/
|
|
2804
1381
|
createDefaultPm10ConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2805
1382
|
this.behaviors.require(Pm10ConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2806
1383
|
measuredValue,
|
|
@@ -2812,17 +1389,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2812
1389
|
});
|
|
2813
1390
|
return this;
|
|
2814
1391
|
}
|
|
2815
|
-
/**
|
|
2816
|
-
* Create a default OzoneConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2817
|
-
*
|
|
2818
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2819
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2820
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2821
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2822
|
-
*
|
|
2823
|
-
* @remarks
|
|
2824
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2825
|
-
*/
|
|
2826
1392
|
createDefaultOzoneConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2827
1393
|
this.behaviors.require(OzoneConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2828
1394
|
measuredValue,
|
|
@@ -2834,18 +1400,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2834
1400
|
});
|
|
2835
1401
|
return this;
|
|
2836
1402
|
}
|
|
2837
|
-
/**
|
|
2838
|
-
* Create a default RadonConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2839
|
-
*
|
|
2840
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2841
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Bqm3).
|
|
2842
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2843
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2844
|
-
*
|
|
2845
|
-
* @remarks
|
|
2846
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2847
|
-
* Apple Home doesn't support RadonConcentrationMeasurement cluster.
|
|
2848
|
-
*/
|
|
2849
1403
|
createDefaultRadonConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Bqm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2850
1404
|
this.behaviors.require(RadonConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2851
1405
|
measuredValue,
|
|
@@ -2857,17 +1411,6 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2857
1411
|
});
|
|
2858
1412
|
return this;
|
|
2859
1413
|
}
|
|
2860
|
-
/**
|
|
2861
|
-
* Create a default NitrogenDioxideConcentrationMeasurement cluster server with feature NumericMeasurement.
|
|
2862
|
-
*
|
|
2863
|
-
* @param {number | null} measuredValue - The measured value of the concentration.
|
|
2864
|
-
* @param {ConcentrationMeasurement.MeasurementUnit} measurementUnit - The unit of measurement (default to ConcentrationMeasurement.MeasurementUnit.Ugm3).
|
|
2865
|
-
* @param {ConcentrationMeasurement.MeasurementMedium} measurementMedium - The unit of measurement (default to ConcentrationMeasurement.MeasurementMedium.Air).
|
|
2866
|
-
* @returns {this} The current MatterbridgeEndpoint instance for chaining.
|
|
2867
|
-
*
|
|
2868
|
-
* @remarks
|
|
2869
|
-
* The measurementUnit and the measurementMedium attributes are fixed and cannot be changed after creation.
|
|
2870
|
-
*/
|
|
2871
1414
|
createDefaultNitrogenDioxideConcentrationMeasurementClusterServer(measuredValue = null, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ugm3, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
2872
1415
|
this.behaviors.require(NitrogenDioxideConcentrationMeasurementServer.with(ConcentrationMeasurement.Feature.NumericMeasurement), {
|
|
2873
1416
|
measuredValue,
|
|
@@ -2880,4 +1423,3 @@ export class MatterbridgeEndpoint extends Endpoint {
|
|
|
2880
1423
|
return this;
|
|
2881
1424
|
}
|
|
2882
1425
|
}
|
|
2883
|
-
//# sourceMappingURL=matterbridgeEndpoint.js.map
|