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