matterbridge 3.3.3 → 3.3.4-dev-20251020-df40d12
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 +22 -0
- package/dist/broadcastServer.js +1 -86
- package/dist/broadcastServerTypes.js +0 -24
- package/dist/cli.js +112 -445
- package/dist/cliEmitter.js +0 -37
- package/dist/cliHistory.js +15 -95
- package/dist/clusters/export.js +0 -2
- package/dist/defaultConfigSchema.js +0 -24
- package/dist/deviceManager.js +1 -124
- package/dist/devices/airConditioner.js +2 -59
- package/dist/devices/batteryStorage.js +4 -51
- package/dist/devices/cooktop.js +0 -55
- package/dist/devices/dishwasher.js +4 -61
- package/dist/devices/evse.js +16 -79
- package/dist/devices/export.js +0 -5
- package/dist/devices/extractorHood.js +1 -43
- package/dist/devices/heatPump.js +4 -52
- package/dist/devices/laundryDryer.js +6 -65
- package/dist/devices/laundryWasher.js +9 -75
- package/dist/devices/microwaveOven.js +10 -93
- package/dist/devices/oven.js +5 -90
- package/dist/devices/refrigerator.js +4 -106
- package/dist/devices/roboticVacuumCleaner.js +20 -111
- package/dist/devices/solarPower.js +2 -40
- package/dist/devices/speaker.js +2 -85
- package/dist/devices/temperatureControl.js +5 -27
- package/dist/devices/waterHeater.js +8 -88
- package/dist/dgram/coap.js +13 -126
- package/dist/dgram/dgram.js +2 -114
- package/dist/dgram/mb_coap.js +3 -41
- package/dist/dgram/mb_mdns.js +15 -80
- package/dist/dgram/mdns.js +137 -299
- package/dist/dgram/multicast.js +1 -62
- package/dist/dgram/unicast.js +0 -54
- package/dist/frontend.js +61 -439
- package/dist/frontendTypes.js +0 -45
- package/dist/helpers.js +1 -54
- package/dist/index.js +0 -25
- package/dist/logger/export.js +0 -1
- package/dist/matter/behaviors.js +0 -2
- package/dist/matter/clusters.js +0 -2
- package/dist/matter/devices.js +0 -2
- package/dist/matter/endpoints.js +0 -2
- package/dist/matter/export.js +0 -3
- package/dist/matter/types.js +0 -3
- package/dist/matterbridge.js +67 -885
- package/dist/matterbridgeAccessoryPlatform.js +2 -36
- package/dist/matterbridgeBehaviors.js +25 -91
- package/dist/matterbridgeDeviceTypes.js +102 -715
- package/dist/matterbridgeDynamicPlatform.js +2 -36
- package/dist/matterbridgeEndpoint.js +122 -1473
- package/dist/matterbridgeEndpointHelpers.js +88 -443
- package/dist/matterbridgePlatform.js +3 -343
- package/dist/matterbridgeTypes.js +0 -26
- package/dist/pluginManager.js +3 -325
- package/dist/shelly.js +7 -168
- package/dist/storage/export.js +0 -1
- package/dist/update.js +1 -70
- package/dist/utils/colorUtils.js +2 -97
- package/dist/utils/commandLine.js +6 -55
- package/dist/utils/copyDirectory.js +1 -38
- package/dist/utils/createDirectory.js +0 -33
- package/dist/utils/createZip.js +2 -47
- package/dist/utils/deepCopy.js +0 -39
- package/dist/utils/deepEqual.js +1 -72
- package/dist/utils/error.js +0 -41
- package/dist/utils/export.js +0 -1
- package/dist/utils/format.js +29 -0
- package/dist/utils/hex.js +0 -124
- package/dist/utils/inspector.js +200 -0
- package/dist/utils/isvalid.js +0 -101
- package/dist/utils/jestHelpers.js +10 -156
- package/dist/utils/network.js +5 -134
- package/dist/utils/spawn.js +0 -71
- package/dist/utils/tracker.js +201 -0
- package/dist/utils/wait.js +8 -60
- package/frontend/build/assets/index.js +4 -4
- package/frontend/build/assets/vendor_mdi.js +1 -1
- package/frontend/package.json +1 -1
- package/npm-shrinkwrap.json +44 -44
- package/package.json +2 -3
- package/dist/broadcastServer.d.ts +0 -105
- package/dist/broadcastServer.d.ts.map +0 -1
- package/dist/broadcastServer.js.map +0 -1
- package/dist/broadcastServerTypes.d.ts +0 -719
- package/dist/broadcastServerTypes.d.ts.map +0 -1
- package/dist/broadcastServerTypes.js.map +0 -1
- package/dist/cli.d.ts +0 -26
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/cliEmitter.d.ts +0 -50
- package/dist/cliEmitter.d.ts.map +0 -1
- package/dist/cliEmitter.js.map +0 -1
- package/dist/cliHistory.d.ts +0 -74
- package/dist/cliHistory.d.ts.map +0 -1
- package/dist/cliHistory.js.map +0 -1
- package/dist/clusters/export.d.ts +0 -2
- package/dist/clusters/export.d.ts.map +0 -1
- package/dist/clusters/export.js.map +0 -1
- package/dist/defaultConfigSchema.d.ts +0 -28
- package/dist/defaultConfigSchema.d.ts.map +0 -1
- package/dist/defaultConfigSchema.js.map +0 -1
- package/dist/deviceManager.d.ts +0 -117
- package/dist/deviceManager.d.ts.map +0 -1
- package/dist/deviceManager.js.map +0 -1
- package/dist/devices/airConditioner.d.ts +0 -98
- package/dist/devices/airConditioner.d.ts.map +0 -1
- package/dist/devices/airConditioner.js.map +0 -1
- package/dist/devices/batteryStorage.d.ts +0 -48
- package/dist/devices/batteryStorage.d.ts.map +0 -1
- package/dist/devices/batteryStorage.js.map +0 -1
- package/dist/devices/cooktop.d.ts +0 -60
- package/dist/devices/cooktop.d.ts.map +0 -1
- package/dist/devices/cooktop.js.map +0 -1
- package/dist/devices/dishwasher.d.ts +0 -71
- package/dist/devices/dishwasher.d.ts.map +0 -1
- package/dist/devices/dishwasher.js.map +0 -1
- package/dist/devices/evse.d.ts +0 -75
- package/dist/devices/evse.d.ts.map +0 -1
- package/dist/devices/evse.js.map +0 -1
- package/dist/devices/export.d.ts +0 -17
- package/dist/devices/export.d.ts.map +0 -1
- package/dist/devices/export.js.map +0 -1
- package/dist/devices/extractorHood.d.ts +0 -46
- package/dist/devices/extractorHood.d.ts.map +0 -1
- package/dist/devices/extractorHood.js.map +0 -1
- package/dist/devices/heatPump.d.ts +0 -47
- package/dist/devices/heatPump.d.ts.map +0 -1
- package/dist/devices/heatPump.js.map +0 -1
- package/dist/devices/laundryDryer.d.ts +0 -67
- package/dist/devices/laundryDryer.d.ts.map +0 -1
- package/dist/devices/laundryDryer.js.map +0 -1
- package/dist/devices/laundryWasher.d.ts +0 -81
- package/dist/devices/laundryWasher.d.ts.map +0 -1
- package/dist/devices/laundryWasher.js.map +0 -1
- package/dist/devices/microwaveOven.d.ts +0 -168
- package/dist/devices/microwaveOven.d.ts.map +0 -1
- package/dist/devices/microwaveOven.js.map +0 -1
- package/dist/devices/oven.d.ts +0 -105
- package/dist/devices/oven.d.ts.map +0 -1
- package/dist/devices/oven.js.map +0 -1
- package/dist/devices/refrigerator.d.ts +0 -118
- package/dist/devices/refrigerator.d.ts.map +0 -1
- package/dist/devices/refrigerator.js.map +0 -1
- package/dist/devices/roboticVacuumCleaner.d.ts +0 -112
- package/dist/devices/roboticVacuumCleaner.d.ts.map +0 -1
- package/dist/devices/roboticVacuumCleaner.js.map +0 -1
- package/dist/devices/solarPower.d.ts +0 -40
- package/dist/devices/solarPower.d.ts.map +0 -1
- package/dist/devices/solarPower.js.map +0 -1
- package/dist/devices/speaker.d.ts +0 -87
- package/dist/devices/speaker.d.ts.map +0 -1
- package/dist/devices/speaker.js.map +0 -1
- package/dist/devices/temperatureControl.d.ts +0 -166
- package/dist/devices/temperatureControl.d.ts.map +0 -1
- package/dist/devices/temperatureControl.js.map +0 -1
- package/dist/devices/waterHeater.d.ts +0 -111
- package/dist/devices/waterHeater.d.ts.map +0 -1
- package/dist/devices/waterHeater.js.map +0 -1
- package/dist/dgram/coap.d.ts +0 -205
- package/dist/dgram/coap.d.ts.map +0 -1
- package/dist/dgram/coap.js.map +0 -1
- package/dist/dgram/dgram.d.ts +0 -141
- package/dist/dgram/dgram.d.ts.map +0 -1
- package/dist/dgram/dgram.js.map +0 -1
- package/dist/dgram/mb_coap.d.ts +0 -24
- package/dist/dgram/mb_coap.d.ts.map +0 -1
- package/dist/dgram/mb_coap.js.map +0 -1
- package/dist/dgram/mb_mdns.d.ts +0 -24
- package/dist/dgram/mb_mdns.d.ts.map +0 -1
- package/dist/dgram/mb_mdns.js.map +0 -1
- package/dist/dgram/mdns.d.ts +0 -290
- package/dist/dgram/mdns.d.ts.map +0 -1
- package/dist/dgram/mdns.js.map +0 -1
- package/dist/dgram/multicast.d.ts +0 -67
- package/dist/dgram/multicast.d.ts.map +0 -1
- package/dist/dgram/multicast.js.map +0 -1
- package/dist/dgram/unicast.d.ts +0 -56
- package/dist/dgram/unicast.d.ts.map +0 -1
- package/dist/dgram/unicast.js.map +0 -1
- package/dist/frontend.d.ts +0 -235
- package/dist/frontend.d.ts.map +0 -1
- package/dist/frontend.js.map +0 -1
- package/dist/frontendTypes.d.ts +0 -529
- package/dist/frontendTypes.d.ts.map +0 -1
- package/dist/frontendTypes.js.map +0 -1
- package/dist/helpers.d.ts +0 -48
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js.map +0 -1
- package/dist/index.d.ts +0 -33
- 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 -469
- package/dist/matterbridge.d.ts.map +0 -1
- package/dist/matterbridge.js.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts +0 -42
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
- package/dist/matterbridgeBehaviors.d.ts +0 -2399
- package/dist/matterbridgeBehaviors.d.ts.map +0 -1
- package/dist/matterbridgeBehaviors.js.map +0 -1
- package/dist/matterbridgeDeviceTypes.d.ts +0 -761
- package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
- package/dist/matterbridgeDeviceTypes.js.map +0 -1
- package/dist/matterbridgeDynamicPlatform.d.ts +0 -42
- package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
- package/dist/matterbridgeDynamicPlatform.js.map +0 -1
- package/dist/matterbridgeEndpoint.d.ts +0 -1545
- package/dist/matterbridgeEndpoint.d.ts.map +0 -1
- package/dist/matterbridgeEndpoint.js.map +0 -1
- package/dist/matterbridgeEndpointHelpers.d.ts +0 -560
- package/dist/matterbridgeEndpointHelpers.d.ts.map +0 -1
- package/dist/matterbridgeEndpointHelpers.js.map +0 -1
- package/dist/matterbridgePlatform.d.ts +0 -402
- package/dist/matterbridgePlatform.d.ts.map +0 -1
- package/dist/matterbridgePlatform.js.map +0 -1
- package/dist/matterbridgeTypes.d.ts +0 -209
- package/dist/matterbridgeTypes.d.ts.map +0 -1
- package/dist/matterbridgeTypes.js.map +0 -1
- package/dist/pluginManager.d.ts +0 -353
- package/dist/pluginManager.d.ts.map +0 -1
- package/dist/pluginManager.js.map +0 -1
- package/dist/shelly.d.ts +0 -174
- package/dist/shelly.d.ts.map +0 -1
- package/dist/shelly.js.map +0 -1
- package/dist/storage/export.d.ts +0 -2
- package/dist/storage/export.d.ts.map +0 -1
- package/dist/storage/export.js.map +0 -1
- package/dist/update.d.ts +0 -75
- package/dist/update.d.ts.map +0 -1
- package/dist/update.js.map +0 -1
- package/dist/utils/colorUtils.d.ts +0 -99
- package/dist/utils/colorUtils.d.ts.map +0 -1
- package/dist/utils/colorUtils.js.map +0 -1
- package/dist/utils/commandLine.d.ts +0 -59
- package/dist/utils/commandLine.d.ts.map +0 -1
- package/dist/utils/commandLine.js.map +0 -1
- package/dist/utils/copyDirectory.d.ts +0 -33
- package/dist/utils/copyDirectory.d.ts.map +0 -1
- package/dist/utils/copyDirectory.js.map +0 -1
- package/dist/utils/createDirectory.d.ts +0 -34
- package/dist/utils/createDirectory.d.ts.map +0 -1
- package/dist/utils/createDirectory.js.map +0 -1
- package/dist/utils/createZip.d.ts +0 -39
- package/dist/utils/createZip.d.ts.map +0 -1
- package/dist/utils/createZip.js.map +0 -1
- package/dist/utils/deepCopy.d.ts +0 -32
- package/dist/utils/deepCopy.d.ts.map +0 -1
- package/dist/utils/deepCopy.js.map +0 -1
- package/dist/utils/deepEqual.d.ts +0 -54
- package/dist/utils/deepEqual.d.ts.map +0 -1
- package/dist/utils/deepEqual.js.map +0 -1
- package/dist/utils/error.d.ts +0 -44
- package/dist/utils/error.d.ts.map +0 -1
- package/dist/utils/error.js.map +0 -1
- package/dist/utils/export.d.ts +0 -13
- package/dist/utils/export.d.ts.map +0 -1
- package/dist/utils/export.js.map +0 -1
- package/dist/utils/hex.d.ts +0 -89
- package/dist/utils/hex.d.ts.map +0 -1
- package/dist/utils/hex.js.map +0 -1
- package/dist/utils/isvalid.d.ts +0 -103
- package/dist/utils/isvalid.d.ts.map +0 -1
- package/dist/utils/isvalid.js.map +0 -1
- package/dist/utils/jestHelpers.d.ts +0 -137
- package/dist/utils/jestHelpers.d.ts.map +0 -1
- package/dist/utils/jestHelpers.js.map +0 -1
- package/dist/utils/network.d.ts +0 -115
- package/dist/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js.map +0 -1
- package/dist/utils/spawn.d.ts +0 -35
- package/dist/utils/spawn.d.ts.map +0 -1
- package/dist/utils/spawn.js.map +0 -1
- package/dist/utils/wait.d.ts +0 -54
- package/dist/utils/wait.d.ts.map +0 -1
- package/dist/utils/wait.js.map +0 -1
|
@@ -1,229 +1,134 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
if (process.argv.includes('--loader') || process.argv.includes('-loader'))
|
|
2
|
+
console.log('\u001B[32mMatterbridgeEndpointHelpers loaded.\u001B[40;0m');
|
|
25
3
|
import { createHash } from 'node:crypto';
|
|
26
|
-
// AnsiLogger module
|
|
27
4
|
import { BLUE, CYAN, db, debugStringify, er, hk, or, YELLOW, zb } from 'node-ansi-logger';
|
|
28
|
-
|
|
29
|
-
import {
|
|
30
|
-
import { getClusterNameById
|
|
31
|
-
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
import {
|
|
43
|
-
import {
|
|
44
|
-
import {
|
|
45
|
-
import {
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import {
|
|
50
|
-
import {
|
|
51
|
-
import {
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import {
|
|
55
|
-
import {
|
|
56
|
-
import {
|
|
57
|
-
import {
|
|
58
|
-
import {
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
import {
|
|
63
|
-
import {
|
|
64
|
-
import {
|
|
65
|
-
import {
|
|
66
|
-
import {
|
|
67
|
-
import {
|
|
68
|
-
import {
|
|
69
|
-
import {
|
|
70
|
-
import {
|
|
71
|
-
import {
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import {
|
|
75
|
-
import {
|
|
76
|
-
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import {
|
|
80
|
-
import {
|
|
81
|
-
import {
|
|
82
|
-
import {
|
|
83
|
-
import {
|
|
84
|
-
import {
|
|
85
|
-
import {
|
|
86
|
-
import {
|
|
87
|
-
import {
|
|
88
|
-
import {
|
|
89
|
-
import {
|
|
90
|
-
import {
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
95
|
-
import {
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
import {
|
|
100
|
-
import {
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
import {
|
|
104
|
-
import { RadonConcentrationMeasurementServer } from '@matter/main/behaviors/radon-concentration-measurement';
|
|
105
|
-
import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/main/behaviors/total-volatile-organic-compounds-concentration-measurement';
|
|
5
|
+
import { Lifecycle } from '@matter/general';
|
|
6
|
+
import { MeasurementType } from '@matter/types/globals';
|
|
7
|
+
import { getClusterNameById } from '@matter/types/cluster';
|
|
8
|
+
import { PowerSource } from '@matter/types/clusters/power-source';
|
|
9
|
+
import { UserLabel } from '@matter/types/clusters/user-label';
|
|
10
|
+
import { FixedLabel } from '@matter/types/clusters/fixed-label';
|
|
11
|
+
import { BasicInformation } from '@matter/types/clusters/basic-information';
|
|
12
|
+
import { BridgedDeviceBasicInformation } from '@matter/types/clusters/bridged-device-basic-information';
|
|
13
|
+
import { Identify } from '@matter/types/clusters/identify';
|
|
14
|
+
import { Groups } from '@matter/types/clusters/groups';
|
|
15
|
+
import { OnOff } from '@matter/types/clusters/on-off';
|
|
16
|
+
import { LevelControl } from '@matter/types/clusters/level-control';
|
|
17
|
+
import { ColorControl } from '@matter/types/clusters/color-control';
|
|
18
|
+
import { WindowCovering } from '@matter/types/clusters/window-covering';
|
|
19
|
+
import { Thermostat } from '@matter/types/clusters/thermostat';
|
|
20
|
+
import { FanControl } from '@matter/types/clusters/fan-control';
|
|
21
|
+
import { DoorLock } from '@matter/types/clusters/door-lock';
|
|
22
|
+
import { ModeSelect } from '@matter/types/clusters/mode-select';
|
|
23
|
+
import { ValveConfigurationAndControl } from '@matter/types/clusters/valve-configuration-and-control';
|
|
24
|
+
import { PumpConfigurationAndControl } from '@matter/types/clusters/pump-configuration-and-control';
|
|
25
|
+
import { SmokeCoAlarm } from '@matter/types/clusters/smoke-co-alarm';
|
|
26
|
+
import { Switch } from '@matter/types/clusters/switch';
|
|
27
|
+
import { BooleanState } from '@matter/types/clusters/boolean-state';
|
|
28
|
+
import { BooleanStateConfiguration } from '@matter/types/clusters/boolean-state-configuration';
|
|
29
|
+
import { PowerTopology } from '@matter/types/clusters/power-topology';
|
|
30
|
+
import { ElectricalPowerMeasurement } from '@matter/types/clusters/electrical-power-measurement';
|
|
31
|
+
import { ElectricalEnergyMeasurement } from '@matter/types/clusters/electrical-energy-measurement';
|
|
32
|
+
import { TemperatureMeasurement } from '@matter/types/clusters/temperature-measurement';
|
|
33
|
+
import { RelativeHumidityMeasurement } from '@matter/types/clusters/relative-humidity-measurement';
|
|
34
|
+
import { PressureMeasurement } from '@matter/types/clusters/pressure-measurement';
|
|
35
|
+
import { FlowMeasurement } from '@matter/types/clusters/flow-measurement';
|
|
36
|
+
import { IlluminanceMeasurement } from '@matter/types/clusters/illuminance-measurement';
|
|
37
|
+
import { OccupancySensing } from '@matter/types/clusters/occupancy-sensing';
|
|
38
|
+
import { AirQuality } from '@matter/types/clusters/air-quality';
|
|
39
|
+
import { CarbonMonoxideConcentrationMeasurement } from '@matter/types/clusters/carbon-monoxide-concentration-measurement';
|
|
40
|
+
import { CarbonDioxideConcentrationMeasurement } from '@matter/types/clusters/carbon-dioxide-concentration-measurement';
|
|
41
|
+
import { NitrogenDioxideConcentrationMeasurement } from '@matter/types/clusters/nitrogen-dioxide-concentration-measurement';
|
|
42
|
+
import { OzoneConcentrationMeasurement } from '@matter/types/clusters/ozone-concentration-measurement';
|
|
43
|
+
import { FormaldehydeConcentrationMeasurement } from '@matter/types/clusters/formaldehyde-concentration-measurement';
|
|
44
|
+
import { Pm1ConcentrationMeasurement } from '@matter/types/clusters/pm1-concentration-measurement';
|
|
45
|
+
import { Pm25ConcentrationMeasurement } from '@matter/types/clusters/pm25-concentration-measurement';
|
|
46
|
+
import { Pm10ConcentrationMeasurement } from '@matter/types/clusters/pm10-concentration-measurement';
|
|
47
|
+
import { RadonConcentrationMeasurement } from '@matter/types/clusters/radon-concentration-measurement';
|
|
48
|
+
import { TotalVolatileOrganicCompoundsConcentrationMeasurement } from '@matter/types/clusters/total-volatile-organic-compounds-concentration-measurement';
|
|
49
|
+
import { OperationalState } from '@matter/types/clusters/operational-state';
|
|
50
|
+
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
51
|
+
import { DeviceEnergyManagementMode } from '@matter/types/clusters/device-energy-management-mode';
|
|
52
|
+
import { PowerSourceServer } from '@matter/node/behaviors/power-source';
|
|
53
|
+
import { UserLabelServer } from '@matter/node/behaviors/user-label';
|
|
54
|
+
import { FixedLabelServer } from '@matter/node/behaviors/fixed-label';
|
|
55
|
+
import { BasicInformationServer } from '@matter/node/behaviors/basic-information';
|
|
56
|
+
import { BridgedDeviceBasicInformationServer } from '@matter/node/behaviors/bridged-device-basic-information';
|
|
57
|
+
import { GroupsServer } from '@matter/node/behaviors/groups';
|
|
58
|
+
import { PumpConfigurationAndControlServer } from '@matter/node/behaviors/pump-configuration-and-control';
|
|
59
|
+
import { SwitchServer } from '@matter/node/behaviors/switch';
|
|
60
|
+
import { BooleanStateServer } from '@matter/node/behaviors/boolean-state';
|
|
61
|
+
import { PowerTopologyServer } from '@matter/node/behaviors/power-topology';
|
|
62
|
+
import { ElectricalPowerMeasurementServer } from '@matter/node/behaviors/electrical-power-measurement';
|
|
63
|
+
import { ElectricalEnergyMeasurementServer } from '@matter/node/behaviors/electrical-energy-measurement';
|
|
64
|
+
import { TemperatureMeasurementServer } from '@matter/node/behaviors/temperature-measurement';
|
|
65
|
+
import { RelativeHumidityMeasurementServer } from '@matter/node/behaviors/relative-humidity-measurement';
|
|
66
|
+
import { PressureMeasurementServer } from '@matter/node/behaviors/pressure-measurement';
|
|
67
|
+
import { FlowMeasurementServer } from '@matter/node/behaviors/flow-measurement';
|
|
68
|
+
import { IlluminanceMeasurementServer } from '@matter/node/behaviors/illuminance-measurement';
|
|
69
|
+
import { OccupancySensingServer } from '@matter/node/behaviors/occupancy-sensing';
|
|
70
|
+
import { AirQualityServer } from '@matter/node/behaviors/air-quality';
|
|
71
|
+
import { CarbonMonoxideConcentrationMeasurementServer } from '@matter/node/behaviors/carbon-monoxide-concentration-measurement';
|
|
72
|
+
import { CarbonDioxideConcentrationMeasurementServer } from '@matter/node/behaviors/carbon-dioxide-concentration-measurement';
|
|
73
|
+
import { NitrogenDioxideConcentrationMeasurementServer } from '@matter/node/behaviors/nitrogen-dioxide-concentration-measurement';
|
|
74
|
+
import { OzoneConcentrationMeasurementServer } from '@matter/node/behaviors/ozone-concentration-measurement';
|
|
75
|
+
import { FormaldehydeConcentrationMeasurementServer } from '@matter/node/behaviors/formaldehyde-concentration-measurement';
|
|
76
|
+
import { Pm1ConcentrationMeasurementServer } from '@matter/node/behaviors/pm1-concentration-measurement';
|
|
77
|
+
import { Pm25ConcentrationMeasurementServer } from '@matter/node/behaviors/pm25-concentration-measurement';
|
|
78
|
+
import { Pm10ConcentrationMeasurementServer } from '@matter/node/behaviors/pm10-concentration-measurement';
|
|
79
|
+
import { RadonConcentrationMeasurementServer } from '@matter/node/behaviors/radon-concentration-measurement';
|
|
80
|
+
import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/node/behaviors/total-volatile-organic-compounds-concentration-measurement';
|
|
106
81
|
import { DeviceEnergyManagementServer } from '@matter/node/behaviors/device-energy-management';
|
|
107
|
-
// Matterbridge
|
|
108
82
|
import { deepCopy, deepEqual, isValidArray } from './utils/export.js';
|
|
109
83
|
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
|
-
*/
|
|
116
84
|
export function capitalizeFirstLetter(name) {
|
|
117
85
|
if (!name)
|
|
118
86
|
return name;
|
|
119
87
|
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
120
88
|
}
|
|
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
|
-
*/
|
|
127
89
|
export function lowercaseFirstLetter(name) {
|
|
128
90
|
if (!name)
|
|
129
91
|
return name;
|
|
130
92
|
return name.charAt(0).toLowerCase() + name.slice(1);
|
|
131
93
|
}
|
|
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
|
-
*/
|
|
138
94
|
export function checkNotLatinCharacters(deviceName) {
|
|
139
95
|
const nonLatinRegexList = [
|
|
140
|
-
/[\u0400-\u04FF\u0500-\u052F]/,
|
|
141
|
-
/[\u2E80-\u9FFF]/,
|
|
142
|
-
/[\uAC00-\uD7AF]/,
|
|
143
|
-
/[\u0600-\u06FF\u0750-\u077F]/,
|
|
144
|
-
/[\u0590-\u05FF]/,
|
|
145
|
-
/[\u0900-\u097F]/,
|
|
146
|
-
/[\u0E00-\u0E7F]/,
|
|
147
|
-
/[\u1200-\u137F]/,
|
|
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]/,
|
|
148
104
|
];
|
|
149
105
|
return nonLatinRegexList.some((regex) => regex.test(deviceName));
|
|
150
106
|
}
|
|
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
|
-
*/
|
|
157
107
|
export function generateUniqueId(deviceName) {
|
|
158
|
-
return createHash('md5').update(deviceName).digest('hex');
|
|
108
|
+
return createHash('md5').update(deviceName).digest('hex');
|
|
159
109
|
}
|
|
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
|
-
*/
|
|
169
110
|
export function createUniqueId(param1, param2, param3, param4) {
|
|
170
111
|
const hash = createHash('md5');
|
|
171
112
|
hash.update(param1 + param2 + param3 + param4);
|
|
172
113
|
return hash.digest('hex');
|
|
173
114
|
}
|
|
174
|
-
/**
|
|
175
|
-
* Retrieves the features for a specific behavior.
|
|
176
|
-
*
|
|
177
|
-
* @param {Endpoint} endpoint - The endpoint to retrieve the features from.
|
|
178
|
-
* @param {string} behavior - The behavior to retrieve the features for.
|
|
179
|
-
*
|
|
180
|
-
* @returns {Record<string, boolean | undefined>} The features for the specified behavior.
|
|
181
|
-
*
|
|
182
|
-
* @remarks Use with:
|
|
183
|
-
* ```typescript
|
|
184
|
-
* expect(featuresFor(device, 'powerSource').wired).toBe(true);
|
|
185
|
-
* ```
|
|
186
|
-
*/
|
|
187
115
|
export function featuresFor(endpoint, behavior) {
|
|
188
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
189
116
|
return endpoint.behaviors.supported[lowercaseFirstLetter(behavior)]['cluster']['supportedFeatures'];
|
|
190
117
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Maps a list of ClusterId to Behavior.Type for server clusters.
|
|
193
|
-
*
|
|
194
|
-
* @param {ClusterId[]} clusterServerList - The list of ClusterId to map.
|
|
195
|
-
* @returns {Behavior.Type[]} An array of Behavior.Type corresponding to the ClusterId in the server list.
|
|
196
|
-
*/
|
|
197
118
|
export function getBehaviourTypesFromClusterServerIds(clusterServerList) {
|
|
198
|
-
// Map Server ClusterId to Behavior.Type
|
|
199
119
|
const behaviorTypes = [];
|
|
200
120
|
clusterServerList.forEach((clusterId) => {
|
|
201
121
|
behaviorTypes.push(getBehaviourTypeFromClusterServerId(clusterId));
|
|
202
122
|
});
|
|
203
123
|
return behaviorTypes;
|
|
204
124
|
}
|
|
205
|
-
/**
|
|
206
|
-
* Maps a list of ClusterId to Behavior.Type for client clusters.
|
|
207
|
-
*
|
|
208
|
-
* @param {ClusterId[]} clusterClientList - The list of ClusterId to map.
|
|
209
|
-
* @returns {Behavior.Type[]} An array of Behavior.Type corresponding to the ClusterId in the client list.
|
|
210
|
-
*/
|
|
211
125
|
export function getBehaviourTypesFromClusterClientIds(clusterClientList) {
|
|
212
|
-
// Map Client ClusterId to Behavior.Type
|
|
213
126
|
const behaviorTypes = [];
|
|
214
127
|
clusterClientList.forEach((_clusterId) => {
|
|
215
|
-
// behaviorTypes.push(getBehaviourTypeFromClusterClientId(clusterId));
|
|
216
128
|
});
|
|
217
129
|
return behaviorTypes;
|
|
218
130
|
}
|
|
219
|
-
/**
|
|
220
|
-
* Maps a ClusterId to a Behavior.Type for server clusters.
|
|
221
|
-
*
|
|
222
|
-
* @param {ClusterId} clusterId - The ClusterId to map.
|
|
223
|
-
* @returns {Behavior.Type} The corresponding Behavior.Type for the given ClusterId.
|
|
224
|
-
*/
|
|
225
131
|
export function getBehaviourTypeFromClusterServerId(clusterId) {
|
|
226
|
-
// Map ClusterId to Server Behavior.Type
|
|
227
132
|
if (clusterId === PowerSource.Cluster.id)
|
|
228
133
|
return PowerSourceServer.with(PowerSource.Feature.Wired);
|
|
229
134
|
if (clusterId === UserLabel.Cluster.id)
|
|
@@ -314,22 +219,8 @@ export function getBehaviourTypeFromClusterServerId(clusterId) {
|
|
|
314
219
|
return MatterbridgeDeviceEnergyManagementModeServer;
|
|
315
220
|
return MatterbridgeIdentifyServer;
|
|
316
221
|
}
|
|
317
|
-
/**
|
|
318
|
-
* Maps a ClusterId to a Behavior.Type for client clusters.
|
|
319
|
-
*
|
|
320
|
-
* @param {ClusterId} _clusterId - The ClusterId to map.
|
|
321
|
-
*/
|
|
322
222
|
export function getBehaviourTypeFromClusterClientId(_clusterId) {
|
|
323
|
-
// Map ClusterId to Client Behavior.Type
|
|
324
|
-
// return IdentifyClient;
|
|
325
223
|
}
|
|
326
|
-
/**
|
|
327
|
-
* Retrieves the Behavior.Type for a given cluster from the endpoint's supported behaviors.
|
|
328
|
-
*
|
|
329
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to retrieve the behavior from.
|
|
330
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the behavior for.
|
|
331
|
-
* @returns {Behavior.Type | undefined} The Behavior.Type for the given cluster, or undefined if not found.
|
|
332
|
-
*/
|
|
333
224
|
export function getBehavior(endpoint, cluster) {
|
|
334
225
|
let behavior;
|
|
335
226
|
if (typeof cluster === 'string') {
|
|
@@ -346,18 +237,6 @@ export function getBehavior(endpoint, cluster) {
|
|
|
346
237
|
}
|
|
347
238
|
return behavior;
|
|
348
239
|
}
|
|
349
|
-
/**
|
|
350
|
-
* Invokes a command on the specified behavior of the endpoint. Used ONLY in Jest tests.
|
|
351
|
-
*
|
|
352
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to invoke the command on.
|
|
353
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the command on.
|
|
354
|
-
* @param {keyof MatterbridgeEndpointCommands} command - The command to invoke.
|
|
355
|
-
* @param {Record<string, boolean | number | bigint | string | object | null>} [params] - The parameters to pass to the command.
|
|
356
|
-
*
|
|
357
|
-
* @returns {Promise<boolean>} A promise that resolves to true if the command was invoked successfully, false otherwise.
|
|
358
|
-
*
|
|
359
|
-
* @deprecated Used ONLY in Jest tests.
|
|
360
|
-
*/
|
|
361
240
|
export async function invokeBehaviorCommand(endpoint, cluster, command, params) {
|
|
362
241
|
const behaviorId = getBehavior(endpoint, cluster)?.id;
|
|
363
242
|
if (!behaviorId) {
|
|
@@ -365,7 +244,6 @@ export async function invokeBehaviorCommand(endpoint, cluster, command, params)
|
|
|
365
244
|
return false;
|
|
366
245
|
}
|
|
367
246
|
await endpoint.act((agent) => {
|
|
368
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
369
247
|
const behavior = agent[behaviorId];
|
|
370
248
|
if (!(command in behavior) || typeof behavior[command] !== 'function') {
|
|
371
249
|
endpoint.log?.error(`invokeBehaviorCommand error: command ${hk}${command}${er} not found on agent for endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
@@ -375,19 +253,6 @@ export async function invokeBehaviorCommand(endpoint, cluster, command, params)
|
|
|
375
253
|
});
|
|
376
254
|
return true;
|
|
377
255
|
}
|
|
378
|
-
/**
|
|
379
|
-
* Invokes the subscription handler on the specified cluster and attribute of the endpoint. Used ONLY in Jest tests.
|
|
380
|
-
*
|
|
381
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to invoke the subscription handler on.
|
|
382
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to invoke the subscription handler on.
|
|
383
|
-
* @param {string} attribute - The attribute to invoke the subscription handler on.
|
|
384
|
-
* @param {unknown} newValue - The new value of the attribute.
|
|
385
|
-
* @param {unknown} oldValue - The old value of the attribute.
|
|
386
|
-
*
|
|
387
|
-
* @returns {Promise<boolean>} A promise that resolves to true if the subscription handler was invoked successfully, false otherwise.
|
|
388
|
-
*
|
|
389
|
-
* @deprecated Used ONLY in Jest tests.
|
|
390
|
-
*/
|
|
391
256
|
export async function invokeSubscribeHandler(endpoint, cluster, attribute, newValue, oldValue) {
|
|
392
257
|
const event = attribute + '$Changed';
|
|
393
258
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
@@ -404,17 +269,9 @@ export async function invokeSubscribeHandler(endpoint, cluster, attribute, newVa
|
|
|
404
269
|
endpoint.log.error(`invokeSubscribeHandler ${hk}${event}${er} error: cluster ${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
|
|
405
270
|
return false;
|
|
406
271
|
}
|
|
407
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
408
|
-
// @ts-ignore
|
|
409
272
|
await endpoint.act((agent) => agent[clusterName].events[event].emit(newValue, oldValue, { ...agent.context, offline: false }));
|
|
410
273
|
return true;
|
|
411
274
|
}
|
|
412
|
-
/**
|
|
413
|
-
* Adds required cluster servers to the specified endpoint based on the device types.
|
|
414
|
-
*
|
|
415
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the required cluster servers to.
|
|
416
|
-
* @returns {void}
|
|
417
|
-
*/
|
|
418
275
|
export function addRequiredClusterServers(endpoint) {
|
|
419
276
|
const requiredServerList = [];
|
|
420
277
|
endpoint.log.debug(`addRequiredClusterServers for ${CYAN}${endpoint.maybeId}${db}`);
|
|
@@ -429,12 +286,6 @@ export function addRequiredClusterServers(endpoint) {
|
|
|
429
286
|
});
|
|
430
287
|
addClusterServers(endpoint, requiredServerList);
|
|
431
288
|
}
|
|
432
|
-
/**
|
|
433
|
-
* Adds optional cluster servers to the specified endpoint based on the device types.
|
|
434
|
-
*
|
|
435
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the optional cluster servers to.
|
|
436
|
-
* @returns {void}
|
|
437
|
-
*/
|
|
438
289
|
export function addOptionalClusterServers(endpoint) {
|
|
439
290
|
const optionalServerList = [];
|
|
440
291
|
endpoint.log.debug(`addOptionalClusterServers for ${CYAN}${endpoint.maybeId}${db}`);
|
|
@@ -449,12 +300,6 @@ export function addOptionalClusterServers(endpoint) {
|
|
|
449
300
|
});
|
|
450
301
|
addClusterServers(endpoint, optionalServerList);
|
|
451
302
|
}
|
|
452
|
-
/**
|
|
453
|
-
* Adds cluster servers to the specified endpoint based on the provided server list.
|
|
454
|
-
*
|
|
455
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
|
|
456
|
-
* @param {ClusterId[]} serverList - The list of cluster IDs to add.
|
|
457
|
-
*/
|
|
458
303
|
export function addClusterServers(endpoint, serverList) {
|
|
459
304
|
if (serverList.includes(PowerSource.Cluster.id))
|
|
460
305
|
endpoint.createDefaultPowerSourceWiredClusterServer();
|
|
@@ -535,13 +380,6 @@ export function addClusterServers(endpoint, serverList) {
|
|
|
535
380
|
if (serverList.includes(DeviceEnergyManagementMode.Cluster.id))
|
|
536
381
|
endpoint.createDefaultDeviceEnergyManagementModeClusterServer();
|
|
537
382
|
}
|
|
538
|
-
/**
|
|
539
|
-
* Adds a fixed label to the FixedLabel cluster. The FixedLabel cluster is created if it does not exist.
|
|
540
|
-
*
|
|
541
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
|
|
542
|
-
* @param {string} label - The label to add. Max 16 characters.
|
|
543
|
-
* @param {string} value - The value of the label. Max 16 characters.
|
|
544
|
-
*/
|
|
545
383
|
export async function addFixedLabel(endpoint, label, value) {
|
|
546
384
|
if (!endpoint.hasClusterServer(FixedLabel.Cluster.id)) {
|
|
547
385
|
endpoint.log.debug(`addFixedLabel: add cluster ${hk}FixedLabel${db}:${hk}fixedLabel${db} with label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
|
|
@@ -558,13 +396,6 @@ export async function addFixedLabel(endpoint, label, value) {
|
|
|
558
396
|
await endpoint.setAttribute(FixedLabel.Cluster.id, 'labelList', labelList, endpoint.log);
|
|
559
397
|
}
|
|
560
398
|
}
|
|
561
|
-
/**
|
|
562
|
-
* Adds a user label to the UserLabel cluster. The UserLabel cluster is created if it does not exist.
|
|
563
|
-
*
|
|
564
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to add the cluster servers to.
|
|
565
|
-
* @param {string} label - The label to add. Max 16 characters.
|
|
566
|
-
* @param {string} value - The value of the label. Max 16 characters.
|
|
567
|
-
*/
|
|
568
399
|
export async function addUserLabel(endpoint, label, value) {
|
|
569
400
|
if (!endpoint.hasClusterServer(UserLabel.Cluster.id)) {
|
|
570
401
|
endpoint.log.debug(`addUserLabel: add cluster ${hk}UserLabel${db}:${hk}userLabel${db} with label ${CYAN}${label}${db} value ${CYAN}${value}${db}`);
|
|
@@ -581,48 +412,16 @@ export async function addUserLabel(endpoint, label, value) {
|
|
|
581
412
|
await endpoint.setAttribute(UserLabel.Cluster.id, 'labelList', labelList, endpoint.log);
|
|
582
413
|
}
|
|
583
414
|
}
|
|
584
|
-
/**
|
|
585
|
-
* Returns the options for a given behavior type.
|
|
586
|
-
*
|
|
587
|
-
* @param {T} type - The behavior type.
|
|
588
|
-
* @param {Behavior.Options<T>} options - The options for the behavior type.
|
|
589
|
-
* @returns {Behavior.Options<T>} The options for the behavior type.
|
|
590
|
-
*/
|
|
591
415
|
export function optionsFor(type, options) {
|
|
592
416
|
return options;
|
|
593
417
|
}
|
|
594
|
-
/**
|
|
595
|
-
* Retrieves the cluster ID.
|
|
596
|
-
*
|
|
597
|
-
* @param {Endpoint} endpoint - The endpoint to retrieve the cluster ID from.
|
|
598
|
-
* @param {ClusterId} cluster - The ID of the cluster.
|
|
599
|
-
* @returns {number | undefined} The ID of the cluster.
|
|
600
|
-
*/
|
|
601
418
|
export function getClusterId(endpoint, cluster) {
|
|
602
419
|
return endpoint.behaviors.supported[lowercaseFirstLetter(cluster)]?.schema?.id;
|
|
603
420
|
}
|
|
604
|
-
/**
|
|
605
|
-
* Retrieves the ID of an attribute from a cluster behavior.
|
|
606
|
-
*
|
|
607
|
-
* @param {Endpoint} endpoint - The endpoint to retrieve the attribute ID from.
|
|
608
|
-
* @param {string} cluster - The name of the cluster.
|
|
609
|
-
* @param {string} attribute - The name of the attribute.
|
|
610
|
-
* @returns {number | undefined} The ID of the attribute, or undefined if not found.
|
|
611
|
-
*/
|
|
612
421
|
export function getAttributeId(endpoint, cluster, attribute) {
|
|
613
422
|
const clusterBehavior = endpoint.behaviors.supported[lowercaseFirstLetter(cluster)];
|
|
614
423
|
return clusterBehavior?.cluster?.attributes[lowercaseFirstLetter(attribute)]?.id;
|
|
615
424
|
}
|
|
616
|
-
/**
|
|
617
|
-
* Retrieves the value of the provided attribute from the given cluster.
|
|
618
|
-
*
|
|
619
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to retrieve the attribute from.
|
|
620
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to retrieve the attribute from.
|
|
621
|
-
* @param {string} attribute - The name of the attribute to retrieve.
|
|
622
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the retrieve. Errors are logged to the endpoint logger.
|
|
623
|
-
* @returns {any} The value of the attribute, or undefined if the attribute is not found.
|
|
624
|
-
*/
|
|
625
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
626
425
|
export function getAttribute(endpoint, cluster, attribute, log) {
|
|
627
426
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
628
427
|
if (!clusterName) {
|
|
@@ -645,16 +444,6 @@ export function getAttribute(endpoint, cluster, attribute, log) {
|
|
|
645
444
|
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}`);
|
|
646
445
|
return value;
|
|
647
446
|
}
|
|
648
|
-
/**
|
|
649
|
-
* Sets the value of an attribute on a cluster server.
|
|
650
|
-
*
|
|
651
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to set the attribute on.
|
|
652
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to set the attribute on.
|
|
653
|
-
* @param {string} attribute - The name of the attribute.
|
|
654
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
655
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the set. Errors are logged to the endpoint logger.
|
|
656
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
657
|
-
*/
|
|
658
447
|
export async function setAttribute(endpoint, cluster, attribute, value, log) {
|
|
659
448
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
660
449
|
if (!clusterName) {
|
|
@@ -680,16 +469,6 @@ export async function setAttribute(endpoint, cluster, attribute, value, log) {
|
|
|
680
469
|
`to ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
681
470
|
return true;
|
|
682
471
|
}
|
|
683
|
-
/**
|
|
684
|
-
* Sets the value of an attribute on a cluster server.
|
|
685
|
-
*
|
|
686
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to update the attribute on.
|
|
687
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to update the attribute on.
|
|
688
|
-
* @param {string} attribute - The name of the attribute.
|
|
689
|
-
* @param {boolean | number | bigint | string | object | null} value - The value to set for the attribute.
|
|
690
|
-
* @param {AnsiLogger} [log] - (Optional) The logger to use for logging the update. Errors are logged to the endpoint logger.
|
|
691
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the attribute was successfully set.
|
|
692
|
-
*/
|
|
693
472
|
export async function updateAttribute(endpoint, cluster, attribute, value, log) {
|
|
694
473
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
695
474
|
if (!clusterName) {
|
|
@@ -720,24 +499,7 @@ export async function updateAttribute(endpoint, cluster, attribute, value, log)
|
|
|
720
499
|
`to ${YELLOW}${value !== null && typeof value === 'object' ? debugStringify(value) : value}${db}`);
|
|
721
500
|
return true;
|
|
722
501
|
}
|
|
723
|
-
|
|
724
|
-
* Subscribes to the provided attribute on a cluster.
|
|
725
|
-
*
|
|
726
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to subscribe the attribute to.
|
|
727
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The cluster to subscribe the attribute to.
|
|
728
|
-
* @param {string} attribute - The name of the attribute to subscribe to.
|
|
729
|
-
* @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.
|
|
730
|
-
* @param {AnsiLogger} [log] - Optional logger for logging errors and information.
|
|
731
|
-
* @returns {boolean} - A boolean indicating whether the subscription was successful.
|
|
732
|
-
*
|
|
733
|
-
* @remarks The listener function (cannot be async) will receive three parameters:
|
|
734
|
-
* - `newValue`: The new value of the attribute.
|
|
735
|
-
* - `oldValue`: The old value of the attribute.
|
|
736
|
-
* - `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.
|
|
737
|
-
*/
|
|
738
|
-
export async function subscribeAttribute(endpoint, cluster, attribute,
|
|
739
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
740
|
-
listener, log) {
|
|
502
|
+
export async function subscribeAttribute(endpoint, cluster, attribute, listener, log) {
|
|
741
503
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
742
504
|
if (!clusterName) {
|
|
743
505
|
endpoint.log.error(`subscribeAttribute ${hk}${attribute}${er} error: cluster not found on endpoint ${or}${endpoint.maybeId}${er}:${or}${endpoint.maybeNumber}${er}`);
|
|
@@ -747,7 +509,6 @@ listener, log) {
|
|
|
747
509
|
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`);
|
|
748
510
|
await endpoint.construction.ready;
|
|
749
511
|
}
|
|
750
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
751
512
|
const events = endpoint.events;
|
|
752
513
|
attribute = lowercaseFirstLetter(attribute) + '$Changed';
|
|
753
514
|
if (!(clusterName in events) || !(attribute in events[clusterName])) {
|
|
@@ -758,17 +519,6 @@ listener, log) {
|
|
|
758
519
|
log?.info(`${db}Subscribed endpoint ${or}${endpoint.id}${db}:${or}${endpoint.number}${db} attribute ${hk}${capitalizeFirstLetter(clusterName)}${db}.${hk}${attribute}${db}`);
|
|
759
520
|
return true;
|
|
760
521
|
}
|
|
761
|
-
/**
|
|
762
|
-
* Triggers an event on the specified cluster.
|
|
763
|
-
*
|
|
764
|
-
* @param {MatterbridgeEndpoint} endpoint - The endpoint to trigger the event on.
|
|
765
|
-
* @param {Behavior.Type | ClusterType | ClusterId | string} cluster - The ID of the cluster.
|
|
766
|
-
* @param {string} event - The name of the event to trigger.
|
|
767
|
-
* @param {Record<string, boolean | number | bigint | string | object | undefined | null>} payload - The payload to pass to the event.
|
|
768
|
-
* @param {AnsiLogger} [log] - Optional logger for logging information.
|
|
769
|
-
*
|
|
770
|
-
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the event was successfully triggered.
|
|
771
|
-
*/
|
|
772
522
|
export async function triggerEvent(endpoint, cluster, event, payload, log) {
|
|
773
523
|
const clusterName = getBehavior(endpoint, cluster)?.id;
|
|
774
524
|
if (!clusterName) {
|
|
@@ -779,32 +529,15 @@ export async function triggerEvent(endpoint, cluster, event, payload, log) {
|
|
|
779
529
|
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`);
|
|
780
530
|
return false;
|
|
781
531
|
}
|
|
782
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
783
532
|
const events = endpoint.events;
|
|
784
533
|
if (!(clusterName in events) || !(event in events[clusterName])) {
|
|
785
534
|
endpoint.log.error(`triggerEvent ${hk}${event}${er} error: cluster ${clusterName} not found on endpoint ${or}${endpoint.id}${er}:${or}${endpoint.number}${er}`);
|
|
786
535
|
return false;
|
|
787
536
|
}
|
|
788
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
789
|
-
// @ts-ignore
|
|
790
537
|
await endpoint.act((agent) => agent[clusterName].events[event].emit(payload, agent.context));
|
|
791
538
|
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} `);
|
|
792
539
|
return true;
|
|
793
540
|
}
|
|
794
|
-
/**
|
|
795
|
-
* Get the default OperationalState Cluster Server.
|
|
796
|
-
*
|
|
797
|
-
* @param {OperationalState.OperationalStateEnum} operationalState - The initial operational state id.
|
|
798
|
-
*
|
|
799
|
-
* @returns {Behavior.Options<MatterbridgeOperationalStateServer>} - The default options for the OperationalState cluster server.
|
|
800
|
-
*
|
|
801
|
-
* @remarks
|
|
802
|
-
* This method adds a cluster server with a default operational state configuration:
|
|
803
|
-
* - { operationalStateId: OperationalState.OperationalStateEnum.Stopped, operationalStateLabel: 'Stopped' },
|
|
804
|
-
* - { operationalStateId: OperationalState.OperationalStateEnum.Running, operationalStateLabel: 'Running' },
|
|
805
|
-
* - { operationalStateId: OperationalState.OperationalStateEnum.Paused, operationalStateLabel: 'Paused' },
|
|
806
|
-
* - { operationalStateId: OperationalState.OperationalStateEnum.Error, operationalStateLabel: 'Error' },
|
|
807
|
-
*/
|
|
808
541
|
export function getDefaultOperationalStateClusterServer(operationalState = OperationalState.OperationalStateEnum.Stopped) {
|
|
809
542
|
return optionsFor(MatterbridgeOperationalStateServer, {
|
|
810
543
|
phaseList: [],
|
|
@@ -820,14 +553,6 @@ export function getDefaultOperationalStateClusterServer(operationalState = Opera
|
|
|
820
553
|
operationalError: { errorStateId: OperationalState.ErrorState.NoError, errorStateLabel: 'No error', errorStateDetails: 'Fully operational' },
|
|
821
554
|
});
|
|
822
555
|
}
|
|
823
|
-
/**
|
|
824
|
-
* Get the default TemperatureMeasurement cluster server options.
|
|
825
|
-
*
|
|
826
|
-
* @param {number | null} measuredValue - The measured value of the temperature x 100.
|
|
827
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the temperature x 100.
|
|
828
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the temperature x 100.
|
|
829
|
-
* @returns {Behavior.Options<MatterbridgeTemperatureMeasurementServer>} - The default options for the TemperatureMeasurement cluster server.
|
|
830
|
-
*/
|
|
831
556
|
export function getDefaultTemperatureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
832
557
|
return optionsFor(TemperatureMeasurementServer, {
|
|
833
558
|
measuredValue,
|
|
@@ -836,14 +561,6 @@ export function getDefaultTemperatureMeasurementClusterServer(measuredValue = nu
|
|
|
836
561
|
tolerance: 0,
|
|
837
562
|
});
|
|
838
563
|
}
|
|
839
|
-
/**
|
|
840
|
-
* Get the default RelativeHumidityMeasurement cluster server options.
|
|
841
|
-
*
|
|
842
|
-
* @param {number | null} measuredValue - The measured value of the relative humidity x 100.
|
|
843
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the relative humidity x 100.
|
|
844
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the relative humidity x 100.
|
|
845
|
-
* @returns {Behavior.Options<MatterbridgeRelativeHumidityMeasurementServer>} - The default options for the RelativeHumidityMeasurement cluster server.
|
|
846
|
-
*/
|
|
847
564
|
export function getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
848
565
|
return optionsFor(RelativeHumidityMeasurementServer, {
|
|
849
566
|
measuredValue,
|
|
@@ -852,14 +569,6 @@ export function getDefaultRelativeHumidityMeasurementClusterServer(measuredValue
|
|
|
852
569
|
tolerance: 0,
|
|
853
570
|
});
|
|
854
571
|
}
|
|
855
|
-
/**
|
|
856
|
-
* Get the default PressureMeasurement cluster server options.
|
|
857
|
-
*
|
|
858
|
-
* @param {number | null} measuredValue - The measured value for the pressure in kPa x 10.
|
|
859
|
-
* @param {number | null} minMeasuredValue - The minimum measured value for the pressure in kPa x 10.
|
|
860
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value for the pressure in kPa x 10.
|
|
861
|
-
* @returns {Behavior.Options<MatterbridgePressureMeasurementServer>} - The default options for the PressureMeasurement cluster server.
|
|
862
|
-
*/
|
|
863
572
|
export function getDefaultPressureMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
864
573
|
return optionsFor(PressureMeasurementServer, {
|
|
865
574
|
measuredValue,
|
|
@@ -868,22 +577,6 @@ export function getDefaultPressureMeasurementClusterServer(measuredValue = null,
|
|
|
868
577
|
tolerance: 0,
|
|
869
578
|
});
|
|
870
579
|
}
|
|
871
|
-
/**
|
|
872
|
-
* Get the default IlluminanceMeasurement cluster server options.
|
|
873
|
-
*
|
|
874
|
-
* @param {number | null} measuredValue - The measured value of illuminance.
|
|
875
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of illuminance.
|
|
876
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of illuminance.
|
|
877
|
-
*
|
|
878
|
-
* @returns {Behavior.Options<MatterbridgeIlluminanceMeasurementServer>} - The default options for the IlluminanceMeasurement cluster server.
|
|
879
|
-
*
|
|
880
|
-
* @remarks The default value for the illuminance measurement is null.
|
|
881
|
-
* This attribute SHALL indicate the illuminance in Lux (symbol lx) as follows:
|
|
882
|
-
* • MeasuredValue = 10,000 x log10(illuminance) + 1,
|
|
883
|
-
* where 1 lx <= illuminance <= 3.576 Mlx, corresponding to a MeasuredValue in the range 1 to 0xFFFE.
|
|
884
|
-
* • 0 indicates a value of illuminance that is too low to be measured
|
|
885
|
-
* • null indicates that the illuminance measurement is invalid.
|
|
886
|
-
*/
|
|
887
580
|
export function getDefaultIlluminanceMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
888
581
|
return optionsFor(IlluminanceMeasurementServer, {
|
|
889
582
|
measuredValue,
|
|
@@ -892,14 +585,6 @@ export function getDefaultIlluminanceMeasurementClusterServer(measuredValue = nu
|
|
|
892
585
|
tolerance: 0,
|
|
893
586
|
});
|
|
894
587
|
}
|
|
895
|
-
/**
|
|
896
|
-
* Get the default FlowMeasurement cluster server options.
|
|
897
|
-
*
|
|
898
|
-
* @param {number | null} measuredValue - The measured value of the flow in 10 x m3/h.
|
|
899
|
-
* @param {number | null} minMeasuredValue - The minimum measured value of the flow in 10 x m3/h.
|
|
900
|
-
* @param {number | null} maxMeasuredValue - The maximum measured value of the flow in 10 x m3/h.
|
|
901
|
-
* @returns {Behavior.Options<MatterbridgeFlowMeasurementServer>} - The default options for the FlowMeasurement cluster server.
|
|
902
|
-
*/
|
|
903
588
|
export function getDefaultFlowMeasurementClusterServer(measuredValue = null, minMeasuredValue = null, maxMeasuredValue = null) {
|
|
904
589
|
return optionsFor(FlowMeasurementServer, {
|
|
905
590
|
measuredValue,
|
|
@@ -908,20 +593,6 @@ export function getDefaultFlowMeasurementClusterServer(measuredValue = null, min
|
|
|
908
593
|
tolerance: 0,
|
|
909
594
|
});
|
|
910
595
|
}
|
|
911
|
-
/**
|
|
912
|
-
* Get the default OccupancySensing cluster server options.
|
|
913
|
-
*
|
|
914
|
-
* @param {boolean} occupied - A boolean indicating whether the occupancy is occupied or not. Default is false.
|
|
915
|
-
* @param {number} holdTime - The hold time in seconds. Default is 30.
|
|
916
|
-
* @param {number} holdTimeMin - The minimum hold time in seconds. Default is 1.
|
|
917
|
-
* @param {number} holdTimeMax - The maximum hold time in seconds. Default is 300.
|
|
918
|
-
* @returns {Behavior.Options<MatterbridgeOccupancySensingServer>} - The default options for the OccupancySensing cluster server.
|
|
919
|
-
*
|
|
920
|
-
* @remarks The default value for the occupancy sensor type is PIR.
|
|
921
|
-
* Servers SHALL set these attributes for backward compatibility with clients implementing a cluster revision <= 4 as
|
|
922
|
-
* described in OccupancySensorType and OccupancySensorTypeBitmap Attributes.
|
|
923
|
-
* This replaces the 9 legacy attributes PIROccupiedToUnoccupiedDelay through PhysicalContactUnoccupiedToOccupiedThreshold.
|
|
924
|
-
*/
|
|
925
596
|
export function getDefaultOccupancySensingClusterServer(occupied = false, holdTime = 30, holdTimeMin = 1, holdTimeMax = 300) {
|
|
926
597
|
return optionsFor(OccupancySensingServer.with(OccupancySensing.Feature.PassiveInfrared), {
|
|
927
598
|
occupancy: { occupied },
|
|
@@ -933,13 +604,6 @@ export function getDefaultOccupancySensingClusterServer(occupied = false, holdTi
|
|
|
933
604
|
holdTimeLimits: { holdTimeMin, holdTimeMax, holdTimeDefault: holdTime },
|
|
934
605
|
});
|
|
935
606
|
}
|
|
936
|
-
/**
|
|
937
|
-
* Get the default Electrical Energy Measurement Cluster Server options with features ImportedEnergy, ExportedEnergy, and CumulativeEnergy.
|
|
938
|
-
*
|
|
939
|
-
* @param {number} energyImported - The total consumption value in mW/h.
|
|
940
|
-
* @param {number} energyExported - The total production value in mW/h.
|
|
941
|
-
* @returns {Behavior.Options<ElectricalEnergyMeasurementServer>} - The default options for the Electrical Energy Measurement Cluster Server.
|
|
942
|
-
*/
|
|
943
607
|
export function getDefaultElectricalEnergyMeasurementClusterServer(energyImported = null, energyExported = null) {
|
|
944
608
|
return optionsFor(ElectricalEnergyMeasurementServer.with(ElectricalEnergyMeasurement.Feature.ImportedEnergy, ElectricalEnergyMeasurement.Feature.ExportedEnergy, ElectricalEnergyMeasurement.Feature.CumulativeEnergy), {
|
|
945
609
|
accuracy: {
|
|
@@ -954,15 +618,6 @@ export function getDefaultElectricalEnergyMeasurementClusterServer(energyImporte
|
|
|
954
618
|
cumulativeEnergyExported: energyExported !== null && energyExported >= 0 ? { energy: energyExported } : null,
|
|
955
619
|
});
|
|
956
620
|
}
|
|
957
|
-
/**
|
|
958
|
-
* Get the default Electrical Power Measurement Cluster Server options with features AlternatingCurrent.
|
|
959
|
-
*
|
|
960
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
961
|
-
* @param {number} current - The current value in milliamperes.
|
|
962
|
-
* @param {number} power - The power value in milliwatts.
|
|
963
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
964
|
-
* @returns {Behavior.Options<ElectricalPowerMeasurementServer>} - The default options for the Electrical Power Measurement Cluster Server.
|
|
965
|
-
*/
|
|
966
621
|
export function getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
967
622
|
return optionsFor(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
968
623
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1003,15 +658,6 @@ export function getDefaultElectricalPowerMeasurementClusterServer(voltage = null
|
|
|
1003
658
|
frequency: frequency,
|
|
1004
659
|
});
|
|
1005
660
|
}
|
|
1006
|
-
/**
|
|
1007
|
-
* Get the default Electrical Apparent Power Measurement Cluster Server with features AlternatingCurrent.
|
|
1008
|
-
*
|
|
1009
|
-
* @param {number} voltage - The voltage value in millivolts.
|
|
1010
|
-
* @param {number} apparentCurrent - The current value in milliamperes.
|
|
1011
|
-
* @param {number} apparentPower - The apparent power value in millivoltamperes.
|
|
1012
|
-
* @param {number} frequency - The frequency value in millihertz.
|
|
1013
|
-
* @returns {Behavior.Options<ElectricalPowerMeasurementServer>} - The default options for the Electrical Apparent Power Measurement Cluster Server.
|
|
1014
|
-
*/
|
|
1015
661
|
export function getApparentElectricalPowerMeasurementClusterServer(voltage = null, apparentCurrent = null, apparentPower = null, frequency = null) {
|
|
1016
662
|
return optionsFor(ElectricalPowerMeasurementServer.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
1017
663
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
@@ -1052,4 +698,3 @@ export function getApparentElectricalPowerMeasurementClusterServer(voltage = nul
|
|
|
1052
698
|
frequency: frequency,
|
|
1053
699
|
});
|
|
1054
700
|
}
|
|
1055
|
-
//# sourceMappingURL=matterbridgeEndpointHelpers.js.map
|