matterbridge 1.3.1 → 1.3.2

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/CODEOWNERS +1 -0
  3. package/README.md +27 -11
  4. package/dist/cluster/CarbonDioxideConcentrationMeasurementCluster.d.ts +396 -0
  5. package/dist/cluster/CarbonDioxideConcentrationMeasurementCluster.d.ts.map +1 -0
  6. package/dist/cluster/CarbonDioxideConcentrationMeasurementCluster.js +30 -0
  7. package/dist/cluster/CarbonDioxideConcentrationMeasurementCluster.js.map +1 -0
  8. package/dist/cluster/FormaldehydeConcentrationMeasurementCluster.d.ts +396 -0
  9. package/dist/cluster/FormaldehydeConcentrationMeasurementCluster.d.ts.map +1 -0
  10. package/dist/cluster/FormaldehydeConcentrationMeasurementCluster.js +30 -0
  11. package/dist/cluster/FormaldehydeConcentrationMeasurementCluster.js.map +1 -0
  12. package/dist/cluster/NitrogenDioxideConcentrationMeasurementCluster.d.ts +396 -0
  13. package/dist/cluster/NitrogenDioxideConcentrationMeasurementCluster.d.ts.map +1 -0
  14. package/dist/cluster/NitrogenDioxideConcentrationMeasurementCluster.js +34 -0
  15. package/dist/cluster/NitrogenDioxideConcentrationMeasurementCluster.js.map +1 -0
  16. package/dist/cluster/OzoneConcentrationMeasurementCluster.d.ts +395 -0
  17. package/dist/cluster/OzoneConcentrationMeasurementCluster.d.ts.map +1 -0
  18. package/dist/cluster/OzoneConcentrationMeasurementCluster.js +29 -0
  19. package/dist/cluster/OzoneConcentrationMeasurementCluster.js.map +1 -0
  20. package/dist/cluster/Pm10ConcentrationMeasurementCluster.d.ts +395 -0
  21. package/dist/cluster/Pm10ConcentrationMeasurementCluster.d.ts.map +1 -0
  22. package/dist/cluster/Pm10ConcentrationMeasurementCluster.js +29 -0
  23. package/dist/cluster/Pm10ConcentrationMeasurementCluster.js.map +1 -0
  24. package/dist/cluster/Pm1ConcentrationMeasurementCluster.d.ts +395 -0
  25. package/dist/cluster/Pm1ConcentrationMeasurementCluster.d.ts.map +1 -0
  26. package/dist/cluster/Pm1ConcentrationMeasurementCluster.js +29 -0
  27. package/dist/cluster/Pm1ConcentrationMeasurementCluster.js.map +1 -0
  28. package/dist/cluster/Pm25ConcentrationMeasurementCluster.d.ts +395 -0
  29. package/dist/cluster/Pm25ConcentrationMeasurementCluster.d.ts.map +1 -0
  30. package/dist/cluster/Pm25ConcentrationMeasurementCluster.js +29 -0
  31. package/dist/cluster/Pm25ConcentrationMeasurementCluster.js.map +1 -0
  32. package/dist/cluster/PowerTopologyCluster.d.ts +0 -10
  33. package/dist/cluster/PowerTopologyCluster.d.ts.map +1 -1
  34. package/dist/cluster/RadonConcentrationMeasurementCluster.d.ts +395 -0
  35. package/dist/cluster/RadonConcentrationMeasurementCluster.d.ts.map +1 -0
  36. package/dist/cluster/RadonConcentrationMeasurementCluster.js +29 -0
  37. package/dist/cluster/RadonConcentrationMeasurementCluster.js.map +1 -0
  38. package/dist/cluster/SmokeCoAlarmCluster.d.ts +0 -24
  39. package/dist/cluster/SmokeCoAlarmCluster.d.ts.map +1 -1
  40. package/dist/defaultConfigSchema.d.ts +4 -7
  41. package/dist/defaultConfigSchema.d.ts.map +1 -1
  42. package/dist/defaultConfigSchema.js +13 -254
  43. package/dist/defaultConfigSchema.js.map +1 -1
  44. package/dist/index.d.ts +1 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +1 -0
  47. package/dist/index.js.map +1 -1
  48. package/dist/matterbridge.d.ts +3 -24
  49. package/dist/matterbridge.d.ts.map +1 -1
  50. package/dist/matterbridge.js +42 -82
  51. package/dist/matterbridge.js.map +1 -1
  52. package/dist/matterbridgeAccessoryPlatform.d.ts +2 -2
  53. package/dist/matterbridgeAccessoryPlatform.d.ts.map +1 -1
  54. package/dist/matterbridgeAccessoryPlatform.js.map +1 -1
  55. package/dist/matterbridgeDevice.d.ts +449 -18
  56. package/dist/matterbridgeDevice.d.ts.map +1 -1
  57. package/dist/matterbridgeDevice.js +269 -8
  58. package/dist/matterbridgeDevice.js.map +1 -1
  59. package/dist/matterbridgeDynamicPlatform.d.ts +2 -2
  60. package/dist/matterbridgeDynamicPlatform.d.ts.map +1 -1
  61. package/dist/matterbridgeDynamicPlatform.js.map +1 -1
  62. package/dist/matterbridgePlatform.d.ts +11 -7
  63. package/dist/matterbridgePlatform.d.ts.map +1 -1
  64. package/dist/matterbridgePlatform.js.map +1 -1
  65. package/dist/matterbridgeV8.d.ts +0 -1
  66. package/dist/matterbridgeV8.d.ts.map +1 -1
  67. package/package.json +5 -5
