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