matterbridge 1.6.6 → 1.6.7-dev.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 (102) hide show
  1. package/CHANGELOG.md +22 -4
  2. package/README.md +5 -3
  3. package/dist/cli.js +0 -26
  4. package/dist/cluster/export.js +0 -2
  5. package/dist/defaultConfigSchema.js +0 -23
  6. package/dist/deviceManager.js +1 -26
  7. package/dist/index.js +0 -30
  8. package/dist/logger/export.js +0 -1
  9. package/dist/matter/export.js +1 -1
  10. package/dist/matterbridge.js +66 -706
  11. package/dist/matterbridgeAccessoryPlatform.js +0 -33
  12. package/dist/matterbridgeBehaviors.js +1 -29
  13. package/dist/matterbridgeDevice.js +11 -947
  14. package/dist/matterbridgeDeviceTypes.js +12 -59
  15. package/dist/matterbridgeDynamicPlatform.js +0 -33
  16. package/dist/matterbridgeEdge.js +147 -574
  17. package/dist/matterbridgeEndpoint.js +13 -1061
  18. package/dist/matterbridgePlatform.js +5 -94
  19. package/dist/matterbridgeTypes.js +0 -24
  20. package/dist/matterbridgeWebsocket.js +0 -45
  21. package/dist/pluginManager.js +11 -240
  22. package/dist/storage/export.js +0 -1
  23. package/dist/utils/colorUtils.js +2 -205
  24. package/dist/utils/export.js +0 -1
  25. package/dist/utils/utils.js +7 -252
  26. package/frontend/build/asset-manifest.json +3 -3
  27. package/frontend/build/index.html +1 -1
  28. package/frontend/build/static/js/{main.a742de4e.js → main.4dd7e165.js} +3 -3
  29. package/frontend/build/static/js/main.4dd7e165.js.map +1 -0
  30. package/npm-shrinkwrap.json +20 -16
  31. package/package.json +2 -3
  32. package/dist/cli.d.ts +0 -25
  33. package/dist/cli.d.ts.map +0 -1
  34. package/dist/cli.js.map +0 -1
  35. package/dist/cluster/export.d.ts +0 -2
  36. package/dist/cluster/export.d.ts.map +0 -1
  37. package/dist/cluster/export.js.map +0 -1
  38. package/dist/defaultConfigSchema.d.ts +0 -27
  39. package/dist/defaultConfigSchema.d.ts.map +0 -1
  40. package/dist/defaultConfigSchema.js.map +0 -1
  41. package/dist/deviceManager.d.ts +0 -46
  42. package/dist/deviceManager.d.ts.map +0 -1
  43. package/dist/deviceManager.js.map +0 -1
  44. package/dist/index.d.ts +0 -40
  45. package/dist/index.d.ts.map +0 -1
  46. package/dist/index.js.map +0 -1
  47. package/dist/logger/export.d.ts +0 -2
  48. package/dist/logger/export.d.ts.map +0 -1
  49. package/dist/logger/export.js.map +0 -1
  50. package/dist/matter/export.d.ts +0 -5
  51. package/dist/matter/export.d.ts.map +0 -1
  52. package/dist/matter/export.js.map +0 -1
  53. package/dist/matterbridge.d.ts +0 -466
  54. package/dist/matterbridge.d.ts.map +0 -1
  55. package/dist/matterbridge.js.map +0 -1
  56. package/dist/matterbridgeAccessoryPlatform.d.ts +0 -39
  57. package/dist/matterbridgeAccessoryPlatform.d.ts.map +0 -1
  58. package/dist/matterbridgeAccessoryPlatform.js.map +0 -1
  59. package/dist/matterbridgeBehaviors.d.ts +0 -942
  60. package/dist/matterbridgeBehaviors.d.ts.map +0 -1
  61. package/dist/matterbridgeBehaviors.js.map +0 -1
  62. package/dist/matterbridgeDevice.d.ts +0 -6674
  63. package/dist/matterbridgeDevice.d.ts.map +0 -1
  64. package/dist/matterbridgeDevice.js.map +0 -1
  65. package/dist/matterbridgeDeviceTypes.d.ts +0 -82
  66. package/dist/matterbridgeDeviceTypes.d.ts.map +0 -1
  67. package/dist/matterbridgeDeviceTypes.js.map +0 -1
  68. package/dist/matterbridgeDynamicPlatform.d.ts +0 -39
  69. package/dist/matterbridgeDynamicPlatform.d.ts.map +0 -1
  70. package/dist/matterbridgeDynamicPlatform.js.map +0 -1
  71. package/dist/matterbridgeEdge.d.ts +0 -89
  72. package/dist/matterbridgeEdge.d.ts.map +0 -1
  73. package/dist/matterbridgeEdge.js.map +0 -1
  74. package/dist/matterbridgeEndpoint.d.ts +0 -9774
  75. package/dist/matterbridgeEndpoint.d.ts.map +0 -1
  76. package/dist/matterbridgeEndpoint.js.map +0 -1
  77. package/dist/matterbridgePlatform.d.ts +0 -114
  78. package/dist/matterbridgePlatform.d.ts.map +0 -1
  79. package/dist/matterbridgePlatform.js.map +0 -1
  80. package/dist/matterbridgeTypes.d.ts +0 -161
  81. package/dist/matterbridgeTypes.d.ts.map +0 -1
  82. package/dist/matterbridgeTypes.js.map +0 -1
  83. package/dist/matterbridgeWebsocket.d.ts +0 -49
  84. package/dist/matterbridgeWebsocket.d.ts.map +0 -1
  85. package/dist/matterbridgeWebsocket.js.map +0 -1
  86. package/dist/pluginManager.d.ts +0 -238
  87. package/dist/pluginManager.d.ts.map +0 -1
  88. package/dist/pluginManager.js.map +0 -1
  89. package/dist/storage/export.d.ts +0 -2
  90. package/dist/storage/export.d.ts.map +0 -1
  91. package/dist/storage/export.js.map +0 -1
  92. package/dist/utils/colorUtils.d.ts +0 -61
  93. package/dist/utils/colorUtils.d.ts.map +0 -1
  94. package/dist/utils/colorUtils.js.map +0 -1
  95. package/dist/utils/export.d.ts +0 -3
  96. package/dist/utils/export.d.ts.map +0 -1
  97. package/dist/utils/export.js.map +0 -1
  98. package/dist/utils/utils.d.ts +0 -221
  99. package/dist/utils/utils.d.ts.map +0 -1
  100. package/dist/utils/utils.js.map +0 -1
  101. package/frontend/build/static/js/main.a742de4e.js.map +0 -1
  102. /package/frontend/build/static/js/{main.a742de4e.js.LICENSE.txt → main.4dd7e165.js.LICENSE.txt} +0 -0