@@ -1,10 +1,10 @@
1
1
  /**
2
- * This file contains the default config end schema for the plugins.
2
+ * This file contains the default config for the plugins.
3
3
  *
4
- * @file utils.ts
4
+ * @file defaultConfigSchema.ts
5
5
  * @author Luca Liguori
6
6
  * @date 2024-05-07
7
- * @version 1.0.0
7
+ * @version 1.0.1
8
8
  *
9
9
  * Copyright 2024 Luca Liguori.
10
10
  *
@@ -28,7 +28,6 @@ export const zigbee2mqtt_config = {
28
28
  password: '',
29
29
  port: 1883,
30
30
  topic: 'zigbee2mqtt',
31
- unregisterOnShutdown: false,
32
31
  blackList: [],
33
32
  whiteList: [],
34
33
  switchList: [],
@@ -36,104 +35,8 @@ export const zigbee2mqtt_config = {
36
35
  outletList: [],
37
36
  featureBlackList: [],
38
37
  deviceFeatureBlackList: {},
39
- };
40
- export const zigbee2mqtt_schema = {
41
- title: 'Matterbridge zigbee2mqtt plugin',
42
- description: 'matterbridge-zigbee2mqtt v. 2.0.13 by https://github.com/Luligu',
43
- type: 'object',
44
- required: ['host', 'port', 'topic'],
45
- properties: {
46
- name: {
47
- description: 'Plugin name',
48
- type: 'string',
49
- readOnly: true,
50
- },
51
- type: {
52
- description: 'Plugin type',
53
- type: 'string',
54
- readOnly: true,
55
- },
56
- host: {
57
- description: 'Host',
58
- type: 'string',
59
- },
60
- username: {
61
- description: 'Username',
62
- type: 'string',
63
- },
64
- password: {
65
- description: 'Password',
66
- type: 'string',
67
- },
68
- port: {
69
- description: 'Port',
70
- type: 'number',
71
- },
72
- topic: {
73
- description: 'Topic',
74
- type: 'string',
75
- },
76
- blackList: {
77
- description: 'The devices in the list will not be exposed.',
78
- type: 'array',
79
- items: {
80
- type: 'string',
81
- },
82
- },
83
- whiteList: {
84
- description: 'Only the devices in the list will be exposed.',
85
- type: 'array',
86
- items: {
87
- type: 'string',
88
- },
89
- },
90
- switchList: {
91
- description: 'The devices in the list will be exposed like switches.',
92
- type: 'array',
93
- items: {
94
- type: 'string',
95
- },
96
- },
97
- lightList: {
98
- description: 'The devices in the list will be exposed like lights.',
99
- type: 'array',
100
- items: {
101
- type: 'string',
102
- },
103
- },
104
- outletList: {
105
- description: 'The devices in the list will be exposed like outlets.',
106
- type: 'array',
107
- items: {
108
- type: 'string',
109
- },
110
- },
111
- featureBlackList: {
112
- description: 'The features in the list will not be exposed for all devices.',
113
- type: 'array',
114
- items: {
115
- type: 'string',
116
- },
117
- },
118
- deviceFeatureBlackList: {
119
- description: 'List of features not to be exposed for a single device. Enter in the first field the name of the device and in the second field add all the features to exclude.',
120
- type: 'object',
121
- additionalProperties: {
122
- type: 'array',
123
- items: {
124
- type: 'string',
125
- },
126
- },
127
- },
128
- debug: {
129
- description: 'Enable the debug for the plugin (development only)',
130
- type: 'boolean',
131
- },
132
- unregisterOnShutdown: {
133
- description: 'Unregister all devices on shutdown (development only)',
134
- type: 'boolean',
135
- },
136
- },
38
+ debug: false,
39
+ unregisterOnShutdown: false,
137
40
  };
138
41
  export const somfytahoma_config = {
139
42
  name: 'matterbridge-somfy-tahoma',
@@ -144,87 +47,17 @@ export const somfytahoma_config = {
144
47
  blackList: [],
145
48
  whiteList: [],
146
49
  movementDuration: {},
147
- };
148
- export const somfytahoma_schema = {
149
- title: 'Matterbridge somfy tahoma plugin',
150
- description: 'matterbridge-somfy-tahoma v. 1.0.7 by https://github.com/Luligu',
151
- type: 'object',
152
- required: ['username', 'password', 'service'],
153
- properties: {
154
- name: {
155
- description: 'Plugin name',
156
- type: 'string',
157
- readOnly: true,
158
- },
159
- type: {
160
- description: 'Plugin type',
161
- type: 'string',
162
- readOnly: true,
163
- },
164
- username: {
165
- description: 'Username',
166
- type: 'string',
167
- },
168
- password: {
169
- description: 'Password',
170
- type: 'string',
171
- },
172
- service: {
173
- description: 'Service name to connect to',
174
- type: 'string',
175
- oneOf: [
176
- {
177
- title: 'Local API (TaHoma / Switch)',
178
- enum: ['local'],
179
- },
180
- {
181
- title: 'Somfy Europe (TaHoma / Switch / Connexoon IO)',
182
- enum: ['somfy_europe'],
183
- },
184
- {
185
- title: 'Somfy Australia (Connexoon RTS)',
186
- enum: ['somfy_australia'],
187
- },
188
- {
189
- title: 'Somfy North America',
190
- enum: ['somfy_north_america'],
191
- },
192
- ],
193
- },
194
- blackList: {
195
- description: 'The devices in the list will not be exposed.',
196
- type: 'array',
197
- items: {
198
- type: 'string',
199
- },
200
- },
201
- whiteList: {
202
- description: 'Only the devices in the list will be exposed.',
203
- type: 'array',
204
- items: {
205
- type: 'string',
206
- },
207
- },
208
- movementDuration: {
209
- description: 'Set the duration in seconds of the full movement for each device. Enter in the first field the name of the device and in the second field the duration in seconds.',
210
- type: 'object',
211
- additionalProperties: {
212
- type: 'integer',
213
- },
214
- },
215
- debug: {
216
- description: 'Enable the debug for the plugin (development only)',
217
- type: 'boolean',
218
- },
219
- unregisterOnShutdown: {
220
- description: 'Unregister all devices on shutdown (development only)',
221
- type: 'boolean',
222
- },
223
- },
50
+ debug: false,
51
+ unregisterOnShutdown: false,
224
52
  };
225
53
  export const shelly_config = {
226
54
  name: 'matterbridge-shelly',
227
55
  type: 'DynamicPlatform',
56
+ username: '',
57
+ password: '',
58
+ exposeSwitch: 'switch',
59
+ exposeInput: 'disabled',
60
+ exposePowerMeter: 'evehistory',
228
61
  blackList: [],
229
62
  whiteList: [],
230
63
  deviceIp: {},
@@ -232,82 +65,8 @@ export const shelly_config = {
232
65
  enableStorageDiscover: true,
233
66
  resetStorageDiscover: false,
234
67
  enableConfigDiscover: false,
68
+ enableBleDiscover: false,
235
69
  debug: false,
236
70
  unregisterOnShutdown: false,
237
71
  };
238
- export const shelly_schema = {
239
- title: 'Matterbridge shelly plugin',
240
- description: 'matterbridge-shelly v. 0.0.1 by https://github.com/Luligu',
241
- type: 'object',
242
- properties: {
243
- name: {
244
- description: 'Plugin name',
245
- type: 'string',
246
- readOnly: true,
247
- },
248
- type: {
249
- description: 'Plugin type',
250
- type: 'string',
251
- readOnly: true,
252
- },
253
- username: {
254
- description: 'Username (always admin for gen 2 and 3 devices so use admin also for gen 1)',
255
- type: 'string',
256
- },
257
- password: {
258
- description: 'Password (must be unique for all the devices)',
259
- type: 'string',
260
- },
261
- blackList: {
262
- description: 'The devices in the list will not be exposed. Use the device id (e.g. shellyplus2pm-5443b23d81f8)',
263
- type: 'array',
264
- items: {
265
- type: 'string',
266
- },
267
- },
268
- whiteList: {
269
- description: 'Only the devices in the list will be exposed. Use the device id (e.g. shellyplus2pm-5443b23d81f8)',
270
- type: 'array',
271
- items: {
272
- type: 'string',
273
- },
274
- },
275
- deviceIp: {
276
- description: 'Set the IP address for each device. Enter in the first field the shelly ID of the device and in the second field the IP address. (e.g. shelly1minig3-543204547478: 192.168.1.221)',
277
- type: 'object',
278
- additionalProperties: {
279
- type: 'string',
280
- },
281
- },
282
- enableMdnsDiscover: {
283
- description: 'Enable the mdns discovery for shelly devices (it will stop after 10 minutes)',
284
- type: 'boolean',
285
- },
286
- enableStorageDiscover: {
287
- description: 'Enable storage discovery for shelly devices (it will load from the storage the devices already discovered)',
288
- type: 'boolean',
289
- },
290
- resetStorageDiscover: {
291
- description: 'Reset the storage discovery on the next restart (it will clear the storage of already discovers devices)',
292
- type: 'boolean',
293
- },
294
- enableConfigDiscover: {
295
- description: 'Enable config discovery for shelly devices (it will load the devices from deviceIp config setting)',
296
- type: 'boolean',
297
- },
298
- enableBleDiscover: {
299
- description: 'Enable ble discovery for shelly devices (under development)',
300
- type: 'boolean',
301
- readOnly: true,
302
- },
303
- debug: {
304
- description: 'Enable the debug for the plugin (development only)',
305
- type: 'boolean',
306
- },
307
- unregisterOnShutdown: {
308
- description: 'Unregister all devices on shutdown (development only)',
309
- type: 'boolean',
310
- },
311
- },
312
- };
313
72
  //# sourceMappingURL=defaultConfigSchema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defaultConfigSchema.js","sourceRoot":"","sources":["../src/defaultConfigSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,MAAM,CAAC,MAAM,kBAAkB,GAAmB;IAChD,IAAI,EAAE,0BAA0B;IAChC,IAAI,EAAE,iBAAiB;IACvB,IAAI,EAAE,WAAW;IACjB,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,aAAa;IACpB,oBAAoB,EAAE,KAAK;IAC3B,SAAS,EAAE,EAAE;IACb,SAAS,EAAE,EAAE;IACb,UAAU,EAAE,EAAE;IACd,SAAS,EAAE,EAAE;IACb,UAAU,EAAE,EAAE;IACd,gBAAgB,EAAE,EAAE;IACpB,sBAAsB,EAAE,EAAE;CAC3B,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAmB;IAChD,KAAK,EAAE,iCAAiC;IACxC,WAAW,EAAE,iEAAiE;IAC9E,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;IACnC,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE,aAAa;YAC1B,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,aAAa;YAC1B,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAE;YACJ,WAAW,EAAE,MAAM;YACnB,IAAI,EAAE,QAAQ;SACf;QACD,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AQ,EAAE,IAAI;SACf;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,6EAA6E;YAC1F,IAAI,EAAE,QAAQ;SACf;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,+CAA+C;YAC5D,IAAI,EAAE,QAAQ;SACf;QACD,SAAS,EAAE;YACT,WAAW,EAAE,kGAAkG;YAC/G,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;aACf;SACF;QACD,SAAS,EAAE;YACT,WAAW,EAAE,mGAAmG;YAChH,IAAI,EAAE,OAAO;YACb,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;aACf;SACF;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,mLAAmL;YAChM,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE;gBACpB,IAAI,EAAE,QAAQ;aACf;SACF;QACD,kBAAkB,EAAE;YAClB,WAAW,EAAE,8EAA8E;YAC3F,IAAI,EAAE,SAAS;SAChB;QACD,qBAAqB,EAAE;YACrB,WAAW,EAAE,4GAA4G;YACzH,IAAI,EAAE,SAAS;SAChB;QACD,oBAAoB,EAAE;YACpB,WAAW,EAAE,0GAA0G;YACvH,IAAI,EAAE,SAAS;SAChB;QACD,oBAAoB,EAAE;YACpB,WAAW,EAAE,oGAAoG;YACjH,IAAI,EAAE,SAAS;SAChB;QACD,iBAAiB,EAAE;YACjB,WAAW,EAAE,6DAA6D;YAC1E,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,IAAI;SACf;QACD,KAAK,EAAE;YACL,WAAW,EAAE,oDAAoD;YACjE,IAAI,EAAE,SAAS;SAChB;QACD,oBAAoB,EAAE;YACpB,WAAW,EAAE,uDAAuD;YACpE,IAAI,EAAE,SAAS;SAChB;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"defaultConfigSchema.js","sourceRoot":"","sources":["../src/defaultConfigSchema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAIH,MAAM,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/dist/index.d.ts CHANGED
@@ -31,6 +31,7 @@ export * from '@project-chip/matter.js/tlv';
31
31
  export * from 'matter-history';
32
32
  export * from './matterbridge.js';
33
33
  export * from './matterbridgeDevice.js';
34
+ export * from './matterbridgePlatform.js';
34
35
  export * from './matterbridgeAccessoryPlatform.js';
35
36
  export * from './matterbridgeDynamicPlatform.js';
36
37
  export * from './cluster/AirQualityCluster.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,8BAA8B,CAAC;AAGtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4DAA4D,CAAC;AAC3E,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mCAAmC,CAAC;AAElD,cAAc,iDAAiD,CAAC;AAChE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,8BAA8B,CAAC;AAGtC,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4DAA4D,CAAC;AAC3E,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mCAAmC,CAAC;AAElD,cAAc,iDAAiD,CAAC;AAChE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -32,6 +32,7 @@ export * from '@project-chip/matter.js/tlv';
32
32
  export * from 'matter-history';
33
33
  export * from './matterbridge.js';
34
34
  export * from './matterbridgeDevice.js';
35
+ export * from './matterbridgePlatform.js';
35
36
  export * from './matterbridgeAccessoryPlatform.js';
36
37
  export * from './matterbridgeDynamicPlatform.js';
37
38
  export * from './cluster/AirQualityCluster.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC;AACtD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAE5C,cAAc,gBAAgB,CAAC;AAE/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,0BAA0B,CAAC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C/C,cAAc,0BAA0B,CAAC;AACzC,cAAc,4DAA4D,CAAC;AAC3E,cAAc,+CAA+C,CAAC;AAC9D,cAAc,mCAAmC,CAAC;AAClD,8FAA8F;AAC9F,cAAc,iDAAiD,CAAC;AAChE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,YAAY,CAAC;AAE3B,KAAK,UAAU,IAAI;IACjB,sCAAsC;IACtC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IAC7F,MAAM,YAAY,CAAC,YAAY,EAAE,CAAC;IAClC,sCAAsC;IACtC,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;AAC/F,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,wDAAwD,KAAK,EAAE,CAAC,CAAC;AACjF,CAAC,CAAC,CAAC"}
@@ -4,7 +4,7 @@
4
4
  * @file matterbridge.ts
5
5
  * @author Luca Liguori
6
6
  * @date 2023-12-29
7
- * @version 1.2.0
7
+ * @version 1.3.2
8
8
  *
9
9
  * Copyright 2023, 2024 Luca Liguori.
10
10
  *
@@ -20,33 +20,14 @@
20
20
  * See the License for the specific language governing permissions and
21
21
  * limitations under the License. *
22
22
  */
