matterbridge 3.1.4-dev-20250715-075e722 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -2
- package/README.md +25 -2
- 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/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 +9 -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/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 +110 -0
- package/dist/devices/roboticVacuumCleaner.d.ts.map +1 -0
- package/dist/devices/roboticVacuumCleaner.js +89 -6
- 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/frontend.d.ts +304 -0
- package/dist/frontend.d.ts.map +1 -0
- package/dist/frontend.js +491 -49
- 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 +444 -0
- package/dist/matterbridge.d.ts.map +1 -0
- package/dist/matterbridge.js +785 -51
- 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 +1340 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +61 -1
- 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 +1250 -0
- package/dist/matterbridgeEndpoint.d.ts.map +1 -0
- package/dist/matterbridgeEndpoint.js +1106 -42
- package/dist/matterbridgeEndpoint.js.map +1 -0
- package/dist/matterbridgeEndpointHelpers.d.ts +3198 -0
- package/dist/matterbridgeEndpointHelpers.d.ts.map +1 -0
- package/dist/matterbridgeEndpointHelpers.js +322 -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 +233 -0
- package/dist/matterbridgePlatform.js.map +1 -0
- package/dist/matterbridgeTypes.d.ts +195 -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 +291 -0
- package/dist/pluginManager.d.ts.map +1 -0
- package/dist/pluginManager.js +269 -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 +59 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +54 -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/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 +49 -0
- package/dist/utils/hex.d.ts.map +1 -0
- package/dist/utils/hex.js +58 -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 +74 -0
- package/dist/utils/network.d.ts.map +1 -0
- package/dist/utils/network.js +81 -5
- package/dist/utils/network.js.map +1 -0
- package/dist/utils/spawn.d.ts +11 -0
- package/dist/utils/spawn.d.ts.map +1 -0
- package/dist/utils/spawn.js +18 -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/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matterbridgeEndpointHelpers.d.ts","sourceRoot":"","sources":["../src/matterbridgeEndpointHelpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAMH,OAAO,EAAE,UAAU,EAA0D,MAAM,kBAAkB,CAAC;AAEtG,OA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AW,SAAM;;;;;;;;;;;;;;;;;;;GAU1H"}
|
|
@@ -1,7 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file contains the helpers for the class MatterbridgeEndpoint.
|
|
3
|
+
*
|
|
4
|
+
* @file matterbridgeEndpointHelpers.ts
|
|
5
|
+
* @author Luca Liguori
|
|
6
|
+
* @created 2024-10-01
|
|
7
|
+
* @version 2.1.0
|
|
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
|
+
// Other modules
|
|
1
25
|
import { createHash } from 'node:crypto';
|
|
26
|
+
// AnsiLogger module
|
|
2
27
|
import { BLUE, CYAN, db, debugStringify, er, hk, or, YELLOW, zb } from 'node-ansi-logger';
|
|
28
|
+
// @matter
|
|
3
29
|
import { Lifecycle } from '@matter/main';
|
|
4
30
|
import { getClusterNameById } from '@matter/main/types';
|
|
31
|
+
// @matter clusters
|
|
5
32
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
6
33
|
import { UserLabel } from '@matter/main/clusters/user-label';
|
|
7
34
|
import { FixedLabel } from '@matter/main/clusters/fixed-label';
|
|
@@ -46,6 +73,7 @@ import { TotalVolatileOrganicCompoundsConcentrationMeasurement } from '@matter/m
|
|
|
46
73
|
import { OperationalState } from '@matter/main/clusters/operational-state';
|
|
47
74
|
import { DeviceEnergyManagement } from '@matter/main/clusters/device-energy-management';
|
|
48
75
|
import { DeviceEnergyManagementMode } from '@matter/main/clusters/device-energy-management-mode';
|
|
76
|
+
// @matter behaviors
|
|
49
77
|
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
50
78
|
import { UserLabelServer } from '@matter/main/behaviors/user-label';
|
|
51
79
|
import { FixedLabelServer } from '@matter/main/behaviors/fixed-label';
|
|
@@ -76,53 +104,109 @@ import { Pm10ConcentrationMeasurementServer } from '@matter/main/behaviors/pm10-
|
|
|
76
104
|
import { RadonConcentrationMeasurementServer } from '@matter/main/behaviors/radon-concentration-measurement';
|
|
77
105
|
import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/main/behaviors/total-volatile-organic-compounds-concentration-measurement';
|
|
78
106
|
import { DeviceEnergyManagementServer } from '@matter/node/behaviors/device-energy-management';
|
|
107
|
+
// Matterbridge
|
|
79
108
|
import { deepCopy, deepEqual, isValidArray } from './utils/export.js';
|
|
80
109
|
import { MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, } from './matterbridgeBehaviors.js';
|
|
110
|
+
/**
|
|
111
|
+
* Capitalizes the first letter of a string.
|
|
112
|
+
*
|
|
113
|
+
* @param {string} name - The string to capitalize.
|
|
114
|
+
* @returns {string} The string with the first letter capitalized.
|
|
115
|
+
*/
|
|
81
116
|
export function capitalizeFirstLetter(name) {
|
|
82
117
|
if (!name)
|
|
83
118
|
return name;
|
|
84
119
|
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
85
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Lowercases the first letter of a string.
|
|
123
|
+
*
|
|
124
|
+
* @param {string} name - The string to lowercase the first letter of.
|
|
125
|
+
* @returns {string} The string with the first letter lowercased.
|
|
126
|
+
*/
|
|
86
127
|
export function lowercaseFirstLetter(name) {
|
|
87
128
|
if (!name)
|
|
88
129
|
return name;
|
|
89
130
|
return name.charAt(0).toLowerCase() + name.slice(1);
|
|
90
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Checks if the device name contains non-Latin characters.
|
|
134
|
+
*
|
|
135
|
+
* @param {string} deviceName - The name of the device to check.
|
|
136
|
+
* @returns {boolean} Returns true if the device name contains non-Latin characters, false otherwise.
|
|
137
|
+
*/
|
|
91
138
|
export function checkNotLatinCharacters(deviceName) {
|
|
92
139
|
const nonLatinRegexList = [
|
|
93
|
-
/[\u0400-\u04FF\u0500-\u052F]/,
|
|
94
|
-
/[\u2E80-\u9FFF]/,
|
|
95
|
-
/[\uAC00-\uD7AF]/,
|
|
96
|
-
/[\u0600-\u06FF\u0750-\u077F]/,
|
|
97
|
-
/[\u0590-\u05FF]/,
|
|
98
|
-
/[\u0900-\u097F]/,
|
|
99
|
-
/[\u0E00-\u0E7F]/,
|
|
100
|
-
/[\u1200-\u137F]/,
|
|
140
|
+
/[\u0400-\u04FF\u0500-\u052F]/, // Cyrillic
|
|
141
|
+
/[\u2E80-\u9FFF]/, // CJK (Chinese, Japanese, Korean)
|
|
142
|
+
/[\uAC00-\uD7AF]/, // Korean Hangul
|
|
143
|
+
/[\u0600-\u06FF\u0750-\u077F]/, // Arabic, Persian
|
|
144
|
+
/[\u0590-\u05FF]/, // Hebrew
|
|
145
|
+
/[\u0900-\u097F]/, // Devanagari (Hindi, Sanskrit)
|
|
146
|
+
/[\u0E00-\u0E7F]/, // Thai
|
|
147
|
+
/[\u1200-\u137F]/, // Ethiopic (Amharic, Tigrinya)
|
|
101
148
|
];
|
|
102
149
|
return nonLatinRegexList.some((regex) => regex.test(deviceName));
|
|
103
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Generates a unique ID based on the device name.
|
|
153
|
+
*
|
|
154
|
+
* @param {string} deviceName - The name of the device to generate a unique ID for.
|
|
155
|
+
* @returns {string} A unique ID generated from the device name using MD5 hashing.
|
|
156
|
+
*/
|
|
104
157
|
export function generateUniqueId(deviceName) {
|
|
105
|
-
return createHash('md5').update(deviceName).digest('hex');
|
|
106
|
-
}
|
|
158
|
+
return createHash('md5').update(deviceName).digest('hex'); // MD5 hash of the device name
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Generates a unique ID based on four parameters.
|
|
162
|
+
*
|
|
163
|
+
* @param {string} param1 - The first parameter.
|
|
164
|
+
* @param {string} param2 - The second parameter.
|
|
165
|
+
* @param {string} param3 - The third parameter.
|
|
166
|
+
* @param {string} param4 - The fourth parameter.
|
|
167
|
+
* @returns {string} A unique ID generated from the concatenation of the parameters using MD5 hashing.
|
|
168
|
+
*/
|
|
107
169
|
export function createUniqueId(param1, param2, param3, param4) {
|
|
108
170
|
const hash = createHash('md5');
|
|
109
171
|
hash.update(param1 + param2 + param3 + param4);
|
|
110
172
|
return hash.digest('hex');
|
|
111
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Maps a list of ClusterId to Behavior.Type for server clusters.
|
|
176
|
+
*
|
|
177
|
+
* @param {ClusterId[]} clusterServerList - The list of ClusterId to map.
|
|
178
|
+
* @returns {Behavior.Type[]} An array of Behavior.Type corresponding to the ClusterId in the server list.
|
|
179
|
+
*/
|
|
112
180
|
export function getBehaviourTypesFromClusterServerIds(clusterServerList) {
|
|
181
|
+
// Map Server ClusterId to Behavior.Type
|
|
113
182
|
const behaviorTypes = [];
|
|
114
183
|
clusterServerList.forEach((clusterId) => {
|
|
115
184
|
behaviorTypes.push(getBehaviourTypeFromClusterServerId(clusterId));
|
|
116
185
|
});
|
|
117
186
|
return behaviorTypes;
|
|
118
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Maps a list of ClusterId to Behavior.Type for client clusters.
|
|
190
|
+
*
|
|
191
|
+
* @param {ClusterId[]} clusterClientList - The list of ClusterId to map.
|
|
192
|
+
* @returns {Behavior.Type[]} An array of Behavior.Type corresponding to the ClusterId in the client list.
|
|
193
|
+
*/
|
|
119
194
|
export function getBehaviourTypesFromClusterClientIds(clusterClientList) {
|
|
195
|
+
// Map Client ClusterId to Behavior.Type
|
|
120
196
|
const behaviorTypes = [];
|
|
121
197
|
clusterClientList.forEach((_clusterId) => {
|
|
198
|
+
// behaviorTypes.push(getBehaviourTypeFromClusterClientId(clusterId));
|
|
122
199
|
});
|
|
123
200
|
return behaviorTypes;
|
|
124
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Maps a ClusterId to a Behavior.Type for server clusters.
|
|
204
|
+
*
|
|
205
|
+
* @param {ClusterId} clusterId - The ClusterId to map.
|
|
206
|
+
* @returns {Behavior.Type} The corresponding Behavior.Type for the given ClusterId.
|
|
207
|
+
*/
|
|
125
208
|
export function getBehaviourTypeFromClusterServerId(clusterId) {
|
|
209
|
+
// Map ClusterId to Server Behavior.Type
|
|
126
210
|
if (clusterId === PowerSource.Cluster.id)
|
|
127
211
|
return PowerSourceServer.with(PowerSource.Feature.Wired);
|
|
128
212
|
if (clusterId === UserLabel.Cluster.id)
|
|
@@ -213,8 +297,22 @@ export function getBehaviourTypeFromClusterServerId(clusterId) {
|
|
|
213
297
|
return MatterbridgeDeviceEnergyManagementModeServer;
|
|
214
298
|
return MatterbridgeIdentifyServer;
|
|
215
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Maps a ClusterId to a Behavior.Type for client clusters.
|
|
302
|
+
*
|
|
303
|
+
* @param {ClusterId} _clusterId - The ClusterId to map.
|
|
304
|
+
*/
|
|
216
305
|
export function getBehaviourTypeFromClusterClientId(_clusterId) {
|
|
217
|
-
|
|
306
|
+
// Map ClusterId to Client Behavior.Type
|
|
307
|
+
// return IdentifyClient;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Retrieves the Behavior.Type for a given cluster from the endpoint's supported behaviors.
|
|
311
|
+
*
|
|
312
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to retrieve the behavior from.
|
|
313
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the behavior for.
|
|
314
|
+
* @returns {Behavior.Type | undefined} The Behavior.Type for the given cluster, or undefined if not found.
|
|
315
|
+
*/
|
|
218
316
|
export function getBehavior(endpoint, cluster) {
|
|
219
317
|
let behavior;
|
|
220
318
|
if (typeof cluster === 'string') {
|
|
@@ -231,6 +329,18 @@ export function getBehavior(endpoint, cluster) {
|
|
|
231
329
|
}
|
|
232
330
|
return behavior;
|
|
233
331
|
}
|
|
332
|
+
/**
|
|
333
|
+
* Invokes a command on the specified behavior of the endpoint. Used ONLY in Jest tests.
|
|
334
|
+
*
|
|
335
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to invoke the command on.
|
|
336
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
|
|
337
|
+
* @param {keyof MatterbridgeEndpointCommands} command - The command to invoke.
|
|
338
|
+
* @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The parameters to pass to the command.
|
|
339
|
+
*
|
|
340
|
+
* @returns {Promise<boolean>} A promise that resolves to true if the command was invoked successfully, false otherwise.
|
|
341
|
+
*
|
|
342
|
+
* @deprecated Used ONLY in Jest tests.
|
|
343
|
+
*/
|
|
234
344
|
export async function invokeBehaviorCommand(endpoint, cluster, command, params) {
|
|
235
345
|
const behaviorId = getBehavior(endpoint, cluster)?.id;
|
|
236
346
|
if (!behaviorId) {
|
|
@@ -238,6 +348,7 @@ export async function invokeBehaviorCommand(endpoint, cluster, command, params)
|
|
|
238
348
|
return false;
|
|
239
349
|
}
|
|
240
350
|
await endpoint.act((agent) => {
|
|
351
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
241
352
|
const behavior = agent[behaviorId];
|
|
242
353
|
if (!(command in behavior) || typeof behavior[command] !== 'function') {
|
|
243
354
|
endpoint.log?.error(`invokeBehaviorCommand error: command ${hk}${command}${er} not found on agent for endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
@@ -247,6 +358,18 @@ export async function invokeBehaviorCommand(endpoint, cluster, command, params)
|
|
|
247
358
|
});
|
|
248
359
|
return true;
|
|
249
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* Invokes the subscription handler on the specified cluster and attribute of the endpoint. Used ONLY in Jest tests.
|
|
363
|
+
*
|
|
364
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to invoke the subscription handler on.
|
|
365
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the subscription handler on.
|
|
366
|
+
* @param {string} attribute - The attribute to invoke the subscription handler on.
|
|
367
|
+
* @param {unknown} newValue - The new value of the attribute.
|
|
368
|
+
* @param {unknown} oldValue - The old value of the attribute.
|
|
369
|
+
*
|
|
370
|
+
* @returns {Promise<boolean>} A promise that resolves to true if the subscription handler was invoked successfully, false otherwise.
|
|
371
|
+
* @deprecated Used ONLY in Jest tests.
|
|
372
|
+
*/
|
|
250
373
|
export async function invokeSubscribeHandler(endpoint, cluster, attribute, newValue, oldValue) {
|
|
251
374
|
const event = attribute + '$Changed';
|
|
252
375
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
@@ -263,9 +386,17 @@ export async function invokeSubscribeHandler(endpoint, cluster, attribute, newVa
|
|
|
263
386
|
endpoint.log.error(`invokeSubscribeHandler ${hk}${event}${er} error: cluster ${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
|
|
264
387
|
return false;
|
|
265
388
|
}
|
|
389
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
390
|
+
// @ts-ignore
|
|
266
391
|
await endpoint.act((agent) => agent[clusterName].events[event].emit(newValue, oldValue, { ...agent.context, offline: false }));
|
|
267
392
|
return true;
|
|
268
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Adds required cluster servers to the specified endpoint based on the device types.
|
|
396
|
+
*
|
|
397
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
398
|
+
* @returns {void}
|
|
399
|
+
*/
|
|
269
400
|
export function addRequiredClusterServers(endpoint) {
|
|
270
401
|
const requiredServerList = [];
|
|
271
402
|
endpoint.log.debug(`addRequiredClusterServers for ${CYAN}${endpoint.maybeId}${db}`);
|
|
@@ -280,6 +411,12 @@ export function addRequiredClusterServers(endpoint) {
|
|
|
280
411
|
});
|
|
281
412
|
addClusterServers(endpoint, requiredServerList);
|
|
282
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* Adds optional cluster servers to the specified endpoint based on the device types.
|
|
416
|
+
*
|
|
417
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the optional cluster servers to.
|
|
418
|
+
* @returns {void}
|
|
419
|
+
*/
|
|
283
420
|
export function addOptionalClusterServers(endpoint) {
|
|
284
421
|
const optionalServerList = [];
|
|
285
422
|
endpoint.log.debug(`addOptionalClusterServers for ${CYAN}${endpoint.maybeId}${db}`);
|
|
@@ -294,6 +431,12 @@ export function addOptionalClusterServers(endpoint) {
|
|
|
294
431
|
});
|
|
295
432
|
addClusterServers(endpoint, optionalServerList);
|
|
296
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* Adds cluster servers to the specified endpoint based on the provided server list.
|
|
436
|
+
*
|
|
437
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
|
|
438
|
+
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
439
|
+
*/
|
|
297
440
|
export function addClusterServers(endpoint, serverList) {
|
|
298
441
|
if (serverList.includes(PowerSource.Cluster.id))
|
|
299
442
|
endpoint.createDefaultPowerSourceWiredClusterServer();
|
|
@@ -374,6 +517,13 @@ export function addClusterServers(endpoint, serverList) {
|
|
|
374
517
|
if (serverList.includes(DeviceEnergyManagementMode.Cluster.id))
|
|
375
518
|
endpoint.createDefaultDeviceEnergyManagementModeClusterServer();
|
|
376
519
|
}
|
|
520
|
+
/**
|
|
521
|
+
* Adds a fixed label to the FixedLabel cluster. The FixedLabel cluster is created if it does not exist.
|
|
522
|
+
*
|
|
523
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
|
|
524
|
+
* @param {string} label - The label to add.
|
|
525
|
+
* @param {string} value - The value of the label.
|
|
526
|
+
*/
|
|
377
527
|
export async function addFixedLabel(endpoint, label, value) {
|
|
378
528
|
if (!endpoint.hasClusterServer(FixedLabel.Cluster.id)) {
|
|
379
529
|
endpoint.log.debug(`addFixedLabel: add cluster ${hk}FixedLabel${db}:${hk}fixedLabel${db} with label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
|
|
@@ -390,6 +540,13 @@ export async function addFixedLabel(endpoint, label, value) {
|
|
|
390
540
|
await endpoint.setAttribute(FixedLabel.Cluster.id, 'labelList', labelList, endpoint.log);
|
|
391
541
|
}
|
|
392
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* Adds a user label to the UserLabel cluster. The UserLabel cluster is created if it does not exist.
|
|
545
|
+
*
|
|
546
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
|
|
547
|
+
* @param {string} label - The label to add.
|
|
548
|
+
* @param {string} value - The value of the label.
|
|
549
|
+
*/
|
|
393
550
|
export async function addUserLabel(endpoint, label, value) {
|
|
394
551
|
if (!endpoint.hasClusterServer(UserLabel.Cluster.id)) {
|
|
395
552
|
endpoint.log.debug(`addUserLabel: add cluster ${hk}UserLabel${db}:${hk}userLabel${db} with label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
|
|
@@ -406,16 +563,48 @@ export async function addUserLabel(endpoint, label, value) {
|
|
|
406
563
|
await endpoint.setAttribute(UserLabel.Cluster.id, 'labelList', labelList, endpoint.log);
|
|
407
564
|
}
|
|
408
565
|
}
|
|
566
|
+
/**
|
|
567
|
+
* Returns the options for a given behavior type.
|
|
568
|
+
*
|
|
569
|
+
* @param {T} type - The behavior type.
|
|
570
|
+
* @param {Behavior.Options<T>} options - The options for the behavior type.
|
|
571
|
+
* @returns {Behavior.Options<T>} The options for the behavior type.
|
|
572
|
+
*/
|
|
409
573
|
export function optionsFor(type, options) {
|
|
410
574
|
return options;
|
|
411
575
|
}
|
|
576
|
+
/**
|
|
577
|
+
* Retrieves the cluster name by its ID.
|
|
578
|
+
*
|
|
579
|
+
* @param {Endpoint} endpoint - The endpoint to retrieve the cluster name from.
|
|
580
|
+
* @param {ClusterId} cluster - The ID of the cluster.
|
|
581
|
+
* @returns {string} The name of the cluster.
|
|
582
|
+
*/
|
|
412
583
|
export function getClusterId(endpoint, cluster) {
|
|
413
584
|
return endpoint.behaviors.supported[lowercaseFirstLetter(cluster)]?.schema?.id;
|
|
414
585
|
}
|
|
586
|
+
/**
|
|
587
|
+
* Retrieves the ID of an attribute from a cluster behavior.
|
|
588
|
+
*
|
|
589
|
+
* @param {Endpoint} endpoint - The endpoint to retrieve the attribute ID from.
|
|
590
|
+
* @param {string} cluster - The name of the cluster.
|
|
591
|
+
* @param {string} attribute - The name of the attribute.
|
|
592
|
+
* @returns {number | undefined} The ID of the attribute, or undefined if not found.
|
|
593
|
+
*/
|
|
415
594
|
export function getAttributeId(endpoint, cluster, attribute) {
|
|
416
595
|
const clusterBehavior = endpoint.behaviors.supported[lowercaseFirstLetter(cluster)];
|
|
417
596
|
return clusterBehavior?.cluster?.attributes[lowercaseFirstLetter(attribute)]?.id;
|
|
418
597
|
}
|
|
598
|
+
/**
|
|
599
|
+
* Retrieves the value of the provided attribute from the given cluster.
|
|
600
|
+
*
|
|
601
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to retrieve the attribute from.
|
|
602
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
603
|
+
* @param {string} attribute - The name of the attribute to retrieve.
|
|
604
|
+
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the retrieve. Errors are logged to the endpoint logger.
|
|
605
|
+
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
606
|
+
*/
|
|
607
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
419
608
|
export function getAttribute(endpoint, cluster, attribute, log) {
|
|
420
609
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
421
610
|
if (!clusterName) {
|
|
@@ -438,6 +627,16 @@ export function getAttribute(endpoint, cluster, attribute, log) {
|
|
|
438
627
|
log?.info(`${db}Get endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db} value ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
439
628
|
return value;
|
|
440
629
|
}
|
|
630
|
+
/**
|
|
631
|
+
* Sets the value of an attribute on a cluster server.
|
|
632
|
+
*
|
|
633
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to set the attribute on.
|
|
634
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
635
|
+
* @param {string} attribute - The name of the attribute.
|
|
636
|
+
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
637
|
+
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the set. Errors are logged to the endpoint logger.
|
|
638
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
639
|
+
*/
|
|
441
640
|
export async function setAttribute(endpoint, cluster, attribute, value, log) {
|
|
442
641
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
443
642
|
if (!clusterName) {
|
|
@@ -463,6 +662,16 @@ export async function setAttribute(endpoint, cluster, attribute, value, log) {
|
|
|
463
662
|
`to ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
464
663
|
return true;
|
|
465
664
|
}
|
|
665
|
+
/**
|
|
666
|
+
* Sets the value of an attribute on a cluster server.
|
|
667
|
+
*
|
|
668
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to update the attribute on.
|
|
669
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to update the attribute on.
|
|
670
|
+
* @param {string} attribute - The name of the attribute.
|
|
671
|
+
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
672
|
+
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
|
|
673
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
674
|
+
*/
|
|
466
675
|
export async function updateAttribute(endpoint, cluster, attribute, value, log) {
|
|
467
676
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
468
677
|
if (!clusterName) {
|
|
@@ -493,7 +702,24 @@ export async function updateAttribute(endpoint, cluster, attribute, value, log)
|
|
|
493
702
|
`to ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
494
703
|
return true;
|
|
495
704
|
}
|
|
496
|
-
|
|
705
|
+
/**
|
|
706
|
+
* Subscribes to the provided attribute on a cluster.
|
|
707
|
+
*
|
|
708
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to subscribe the attribute to.
|
|
709
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
|
|
710
|
+
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
711
|
+
* @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.
|
|
712
|
+
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
713
|
+
* @returns {boolean} - A boolean indicating whether the subscription was successful.
|
|
714
|
+
*
|
|
715
|
+
* @remarks The listener function (cannot be async) will receive three parameters:
|
|
716
|
+
* - `newValue`: The new value of the attribute.
|
|
717
|
+
* - `oldValue`: The old value of the attribute.
|
|
718
|
+
* - `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.
|
|
719
|
+
*/
|
|
720
|
+
export async function subscribeAttribute(endpoint, cluster, attribute,
|
|
721
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
722
|
+
listener, log) {
|
|
497
723
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
498
724
|
if (!clusterName) {
|
|
499
725
|
endpoint.log.error(`subscribeAttribute ${hk}${attribute}${er} error: cluster not found on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
@@ -503,6 +729,7 @@ export async function subscribeAttribute(endpoint, cluster, attribute, listener,
|
|
|
503
729
|
endpoint.log.debug(`subscribeAttribute ${hk}${clusterName}.${attribute}${db}: Endpoint ${or}${endpoint.maybeId}${db}:${or}${endpoint.maybeNumber}${db} is in the ${BLUE}${endpoint.construction.status}${db} state`);
|
|
504
730
|
await endpoint.construction.ready;
|
|
505
731
|
}
|
|
732
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
506
733
|
const events = endpoint.events;
|
|
507
734
|
attribute = lowercaseFirstLetter(attribute) + '$Changed';
|
|
508
735
|
if (!(clusterName in events) || !(attribute in events[clusterName])) {
|
|
@@ -513,6 +740,17 @@ export async function subscribeAttribute(endpoint, cluster, attribute, listener,
|
|
|
513
740
|
log?.info(`${db}Subscribed endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
|
|
514
741
|
return true;
|
|
515
742
|
}
|
|
743
|
+
/**
|
|
744
|
+
* Triggers an event on the specified cluster.
|
|
745
|
+
*
|
|
746
|
+
* @param {MatterbridgeEndpoint} endpoint - The endpoint to trigger the event on.
|
|
747
|
+
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The ID of the cluster.
|
|
748
|
+
* @param {string} event - The name of the event to trigger.
|
|
749
|
+
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
750
|
+
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
751
|
+
*
|
|
752
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
753
|
+
*/
|
|
516
754
|
export async function triggerEvent(endpoint, cluster, event, payload, log) {
|
|
517
755
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
518
756
|
if (!clusterName) {
|
|
@@ -523,15 +761,24 @@ export async function triggerEvent(endpoint, cluster, event, payload, log) {
|
|
|
523
761
|
endpoint.log.error(`triggerEvent ${hk}${clusterName}.${event}${er} error: Endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er} is in the ${BLUE}${endpoint.construction.status}${er} state`);
|
|
524
762
|
return false;
|
|
525
763
|
}
|
|
764
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
526
765
|
const events = endpoint.events;
|
|
527
766
|
if (!(clusterName in events) || !(event in events[clusterName])) {
|
|
528
767
|
endpoint.log.error(`triggerEvent ${hk}${event}${er} error: cluster ${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
|
|
529
768
|
return false;
|
|
530
769
|
}
|
|
770
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
771
|
+
// @ts-ignore
|
|
531
772
|
await endpoint.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
|
|
532
773
|
log?.info(`${db}Trigger event ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${event}${db} with ${debugStringify(payload)}${db} on endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} `);
|
|
533
774
|
return true;
|
|
534
775
|
}
|
|
776
|
+
/**
|
|
777
|
+
* Get the default OperationalState Cluster Server.
|
|
778
|
+
*
|
|
779
|
+
* @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state.
|
|
780
|
+
* @returns {Behavior.Options<MatterbridgeOperationalStateServer>} - The default options for the OperationalState cluster server.
|
|
781
|
+
*/
|
|
535
782
|
export function getDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
|
536
783
|
return optionsFor(MatterbridgeOperationalStateServer, {
|
|
537
784
|
phaseList: [],
|
|
@@ -546,6 +793,14 @@ export function getDefaultOperationalStateClusterServer(operationalState = Opera
|
|
|
546
793
|
operationalError: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
|
547
794
|
});
|
|
548
795
|
}
|
|
796
|
+
/**
|
|
797
|
+
* Get the default TemperatureMeasurement cluster server options.
|
|
798
|
+
*
|
|
799
|
+
* @param {number | null} measuredValue - The measured value of the temperature x 100.
|
|
800
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
|
|
801
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
|
|
802
|
+
* @returns {Behavior.Options<MatterbridgeTemperatureMeasurementServer>} - The default options for the TemperatureMeasurement cluster server.
|
|
803
|
+
*/
|
|
549
804
|
export function getDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
550
805
|
return optionsFor(TemperatureMeasurementServer, {
|
|
551
806
|
measuredValue,
|
|
@@ -554,6 +809,14 @@ export function getDefaultTemperatureMeasurementClusterServer(measuredValue = nu
|
|
|
554
809
|
tolerance: 0,
|
|
555
810
|
});
|
|
556
811
|
}
|
|
812
|
+
/**
|
|
813
|
+
* Get the default RelativeHumidityMeasurement cluster server options.
|
|
814
|
+
*
|
|
815
|
+
* @param {number | null} measuredValue - The measured value of the relative humidity x 100.
|
|
816
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
|
|
817
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
|
|
818
|
+
* @returns {Behavior.Options<MatterbridgeRelativeHumidityMeasurementServer>} - The default options for the RelativeHumidityMeasurement cluster server.
|
|
819
|
+
*/
|
|
557
820
|
export function getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
558
821
|
return optionsFor(RelativeHumidityMeasurementServer, {
|
|
559
822
|
measuredValue,
|
|
@@ -562,6 +825,14 @@ export function getDefaultRelativeHumidityMeasurementClusterServer(measuredValue
|
|
|
562
825
|
tolerance: 0,
|
|
563
826
|
});
|
|
564
827
|
}
|
|
828
|
+
/**
|
|
829
|
+
* Get the default PressureMeasurement cluster server options.
|
|
830
|
+
*
|
|
831
|
+
* @param {number | null} measuredValue - The measured value for the pressure in kPa x 10.
|
|
832
|
+
* @param {number | null} minMeasuredValue - The minimum measured value for the pressure in kPa x 10.
|
|
833
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value for the pressure in kPa x 10.
|
|
834
|
+
* @returns {Behavior.Options<MatterbridgePressureMeasurementServer>} - The default options for the PressureMeasurement cluster server.
|
|
835
|
+
*/
|
|
565
836
|
export function getDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
566
837
|
return optionsFor(PressureMeasurementServer, {
|
|
567
838
|
measuredValue,
|
|
@@ -570,6 +841,22 @@ export function getDefaultPressureMeasurementClusterServer(measuredValue = null,
|
|
|
570
841
|
tolerance: 0,
|
|
571
842
|
});
|
|
572
843
|
}
|
|
844
|
+
/**
|
|
845
|
+
* Get the default IlluminanceMeasurement cluster server options.
|
|
846
|
+
*
|
|
847
|
+
* @param {number | null} measuredValue - The measured value of illuminance.
|
|
848
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
|
|
849
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
|
|
850
|
+
*
|
|
851
|
+
* @returns {Behavior.Options<MatterbridgeIlluminanceMeasurementServer>} - The default options for the IlluminanceMeasurement cluster server.
|
|
852
|
+
*
|
|
853
|
+
* @remarks The default value for the illuminance measurement is null.
|
|
854
|
+
* This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
|
|
855
|
+
* • MeasuredValue = 10,000 x log10(illuminance) + 1,
|
|
856
|
+
* where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
|
|
857
|
+
* • 0 indicates a value of illuminance that is too low to be measured
|
|
858
|
+
* • null indicates that the illuminance measurement is invalid.
|
|
859
|
+
*/
|
|
573
860
|
export function getDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
574
861
|
return optionsFor(IlluminanceMeasurementServer, {
|
|
575
862
|
measuredValue,
|
|
@@ -578,6 +865,14 @@ export function getDefaultIlluminanceMeasurementClusterServer(measuredValue = nu
|
|
|
578
865
|
tolerance: 0,
|
|
579
866
|
});
|
|
580
867
|
}
|
|
868
|
+
/**
|
|
869
|
+
* Get the default FlowMeasurement cluster server options.
|
|
870
|
+
*
|
|
871
|
+
* @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
|
|
872
|
+
* @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
|
|
873
|
+
* @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
|
|
874
|
+
* @returns {Behavior.Options<MatterbridgeFlowMeasurementServer>} - The default options for the FlowMeasurement cluster server.
|
|
875
|
+
*/
|
|
581
876
|
export function getDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
582
877
|
return optionsFor(FlowMeasurementServer, {
|
|
583
878
|
measuredValue,
|
|
@@ -586,6 +881,20 @@ export function getDefaultFlowMeasurementClusterServer(measuredValue = null, min
|
|
|
586
881
|
tolerance: 0,
|
|
587
882
|
});
|
|
588
883
|
}
|
|
884
|
+
/**
|
|
885
|
+
* Get the default OccupancySensing cluster server options.
|
|
886
|
+
*
|
|
887
|
+
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
888
|
+
* @param {number} holdTime - The hold time in seconds. Default is 30.
|
|
889
|
+
* @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
|
|
890
|
+
* @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
|
|
891
|
+
* @returns {Behavior.Options<MatterbridgeOccupancySensingServer>} - The default options for the OccupancySensing cluster server.
|
|
892
|
+
*
|
|
893
|
+
* @remarks The default value for the occupancy sensor type is PIR.
|
|
894
|
+
* Servers SHALL set these attributes for backward compatibility with clients implementing a cluster revision <= 4 as
|
|
895
|
+
* described in OccupancySensorType and OccupancySensorTypeBitmap Attributes.
|
|
896
|
+
* This replaces the 9 legacy attributes PIROccupiedToUnoccupiedDelay through PhysicalContactUnoccupiedToOccupiedThreshold.
|
|
897
|
+
*/
|
|
589
898
|
export function getDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
590
899
|
return optionsFor(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), {
|
|
591
900
|
occupancy: { occupied },
|
|
@@ -597,3 +906,4 @@ export function getDefaultOccupancySensingClusterServer(occupied = false, holdTi
|
|
|
597
906
|
holdTimeLimits: { holdTimeMin, holdTimeMax, holdTimeDefault: holdTime },
|
|
598
907
|
});
|
|
599
908
|
}
|
|
909
|
+
//# sourceMappingURL=matterbridgeEndpointHelpers.js.map
|