@@ -1,91 +1,32 @@
1
- /**
2
- * This file contains the class MatterbridgeAccessoryPlatform.
3
- *
4
- * @file matterbridgePlatform.ts
5
- * @author Luca Liguori
6
- * @date 2024-03-21
7
- * @version 1.0.0
8
- *
9
- * Copyright 2024, 2025, 2026 Luca Liguori.
10
- *
11
- * Licensed under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License.
13
- * You may obtain a copy of the License at
14
- *
15
- * http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- * See the License for the specific language governing permissions and
21
- * limitations under the License. *
22
- */
23
1
  import { MatterbridgeDevice } from './matterbridgeDevice.js';
24
- // AnsiLogger module
25
- import { CYAN, nf, wr } from 'node-ansi-logger';
2
+ import { CYAN, nf } from 'node-ansi-logger';
26
3
  import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
27
4
  import { isValidArray, isValidObject } from './utils/utils.js';
28
- /**
29
- * Represents the base Matterbridge platform.
30
- *
31
- */
32
5
  export class MatterbridgePlatform {
33
6
  matterbridge;
34
7
  log;
35
8
  config = {};
36
- name = ''; // Will be set by the loadPlugin() method using the package.json value.
37
- type = ''; // Will be set by the extending classes.
38
- version = ''; // Will be set by the loadPlugin() method using the package.json value.
39
- /**
40
- * Creates an instance of the base MatterbridgePlatform.
41
- * @param {Matterbridge} matterbridge - The Matterbridge instance.
42
- * @param {AnsiLogger} log - The logger instance.
43
- * @param {PlatformConfig} config - The platform configuration.
44
- */
9
+ name = '';
10
+ type = '';
11
+ version = '';
45
12
  constructor(matterbridge, log, config) {
46
13
  this.matterbridge = matterbridge;
47
14
  this.log = log;
48
15
  this.config = config;
49
16
  }
50
- /**
51
- * This method must be overridden in the extended class.
52
- * It is called when the platform is started.
53
- * Use this method to create the MatterbridgeDevice and call this.registerDevice().
54
- * @param {string} [reason] - The reason for starting.
55
- * @throws {Error} - Throws an error if the method is not overridden.
56
- */
57
17
  async onStart(reason) {
58
18
  this.log.error('Plugins must override onStart.', reason);
59
19
  throw new Error('Plugins must override onStart.');
60
20
  }
61
- /**
62
- * This method can be overridden in the extended class.
63
- * It is called after the platform has been commissioned.
64
- * Use this method to perform any configuration of your devices.
65
- */
66
21
  async onConfigure() {
67
22
  this.log.debug("The plugin doesn't override onConfigure.");
68
23
  }
69
- /**
70
- * This method can be overridden in the extended class.
71
- * It is called when the platform is shutting down.
72
- * Use this method to clean up any resources.
73
- * @param {string} [reason] - The reason for shutting down.
74
- */
75
24
  async onShutdown(reason) {
76
25
  this.log.debug("The plugin doesn't override onShutdown.", reason);
77
26
  }
78
- /**
79
- * Sets the logger level and logs a debug message indicating that the plugin doesn't override this method.
80
- * @param {LogLevel} logLevel The new logger level.
81
- */
82
27
  async onChangeLoggerLevel(logLevel) {
83
28
  this.log.debug(`The plugin doesn't override onChangeLoggerLevel. Logger level set to: ${logLevel}`);
84
29
  }
85
- /**
86
- * Registers a device with the Matterbridge platform.
87
- * @param {MatterbridgeDevice} device - The device to register.
88
- */
89
30
  async registerDevice(device) {
90
31
  device.plugin = this.name;
91
32
  if (device instanceof MatterbridgeDevice)
@@ -93,30 +34,18 @@ export class MatterbridgePlatform {
93
34
  if (device instanceof MatterbridgeEndpoint)
94
35
  await this.matterbridge.addBridgedEndpoint(this.name, device);
95
36
  }
96
- /**
97
- * Unregisters a device registered with the Matterbridge platform.
98
- * @param {MatterbridgeDevice} device - The device to unregister.
99
- */
100
37
  async unregisterDevice(device) {
101
38
  if (device instanceof MatterbridgeDevice)
102
39
  await this.matterbridge.removeBridgedDevice(this.name, device);
103
40
  if (device instanceof MatterbridgeEndpoint)
104
41
  await this.matterbridge.removeBridgedEndpoint(this.name, device);
105
42
  }
106
- /**
107
- * Unregisters all devices registered with the Matterbridge platform.
108
- */
109
43
  async unregisterAllDevices() {
110
44
  if (this.matterbridge.edge)
111
45
  await this.matterbridge.removeAllBridgedEndpoints(this.name);
112
46
  else
113
47
  await this.matterbridge.removeAllBridgedDevices(this.name);
114
48
  }
115
- /**
116
- * Verifies if the Matterbridge version meets the required version.
117
- * @param {string} requiredVersion - The required version to compare against.
118
- * @returns {boolean} True if the Matterbridge version meets or exceeds the required version, false otherwise.
119
- */
120
49
  verifyMatterbridgeVersion(requiredVersion) {
121
50
  const compareVersions = (matterbridgeVersion, requiredVersion) => {
122
51
  const stripTag = (v) => {
@@ -141,14 +70,6 @@ export class MatterbridgePlatform {
141
70
  return false;
142
71
  return true;
143
72
  }
144
- /**
145
- * Validates if a device is allowed based on the whitelist and blacklist configurations.
146
- * The blacklist has priority over the whitelist.
147
- *
148
- * @param {string | string[]} device - The device name(s) to validate.
149
- * @param {boolean} [log=true] - Whether to log the validation result.
150
- * @returns {boolean} - Returns true if the device is allowed, false otherwise.
151
- */
152
73
  validateDeviceWhiteBlackList(device, log = true) {
153
74
  if (!Array.isArray(device))
154
75
  device = [device];
@@ -178,15 +99,6 @@ export class MatterbridgePlatform {
178
99
  this.log.info(`Skipping device ${CYAN}${device.join(', ')}${nf} because not in whitelist`);
179
100
  return false;
180
101
  }
181
- // TODO: remove when matterbridge 1.6.6 is published
182
- /**
183
- * Validates if an entity is allowed based on the entity blacklist and device-entity blacklist configurations.
184
- *
185
- * @param {string} device - The device to which the entity belongs.
186
- * @param {string} entity - The entity to validate.
187
- * @param {boolean} [log=true] - Whether to log the validation result.
188
- * @returns {boolean} - Returns true if the entity is allowed, false otherwise.
189
- */
190
102
  validateEntityBlackList(device, entity, log = true) {
191
103
  if (isValidArray(this.config.entityBlackList, 1) && this.config.entityBlackList.find((e) => e === entity)) {
192
104
  if (log)
@@ -195,10 +107,9 @@ export class MatterbridgePlatform {
195
107
  }
196
108
  if (isValidObject(this.config.deviceEntityBlackList, 1) && device in this.config.deviceEntityBlackList && this.config.deviceEntityBlackList[device].includes(entity)) {
197
109
  if (log)
198
- this.log.info(`Skipping entity ${CYAN}${entity}${wr} for device ${CYAN}${device}${nf} because in deviceEntityBlackList`);
110
+ this.log.info(`Skipping entity ${CYAN}${entity}${nf} for device ${CYAN}${device}${nf} because in deviceEntityBlackList`);
199
111
  return false;
200
112
  }
201
113
  return true;
202
114
  }
203
115
  }
204
- //# sourceMappingURL=matterbridgePlatform.js.map
@@ -1,27 +1,3 @@
1
- /**
2
- * This file contains the types for Matterbridge.
3
- *
4
- * @file matterbridgeTypes.ts
5
- * @author Luca Liguori
6
- * @date 2024-07-12
7
- * @version 1.0.2
8
- *
9
- * Copyright 2023, 2024, 2025 Luca Liguori.
10
- *
11
- * Licensed under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License.
13
- * You may obtain a copy of the License at
14
- *
15
- * http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- * See the License for the specific language governing permissions and
21
- * limitations under the License. *
22
- */
23
- // Default colors
24
1
  export const plg = '\u001B[38;5;33m';
25
2
  export const dev = '\u001B[38;5;79m';
26
3
  export const typ = '\u001B[38;5;207m';
27
- //# sourceMappingURL=matterbridgeTypes.js.map
@@ -1,54 +1,10 @@
1
- /**
2
- * This file contains the function matterbridgeMessageHandler.
3
- *
4
- * @file matterbridgeWebsocket.ts
5
- * @author Luca Liguori
6
- * @date 2024-10-16
7
- * @version 1.0.0
8
- *
9
- * Copyright 2024, 2025, 2026 Luca Liguori.
10
- *
11
- * Licensed under the Apache License, Version 2.0 (the "License");
12
- * you may not use this file except in compliance with the License.
13
- * You may obtain a copy of the License at
14
- *
15
- * http://www.apache.org/licenses/LICENSE-2.0
16
- *
17
- * Unless required by applicable law or agreed to in writing, software
18
- * distributed under the License is distributed on an "AS IS" BASIS,
19
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- * See the License for the specific language governing permissions and
21
- * limitations under the License. *
22
- */
23
1
  import { isValidNumber, isValidObject, isValidString } from './utils/utils.js';
24
- // AnsiLogger module
25
2
  import { debugStringify } from 'node-ansi-logger';
26
- // @matter
27
3
  import { Logger } from '@matter/main';
28
4
  import { BasicInformationCluster, BridgedDeviceBasicInformationCluster } from '@matter/main/clusters';
29
- /**
30
- * Websocket message ID for logging.
31
- * @constant {number}
32
- */
33
5
  export const WS_ID_LOG = 0;
34
- /**
35
- * Websocket message ID indicating a refresh is needed.
36
- * @constant {number}
37
- */
38
6
  export const WS_ID_REFRESH_NEEDED = 1;
39
- /**
40
- * Websocket message ID indicating a restart is needed.
41
- * @constant {number}
42
- */
43
7
  export const WS_ID_RESTART_NEEDED = 2;
44
- /**
45
- * Handles incoming websocket messages for the Matterbridge.
46
- *
47
- * @param {Matterbridge} this - The Matterbridge instance.
48
- * @param {WebSocket} client - The websocket client that sent the message.
49
- * @param {WebSocket.RawData} message - The raw data of the message received from the client.
50
- * @returns {Promise<void>} A promise that resolves when the message has been handled.
51
- */
52
8
  export async function wsMessageHandler(client, message) {
53
9
  let data;
54
10
  try {
@@ -188,4 +144,3 @@ export async function wsMessageHandler(client, message) {
188
144
  return;
189
145
  }
190
146
  }
191
- //# sourceMappingURL=matterbridgeWebsocket.js.map