23
- /// <reference types="node" resolution-mode="require"/>
24
- import { MatterbridgeDevice } from './matterbridgeDevice.js';
25
23
  import { NodeStorage } from 'node-persist-manager';
26
- import { AnsiLogger } from 'node-ansi-logger';
27
24
  import EventEmitter from 'events';
25
+ import { MatterbridgeDevice } from './matterbridgeDevice.js';
26
+ import { MatterbridgePlatform, PlatformConfig, PlatformSchema } from './matterbridgePlatform.js';
28
27
  import { CommissioningServer } from '@project-chip/matter-node.js';
29
28
  import { Aggregator } from '@project-chip/matter-node.js/device';
30
29
  import { StorageContext } from '@project-chip/matter-node.js/storage';
31
30
  import { ExposedFabricInformation } from '@project-chip/matter-node.js/fabric';
32
- export interface MatterbridgePlatform {
33
- onStart(reason?: string): Promise<void>;
34
- onConfigure(): Promise<void>;
35
- onShutdown(reason?: string): Promise<void>;
36
- registerDevice(device: MatterbridgeDevice): Promise<void>;
37
- unregisterDevice(device: MatterbridgeDevice): Promise<void>;
38
- unregisterAllDevices(): Promise<void>;
39
- matterbridge: Matterbridge;
40
- log: AnsiLogger;
41
- config: PlatformConfig;
42
- name: string;
43
- type: string;
44
- version: string;
45
- }
46
- export type PlatformConfigValue = string | number | boolean | bigint | object | undefined | null;
47
- export type PlatformConfig = Record<string, PlatformConfigValue>;
48
- export type PlatformSchemaValue = string | number | boolean | bigint | object | undefined | null;
49
- export type PlatformSchema = Record<string, PlatformSchemaValue>;
50
31
  export interface RegisteredPlugin extends BaseRegisteredPlugin {
51
32
  nodeContext?: NodeStorage;
52
33
  storageContext?: StorageContext;
@@ -287,9 +268,7 @@ export declare class Matterbridge extends EventEmitter {
287
268
  /**
288
269
  * Loads the schema for a plugin.
289
270
  * If the schema file exists in the plugin directory, it reads the file and returns the parsed JSON data and delete the schema form .matterbridge.
290
- * If the schema file exists in matterbridgeDirectory, it reads the file and returns the parsed JSON data.
291
271
  * If the schema file does not exist, it creates a new schema with the default configuration and returns it.
292
- * If any error occurs during file access or creation, it logs an error and return an empty schema.
293
272
  *
294
273
  * @param plugin - The plugin for which to load the schema.
295
274
  * @returns A promise that resolves to the loaded or created schema.
@@ -1 +1 @@
1
- {"version":3,"file":"matterbridge.d.ts","sourceRoot":"","sources":["../src/matterbridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;AAEH,OAAO,EAAE,kBAAkB,EAAgC,MAAM,yBAAyB,CAAC;AAE3F,OAAO,EAAsB,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,UAAU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AwB;IA8BtC;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAmBhC;;;;;OAKG;YACW,YAAY;IA0E1B;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IActB;;;;OAIG;IACG,kBAAkB,CAAC,IAAI,SAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA4epD;;;;OAIG;IACH,OAAO,CAAC,wBAAwB;CAkCjC"}
@@ -4,7 +4,7 @@
4
4
  * @file matterbridge.ts
5
5
  * @author Luca Liguori
6
6
  * @date 2023-12-29
7
- * @version 1.2.0
7
+ * @version 1.3.2
8
8
  *
9
9
  * Copyright 2023, 2024 Luca Liguori.
10
10
  *
@@ -20,7 +20,6 @@
20
20
  * See the License for the specific language governing permissions and
21
21
  * limitations under the License. *
22
22
  */
23
- import { MatterbridgeDevice } from './matterbridgeDevice.js';
24
23
  import { NodeStorageManager } from 'node-persist-manager';
25
24
  import { AnsiLogger, BRIGHT, RESET, UNDERLINE, UNDERLINEOFF, YELLOW, db, debugStringify, stringify, er, nf, rs, wr, RED, GREEN, zb } from 'node-ansi-logger';
26
25
  import { fileURLToPath, pathToFileURL } from 'url';
@@ -32,7 +31,11 @@ import express from 'express';
32
31
  import os from 'os';
33
32
  import path from 'path';
34
33
  import WebSocket, { WebSocketServer } from 'ws';
34
+ // Matterbridge
35
+ import { MatterbridgeDevice } from './matterbridgeDevice.js';
36
+ import { shelly_config, somfytahoma_config, zigbee2mqtt_config } from './defaultConfigSchema.js';
35
37
  import { BridgedDeviceBasicInformation, BridgedDeviceBasicInformationCluster } from './cluster/BridgedDeviceBasicInformationCluster.js';
38
+ // @project-chip/matter-node.js
36
39
  import { CommissioningController, CommissioningServer, MatterServer } from '@project-chip/matter-node.js';
37
40
  import { BasicInformationCluster, ClusterServer, FixedLabelCluster, GeneralCommissioning, PowerSourceCluster, ThreadNetworkDiagnosticsCluster, getClusterNameById } from '@project-chip/matter-node.js/cluster';
38
41
  import { DeviceTypeId, VendorId } from '@project-chip/matter-node.js/datatype';
@@ -42,7 +45,7 @@ import { ManualPairingCodeCodec, QrCodeSchema } from '@project-chip/matter-node.
42
45
  import { StorageBackendDisk, StorageBackendJsonFile, StorageManager } from '@project-chip/matter-node.js/storage';
43
46
  import { requireMinNodeVersion, getParameter, getIntParameter, hasParameter } from '@project-chip/matter-node.js/util';
44
47
  import { CryptoNode } from '@project-chip/matter-node.js/crypto';
45
- import { shelly_config, shelly_schema, somfytahoma_config, somfytahoma_schema, zigbee2mqtt_config, zigbee2mqtt_schema } from './defaultConfigSchema.js';
48
+ // Default colors
46
49
  const plg = '\u001B[38;5;33m';
47
50
  const dev = '\u001B[38;5;79m';
48
51
  const typ = '\u001B[38;5;207m';
@@ -112,9 +115,9 @@ export class Matterbridge extends EventEmitter {
112
115
  commissioningServer;
113
116
  commissioningController;
114
117
  static instance;
118
+ // We load asyncronously so is private
115
119
  constructor() {
116
120
  super();
117
- // We load asyncronously
118
121
  }
119
122
  /**
120
123
  * Loads an instance of the Matterbridge class.
@@ -252,7 +255,7 @@ export class Matterbridge extends EventEmitter {
252
255
  - help: show the help
253
256
  - bridge: start Matterbridge in bridge mode
254
257
  - childbridge: start Matterbridge in childbridge mode
255
- - frontend [port]: start the frontend on the given port (default 3000)
258
+ - frontend [port]: start the frontend on the given port (default 8283)
256
259
  - debug: enable debug mode (default false)
257
260
  - reset: remove the commissioning for Matterbridge (bridge mode). Shutdown Matterbridge before using it!
258
261
  - factoryreset: remove all commissioning information and reset all internal storages. Shutdown Matterbridge before using it!
@@ -350,7 +353,7 @@ export class Matterbridge extends EventEmitter {
350
353
  */
351
354
  async parseCommandLine() {
352
355
  if (hasParameter('list')) {
353
- this.log.info('│ Registered plugins');
356
+ this.log.info(`│ Registered plugins (${this.registeredPlugins?.length})`);
354
357
  this.registeredPlugins.forEach((plugin, index) => {
355
358
  if (index !== this.registeredPlugins.length - 1) {
356
359
  this.log.info(`├─┬─ plugin ${plg}${plugin.name}${nf}: "${plg}${BRIGHT}${plugin.description}${RESET}${nf}" type: ${typ}${plugin.type}${nf} ${plugin.enabled ? GREEN : RED}enabled ${plugin.paired ? GREEN : RED}paired${nf}`);
@@ -362,7 +365,7 @@ export class Matterbridge extends EventEmitter {
362
365
  }
363
366
  });
364
367
  const serializedRegisteredDevices = await this.nodeContext?.get('devices', []);
365
- this.log.info('│ Registered devices');
368
+ this.log.info(`│ Registered devices (${serializedRegisteredDevices?.length})`);
366
369
  serializedRegisteredDevices?.forEach((device, index) => {
367
370
  if (index !== serializedRegisteredDevices.length - 1) {
368
371
  this.log.info(`├─┬─ plugin ${plg}${device.pluginName}${nf} device: ${dev}${device.deviceName}${nf} uniqueId: ${YELLOW}${device.uniqueId}${nf}`);
@@ -556,7 +559,7 @@ export class Matterbridge extends EventEmitter {
556
559
  pluginPath = path.join(pluginPath, 'package.json');
557
560
  // Resolve the package.json of the plugin
558
561
  let packageJsonPath = path.resolve(pluginPath);
559
- this.log.debug(`Loading plugin from ${plg}${packageJsonPath}${db}`);
562
+ this.log.debug(`Resolving plugin from ${plg}${packageJsonPath}${db}`);
560
563
  // Check if the package.json file exists
561
564
  let packageJsonExists = false;
562
565
  try {
@@ -857,7 +860,7 @@ export class Matterbridge extends EventEmitter {
857
860
  serializedRegisteredDevices.push(serializedMatterbridgeDevice);
858
861
  });
859
862
  await this.nodeContext.set('devices', serializedRegisteredDevices);
860
- this.log.info('Saved registered devices');
863
+ this.log.info(`Saved registered devices (${serializedRegisteredDevices?.length})`);
861
864
  // Clear nodeContext and nodeStorage (they just need 1000ms to write the data to disk)
862
865
  this.log.debug('Closing node storage context...');
863
866
  this.nodeContext.close();
@@ -905,7 +908,7 @@ export class Matterbridge extends EventEmitter {
905
908
  Matterbridge.instance = undefined;
906
909
  this.emit('shutdown');
907
910
  }
908
- }, 2 * 1000); // From 2 to 5 seconds
911
+ }, 2 * 1000);
909
912
  }, 3 * 1000);
910
913
  }
911
914
  }
@@ -1139,9 +1142,7 @@ export class Matterbridge extends EventEmitter {
1139
1142
  /**
1140
1143
  * Loads the schema for a plugin.
1141
1144
  * If the schema file exists in the plugin directory, it reads the file and returns the parsed JSON data and delete the schema form .matterbridge.
1142
- * If the schema file exists in matterbridgeDirectory, it reads the file and returns the parsed JSON data.
1143
1145
  * If the schema file does not exist, it creates a new schema with the default configuration and returns it.
1144
- * If any error occurs during file access or creation, it logs an error and return an empty schema.
1145
1146
  *
1146
1147
  * @param plugin - The plugin for which to load the schema.
1147
1148
  * @returns A promise that resolves to the loaded or created schema.
@@ -1167,77 +1168,36 @@ export class Matterbridge extends EventEmitter {
1167
1168
  return schema;
1168
1169
  }
1169
1170
  catch (err) {
1170
- this.log.debug(`Schema file ${schemaFile} not found.`);
1171
- }
1172
- schemaFile = path.join(this.matterbridgeDirectory, `${plugin.name}.schema.json`);
1173
- try {
1174
- await fs.access(schemaFile);
1175
- const data = await fs.readFile(schemaFile, 'utf8');
1176
- const schema = JSON.parse(data);
1177
- schema.title = plugin.description;
1178
- schema.description = plugin.name + ' v. ' + plugin.version + ' by ' + plugin.author;
1179
- this.log.debug(`Schema file found: ${schemaFile}.`);
1180
- // this.log.debug(`Schema file found: ${schemaFile}.\nSchema:${rs}\n`, schema);
1171
+ this.log.debug(`Schema file ${schemaFile} not found. Loading default schema.`);
1172
+ const schema = {
1173
+ title: plugin.description,
1174
+ description: plugin.name + ' v. ' + plugin.version + ' by ' + plugin.author,
1175
+ type: 'object',
1176
+ properties: {
1177
+ name: {
1178
+ description: 'Plugin name',
1179
+ type: 'string',
1180
+ readOnly: true,
1181
+ },
1182
+ type: {
1183
+ description: 'Plugin type',
1184
+ type: 'string',
1185
+ readOnly: true,
1186
+ },
1187
+ debug: {
1188
+ description: 'Enable the debug for the plugin (development only)',
1189
+ type: 'boolean',
1190
+ default: false,
1191
+ },
1192
+ unregisterOnShutdown: {
1193
+ description: 'Unregister all devices on shutdown (development only)',
1194
+ type: 'boolean',
1195
+ default: false,
1196
+ },
1197
+ },
1198
+ };
1181
1199
  return schema;
1182
1200
  }
1183
- catch (err) {
1184
- if (err instanceof Error) {
1185
- const nodeErr = err;
1186
- if (nodeErr.code === 'ENOENT') {
1187
- let schema;
1188
- if (plugin.name === 'matterbridge-zigbee2mqtt')
1189
- schema = zigbee2mqtt_schema;
1190
- else if (plugin.name === 'matterbridge-somfy-tahoma')
1191
- schema = somfytahoma_schema;
1192
- else if (plugin.name === 'matterbridge-shelly')
1193
- schema = shelly_schema;
1194
- else
1195
- schema = {
1196
- title: plugin.description,
1197
- description: plugin.name + ' v. ' + plugin.version + ' by ' + plugin.author,
1198
- type: 'object',
1199
- properties: {
1200
- name: {
1201
- description: 'Plugin name',
1202
- type: 'string',
1203
- readOnly: true,
1204
- },
1205
- type: {
1206
- description: 'Plugin type',
1207
- type: 'string',
1208
- readOnly: true,
1209
- },
1210
- debug: {
1211
- description: 'Enable the debug for the plugin (development only)',
1212
- type: 'boolean',
1213
- },
1214
- unregisterOnShutdown: {
1215
- description: 'Unregister all devices on shutdown (development only)',
1216
- type: 'boolean',
1217
- },
1218
- },
1219
- };
1220
- return schema;
1221
- /*
1222
- try {
1223
- await this.writeFile(schemaFile, JSON.stringify(schema, null, 2));
1224
- this.log.debug(`Created schema file: ${schemaFile}.`);
1225
- // this.log.debug(`Created schema file: ${schemaFile}.\nSchema:${rs}\n`, schema);
1226
- return schema;
1227
- } catch (err) {
1228
- this.log.error(`Error creating schema file ${schemaFile}: ${err}`);
1229
- return schema;
1230
- }
1231
- */
1232
- }
1233
- else {
1234
- this.log.error(`Error accessing schema file ${schemaFile}: ${err}`);
1235
- return {};
1236
- }
1237
- }
1238
- this.log.error(`Error loading schema file ${schemaFile}: ${err}`);
1239
- return {};
1240
- }
1241
1201
  }
1242
1202
  /**
1243
1203
  * Saves the plugin configuration to a JSON file.
@@ -1295,7 +1255,7 @@ export class Matterbridge extends EventEmitter {
1295
1255
  else if (plugin.name === 'matterbridge-shelly')
1296
1256
  config = shelly_config;
1297
1257
  else
1298
- config = { name: plugin.name, type: plugin.type, unregisterOnShutdown: false };
1258
+ config = { name: plugin.name, type: plugin.type, debug: false, unregisterOnShutdown: false };
1299
1259
  try {
1300
1260
  await this.writeFile(configFile, JSON.stringify(config, null, 2));
1301
1261
  this.log.debug(`Created config file: ${configFile}.`);