matterbridge 2.2.9 → 3.0.0-edge.10
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 +44 -0
- package/dist/cli.js +6 -38
- package/dist/cluster/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -23
- package/dist/deviceManager.js +1 -94
- package/dist/frontend.js +20 -328
- package/dist/index.js +1 -28
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.js +0 -2
- package/dist/matter/types.js +0 -2
- package/dist/matterbridge.js +104 -761
- package/dist/matterbridgeAccessoryPlatform.js +0 -33
- package/dist/matterbridgeBehaviors.js +46 -72
- package/dist/matterbridgeDeviceTypes.js +249 -233
- package/dist/matterbridgeDynamicPlatform.js +0 -33
- package/dist/matterbridgeEndpoint.js +85 -759
- package/dist/matterbridgeEndpointHelpers.js +30 -136
- package/dist/matterbridgePlatform.js +9 -218
- package/dist/matterbridgeTypes.js +0 -24
- package/dist/pluginManager.js +3 -262
- package/dist/shelly.js +6 -146
- package/dist/storage/export.js +0 -1
- package/dist/update.js +0 -45
- package/dist/utils/colorUtils.js +2 -205
- package/dist/utils/copyDirectory.js +1 -37
- package/dist/utils/createZip.js +2 -42
- package/dist/utils/deepCopy.js +0 -40
- package/dist/utils/deepEqual.js +1 -65
- package/dist/utils/export.js +0 -1
- package/dist/utils/isvalid.js +0 -86
- package/dist/utils/network.js +5 -76
- package/dist/utils/parameter.js +0 -41
- package/dist/utils/wait.js +5 -48
- package/npm-shrinkwrap.json +289 -351
- package/package.json +3 -4
- package/dist/cli.d.ts +0 -29
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cluster/export.d.ts +0 -2
- package/dist/cluster/export.d.ts.map +0 -1
- package/dist/cluster/export.js.map +0 -1
- package/dist/defaultConfigSchema.d.ts +0 -27
- package/dist/defaultConfigSchema.d.ts.map +0 -1
- package/dist/defaultConfigSchema.js.map +0 -1
- package/dist/deviceManager.d.ts +0 -114
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/frontend.d.ts +0 -221
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/index.d.ts +0 -35
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/logger/export.d.ts +0 -2
- package/dist/logger/export.d.ts.map +0 -1
- package/dist/logger/export.js.map +0 -1
- package/dist/matter/behaviors.d.ts +0 -2
- package/dist/matter/behaviors.d.ts.map +0 -1
- package/dist/matter/behaviors.js.map +0 -1
- package/dist/matter/clusters.d.ts +0 -2
- package/dist/matter/clusters.d.ts.map +0 -1
- package/dist/matter/clusters.js.map +0 -1
- package/dist/matter/devices.d.ts +0 -2
- package/dist/matter/devices.d.ts.map +0 -1
- package/dist/matter/devices.js.map +0 -1
- package/dist/matter/endpoints.d.ts +0 -2
- package/dist/matter/endpoints.d.ts.map +0 -1
- package/dist/matter/endpoints.js.map +0 -1
- package/dist/matter/export.d.ts +0 -5
- package/dist/matter/export.d.ts.map +0 -1
- package/dist/matter/export.js.map +0 -1
- package/dist/matter/types.d.ts +0 -3
- package/dist/matter/types.d.ts.map +0 -1
- package/dist/matter/types.js.map +0 -1
- package/dist/matterbridge.d.ts +0 -425
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -39
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -1056
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -178
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -39
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -867
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -2275
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -285
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -183
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -271
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/shelly.d.ts +0 -92
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.js.map +0 -1
- package/dist/storage/export.d.ts +0 -2
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/update.d.ts +0 -32
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -61
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -32
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -38
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -31
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -53
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/export.d.ts +0 -10
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/isvalid.d.ts +0 -87
- package/dist/utils/isvalid.d.ts.map +0 -1
- package/dist/utils/isvalid.js.map +0 -1
- package/dist/utils/network.d.ts +0 -69
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/parameter.d.ts +0 -44
- package/dist/utils/parameter.d.ts.map +0 -1
- package/dist/utils/parameter.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -43
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
-
// Node.js modules
|
|
3
1
|
import { createHash } from 'node:crypto';
|
|
4
|
-
// AnsiLogger module
|
|
5
2
|
import { BLUE, CYAN, db, debugStringify, er, hk, or, YELLOW, zb } from './logger/export.js';
|
|
6
|
-
// Matterbridge
|
|
7
3
|
import { deepCopy, deepEqual, isValidArray } from './utils/export.js';
|
|
8
4
|
import { MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, } from './matterbridgeBehaviors.js';
|
|
9
|
-
// @matter
|
|
10
5
|
import { Lifecycle } from '@matter/main';
|
|
11
6
|
import { getClusterNameById } from '@matter/main/types';
|
|
12
|
-
// @matter clusters
|
|
13
7
|
import { PowerSource } from '@matter/main/clusters/power-source';
|
|
14
8
|
import { UserLabel } from '@matter/main/clusters/user-label';
|
|
15
9
|
import { FixedLabel } from '@matter/main/clusters/fixed-label';
|
|
@@ -51,7 +45,6 @@ import { Pm25ConcentrationMeasurement } from '@matter/main/clusters/pm25-concent
|
|
|
51
45
|
import { Pm10ConcentrationMeasurement } from '@matter/main/clusters/pm10-concentration-measurement';
|
|
52
46
|
import { RadonConcentrationMeasurement } from '@matter/main/clusters/radon-concentration-measurement';
|
|
53
47
|
import { TotalVolatileOrganicCompoundsConcentrationMeasurement } from '@matter/main/clusters/total-volatile-organic-compounds-concentration-measurement';
|
|
54
|
-
// @matter behaviors
|
|
55
48
|
import { PowerSourceServer } from '@matter/main/behaviors/power-source';
|
|
56
49
|
import { UserLabelServer } from '@matter/main/behaviors/user-label';
|
|
57
50
|
import { FixedLabelServer } from '@matter/main/behaviors/fixed-label';
|
|
@@ -93,19 +86,19 @@ export function lowercaseFirstLetter(name) {
|
|
|
93
86
|
}
|
|
94
87
|
export function checkNotLatinCharacters(deviceName) {
|
|
95
88
|
const nonLatinRegexList = [
|
|
96
|
-
/[\u0400-\u04FF\u0500-\u052F]/,
|
|
97
|
-
/[\u2E80-\u9FFF]/,
|
|
98
|
-
/[\uAC00-\uD7AF]/,
|
|
99
|
-
/[\u0600-\u06FF\u0750-\u077F]/,
|
|
100
|
-
/[\u0590-\u05FF]/,
|
|
101
|
-
/[\u0900-\u097F]/,
|
|
102
|
-
/[\u0E00-\u0E7F]/,
|
|
103
|
-
/[\u1200-\u137F]/,
|
|
89
|
+
/[\u0400-\u04FF\u0500-\u052F]/,
|
|
90
|
+
/[\u2E80-\u9FFF]/,
|
|
91
|
+
/[\uAC00-\uD7AF]/,
|
|
92
|
+
/[\u0600-\u06FF\u0750-\u077F]/,
|
|
93
|
+
/[\u0590-\u05FF]/,
|
|
94
|
+
/[\u0900-\u097F]/,
|
|
95
|
+
/[\u0E00-\u0E7F]/,
|
|
96
|
+
/[\u1200-\u137F]/,
|
|
104
97
|
];
|
|
105
98
|
return nonLatinRegexList.some((regex) => regex.test(deviceName));
|
|
106
99
|
}
|
|
107
100
|
export function generateUniqueId(deviceName) {
|
|
108
|
-
return createHash('md5').update(deviceName).digest('hex');
|
|
101
|
+
return createHash('md5').update(deviceName).digest('hex');
|
|
109
102
|
}
|
|
110
103
|
export function createUniqueId(param1, param2, param3, param4) {
|
|
111
104
|
const hash = createHash('md5');
|
|
@@ -113,7 +106,6 @@ export function createUniqueId(param1, param2, param3, param4) {
|
|
|
113
106
|
return hash.digest('hex');
|
|
114
107
|
}
|
|
115
108
|
export function getBehaviourTypesFromClusterServerIds(clusterServerList) {
|
|
116
|
-
// Map Server ClusterId to Behavior.Type
|
|
117
109
|
const behaviorTypes = [];
|
|
118
110
|
clusterServerList.forEach((clusterId) => {
|
|
119
111
|
behaviorTypes.push(getBehaviourTypeFromClusterServerId(clusterId));
|
|
@@ -121,15 +113,12 @@ export function getBehaviourTypesFromClusterServerIds(clusterServerList) {
|
|
|
121
113
|
return behaviorTypes;
|
|
122
114
|
}
|
|
123
115
|
export function getBehaviourTypesFromClusterClientIds(clusterClientList) {
|
|
124
|
-
// Map Client ClusterId to Behavior.Type
|
|
125
116
|
const behaviorTypes = [];
|
|
126
117
|
clusterClientList.forEach((clusterId) => {
|
|
127
|
-
// behaviorTypes.push(getBehaviourTypeFromClusterClientId(clusterId));
|
|
128
118
|
});
|
|
129
119
|
return behaviorTypes;
|
|
130
120
|
}
|
|
131
121
|
export function getBehaviourTypeFromClusterServerId(clusterId) {
|
|
132
|
-
// Map ClusterId to Server Behavior.Type
|
|
133
122
|
if (clusterId === PowerSource.Cluster.id)
|
|
134
123
|
return PowerSourceServer.with(PowerSource.Feature.Wired);
|
|
135
124
|
if (clusterId === UserLabel.Cluster.id)
|
|
@@ -215,8 +204,6 @@ export function getBehaviourTypeFromClusterServerId(clusterId) {
|
|
|
215
204
|
return MatterbridgeIdentifyServer;
|
|
216
205
|
}
|
|
217
206
|
export function getBehaviourTypeFromClusterClientId(clusterId) {
|
|
218
|
-
// Map ClusterId to Client Behavior.Type
|
|
219
|
-
// return IdentifyClient;
|
|
220
207
|
}
|
|
221
208
|
export function getBehavior(endpoint, cluster) {
|
|
222
209
|
let behavior;
|
|
@@ -262,13 +249,6 @@ export function addOptionalClusterServers(endpoint) {
|
|
|
262
249
|
});
|
|
263
250
|
addClusterServers(endpoint, optionalServerList);
|
|
264
251
|
}
|
|
265
|
-
/**
|
|
266
|
-
* Adds cluster servers to the specified endpoint based on the provided server list.
|
|
267
|
-
*
|
|
268
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
|
|
269
|
-
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
270
|
-
* @returns void
|
|
271
|
-
*/
|
|
272
252
|
export function addClusterServers(endpoint, serverList) {
|
|
273
253
|
if (serverList.includes(PowerSource.Cluster.id))
|
|
274
254
|
endpoint.createDefaultPowerSourceWiredClusterServer();
|
|
@@ -342,16 +322,7 @@ export function addClusterServers(endpoint, serverList) {
|
|
|
342
322
|
endpoint.createDefaultRadonConcentrationMeasurementClusterServer();
|
|
343
323
|
if (serverList.includes(TotalVolatileOrganicCompoundsConcentrationMeasurement.Cluster.id))
|
|
344
324
|
endpoint.createDefaultTvocMeasurementClusterServer();
|
|
345
|
-
// if (serverList.includes(DeviceEnergyManagement.Cluster.id)) endpoint.createDefaultDeviceEnergyManagementClusterServer();
|
|
346
|
-
// if (serverList.includes(DeviceEnergyManagementMode.Cluster.id)) endpoint.createDefaultDeviceEnergyManagementModeClusterServer();
|
|
347
325
|
}
|
|
348
|
-
/**
|
|
349
|
-
* Adds a fixed label to the FixedLabel cluster. The FixedLabel cluster is created if it does not exist.
|
|
350
|
-
*
|
|
351
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
|
|
352
|
-
* @param {string} label - The label to add.
|
|
353
|
-
* @param {string} value - The value of the label.
|
|
354
|
-
*/
|
|
355
326
|
export async function addFixedLabel(endpoint, label, value) {
|
|
356
327
|
if (!endpoint.hasClusterServer(FixedLabel.Cluster.id)) {
|
|
357
328
|
endpoint.log.debug(`addFixedLabel: add cluster ${hk}FixedLabel${db}:${hk}fixedLabel${db} with label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
|
|
@@ -368,13 +339,6 @@ export async function addFixedLabel(endpoint, label, value) {
|
|
|
368
339
|
await endpoint.setAttribute(FixedLabel.Cluster.id, 'labelList', labelList, endpoint.log);
|
|
369
340
|
}
|
|
370
341
|
}
|
|
371
|
-
/**
|
|
372
|
-
* Adds a user label to the UserLabel cluster. The UserLabel cluster is created if it does not exist.
|
|
373
|
-
*
|
|
374
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
|
|
375
|
-
* @param {string} label - The label to add.
|
|
376
|
-
* @param {string} value - The value of the label.
|
|
377
|
-
*/
|
|
378
342
|
export async function addUserLabel(endpoint, label, value) {
|
|
379
343
|
if (!endpoint.hasClusterServer(UserLabel.Cluster.id)) {
|
|
380
344
|
endpoint.log.debug(`addUserLabel: add cluster ${hk}UserLabel${db}:${hk}userLabel${db} with label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
|
|
@@ -438,16 +402,6 @@ export function getAttributeId(endpoint, cluster, attribute) {
|
|
|
438
402
|
return endpoint.behaviors.supported[lowercaseFirstLetter(cluster)]?.schema?.children?.find((child) => child.name === capitalizeFirstLetter(attribute))?.id;
|
|
439
403
|
}
|
|
440
404
|
}
|
|
441
|
-
/**
|
|
442
|
-
* Retrieves the value of the provided attribute from the given cluster.
|
|
443
|
-
*
|
|
444
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to retrieve the attribute from.
|
|
445
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
446
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
447
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the retrieve. Errors are logged to the endpoint logger.
|
|
448
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
449
|
-
*/
|
|
450
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
451
405
|
export function getAttribute(endpoint, cluster, attribute, log) {
|
|
452
406
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
453
407
|
if (!clusterName) {
|
|
@@ -470,16 +424,6 @@ export function getAttribute(endpoint, cluster, attribute, log) {
|
|
|
470
424
|
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}`);
|
|
471
425
|
return value;
|
|
472
426
|
}
|
|
473
|
-
/**
|
|
474
|
-
* Sets the value of an attribute on a cluster server.
|
|
475
|
-
*
|
|
476
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to set the attribute on.
|
|
477
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
478
|
-
* @param {string} attribute - The name of the attribute.
|
|
479
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
480
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the set. Errors are logged to the endpoint logger.
|
|
481
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
482
|
-
*/
|
|
483
427
|
export async function setAttribute(endpoint, cluster, attribute, value, log) {
|
|
484
428
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
485
429
|
if (!clusterName) {
|
|
@@ -505,16 +449,6 @@ export async function setAttribute(endpoint, cluster, attribute, value, log) {
|
|
|
505
449
|
`to ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
506
450
|
return true;
|
|
507
451
|
}
|
|
508
|
-
/**
|
|
509
|
-
* Sets the value of an attribute on a cluster server.
|
|
510
|
-
*
|
|
511
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to update the attribute on.
|
|
512
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to update the attribute on.
|
|
513
|
-
* @param {string} attribute - The name of the attribute.
|
|
514
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
515
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
|
|
516
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
517
|
-
*/
|
|
518
452
|
export async function updateAttribute(endpoint, cluster, attribute, value, log) {
|
|
519
453
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
520
454
|
if (!clusterName) {
|
|
@@ -545,17 +479,6 @@ export async function updateAttribute(endpoint, cluster, attribute, value, log)
|
|
|
545
479
|
`to ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
546
480
|
return true;
|
|
547
481
|
}
|
|
548
|
-
/**
|
|
549
|
-
* Subscribes to the provided attribute on a cluster.
|
|
550
|
-
*
|
|
551
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to subscribe the attribute to.
|
|
552
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
|
|
553
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
554
|
-
* @param {(newValue: any, oldValue: any) => void} listener - A callback function that will be called when the attribute value changes.
|
|
555
|
-
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
556
|
-
* @returns {boolean} - A boolean indicating whether the subscription was successful.
|
|
557
|
-
*/
|
|
558
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
559
482
|
export async function subscribeAttribute(endpoint, cluster, attribute, listener, log) {
|
|
560
483
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
561
484
|
if (!clusterName) {
|
|
@@ -566,7 +489,6 @@ export async function subscribeAttribute(endpoint, cluster, attribute, listener,
|
|
|
566
489
|
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`);
|
|
567
490
|
await endpoint.construction.ready;
|
|
568
491
|
}
|
|
569
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
570
492
|
const events = endpoint.events;
|
|
571
493
|
attribute = lowercaseFirstLetter(attribute) + '$Changed';
|
|
572
494
|
if (!(clusterName in events) || !(attribute in events[clusterName])) {
|
|
@@ -577,82 +499,54 @@ export async function subscribeAttribute(endpoint, cluster, attribute, listener,
|
|
|
577
499
|
log?.info(`${db}Subscribed endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
|
|
578
500
|
return true;
|
|
579
501
|
}
|
|
580
|
-
|
|
581
|
-
* Get the default TemperatureMeasurement cluster server options.
|
|
582
|
-
*
|
|
583
|
-
* @param {number} measuredValue - The measured value of the temperature x 100.
|
|
584
|
-
*/
|
|
585
|
-
export function getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
502
|
+
export function getDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
586
503
|
return optionsFor(TemperatureMeasurementServer, {
|
|
587
504
|
measuredValue,
|
|
588
|
-
minMeasuredValue
|
|
589
|
-
maxMeasuredValue
|
|
505
|
+
minMeasuredValue,
|
|
506
|
+
maxMeasuredValue,
|
|
590
507
|
tolerance: 0,
|
|
591
508
|
});
|
|
592
509
|
}
|
|
593
|
-
|
|
594
|
-
* Get the default RelativeHumidityMeasurement cluster server options.
|
|
595
|
-
*
|
|
596
|
-
* @param {number} measuredValue - The measured value of the relative humidity x 100.
|
|
597
|
-
*/
|
|
598
|
-
export function getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
510
|
+
export function getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
599
511
|
return optionsFor(RelativeHumidityMeasurementServer, {
|
|
600
512
|
measuredValue,
|
|
601
|
-
minMeasuredValue
|
|
602
|
-
maxMeasuredValue
|
|
513
|
+
minMeasuredValue,
|
|
514
|
+
maxMeasuredValue,
|
|
603
515
|
tolerance: 0,
|
|
604
516
|
});
|
|
605
517
|
}
|
|
606
|
-
|
|
607
|
-
* Get the default PressureMeasurement cluster server options.
|
|
608
|
-
*
|
|
609
|
-
* @param {number} measuredValue - The measured value for the pressure.
|
|
610
|
-
*/
|
|
611
|
-
export function getDefaultPressureMeasurementClusterServer(measuredValue = 1000) {
|
|
518
|
+
export function getDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
612
519
|
return optionsFor(PressureMeasurementServer, {
|
|
613
520
|
measuredValue,
|
|
614
|
-
minMeasuredValue
|
|
615
|
-
maxMeasuredValue
|
|
521
|
+
minMeasuredValue,
|
|
522
|
+
maxMeasuredValue,
|
|
616
523
|
tolerance: 0,
|
|
617
524
|
});
|
|
618
525
|
}
|
|
619
|
-
|
|
620
|
-
* Get the default IlluminanceMeasurement cluster server options.
|
|
621
|
-
*
|
|
622
|
-
* @param {number} measuredValue - The measured value of illuminance.
|
|
623
|
-
*/
|
|
624
|
-
export function getDefaultIlluminanceMeasurementClusterServer(measuredValue = 0) {
|
|
526
|
+
export function getDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
625
527
|
return optionsFor(IlluminanceMeasurementServer, {
|
|
626
528
|
measuredValue,
|
|
627
|
-
minMeasuredValue
|
|
628
|
-
maxMeasuredValue
|
|
529
|
+
minMeasuredValue,
|
|
530
|
+
maxMeasuredValue,
|
|
629
531
|
tolerance: 0,
|
|
630
532
|
});
|
|
631
533
|
}
|
|
632
|
-
|
|
633
|
-
* Get the default FlowMeasurement cluster server options.
|
|
634
|
-
*
|
|
635
|
-
* @param {number} measuredValue - The measured value of the flow in 10 x m3/h.
|
|
636
|
-
*/
|
|
637
|
-
export function getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
534
|
+
export function getDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
638
535
|
return optionsFor(FlowMeasurementServer, {
|
|
639
536
|
measuredValue,
|
|
640
|
-
minMeasuredValue
|
|
641
|
-
maxMeasuredValue
|
|
537
|
+
minMeasuredValue,
|
|
538
|
+
maxMeasuredValue,
|
|
642
539
|
tolerance: 0,
|
|
643
540
|
});
|
|
644
541
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
*
|
|
648
|
-
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
649
|
-
*/
|
|
650
|
-
export function getDefaultOccupancySensingClusterServer(occupied = false) {
|
|
651
|
-
return optionsFor(OccupancySensingServer, {
|
|
542
|
+
export function getDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
543
|
+
return optionsFor(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), {
|
|
652
544
|
occupancy: { occupied },
|
|
653
545
|
occupancySensorType: OccupancySensing.OccupancySensorType.Pir,
|
|
654
546
|
occupancySensorTypeBitmap: { pir: true, ultrasonic: false, physicalContact: false },
|
|
655
|
-
pirOccupiedToUnoccupiedDelay:
|
|
547
|
+
pirOccupiedToUnoccupiedDelay: holdTime,
|
|
548
|
+
pirUnoccupiedToOccupiedDelay: holdTime,
|
|
549
|
+
holdTime,
|
|
550
|
+
holdTimeLimits: { holdTimeMin, holdTimeMax, holdTimeDefault: holdTime },
|
|
656
551
|
});
|
|
657
552
|
}
|
|
658
|
-
//# sourceMappingURL=matterbridgeEndpointHelpers.js.map
|