matterbridge 1.6.1 → 1.6.3-dev.1
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 +45 -1
- package/README-DEV.md +0 -4
- package/README-NGINX.md +63 -0
- package/README.md +7 -3
- package/dist/cli.js +15 -7
- package/dist/cli.js.map +1 -1
- package/dist/deviceManager.d.ts +1 -1
- package/dist/deviceManager.d.ts.map +1 -1
- package/dist/deviceManager.js +1 -1
- package/dist/deviceManager.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -10
- package/dist/index.js.map +1 -1
- package/dist/matter/export.d.ts +5 -0
- package/dist/matter/export.d.ts.map +1 -0
- package/dist/matter/export.js +5 -0
- package/dist/matter/export.js.map +1 -0
- package/dist/matterbridge.d.ts +12 -7
- package/dist/matterbridge.d.ts.map +1 -1
- package/dist/matterbridge.js +133 -83
- package/dist/matterbridge.js.map +1 -1
- package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -1
- package/dist/matterbridgeAccessoryPlatform.js.map +1 -1
- package/dist/matterbridgeBehaviors.d.ts +1123 -0
- package/dist/matterbridgeBehaviors.d.ts.map +1 -0
- package/dist/matterbridgeBehaviors.js +281 -0
- package/dist/matterbridgeBehaviors.js.map +1 -0
- package/dist/matterbridgeDevice.d.ts +2089 -1511
- package/dist/matterbridgeDevice.d.ts.map +1 -1
- package/dist/matterbridgeDevice.js +243 -209
- package/dist/matterbridgeDevice.js.map +1 -1
- package/dist/matterbridgeDeviceTypes.d.ts +65 -0
- package/dist/matterbridgeDeviceTypes.d.ts.map +1 -0
- package/dist/matterbridgeDeviceTypes.js +307 -0
- package/dist/matterbridgeDeviceTypes.js.map +1 -0
- package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -1
- package/dist/matterbridgeDynamicPlatform.js.map +1 -1
- package/dist/matterbridgeEdge.d.ts +19 -20
- package/dist/matterbridgeEdge.d.ts.map +1 -1
- package/dist/matterbridgeEdge.js +505 -102
- package/dist/matterbridgeEdge.js.map +1 -1
- package/dist/matterbridgeEndpoint.d.ts +3554 -2297
- package/dist/matterbridgeEndpoint.d.ts.map +1 -1
- package/dist/matterbridgeEndpoint.js +709 -476
- package/dist/matterbridgeEndpoint.js.map +1 -1
- package/dist/matterbridgePlatform.d.ts +4 -3
- package/dist/matterbridgePlatform.d.ts.map +1 -1
- package/dist/matterbridgePlatform.js +10 -2
- package/dist/matterbridgePlatform.js.map +1 -1
- package/dist/matterbridgeTypes.d.ts +7 -8
- package/dist/matterbridgeTypes.d.ts.map +1 -1
- package/dist/matterbridgeTypes.js.map +1 -1
- package/dist/matterbridgeWebsocket.d.ts +1 -1
- package/dist/matterbridgeWebsocket.d.ts.map +1 -1
- package/dist/matterbridgeWebsocket.js +5 -3
- package/dist/matterbridgeWebsocket.js.map +1 -1
- package/dist/pluginManager.d.ts.map +1 -1
- package/dist/pluginManager.js +16 -7
- package/dist/pluginManager.js.map +1 -1
- package/dist/utils/colorUtils.js +1 -1
- package/dist/utils/colorUtils.js.map +1 -1
- package/dist/utils/utils.d.ts +21 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +49 -3
- package/dist/utils/utils.js.map +1 -1
- package/frontend/build/asset-manifest.json +62 -6
- package/frontend/build/index.html +1 -1
- package/frontend/build/static/css/main.823e08b6.css +2 -0
- package/frontend/build/static/css/main.823e08b6.css.map +1 -0
- package/frontend/build/static/js/main.a14c87e7.js +115 -0
- package/frontend/build/static/js/{main.045d08f7.js.LICENSE.txt → main.a14c87e7.js.LICENSE.txt} +3 -3
- package/frontend/build/static/js/main.a14c87e7.js.map +1 -0
- package/frontend/build/static/media/roboto-cyrillic-300-normal.1b79538ccd585c259996.woff2 +0 -0
- package/frontend/build/static/media/roboto-cyrillic-300-normal.5f077fd7b977d1715acf.woff +0 -0
- package/frontend/build/static/media/roboto-cyrillic-400-normal.5d2930082227d172f62c.woff +0 -0
- package/frontend/build/static/media/roboto-cyrillic-400-normal.a9e19870cf6c4b973427.woff2 +0 -0
- package/frontend/build/static/media/roboto-cyrillic-500-normal.0ae2428323939af5e1ad.woff2 +0 -0
- package/frontend/build/static/media/roboto-cyrillic-500-normal.dd7bc8a52c6c70c5a3f5.woff +0 -0
- package/frontend/build/static/media/roboto-cyrillic-700-normal.3f6e1548bd5175a8c342.woff +0 -0
- package/frontend/build/static/media/roboto-cyrillic-700-normal.4fdfc29a10e7d4b7c527.woff2 +0 -0
- package/frontend/build/static/media/roboto-cyrillic-ext-300-normal.795dbc8140e3fef82983.woff +0 -0
- package/frontend/build/static/media/roboto-cyrillic-ext-300-normal.80947a31d23c70204b47.woff2 +0 -0
- package/frontend/build/static/media/roboto-cyrillic-ext-400-normal.135d076fa32aa0b4d105.woff +0 -0
- package/frontend/build/static/media/roboto-cyrillic-ext-400-normal.5cec61a21cc20180fbe1.woff2 +0 -0
- package/frontend/build/static/media/roboto-cyrillic-ext-500-normal.6de16332fda843a3dc3d.woff2 +0 -0
- package/frontend/build/static/media/roboto-cyrillic-ext-500-normal.c0a0638f90b31d6454ba.woff +0 -0
- package/frontend/build/static/media/roboto-cyrillic-ext-700-normal.4750292c47fa2bc6ac1a.woff2 +0 -0
- package/frontend/build/static/media/roboto-cyrillic-ext-700-normal.ca247189fc12d00de361.woff +0 -0
- package/frontend/build/static/media/roboto-greek-300-normal.285f3e6261d8eb20417d.woff2 +0 -0
- package/frontend/build/static/media/roboto-greek-300-normal.889beddda1c9bd9f97df.woff +0 -0
- package/frontend/build/static/media/roboto-greek-400-normal.160a791a8e4f46bca3cc.woff +0 -0
- package/frontend/build/static/media/roboto-greek-400-normal.2c32b1315be61477013a.woff2 +0 -0
- package/frontend/build/static/media/roboto-greek-500-normal.60810e07c7b0273013aa.woff +0 -0
- package/frontend/build/static/media/roboto-greek-500-normal.f95e757c5483310f9c11.woff2 +0 -0
- package/frontend/build/static/media/roboto-greek-700-normal.77dd370f2001e184ba0d.woff2 +0 -0
- package/frontend/build/static/media/roboto-greek-700-normal.df87b053fae3d7ad5f7a.woff +0 -0
- package/frontend/build/static/media/roboto-greek-ext-300-normal.b590dbe5c639944366d1.woff +0 -0
- package/frontend/build/static/media/roboto-greek-ext-300-normal.d6049cb54aa6fbe14c42.woff2 +0 -0
- package/frontend/build/static/media/roboto-greek-ext-400-normal.16eb83b4a3b1ea994243.woff +0 -0
- package/frontend/build/static/media/roboto-greek-ext-400-normal.1df4abad55796d11a0c8.woff2 +0 -0
- package/frontend/build/static/media/roboto-greek-ext-500-normal.4a96ba31abcce0f5d52b.woff2 +0 -0
- package/frontend/build/static/media/roboto-greek-ext-500-normal.fd28d9c008bf3af1bed7.woff +0 -0
- package/frontend/build/static/media/roboto-greek-ext-700-normal.2dd6febad11502dec6a6.woff2 +0 -0
- package/frontend/build/static/media/roboto-greek-ext-700-normal.4abdc9fff4507f17d726.woff +0 -0
- package/frontend/build/static/media/roboto-latin-300-normal.b850f1ff581ea232fac9.woff2 +0 -0
- package/frontend/build/static/media/roboto-latin-300-normal.c4bc0593c9954d79cb3a.woff +0 -0
- package/frontend/build/static/media/roboto-latin-400-normal.047a7839f69b209db815.woff +0 -0
- package/frontend/build/static/media/roboto-latin-400-normal.297d48e1b5a10c0831a9.woff2 +0 -0
- package/frontend/build/static/media/roboto-latin-500-normal.68d40d6d01c6f85d24ba.woff +0 -0
- package/frontend/build/static/media/roboto-latin-500-normal.7077203b1982951ecf76.woff2 +0 -0
- package/frontend/build/static/media/roboto-latin-700-normal.4535474e1cf8598695ad.woff2 +0 -0
- package/frontend/build/static/media/roboto-latin-700-normal.9f6a16a7770c87b2042b.woff +0 -0
- package/frontend/build/static/media/roboto-latin-ext-300-normal.14982a9e4857a93b6dce.woff +0 -0
- package/frontend/build/static/media/roboto-latin-ext-300-normal.97cbc447d4a8d41a9543.woff2 +0 -0
- package/frontend/build/static/media/roboto-latin-ext-400-normal.27da5b36b6d3a16f53f4.woff +0 -0
- package/frontend/build/static/media/roboto-latin-ext-400-normal.2eeae187764baf05867d.woff2 +0 -0
- package/frontend/build/static/media/roboto-latin-ext-500-normal.06c30711d588145a4541.woff +0 -0
- package/frontend/build/static/media/roboto-latin-ext-500-normal.9a18d7bb9ff7a6af7b32.woff2 +0 -0
- package/frontend/build/static/media/roboto-latin-ext-700-normal.18841836e391d39e83a8.woff2 +0 -0
- package/frontend/build/static/media/roboto-latin-ext-700-normal.3c5bcdd0e69c4c3ffafe.woff +0 -0
- package/frontend/build/static/media/roboto-vietnamese-300-normal.c96b16e5c05c7b7c3e89.woff2 +0 -0
- package/frontend/build/static/media/roboto-vietnamese-300-normal.f5e7cea32756dfe7af40.woff +0 -0
- package/frontend/build/static/media/roboto-vietnamese-400-normal.0dc97c66f9b542d6fa17.woff +0 -0
- package/frontend/build/static/media/roboto-vietnamese-400-normal.d3f8e26d6c27de8102b6.woff2 +0 -0
- package/frontend/build/static/media/roboto-vietnamese-500-normal.090fabef926bdc0e9b9f.woff2 +0 -0
- package/frontend/build/static/media/roboto-vietnamese-500-normal.23b7b8a2524d2d4b637b.woff +0 -0
- package/frontend/build/static/media/roboto-vietnamese-700-normal.0a79a9fabfc32e33f360.woff2 +0 -0
- package/frontend/build/static/media/roboto-vietnamese-700-normal.35ed0597568ff6f19c16.woff +0 -0
- package/npm-shrinkwrap.json +117 -36
- package/package.json +8 -3
- package/dist/matterbridgeController.d.ts +0 -24
- package/dist/matterbridgeController.d.ts.map +0 -1
- package/dist/matterbridgeController.js +0 -386
- package/dist/matterbridgeController.js.map +0 -1
- package/frontend/build/static/css/main.1cf003ae.css +0 -2
- package/frontend/build/static/css/main.1cf003ae.css.map +0 -1
- package/frontend/build/static/js/main.045d08f7.js +0 -3
- package/frontend/build/static/js/main.045d08f7.js.map +0 -1
|
@@ -20,179 +20,19 @@
|
|
|
20
20
|
* See the License for the specific language governing permissions and
|
|
21
21
|
* limitations under the License. *
|
|
22
22
|
*/
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
23
|
+
// @matter
|
|
24
|
+
import { AirQuality, AirQualityCluster, BasicInformationCluster, BooleanState, BooleanStateCluster, BooleanStateConfiguration, BooleanStateConfigurationCluster, BridgedDeviceBasicInformationCluster, CarbonDioxideConcentrationMeasurement, CarbonDioxideConcentrationMeasurementCluster, CarbonMonoxideConcentrationMeasurement, CarbonMonoxideConcentrationMeasurementCluster, ColorControl, ColorControlCluster, ConcentrationMeasurement, Descriptor, DescriptorCluster, DeviceEnergyManagement, DeviceEnergyManagementCluster, DeviceEnergyManagementMode, DeviceEnergyManagementModeCluster, DoorLock, DoorLockCluster, ElectricalEnergyMeasurement, ElectricalEnergyMeasurementCluster, ElectricalPowerMeasurement, ElectricalPowerMeasurementCluster, FanControl, FanControlCluster, FlowMeasurement, FlowMeasurementCluster, FormaldehydeConcentrationMeasurement, FormaldehydeConcentrationMeasurementCluster, Groups, GroupsCluster, Identify, IdentifyCluster, IlluminanceMeasurement, IlluminanceMeasurementCluster, LevelControl, LevelControlCluster, ModeSelectCluster, NitrogenDioxideConcentrationMeasurement, NitrogenDioxideConcentrationMeasurementCluster, OccupancySensing, OccupancySensingCluster, OnOff, OnOffCluster, OzoneConcentrationMeasurement, OzoneConcentrationMeasurementCluster, Pm10ConcentrationMeasurement, Pm10ConcentrationMeasurementCluster, Pm1ConcentrationMeasurement, Pm1ConcentrationMeasurementCluster, Pm25ConcentrationMeasurement, Pm25ConcentrationMeasurementCluster, PowerSource, PowerSourceCluster, PowerSourceConfigurationCluster, PowerTopology, PowerTopologyCluster, PressureMeasurement, PressureMeasurementCluster, RadonConcentrationMeasurement, RadonConcentrationMeasurementCluster, RelativeHumidityMeasurement, RelativeHumidityMeasurementCluster, SmokeCoAlarm, SmokeCoAlarmCluster, Switch, SwitchCluster, TemperatureMeasurement, TemperatureMeasurementCluster, Thermostat, ThermostatCluster, ThreadNetworkDiagnostics, ThreadNetworkDiagnosticsCluster, TimeSynchronization, TimeSynchronizationCluster, TotalVolatileOrganicCompoundsConcentrationMeasurement, TotalVolatileOrganicCompoundsConcentrationMeasurementCluster, WindowCovering, WindowCoveringCluster, } from '@matter/main/clusters';
|
|
25
|
+
import { Specification } from '@matter/main/model';
|
|
26
|
+
import { EndpointNumber, extendPublicHandlerMethods, VendorId } from '@matter/main';
|
|
27
|
+
import { MeasurementType, getClusterNameById } from '@matter/main/types';
|
|
28
|
+
// @project-chip
|
|
29
|
+
import { Device, Endpoint } from '@project-chip/matter.js/device';
|
|
30
|
+
import { GroupsClusterHandler, ClusterServer } from '@project-chip/matter.js/cluster';
|
|
31
|
+
// AnsiLogger module
|
|
32
|
+
import { AnsiLogger, CYAN, YELLOW, db, hk, or, zb, debugStringify } from 'node-ansi-logger';
|
|
33
|
+
// Node.js modules
|
|
29
34
|
import { createHash } from 'crypto';
|
|
30
|
-
|
|
31
|
-
export const airQualitySensor = DeviceTypeDefinition({
|
|
32
|
-
name: 'MA-airQualitySensor',
|
|
33
|
-
code: 0x002c,
|
|
34
|
-
deviceClass: DeviceClasses.Simple,
|
|
35
|
-
revision: 1,
|
|
36
|
-
requiredServerClusters: [Identify.Cluster.id, AirQuality.Cluster.id],
|
|
37
|
-
optionalServerClusters: [
|
|
38
|
-
TemperatureMeasurement.Cluster.id,
|
|
39
|
-
RelativeHumidityMeasurement.Cluster.id,
|
|
40
|
-
CarbonMonoxideConcentrationMeasurement.Cluster.id,
|
|
41
|
-
CarbonDioxideConcentrationMeasurement.Cluster.id,
|
|
42
|
-
NitrogenDioxideConcentrationMeasurement.Cluster.id,
|
|
43
|
-
OzoneConcentrationMeasurement.Cluster.id,
|
|
44
|
-
FormaldehydeConcentrationMeasurement.Cluster.id,
|
|
45
|
-
Pm1ConcentrationMeasurement.Cluster.id,
|
|
46
|
-
Pm25ConcentrationMeasurement.Cluster.id,
|
|
47
|
-
Pm10ConcentrationMeasurement.Cluster.id,
|
|
48
|
-
RadonConcentrationMeasurement.Cluster.id,
|
|
49
|
-
TotalVolatileOrganicCompoundsConcentrationMeasurement.Cluster.id,
|
|
50
|
-
],
|
|
51
|
-
});
|
|
52
|
-
export const waterFreezeDetector = DeviceTypeDefinition({
|
|
53
|
-
name: 'MA-waterFreezeDetector',
|
|
54
|
-
code: 0x0041,
|
|
55
|
-
deviceClass: DeviceClasses.Simple,
|
|
56
|
-
revision: 1,
|
|
57
|
-
requiredServerClusters: [Identify.Cluster.id, BooleanState.Cluster.id],
|
|
58
|
-
optionalServerClusters: [BooleanStateConfiguration.Cluster.id],
|
|
59
|
-
});
|
|
60
|
-
export const waterLeakDetector = DeviceTypeDefinition({
|
|
61
|
-
name: 'MA-waterLeakDetector',
|
|
62
|
-
code: 0x0043,
|
|
63
|
-
deviceClass: DeviceClasses.Simple,
|
|
64
|
-
revision: 1,
|
|
65
|
-
requiredServerClusters: [Identify.Cluster.id, BooleanState.Cluster.id],
|
|
66
|
-
optionalServerClusters: [BooleanStateConfiguration.Cluster.id],
|
|
67
|
-
});
|
|
68
|
-
export const rainSensor = DeviceTypeDefinition({
|
|
69
|
-
name: 'MA-rainSensor',
|
|
70
|
-
code: 0x0044,
|
|
71
|
-
deviceClass: DeviceClasses.Simple,
|
|
72
|
-
revision: 1,
|
|
73
|
-
requiredServerClusters: [Identify.Cluster.id, BooleanState.Cluster.id],
|
|
74
|
-
optionalServerClusters: [BooleanStateConfiguration.Cluster.id],
|
|
75
|
-
});
|
|
76
|
-
export const smokeCoAlarm = DeviceTypeDefinition({
|
|
77
|
-
name: 'MA-smokeCoAlarm',
|
|
78
|
-
code: 0x0076,
|
|
79
|
-
deviceClass: DeviceClasses.Simple,
|
|
80
|
-
revision: 1,
|
|
81
|
-
requiredServerClusters: [Identify.Cluster.id, SmokeCoAlarm.Cluster.id],
|
|
82
|
-
optionalServerClusters: [Groups.Cluster.id, TemperatureMeasurement.Cluster.id, RelativeHumidityMeasurement.Cluster.id, CarbonMonoxideConcentrationMeasurement.Cluster.id],
|
|
83
|
-
});
|
|
84
|
-
export const electricalSensor = DeviceTypeDefinition({
|
|
85
|
-
name: 'MA-electricalSensor',
|
|
86
|
-
code: 0x0510,
|
|
87
|
-
deviceClass: DeviceClasses.Utility,
|
|
88
|
-
revision: 1,
|
|
89
|
-
requiredServerClusters: [PowerTopology.Cluster.id],
|
|
90
|
-
optionalServerClusters: [ElectricalPowerMeasurement.Cluster.id, ElectricalEnergyMeasurement.Cluster.id],
|
|
91
|
-
});
|
|
92
|
-
export const deviceEnergyManagement = DeviceTypeDefinition({
|
|
93
|
-
name: 'MA-deviceEnergyManagement',
|
|
94
|
-
code: 0x050d,
|
|
95
|
-
deviceClass: DeviceClasses.Utility,
|
|
96
|
-
revision: 1,
|
|
97
|
-
requiredServerClusters: [DeviceEnergyManagement.Cluster.id, DeviceEnergyManagementMode.Cluster.id],
|
|
98
|
-
optionalServerClusters: [],
|
|
99
|
-
});
|
|
100
|
-
export const bridge = DeviceTypeDefinition({
|
|
101
|
-
name: 'MA-aggregator',
|
|
102
|
-
code: 0x000e,
|
|
103
|
-
deviceClass: DeviceClasses.Dynamic,
|
|
104
|
-
revision: 1,
|
|
105
|
-
optionalServerClusters: [ActionsCluster.id],
|
|
106
|
-
});
|
|
107
|
-
export const powerSource = DeviceTypeDefinition({
|
|
108
|
-
name: 'MA-powerSource',
|
|
109
|
-
code: 0x0011,
|
|
110
|
-
deviceClass: DeviceClasses.Utility,
|
|
111
|
-
revision: 1,
|
|
112
|
-
requiredServerClusters: [PowerSource.Cluster.id],
|
|
113
|
-
optionalServerClusters: [],
|
|
114
|
-
});
|
|
115
|
-
export const bridgedNode = DeviceTypeDefinition({
|
|
116
|
-
name: 'MA-bridgedNode',
|
|
117
|
-
code: 0x0013,
|
|
118
|
-
deviceClass: DeviceClasses.Utility,
|
|
119
|
-
revision: 2,
|
|
120
|
-
requiredServerClusters: [BridgedDeviceBasicInformation.Cluster.id],
|
|
121
|
-
optionalServerClusters: [PowerSource.Cluster.id],
|
|
122
|
-
});
|
|
123
|
-
export const genericSwitch = DeviceTypeDefinition({
|
|
124
|
-
name: 'MA-genericswitch',
|
|
125
|
-
code: 0x000f,
|
|
126
|
-
deviceClass: DeviceClasses.Simple,
|
|
127
|
-
revision: 1,
|
|
128
|
-
requiredServerClusters: [IdentifyCluster.id, SwitchCluster.id],
|
|
129
|
-
optionalServerClusters: [FixedLabelCluster.id],
|
|
130
|
-
});
|
|
131
|
-
export const onOffLight = DeviceTypeDefinition({
|
|
132
|
-
name: 'MA-onofflight',
|
|
133
|
-
code: 0x0100,
|
|
134
|
-
deviceClass: DeviceClasses.Simple,
|
|
135
|
-
revision: 2,
|
|
136
|
-
requiredServerClusters: [Identify.Cluster.id, Groups.Cluster.id, /* Scenes.Cluster.id,*/ OnOff.Cluster.id],
|
|
137
|
-
optionalServerClusters: [LevelControl.Cluster.id, ColorControl.Cluster.id],
|
|
138
|
-
});
|
|
139
|
-
export const dimmableLight = DeviceTypeDefinition({
|
|
140
|
-
name: 'MA-dimmablelight',
|
|
141
|
-
code: 0x0101,
|
|
142
|
-
deviceClass: DeviceClasses.Simple,
|
|
143
|
-
revision: 2,
|
|
144
|
-
requiredServerClusters: [Identify.Cluster.id, Groups.Cluster.id, /* Scenes.Cluster.id,*/ OnOff.Cluster.id, LevelControl.Cluster.id],
|
|
145
|
-
optionalServerClusters: [ColorControl.Cluster.id],
|
|
146
|
-
});
|
|
147
|
-
export const colorTemperatureLight = DeviceTypeDefinition({
|
|
148
|
-
name: 'MA-colortemperaturelight',
|
|
149
|
-
code: 0x010c,
|
|
150
|
-
deviceClass: DeviceClasses.Simple,
|
|
151
|
-
revision: 2,
|
|
152
|
-
requiredServerClusters: [Identify.Cluster.id, Groups.Cluster.id, /* Scenes.Cluster.id,*/ OnOff.Cluster.id, LevelControl.Cluster.id, ColorControl.Cluster.id],
|
|
153
|
-
optionalServerClusters: [],
|
|
154
|
-
});
|
|
155
|
-
export const onOffOutlet = DeviceTypeDefinition({
|
|
156
|
-
name: 'MA-onoffpluginunit',
|
|
157
|
-
code: 0x010a,
|
|
158
|
-
deviceClass: DeviceClasses.Simple,
|
|
159
|
-
revision: 2,
|
|
160
|
-
requiredServerClusters: [Identify.Cluster.id, Groups.Cluster.id, /* Scenes.Cluster.id,*/ OnOff.Cluster.id],
|
|
161
|
-
optionalServerClusters: [LevelControl.Cluster.id],
|
|
162
|
-
});
|
|
163
|
-
export const dimmableOutlet = DeviceTypeDefinition({
|
|
164
|
-
name: 'MA-dimmablepluginunit',
|
|
165
|
-
code: 0x010b,
|
|
166
|
-
deviceClass: DeviceClasses.Simple,
|
|
167
|
-
revision: 2,
|
|
168
|
-
requiredServerClusters: [Identify.Cluster.id, Groups.Cluster.id, /* Scenes.Cluster.id,*/ OnOff.Cluster.id, LevelControl.Cluster.id],
|
|
169
|
-
optionalServerClusters: [],
|
|
170
|
-
});
|
|
171
|
-
// Custom device types: switch without ClientClusters
|
|
172
|
-
export const onOffSwitch = DeviceTypeDefinition({
|
|
173
|
-
name: 'MA-onoffswitch',
|
|
174
|
-
code: 0x0103,
|
|
175
|
-
deviceClass: DeviceClasses.Simple,
|
|
176
|
-
revision: 2,
|
|
177
|
-
requiredServerClusters: [Identify.Cluster.id, Groups.Cluster.id, /* Scenes.Cluster.id,*/ OnOff.Cluster.id],
|
|
178
|
-
optionalServerClusters: [LevelControl.Cluster.id, ColorControl.Cluster.id],
|
|
179
|
-
});
|
|
180
|
-
export const dimmableSwitch = DeviceTypeDefinition({
|
|
181
|
-
name: 'MA-dimmableswitch',
|
|
182
|
-
code: 0x0104,
|
|
183
|
-
deviceClass: DeviceClasses.Simple,
|
|
184
|
-
revision: 2,
|
|
185
|
-
requiredServerClusters: [Identify.Cluster.id, Groups.Cluster.id, /* Scenes.Cluster.id,*/ OnOff.Cluster.id, LevelControl.Cluster.id],
|
|
186
|
-
optionalServerClusters: [ColorControl.Cluster.id],
|
|
187
|
-
});
|
|
188
|
-
export const colorTemperatureSwitch = DeviceTypeDefinition({
|
|
189
|
-
name: 'MA-colortemperatureswitch',
|
|
190
|
-
code: 0x0105,
|
|
191
|
-
deviceClass: DeviceClasses.Simple,
|
|
192
|
-
revision: 2,
|
|
193
|
-
requiredServerClusters: [Identify.Cluster.id, Groups.Cluster.id, /* Scenes.Cluster.id,*/ OnOff.Cluster.id, LevelControl.Cluster.id, ColorControl.Cluster.id],
|
|
194
|
-
optionalServerClusters: [],
|
|
195
|
-
});
|
|
35
|
+
import { bridgedNode } from './matterbridgeDeviceTypes.js';
|
|
196
36
|
export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
197
37
|
static bridgeMode = '';
|
|
198
38
|
static logLevel = "info" /* LogLevel.INFO */;
|
|
@@ -201,6 +41,14 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
201
41
|
serialNumber = undefined;
|
|
202
42
|
deviceName = undefined;
|
|
203
43
|
uniqueId = undefined;
|
|
44
|
+
vendorId = undefined;
|
|
45
|
+
vendorName = undefined;
|
|
46
|
+
productId = undefined;
|
|
47
|
+
productName = undefined;
|
|
48
|
+
softwareVersion = undefined;
|
|
49
|
+
softwareVersionString = undefined;
|
|
50
|
+
hardwareVersion = undefined;
|
|
51
|
+
hardwareVersionString = undefined;
|
|
204
52
|
/**
|
|
205
53
|
* Create a Matterbridge device.
|
|
206
54
|
* @constructor
|
|
@@ -282,14 +130,23 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
282
130
|
*
|
|
283
131
|
* @param {string} endpointName - The name of the new enpoint to add.
|
|
284
132
|
* @param {AtLeastOne<DeviceTypeDefinition>} deviceTypes - The device types to add.
|
|
285
|
-
* @param {ClusterId[]} includeServerList - The list of cluster IDs to include.
|
|
133
|
+
* @param {ClusterId[]} [includeServerList=[]] - The list of cluster IDs to include.
|
|
134
|
+
* @param {EndpointOptions} [options={}] - The options for the device.
|
|
135
|
+
* @param {boolean} [debug=false] - Whether to enable debug logging.
|
|
286
136
|
* @returns {Endpoint} - The child endpoint that was found or added.
|
|
287
137
|
*/
|
|
288
|
-
|
|
138
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
139
|
+
addChildDeviceTypeWithClusterServer(endpointName, deviceTypes, includeServerList = [], options = {}, debug = false) {
|
|
289
140
|
this.log.debug(`addChildDeviceTypeWithClusterServer: ${CYAN}${endpointName}${db}`);
|
|
290
141
|
let child = this.getChildEndpoints().find((endpoint) => endpoint.uniqueStorageKey === endpointName);
|
|
291
142
|
if (!child) {
|
|
292
143
|
child = new Endpoint(deviceTypes, { uniqueStorageKey: endpointName });
|
|
144
|
+
if ('tagList' in options) {
|
|
145
|
+
for (const tag of options.tagList) {
|
|
146
|
+
this.log.debug(`- with tagList: mfgCode ${CYAN}${tag.mfgCode}${db} namespaceId ${CYAN}${tag.namespaceId}${db} tag ${CYAN}${tag.tag}${db} label ${CYAN}${tag.label}${db}`);
|
|
147
|
+
this.addTagList(child, tag.mfgCode, tag.namespaceId, tag.tag, tag.label);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
293
150
|
this.addChildEndpoint(child);
|
|
294
151
|
}
|
|
295
152
|
deviceTypes.forEach((deviceType) => {
|
|
@@ -464,19 +321,18 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
464
321
|
endpoint = this;
|
|
465
322
|
const clusterServer = endpoint.getClusterServerById(clusterId);
|
|
466
323
|
if (!clusterServer) {
|
|
467
|
-
log
|
|
324
|
+
this.log.error(`getAttribute error: Cluster ${clusterId} not found on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
468
325
|
return undefined;
|
|
469
326
|
}
|
|
470
327
|
const capitalizedAttributeName = attribute.charAt(0).toUpperCase() + attribute.slice(1);
|
|
471
328
|
if (!clusterServer.isAttributeSupportedByName(attribute) && !clusterServer.isAttributeSupportedByName(capitalizedAttributeName)) {
|
|
472
|
-
|
|
473
|
-
log.error(`getAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
329
|
+
this.log.error(`getAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
474
330
|
return undefined;
|
|
475
331
|
}
|
|
476
332
|
// Find the getter method
|
|
477
333
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
478
334
|
if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
|
|
479
|
-
log
|
|
335
|
+
this.log.error(`getAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
480
336
|
return undefined;
|
|
481
337
|
}
|
|
482
338
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
@@ -500,19 +356,18 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
500
356
|
endpoint = this;
|
|
501
357
|
const clusterServer = endpoint.getClusterServerById(clusterId);
|
|
502
358
|
if (!clusterServer) {
|
|
503
|
-
log
|
|
359
|
+
this.log.error(`setAttribute error: Cluster ${clusterId} not found on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
504
360
|
return false;
|
|
505
361
|
}
|
|
506
362
|
const capitalizedAttributeName = attribute.charAt(0).toUpperCase() + attribute.slice(1);
|
|
507
363
|
if (!clusterServer.isAttributeSupportedByName(attribute) && !clusterServer.isAttributeSupportedByName(capitalizedAttributeName)) {
|
|
508
|
-
|
|
509
|
-
log.error(`setAttribute error: Attribute ${attribute} not found on Cluster ${clusterId} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
364
|
+
this.log.error(`setAttribute error: Attribute ${attribute} not found on Cluster ${clusterId} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
510
365
|
return false;
|
|
511
366
|
}
|
|
512
367
|
// Find the getter method
|
|
513
368
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
514
369
|
if (!clusterServer[`get${capitalizedAttributeName}Attribute`]) {
|
|
515
|
-
log
|
|
370
|
+
this.log.error(`setAttribute error: Getter get${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
516
371
|
return false;
|
|
517
372
|
}
|
|
518
373
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
@@ -520,7 +375,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
520
375
|
// Find the setter method
|
|
521
376
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
522
377
|
if (!clusterServer[`set${capitalizedAttributeName}Attribute`]) {
|
|
523
|
-
log
|
|
378
|
+
this.log.error(`setAttribute error: Setter set${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
524
379
|
return false;
|
|
525
380
|
}
|
|
526
381
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
@@ -548,19 +403,18 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
548
403
|
endpoint = this;
|
|
549
404
|
const clusterServer = endpoint.getClusterServerById(clusterId);
|
|
550
405
|
if (!clusterServer) {
|
|
551
|
-
log
|
|
406
|
+
this.log.error(`subscribeAttribute error: Cluster ${clusterId} not found on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
552
407
|
return false;
|
|
553
408
|
}
|
|
554
409
|
const capitalizedAttributeName = attribute.charAt(0).toUpperCase() + attribute.slice(1);
|
|
555
410
|
if (!clusterServer.isAttributeSupportedByName(attribute) && !clusterServer.isAttributeSupportedByName(capitalizedAttributeName)) {
|
|
556
|
-
|
|
557
|
-
log.error(`subscribeAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
411
|
+
this.log.error(`subscribeAttribute error: Attribute ${attribute} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
558
412
|
return false;
|
|
559
413
|
}
|
|
560
414
|
// Find the subscribe method
|
|
561
415
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
562
416
|
if (!clusterServer[`subscribe${capitalizedAttributeName}Attribute`]) {
|
|
563
|
-
log
|
|
417
|
+
this.log.error(`subscribeAttribute error: subscribe${capitalizedAttributeName}Attribute not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
564
418
|
return false;
|
|
565
419
|
}
|
|
566
420
|
// Subscribe to the attribute
|
|
@@ -570,6 +424,82 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
570
424
|
log?.info(`${db}Subscribe endpoint ${or}${endpoint.name}:${endpoint.number}${db} attribute ${hk}${clusterServer.name}.${capitalizedAttributeName}${db}`);
|
|
571
425
|
return true;
|
|
572
426
|
}
|
|
427
|
+
/**
|
|
428
|
+
* Triggers the specified event of the specified cluster from the given endpoint and cluster.
|
|
429
|
+
*
|
|
430
|
+
* @param {ClusterId} clusterId - The ID of the cluster to retrieve the event from.
|
|
431
|
+
* @param {string} event - The name of the event to trigger.
|
|
432
|
+
* @param {Record<string, any>} payload - The payload of the event to trigger.
|
|
433
|
+
* @param {AnsiLogger} [log] - Optional logger for error and info messages.
|
|
434
|
+
* @param {Endpoint} [endpoint] - Optional the child endpoint to retrieve the event from.
|
|
435
|
+
*/
|
|
436
|
+
triggerEvent(clusterId, event, payload, log, endpoint) {
|
|
437
|
+
if (!endpoint)
|
|
438
|
+
endpoint = this;
|
|
439
|
+
if (!endpoint.number)
|
|
440
|
+
return;
|
|
441
|
+
const clusterServer = endpoint.getClusterServerById(clusterId);
|
|
442
|
+
if (!clusterServer) {
|
|
443
|
+
this.log.error(`triggerEvent error: Cluster ${clusterId} not found on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
const capitalizedEventName = event.charAt(0).toUpperCase() + event.slice(1);
|
|
447
|
+
if (!clusterServer.isEventSupportedByName(event) && !clusterServer.isEventSupportedByName(capitalizedEventName)) {
|
|
448
|
+
this.log.error(`triggerEvent error: Event ${event} not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
// Find the getter method
|
|
452
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
453
|
+
if (!clusterServer[`trigger${capitalizedEventName}Event`]) {
|
|
454
|
+
this.log.error(`triggerEvent error: Trigger trigger${capitalizedEventName}Event not found on Cluster ${clusterServer.name} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-empty-object-type
|
|
458
|
+
const trigger = clusterServer[`trigger${capitalizedEventName}Event`];
|
|
459
|
+
trigger(payload);
|
|
460
|
+
log?.info(`${db}Trigger event ${hk}${clusterServer.name}.${capitalizedEventName}${db} on endpoint ${or}${endpoint.name}:${endpoint.number}${db}`);
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Adds a tag to the tag list of the specified endpoint.
|
|
464
|
+
*
|
|
465
|
+
* @param {Endpoint} endpoint - The endpoint to add the tag to.
|
|
466
|
+
* @param {VendorId | null} mfgCode - The manufacturer code.
|
|
467
|
+
* @param {number} namespaceId - The namespace ID of the tag.
|
|
468
|
+
* @param {number} tag - The tag number.
|
|
469
|
+
* @param {string | null} [label=null] - The label for the tag.
|
|
470
|
+
*
|
|
471
|
+
* @remarks
|
|
472
|
+
* This method is used to add a tag to the tag list of a given endpoint.
|
|
473
|
+
* If the tag list already exists, the new tag is added to the existing list. Otherwise, a new tag list is created with the provided tag.
|
|
474
|
+
*
|
|
475
|
+
* Example usage:
|
|
476
|
+
* ```typescript
|
|
477
|
+
* this.addTagList(endpoint, null, NumberTag.One.namespaceId, NumberTag.One.tag, 'Label');
|
|
478
|
+
* this.addTagList(endpoint, null, SwitchesTag.Custom.namespaceId, SwitchesTag.Custom.tag, 'Label');
|
|
479
|
+
* ```
|
|
480
|
+
*/
|
|
481
|
+
addTagList(endpoint, mfgCode, namespaceId, tag, label) {
|
|
482
|
+
const descriptor = endpoint.getClusterServer(DescriptorCluster.with(Descriptor.Feature.TagList));
|
|
483
|
+
if (!descriptor) {
|
|
484
|
+
this.log.error(`addTagList: descriptor cluster not found on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
// tagList: { mfgCode: VendorId | null; namespaceId: number; tag: number; label?: string | null }[] = [];
|
|
488
|
+
if (descriptor.attributes.tagList) {
|
|
489
|
+
this.log.debug(`addTagList: adding ${CYAN}tagList${db} mfCode: ${mfgCode}, namespaceId: ${namespaceId}, tag: ${tag}, label: ${label} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
490
|
+
const tagList = descriptor.attributes.tagList.getLocal();
|
|
491
|
+
tagList.push({ mfgCode, namespaceId, tag, label });
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
this.log.debug(`addTagList: creating ${CYAN}tagList${db} mfCode: ${mfgCode}, namespaceId: ${namespaceId}, tag: ${tag}, label: ${label} on endpoint ${endpoint.name}:${endpoint.number}`);
|
|
495
|
+
endpoint.addClusterServer(ClusterServer(DescriptorCluster.with(Descriptor.Feature.TagList), {
|
|
496
|
+
tagList: [{ mfgCode, namespaceId, tag, label }],
|
|
497
|
+
deviceTypeList: [...descriptor.attributes.deviceTypeList.getLocal()],
|
|
498
|
+
serverList: [...descriptor.attributes.serverList.getLocal()],
|
|
499
|
+
clientList: [...descriptor.attributes.clientList.getLocal()],
|
|
500
|
+
partsList: [...descriptor.attributes.partsList.getLocal()],
|
|
501
|
+
}, {}, {}));
|
|
502
|
+
}
|
|
573
503
|
/**
|
|
574
504
|
* Serializes the Matterbridge device into a serialized object.
|
|
575
505
|
*
|
|
@@ -721,6 +651,18 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
721
651
|
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
722
652
|
*/
|
|
723
653
|
getDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
654
|
+
this.log.logName = deviceName;
|
|
655
|
+
this.deviceName = deviceName;
|
|
656
|
+
this.serialNumber = serialNumber;
|
|
657
|
+
this.uniqueId = this.createUniqueId(deviceName, serialNumber, vendorName, productName);
|
|
658
|
+
this.productId = productId;
|
|
659
|
+
this.productName = productName;
|
|
660
|
+
this.vendorId = vendorId;
|
|
661
|
+
this.vendorName = vendorName;
|
|
662
|
+
this.softwareVersion = softwareVersion;
|
|
663
|
+
this.softwareVersionString = softwareVersionString;
|
|
664
|
+
this.hardwareVersion = hardwareVersion;
|
|
665
|
+
this.hardwareVersionString = hardwareVersionString;
|
|
724
666
|
return ClusterServer(BasicInformationCluster, {
|
|
725
667
|
dataModelRevision: 1,
|
|
726
668
|
location: 'XX',
|
|
@@ -762,10 +704,8 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
762
704
|
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
763
705
|
*/
|
|
764
706
|
createDefaultBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productId, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
765
|
-
this.deviceName = deviceName;
|
|
766
|
-
this.serialNumber = serialNumber;
|
|
767
|
-
this.uniqueId = this.createUniqueId(deviceName, serialNumber, vendorName, productName);
|
|
768
707
|
if (MatterbridgeDevice.bridgeMode === 'bridge') {
|
|
708
|
+
this.addDeviceType(bridgedNode);
|
|
769
709
|
this.createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString);
|
|
770
710
|
return;
|
|
771
711
|
}
|
|
@@ -785,6 +725,18 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
785
725
|
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
786
726
|
*/
|
|
787
727
|
getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
728
|
+
this.log.logName = deviceName;
|
|
729
|
+
this.deviceName = deviceName;
|
|
730
|
+
this.serialNumber = serialNumber;
|
|
731
|
+
this.uniqueId = this.createUniqueId(deviceName, serialNumber, vendorName, productName);
|
|
732
|
+
this.productId = undefined;
|
|
733
|
+
this.productName = productName;
|
|
734
|
+
this.vendorId = vendorId;
|
|
735
|
+
this.vendorName = vendorName;
|
|
736
|
+
this.softwareVersion = softwareVersion;
|
|
737
|
+
this.softwareVersionString = softwareVersionString;
|
|
738
|
+
this.hardwareVersion = hardwareVersion;
|
|
739
|
+
this.hardwareVersionString = hardwareVersionString;
|
|
788
740
|
return ClusterServer(BridgedDeviceBasicInformationCluster, {
|
|
789
741
|
vendorId: vendorId !== undefined ? VendorId(vendorId) : undefined, // 4874
|
|
790
742
|
vendorName: vendorName.slice(0, 32),
|
|
@@ -819,9 +771,6 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
819
771
|
* @param hardwareVersionString - The hardware version string of the device. Default is 'v.1.0.0'.
|
|
820
772
|
*/
|
|
821
773
|
createDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion = 1, softwareVersionString = '1.0.0', hardwareVersion = 1, hardwareVersionString = '1.0.0') {
|
|
822
|
-
this.deviceName = deviceName;
|
|
823
|
-
this.serialNumber = serialNumber;
|
|
824
|
-
this.uniqueId = this.createUniqueId(deviceName, serialNumber, vendorName, productName);
|
|
825
774
|
this.addClusterServer(this.getDefaultBridgedDeviceBasicInformationClusterServer(deviceName, serialNumber, vendorId, vendorName, productName, softwareVersion, softwareVersionString, hardwareVersion, hardwareVersionString));
|
|
826
775
|
}
|
|
827
776
|
/**
|
|
@@ -866,7 +815,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
866
815
|
getDefaultElectricalPowerMeasurementClusterServer(voltage = null, current = null, power = null, frequency = null) {
|
|
867
816
|
return ClusterServer(ElectricalPowerMeasurementCluster.with(ElectricalPowerMeasurement.Feature.AlternatingCurrent), {
|
|
868
817
|
powerMode: ElectricalPowerMeasurement.PowerMode.Ac,
|
|
869
|
-
numberOfMeasurementTypes:
|
|
818
|
+
numberOfMeasurementTypes: 4,
|
|
870
819
|
accuracy: [
|
|
871
820
|
{
|
|
872
821
|
measurementType: MeasurementType.Voltage,
|
|
@@ -973,12 +922,17 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
973
922
|
/**
|
|
974
923
|
* Get a default level control cluster server.
|
|
975
924
|
*
|
|
976
|
-
* @param currentLevel - The current level (default:
|
|
925
|
+
* @param currentLevel - The current level (default: 254).
|
|
926
|
+
* @param minLevel - The minimum level (default: 0).
|
|
927
|
+
* @param maxLevel - The maximum level (default: 254).
|
|
928
|
+
* @param onLevel - The on level (default: null).
|
|
977
929
|
*/
|
|
978
|
-
getDefaultLevelControlClusterServer(currentLevel = 0) {
|
|
930
|
+
getDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 0, maxLevel = 254, onLevel = null) {
|
|
979
931
|
return ClusterServer(LevelControlCluster.with(LevelControl.Feature.OnOff), {
|
|
980
932
|
currentLevel,
|
|
981
|
-
|
|
933
|
+
minLevel,
|
|
934
|
+
maxLevel,
|
|
935
|
+
onLevel,
|
|
982
936
|
options: {
|
|
983
937
|
executeIfOff: false,
|
|
984
938
|
coupleColorTempToLevel: false,
|
|
@@ -1015,10 +969,13 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1015
969
|
/**
|
|
1016
970
|
* Creates a default level control cluster server.
|
|
1017
971
|
*
|
|
1018
|
-
* @param currentLevel - The current level (default:
|
|
972
|
+
* @param currentLevel - The current level (default: 254).
|
|
973
|
+
* @param minLevel - The minimum level (default: 0).
|
|
974
|
+
* @param maxLevel - The maximum level (default: 254).
|
|
975
|
+
* @param onLevel - The on level (default: null).
|
|
1019
976
|
*/
|
|
1020
|
-
createDefaultLevelControlClusterServer(currentLevel = 0) {
|
|
1021
|
-
this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel));
|
|
977
|
+
createDefaultLevelControlClusterServer(currentLevel = 254, minLevel = 0, maxLevel = 254, onLevel = null) {
|
|
978
|
+
this.addClusterServer(this.getDefaultLevelControlClusterServer(currentLevel, minLevel, maxLevel, onLevel));
|
|
1022
979
|
}
|
|
1023
980
|
/**
|
|
1024
981
|
* Get a default color control cluster server.
|
|
@@ -1538,7 +1495,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1538
1495
|
/**
|
|
1539
1496
|
* Get a default flow measurement cluster server.
|
|
1540
1497
|
*
|
|
1541
|
-
* @param measuredValue - The measured value of the
|
|
1498
|
+
* @param measuredValue - The measured value of the flow in 10 x m/h.
|
|
1542
1499
|
*/
|
|
1543
1500
|
getDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1544
1501
|
return ClusterServer(FlowMeasurementCluster, {
|
|
@@ -1551,7 +1508,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1551
1508
|
/**
|
|
1552
1509
|
* Creates a default flow measurement cluster server.
|
|
1553
1510
|
*
|
|
1554
|
-
* @param measuredValue - The measured value of the
|
|
1511
|
+
* @param measuredValue - The measured value of the of the flow in 10 x m/h.
|
|
1555
1512
|
*/
|
|
1556
1513
|
createDefaultFlowMeasurementClusterServer(measuredValue = 0) {
|
|
1557
1514
|
this.addClusterServer(this.getDefaultFlowMeasurementClusterServer(measuredValue));
|
|
@@ -1559,7 +1516,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1559
1516
|
/**
|
|
1560
1517
|
* Get a default temperature measurement cluster server.
|
|
1561
1518
|
*
|
|
1562
|
-
* @param measuredValue - The measured value of the temperature.
|
|
1519
|
+
* @param measuredValue - The measured value of the temperature x 100.
|
|
1563
1520
|
*/
|
|
1564
1521
|
getDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1565
1522
|
return ClusterServer(TemperatureMeasurementCluster, {
|
|
@@ -1572,7 +1529,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1572
1529
|
/**
|
|
1573
1530
|
* Creates a default temperature measurement cluster server.
|
|
1574
1531
|
*
|
|
1575
|
-
* @param measuredValue - The measured value of the temperature.
|
|
1532
|
+
* @param measuredValue - The measured value of the temperature x 100.
|
|
1576
1533
|
*/
|
|
1577
1534
|
createDefaultTemperatureMeasurementClusterServer(measuredValue = 0) {
|
|
1578
1535
|
this.addClusterServer(this.getDefaultTemperatureMeasurementClusterServer(measuredValue));
|
|
@@ -1580,7 +1537,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1580
1537
|
/**
|
|
1581
1538
|
* Get a default RelativeHumidityMeasurementCluster server.
|
|
1582
1539
|
*
|
|
1583
|
-
* @param measuredValue - The measured value of the relative humidity.
|
|
1540
|
+
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
1584
1541
|
*/
|
|
1585
1542
|
getDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1586
1543
|
return ClusterServer(RelativeHumidityMeasurementCluster, {
|
|
@@ -1593,7 +1550,7 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1593
1550
|
/**
|
|
1594
1551
|
* Creates a default RelativeHumidityMeasurementCluster server.
|
|
1595
1552
|
*
|
|
1596
|
-
* @param measuredValue - The measured value of the relative humidity.
|
|
1553
|
+
* @param measuredValue - The measured value of the relative humidity x 100.
|
|
1597
1554
|
*/
|
|
1598
1555
|
createDefaultRelativeHumidityMeasurementClusterServer(measuredValue = 0) {
|
|
1599
1556
|
this.addClusterServer(this.getDefaultRelativeHumidityMeasurementClusterServer(measuredValue));
|
|
@@ -1814,6 +1771,80 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1814
1771
|
createDefaultTvocMeasurementClusterServer(measuredValue = 0, measurementUnit = ConcentrationMeasurement.MeasurementUnit.Ppm, measurementMedium = ConcentrationMeasurement.MeasurementMedium.Air) {
|
|
1815
1772
|
this.addClusterServer(this.getDefaultTvocMeasurementClusterServer(measuredValue, measurementUnit, measurementMedium));
|
|
1816
1773
|
}
|
|
1774
|
+
/**
|
|
1775
|
+
* Get a default heating thermostat cluster server with the specified parameters.
|
|
1776
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1777
|
+
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1778
|
+
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1779
|
+
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1780
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
1781
|
+
*/
|
|
1782
|
+
getDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1783
|
+
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating), {
|
|
1784
|
+
localTemperature: localTemperature * 100,
|
|
1785
|
+
systemMode: Thermostat.SystemMode.Heat,
|
|
1786
|
+
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.HeatingOnly,
|
|
1787
|
+
// Thermostat.Feature.Heating
|
|
1788
|
+
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1789
|
+
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1790
|
+
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1791
|
+
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1792
|
+
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1793
|
+
}, {
|
|
1794
|
+
setpointRaiseLower: async ({ request, attributes }) => {
|
|
1795
|
+
this.log.debug('Matter command: setpointRaiseLower', request);
|
|
1796
|
+
await this.commandHandler.executeHandler('setpointRaiseLower', { request, attributes });
|
|
1797
|
+
},
|
|
1798
|
+
}, {});
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Creates and adds a default heating thermostat cluster server to the device.
|
|
1802
|
+
*
|
|
1803
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1804
|
+
* @param {number} [occupiedHeatingSetpoint] - The occupied heating setpoint value in degrees Celsius. Defaults to 21°.
|
|
1805
|
+
* @param {number} [minHeatSetpointLimit] - The minimum heat setpoint limit value. Defaults to 0°.
|
|
1806
|
+
* @param {number} [maxHeatSetpointLimit] - The maximum heat setpoint limit value. Defaults to 50°.
|
|
1807
|
+
*/
|
|
1808
|
+
createDefaultHeatingThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 25, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50) {
|
|
1809
|
+
this.addClusterServer(this.getDefaultHeatingThermostatClusterServer(localTemperature, occupiedHeatingSetpoint, minHeatSetpointLimit, maxHeatSetpointLimit));
|
|
1810
|
+
}
|
|
1811
|
+
/**
|
|
1812
|
+
* Get a default cooling thermostat cluster server with the specified parameters.
|
|
1813
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1814
|
+
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1815
|
+
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1816
|
+
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1817
|
+
* @returns {ThermostatClusterServer} A default thermostat cluster server configured with the specified parameters.
|
|
1818
|
+
*/
|
|
1819
|
+
getDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1820
|
+
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Cooling), {
|
|
1821
|
+
localTemperature: localTemperature * 100,
|
|
1822
|
+
systemMode: Thermostat.SystemMode.Cool,
|
|
1823
|
+
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingOnly,
|
|
1824
|
+
// Thermostat.Feature.Cooling
|
|
1825
|
+
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1826
|
+
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1827
|
+
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1828
|
+
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1829
|
+
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1830
|
+
}, {
|
|
1831
|
+
setpointRaiseLower: async ({ request, attributes }) => {
|
|
1832
|
+
this.log.debug('Matter command: setpointRaiseLower', request);
|
|
1833
|
+
await this.commandHandler.executeHandler('setpointRaiseLower', { request, attributes });
|
|
1834
|
+
},
|
|
1835
|
+
}, {});
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* Creates and adds a default cooling thermostat cluster server to the device.
|
|
1839
|
+
*
|
|
1840
|
+
* @param {number} [localTemperature] - The local temperature value in degrees Celsius. Defaults to 23°.
|
|
1841
|
+
* @param {number} [occupiedCoolingSetpoint] - The occupied cooling setpoint value in degrees Celsius. Defaults to 25°.
|
|
1842
|
+
* @param {number} [minCoolSetpointLimit] - The minimum cool setpoint limit value. Defaults to 0°.
|
|
1843
|
+
* @param {number} [maxCoolSetpointLimit] - The maximum cool setpoint limit value. Defaults to 50°.
|
|
1844
|
+
*/
|
|
1845
|
+
createDefaultCoolingThermostatClusterServer(localTemperature = 23, occupiedCoolingSetpoint = 25, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1846
|
+
this.addClusterServer(this.getDefaultCoolingThermostatClusterServer(localTemperature, occupiedCoolingSetpoint, minCoolSetpointLimit, maxCoolSetpointLimit));
|
|
1847
|
+
}
|
|
1817
1848
|
/**
|
|
1818
1849
|
* Get a default thermostat cluster server with the specified parameters.
|
|
1819
1850
|
*
|
|
@@ -1830,19 +1861,22 @@ export class MatterbridgeDevice extends extendPublicHandlerMethods(Device) {
|
|
|
1830
1861
|
getDefaultThermostatClusterServer(localTemperature = 23, occupiedHeatingSetpoint = 21, occupiedCoolingSetpoint = 25, minSetpointDeadBand = 1, minHeatSetpointLimit = 0, maxHeatSetpointLimit = 50, minCoolSetpointLimit = 0, maxCoolSetpointLimit = 50) {
|
|
1831
1862
|
return ClusterServer(ThermostatCluster.with(Thermostat.Feature.Heating, Thermostat.Feature.Cooling, Thermostat.Feature.AutoMode), {
|
|
1832
1863
|
localTemperature: localTemperature * 100,
|
|
1864
|
+
systemMode: Thermostat.SystemMode.Auto,
|
|
1865
|
+
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1866
|
+
// Thermostat.Feature.Heating
|
|
1833
1867
|
occupiedHeatingSetpoint: occupiedHeatingSetpoint * 100,
|
|
1834
|
-
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1835
1868
|
minHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1836
1869
|
maxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1837
1870
|
absMinHeatSetpointLimit: minHeatSetpointLimit * 100,
|
|
1838
1871
|
absMaxHeatSetpointLimit: maxHeatSetpointLimit * 100,
|
|
1872
|
+
// Thermostat.Feature.Cooling
|
|
1873
|
+
occupiedCoolingSetpoint: occupiedCoolingSetpoint * 100,
|
|
1839
1874
|
minCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1840
1875
|
maxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1841
1876
|
absMinCoolSetpointLimit: minCoolSetpointLimit * 100,
|
|
1842
1877
|
absMaxCoolSetpointLimit: maxCoolSetpointLimit * 100,
|
|
1878
|
+
// Thermostat.Feature.AutoMode
|
|
1843
1879
|
minSetpointDeadBand: minSetpointDeadBand * 100,
|
|
1844
|
-
systemMode: Thermostat.SystemMode.Off,
|
|
1845
|
-
controlSequenceOfOperation: Thermostat.ControlSequenceOfOperation.CoolingAndHeating,
|
|
1846
1880
|
thermostatRunningMode: Thermostat.ThermostatRunningMode.Off,
|
|
1847
1881
|
}, {
|
|
1848
1882
|
setpointRaiseLower: async ({ request, attributes }) => {
|