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