matterbridge 3.0.7-dev-20250620-076b34c → 3.0.8-dev-20250622-f9e44a2

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 (39) hide show
  1. package/CHANGELOG.md +27 -2
  2. package/README-DEV.md +4 -4
  3. package/bin/matterbridge +2 -0
  4. package/dist/cli.js +3 -4
  5. package/dist/deviceManager.js +1 -1
  6. package/dist/frontend.js +31 -9
  7. package/dist/helpers.js +4 -1
  8. package/dist/index.js +1 -1
  9. package/dist/matterbridge.js +7 -7
  10. package/dist/matterbridgeEndpoint.js +5 -5
  11. package/dist/matterbridgeEndpointHelpers.js +2 -2
  12. package/dist/matterbridgePlatform.js +7 -3
  13. package/dist/pluginManager.js +1 -1
  14. package/dist/roboticVacuumCleaner.js +3 -3
  15. package/dist/shelly.js +2 -1
  16. package/dist/utils/network.js +1 -1
  17. package/dist/utils/wait.js +1 -0
  18. package/dist/waterHeater.js +3 -3
  19. package/frontend/build/matterbridge 1250x1250.png +0 -0
  20. package/frontend/build/matterbridge 624x624.png +0 -0
  21. package/frontend/package-lock.json +19176 -0
  22. package/frontend/package.json +79 -0
  23. package/frontend/public/Shelly.svg +1 -0
  24. package/frontend/public/bmc-button.svg +22 -0
  25. package/frontend/public/discord.svg +5 -0
  26. package/frontend/public/favicon.ico +0 -0
  27. package/frontend/public/index.html +19 -0
  28. package/frontend/public/manifest.json +15 -0
  29. package/frontend/public/matter.png +0 -0
  30. package/frontend/public/matterbridge 1250x1250.png +0 -0
  31. package/frontend/public/matterbridge 32x32.png +0 -0
  32. package/frontend/public/matterbridge 624x624.png +0 -0
  33. package/frontend/public/matterbridge 64x64.png +0 -0
  34. package/frontend/public/matterbridge.svg +50 -0
  35. package/frontend/public/robots.txt +3 -0
  36. package/npm-shrinkwrap.json +27 -36
  37. package/package.json +2 -2
  38. package/tsconfig.jest.json +0 -8
  39. package/tsconfig.production.json +0 -13
package/CHANGELOG.md CHANGED
@@ -8,7 +8,31 @@ If you like this project and find it useful, please consider giving it a star on
8
8
  <img src="bmc-button.svg" alt="Buy me a coffee" width="120">
9
9
  </a>
10
10
 
11
- ## [3.0.7] - 2025-06-??
11
+ ## [3.0.8] - 2025-06-??
12
+
13
+ ### Breaking Changes
14
+
15
+ ### Added
16
+
17
+ - [DevContainer]: Added support for **Matterbridge Dev Container** with optimized Named Volume for node_modules.
18
+ - [GitHub]: Added GitHub issue templates for bug reports and feature requests.
19
+ - [Systemd]: Added systemd service file for Matterbridge.
20
+ - [Eslint]: Refactored ESLint configuration for TypeScript and improve plugin integration.
21
+ - [Eslint]: Added plugin eslint-plugin-promise, eslint-plugin-jsdoc and @vitest/eslint-plugin.
22
+ - [Vitest]: Added Vitest for TypeScript project test. It will replace Jest that doesn't work correctly with ESM module mock.
23
+ - [JSDoc]: Added missed JSDoc, @params and @returns.
24
+
25
+ ### Changed
26
+
27
+ - [package]: Updated dependencies and refactored scripts.
28
+
29
+ ### Fixed
30
+
31
+ <a href="https://www.buymeacoffee.com/luligugithub">
32
+ <img src="bmc-button.svg" alt="Buy me a coffee" width="80">
33
+ </a>
34
+
35
+ ## [3.0.7] - 2025-06-21
12
36
 
13
37
  ### Breaking Changes
14
38
 
@@ -16,7 +40,8 @@ If you like this project and find it useful, please consider giving it a star on
16
40
 
17
41
  ### Added
18
42
 
19
- - [template]: Added the [Matterbridge Plugin Template](https://github.com/Luligu/matterbridge-plugin-template).
43
+ - [template]: Added the [Matterbridge Plugin Template](https://github.com/Luligu/matterbridge-plugin-template). It supports Dev Container and Vitest.
44
+ - [platform]: Add getDevices() method to retrieve the registered devices in MatterbridgePlatform.
20
45
 
21
46
  ### Changed
22
47
 
package/README-DEV.md CHANGED
@@ -16,7 +16,7 @@
16
16
 
17
17
  ## How to create your plugin
18
18
 
19
- The easiest way is to clone the [Matterbridge Plugin Template](https://github.com/Luligu/matterbridge-plugin-template) that has **Dev Container support for instant development environment** and all tools and extensions (like Node.js, npm, TypeScript, ESLint, Prettier, Jest) already loaded and configured.
19
+ The easiest way is to clone the [Matterbridge Plugin Template](https://github.com/Luligu/matterbridge-plugin-template) that has **Dev Container support for instant development environment** and all tools and extensions (like Node.js, npm, TypeScript, ESLint, Prettier, Jest and Vitest) already loaded and configured.
20
20
 
21
21
  Then change the name (keep matterbridge- at the beginning of the name), version, description, author, homepage, repository, bugs and funding in the package.json.
22
22
 
@@ -24,9 +24,9 @@ It is possible to add two custom properties to the package.json: **help** and **
24
24
 
25
25
  Add your plugin logic in module.ts.
26
26
 
27
- The Matterbridge Plugin Template has an already configured Jest test (coverage 100%) that you can expand while you add your own plugin logic.
27
+ The Matterbridge Plugin Template has an already configured Jest / Vitest test unit (coverage 100%) that you can expand while you add your own plugin logic.
28
28
 
29
- It also has a workflow configured to run on push and pull request that build, lint and test the plugin on node 18, 20, 22 and 24 with ubuntu, macOS and windows.
29
+ It also has a workflow configured to run on push and pull request that build, lint and test the plugin on node 20, 22 and 24 with ubuntu, macOS and windows.
30
30
 
31
31
  ## Guidelines on imports/exports
32
32
 
@@ -139,7 +139,7 @@ npm run build
139
139
  then add the plugin to Matterbridge
140
140
 
141
141
  ```
142
- matterbridge -add .\
142
+ matterbridge -add .
143
143
  ```
144
144
 
145
145
  ## MatterbridgeDynamicPlatform and MatterbridgeAccessoryPlatform api
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import('../dist/cli.js');
package/dist/cli.js CHANGED
@@ -1,10 +1,9 @@
1
- #!/usr/bin/env node
2
- import { Matterbridge } from './matterbridge.js';
3
- import { getIntParameter, hasParameter } from './utils/export.js';
4
- import { AnsiLogger, BRIGHT, CYAN, db, YELLOW } from './logger/export.js';
5
1
  import os from 'node:os';
6
2
  import { EventEmitter } from 'node:events';
7
3
  import { inspect } from 'node:util';
4
+ import { AnsiLogger, BRIGHT, CYAN, db, YELLOW } from 'node-ansi-logger';
5
+ import { getIntParameter, hasParameter } from './utils/export.js';
6
+ import { Matterbridge } from './matterbridge.js';
8
7
  export const cliEmitter = new EventEmitter();
9
8
  export let instance;
10
9
  let session;
@@ -1,4 +1,4 @@
1
- import { AnsiLogger, BLUE, er } from './logger/export.js';
1
+ import { AnsiLogger, BLUE, er } from 'node-ansi-logger';
2
2
  import { dev } from './matterbridgeTypes.js';
3
3
  export class DeviceManager {
4
4
  _devices = new Map();
package/dist/frontend.js CHANGED
@@ -1,5 +1,3 @@
1
- import { Logger, LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, Lifecycle } from '@matter/main';
2
- import { BridgedDeviceBasicInformation, PowerSource } from '@matter/main/clusters';
3
1
  import { createServer } from 'node:http';
4
2
  import https from 'node:https';
5
3
  import os from 'node:os';
@@ -8,10 +6,11 @@ import { promises as fs } from 'node:fs';
8
6
  import express from 'express';
9
7
  import WebSocket, { WebSocketServer } from 'ws';
10
8
  import multer from 'multer';
11
- import { AnsiLogger, stringify, debugStringify, CYAN, db, er, nf, rs, UNDERLINE, UNDERLINEOFF, wr, YELLOW, nt } from './logger/export.js';
12
- import { createZip, isValidArray, isValidNumber, isValidObject, isValidString, isValidBoolean, withTimeout } from './utils/export.js';
9
+ import { AnsiLogger, stringify, debugStringify, CYAN, db, er, nf, rs, UNDERLINE, UNDERLINEOFF, wr, YELLOW, nt } from 'node-ansi-logger';
10
+ import { Logger, LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, Lifecycle } from '@matter/main';
11
+ import { BridgedDeviceBasicInformation, PowerSource } from '@matter/main/clusters';
12
+ import { createZip, isValidArray, isValidNumber, isValidObject, isValidString, isValidBoolean, withTimeout, hasParameter } from './utils/export.js';
13
13
  import { plg } from './matterbridgeTypes.js';
14
- import { hasParameter } from './utils/export.js';
15
14
  import { capitalizeFirstLetter } from './matterbridgeEndpointHelpers.js';
16
15
  import spawn from './utils/spawn.js';
17
16
  export const WS_ID_LOG = 0;
@@ -893,12 +892,19 @@ export class Frontend {
893
892
  this.wssSendSnackbarMessage(`Installed package ${data.params.packageName}`, 5, 'success');
894
893
  const packageName = data.params.packageName.replace(/@.*$/, '');
895
894
  if (data.params.restart === false && packageName !== 'matterbridge') {
896
- this.matterbridge.plugins.add(packageName).then((plugin) => {
895
+ this.matterbridge.plugins
896
+ .add(packageName)
897
+ .then((plugin) => {
897
898
  if (plugin) {
898
899
  this.wssSendSnackbarMessage(`Added plugin ${packageName}`, 5, 'success');
899
- this.matterbridge.plugins.load(plugin, true, 'The plugin has been added', true).then(() => {
900
+ this.matterbridge.plugins
901
+ .load(plugin, true, 'The plugin has been added', true)
902
+ .then(() => {
900
903
  this.wssSendSnackbarMessage(`Started plugin ${packageName}`, 5, 'success');
901
904
  this.wssSendRefreshRequired('plugins');
905
+ return;
906
+ })
907
+ .catch((_error) => {
902
908
  });
903
909
  }
904
910
  else {
@@ -906,6 +912,9 @@ export class Frontend {
906
912
  this.wssSendRefreshRequired('plugins');
907
913
  this.wssSendRestartRequired();
908
914
  }
915
+ return;
916
+ })
917
+ .catch((_error) => {
909
918
  });
910
919
  }
911
920
  else {
@@ -918,6 +927,7 @@ export class Frontend {
918
927
  this.wssSendRestartRequired();
919
928
  }
920
929
  }
930
+ return;
921
931
  })
922
932
  .catch((error) => {
923
933
  client.send(JSON.stringify({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: error instanceof Error ? error.message : error }));
@@ -945,6 +955,7 @@ export class Frontend {
945
955
  client.send(JSON.stringify({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, response }));
946
956
  this.wssSendCloseSnackbarMessage(`Uninstalling package ${data.params.packageName}...`);
947
957
  this.wssSendSnackbarMessage(`Uninstalled package ${data.params.packageName}`, 5, 'success');
958
+ return;
948
959
  })
949
960
  .catch((error) => {
950
961
  client.send(JSON.stringify({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, error: error instanceof Error ? error.message : error }));
@@ -968,10 +979,15 @@ export class Frontend {
968
979
  if (plugin) {
969
980
  client.send(JSON.stringify({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, response: plugin.name }));
970
981
  this.wssSendSnackbarMessage(`Added plugin ${data.params.pluginNameOrPath}`, 5, 'success');
971
- this.matterbridge.plugins.load(plugin, true, 'The plugin has been added', true).then(() => {
982
+ this.matterbridge.plugins
983
+ .load(plugin, true, 'The plugin has been added', true)
984
+ .then(() => {
972
985
  this.wssSendRefreshRequired('plugins');
973
986
  this.wssSendRefreshRequired('devices');
974
987
  this.wssSendSnackbarMessage(`Started plugin ${data.params.pluginNameOrPath}`, 5, 'success');
988
+ return;
989
+ })
990
+ .catch((_error) => {
975
991
  });
976
992
  }
977
993
  else {
@@ -1009,10 +1025,15 @@ export class Frontend {
1009
1025
  plugin.addedDevices = undefined;
1010
1026
  await this.matterbridge.plugins.enable(data.params.pluginName);
1011
1027
  this.wssSendSnackbarMessage(`Enabled plugin ${data.params.pluginName}`, 5, 'success');
1012
- this.matterbridge.plugins.load(plugin, true, 'The plugin has been enabled', true).then(() => {
1028
+ this.matterbridge.plugins
1029
+ .load(plugin, true, 'The plugin has been enabled', true)
1030
+ .then(() => {
1013
1031
  this.wssSendRefreshRequired('plugins');
1014
1032
  this.wssSendRefreshRequired('devices');
1015
1033
  this.wssSendSnackbarMessage(`Started plugin ${data.params.pluginName}`, 5, 'success');
1034
+ return;
1035
+ })
1036
+ .catch((_error) => {
1016
1037
  });
1017
1038
  }
1018
1039
  client.send(JSON.stringify({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true }));
@@ -1219,6 +1240,7 @@ export class Frontend {
1219
1240
  ?.onAction(data.params.action, data.params.value, data.params.id, data.params.formData)
1220
1241
  .then(() => {
1221
1242
  client.send(JSON.stringify({ id: data.id, method: data.method, src: 'Matterbridge', dst: data.src, success: true }));
1243
+ return;
1222
1244
  })
1223
1245
  .catch((error) => {
1224
1246
  this.log.error(`Error in plugin ${plugin.name} action ${data.params.action}: ${error}`);
package/dist/helpers.js CHANGED
@@ -3,10 +3,10 @@ import { Endpoint } from '@matter/node';
3
3
  import { BridgedDeviceBasicInformationServer } from '@matter/node/behaviors/bridged-device-basic-information';
4
4
  import { OnOffBaseServer } from '@matter/node/behaviors/on-off';
5
5
  import { OnOffPlugInUnitDevice } from '@matter/node/devices/on-off-plug-in-unit';
6
- import { hasParameter } from './utils/commandLine.js';
7
6
  import { MountedOnOffControlDevice } from '@matter/node/devices/mounted-on-off-control';
8
7
  import { OnOffLightDevice } from '@matter/node/devices/on-off-light';
9
8
  import { OnOffLightSwitchDevice } from '@matter/node/devices/on-off-light-switch';
9
+ import { hasParameter } from './utils/commandLine.js';
10
10
  export async function addVirtualDevice(aggregatorEndpoint, name, type, callback) {
11
11
  let deviceType;
12
12
  switch (type) {
@@ -59,6 +59,7 @@ export async function addVirtualDevices(matterbridge, aggregatorEndpoint) {
59
59
  getShelly('/api/updates/sys/perform', 10 * 1000)
60
60
  .then(() => {
61
61
  matterbridge.log.notice('Shelly system updated successfully');
62
+ return;
62
63
  })
63
64
  .catch((error) => {
64
65
  matterbridge.log.error(`Error updating shelly system: ${error}`);
@@ -66,6 +67,7 @@ export async function addVirtualDevices(matterbridge, aggregatorEndpoint) {
66
67
  getShelly('/api/updates/main/perform', 10 * 1000)
67
68
  .then(() => {
68
69
  matterbridge.log.notice('Shelly software updated successfully');
70
+ return;
69
71
  })
70
72
  .catch((error) => {
71
73
  matterbridge.log.error(`Error updating shelly software: ${error}`);
@@ -81,6 +83,7 @@ export async function addVirtualDevices(matterbridge, aggregatorEndpoint) {
81
83
  postShelly('/api/system/reboot', {}, 60 * 1000)
82
84
  .then(() => {
83
85
  matterbridge.log.notice('Rebooting shelly board...');
86
+ return;
84
87
  })
85
88
  .catch((error) => {
86
89
  matterbridge.log.error(`Error rebooting shelly board: ${error}`);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
+ import { AnsiLogger } from 'node-ansi-logger';
1
2
  import { Matterbridge } from './matterbridge.js';
2
3
  import { hasParameter } from './utils/export.js';
3
- import { AnsiLogger } from './logger/export.js';
4
4
  export * from './matterbridge.js';
5
5
  export * from './matterbridgeTypes.js';
6
6
  export * from './matterbridgeEndpoint.js';
@@ -3,8 +3,13 @@ import path from 'node:path';
3
3
  import { promises as fs } from 'node:fs';
4
4
  import EventEmitter from 'node:events';
5
5
  import { inspect } from 'node:util';
6
- import { AnsiLogger, UNDERLINE, UNDERLINEOFF, YELLOW, db, debugStringify, BRIGHT, RESET, er, nf, rs, wr, RED, GREEN, zb, CYAN } from './logger/export.js';
7
- import { NodeStorageManager } from './storage/export.js';
6
+ import { AnsiLogger, UNDERLINE, UNDERLINEOFF, YELLOW, db, debugStringify, BRIGHT, RESET, er, nf, rs, wr, RED, GREEN, zb, CYAN } from 'node-ansi-logger';
7
+ import { NodeStorageManager } from 'node-persist-manager';
8
+ import { DeviceTypeId, Endpoint, Logger, LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, VendorId, StorageService, Environment, ServerNode, UINT32_MAX, UINT16_MAX, } from '@matter/main';
9
+ import { DeviceCommissioner, FabricAction, MdnsService, PaseClient } from '@matter/main/protocol';
10
+ import { AggregatorEndpoint } from '@matter/main/endpoints';
11
+ import { BasicInformationServer } from '@matter/main/behaviors/basic-information';
12
+ import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
8
13
  import { getParameter, getIntParameter, hasParameter, copyDirectory, withTimeout, waiter, isValidString, parseVersionString, isValidNumber, createDirectory } from './utils/export.js';
9
14
  import { logInterfaces, getGlobalNodeModules } from './utils/network.js';
10
15
  import { dev, plg, typ } from './matterbridgeTypes.js';
@@ -15,11 +20,6 @@ import { bridge } from './matterbridgeDeviceTypes.js';
15
20
  import { Frontend } from './frontend.js';
16
21
  import { addVirtualDevices } from './helpers.js';
17
22
  import spawn from './utils/spawn.js';
18
- import { DeviceTypeId, Endpoint, Logger, LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, VendorId, StorageService, Environment, ServerNode, UINT32_MAX, UINT16_MAX, } from '@matter/main';
19
- import { DeviceCommissioner, FabricAction, MdnsService, PaseClient } from '@matter/main/protocol';
20
- import { AggregatorEndpoint } from '@matter/main/endpoints';
21
- import { BasicInformationServer } from '@matter/main/behaviors/basic-information';
22
- import { BridgedDeviceBasicInformationServer } from '@matter/main/behaviors/bridged-device-basic-information';
23
23
  export class Matterbridge extends EventEmitter {
24
24
  systemInformation = {
25
25
  interfaceName: '',
@@ -1,8 +1,3 @@
1
- import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
2
- import { bridgedNode } from './matterbridgeDeviceTypes.js';
3
- import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
4
- import { MatterbridgeServer, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, } from './matterbridgeBehaviors.js';
5
- import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultOperationalStateClusterServer, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, invokeBehaviorCommand, triggerEvent, } from './matterbridgeEndpointHelpers.js';
6
1
  import { Endpoint, Lifecycle, MutableEndpoint, NamedHandler, SupportedBehaviors, UINT16_MAX, UINT32_MAX, VendorId } from '@matter/main';
7
2
  import { getClusterNameById, MeasurementType } from '@matter/main/types';
8
3
  import { Descriptor } from '@matter/main/clusters/descriptor';
@@ -65,6 +60,11 @@ import { HepaFilterMonitoringServer } from '@matter/main/behaviors/hepa-filter-m
65
60
  import { ActivatedCarbonFilterMonitoringServer } from '@matter/main/behaviors/activated-carbon-filter-monitoring';
66
61
  import { ThermostatUserInterfaceConfigurationServer } from '@matter/main/behaviors/thermostat-user-interface-configuration';
67
62
  import { DeviceEnergyManagementServer } from '@matter/main/behaviors/device-energy-management';
63
+ import { AnsiLogger, CYAN, YELLOW, db, debugStringify, hk, or, zb } from './logger/export.js';
64
+ import { bridgedNode } from './matterbridgeDeviceTypes.js';
65
+ import { isValidNumber, isValidObject, isValidString } from './utils/export.js';
66
+ import { MatterbridgeServer, MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeLiftTiltWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeSwitchServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, } from './matterbridgeBehaviors.js';
67
+ import { addClusterServers, addFixedLabel, addOptionalClusterServers, addRequiredClusterServers, addUserLabel, createUniqueId, getBehavior, getBehaviourTypesFromClusterClientIds, getBehaviourTypesFromClusterServerIds, getDefaultOperationalStateClusterServer, getDefaultFlowMeasurementClusterServer, getDefaultIlluminanceMeasurementClusterServer, getDefaultPressureMeasurementClusterServer, getDefaultRelativeHumidityMeasurementClusterServer, getDefaultTemperatureMeasurementClusterServer, getDefaultOccupancySensingClusterServer, lowercaseFirstLetter, updateAttribute, getClusterId, getAttributeId, setAttribute, getAttribute, checkNotLatinCharacters, generateUniqueId, subscribeAttribute, invokeBehaviorCommand, triggerEvent, } from './matterbridgeEndpointHelpers.js';
68
68
  export class MatterbridgeEndpoint extends Endpoint {
69
69
  static bridgeMode = '';
70
70
  static logLevel = "info";
@@ -1,3 +1,5 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { BLUE, CYAN, db, debugStringify, er, hk, or, YELLOW, zb } from 'node-ansi-logger';
1
3
  import { Lifecycle } from '@matter/main';
2
4
  import { getClusterNameById } from '@matter/main/types';
3
5
  import { PowerSource } from '@matter/main/clusters/power-source';
@@ -74,8 +76,6 @@ import { Pm10ConcentrationMeasurementServer } from '@matter/main/behaviors/pm10-
74
76
  import { RadonConcentrationMeasurementServer } from '@matter/main/behaviors/radon-concentration-measurement';
75
77
  import { TotalVolatileOrganicCompoundsConcentrationMeasurementServer } from '@matter/main/behaviors/total-volatile-organic-compounds-concentration-measurement';
76
78
  import { DeviceEnergyManagementServer } from '@matter/node/behaviors/device-energy-management';
77
- import { createHash } from 'node:crypto';
78
- import { BLUE, CYAN, db, debugStringify, er, hk, or, YELLOW, zb } from 'node-ansi-logger';
79
79
  import { deepCopy, deepEqual, isValidArray } from './utils/export.js';
80
80
  import { MatterbridgeIdentifyServer, MatterbridgeOnOffServer, MatterbridgeLevelControlServer, MatterbridgeColorControlServer, MatterbridgeLiftWindowCoveringServer, MatterbridgeThermostatServer, MatterbridgeFanControlServer, MatterbridgeDoorLockServer, MatterbridgeModeSelectServer, MatterbridgeValveConfigurationAndControlServer, MatterbridgeSmokeCoAlarmServer, MatterbridgeBooleanStateConfigurationServer, MatterbridgeOperationalStateServer, MatterbridgeDeviceEnergyManagementModeServer, } from './matterbridgeBehaviors.js';
81
81
  export function capitalizeFirstLetter(name) {
@@ -1,8 +1,8 @@
1
+ import path from 'node:path';
2
+ import { CYAN, db, er, nf, wr } from 'node-ansi-logger';
3
+ import { NodeStorageManager } from 'node-persist-manager';
1
4
  import { checkNotLatinCharacters } from './matterbridgeEndpointHelpers.js';
2
5
  import { isValidArray, isValidObject, isValidString } from './utils/export.js';
3
- import { CYAN, db, er, nf, wr } from './logger/export.js';
4
- import { NodeStorageManager } from './storage/export.js';
5
- import path from 'node:path';
6
6
  export class MatterbridgePlatform {
7
7
  matterbridge;
8
8
  log;
@@ -39,6 +39,7 @@ export class MatterbridgePlatform {
39
39
  this.context = context;
40
40
  this.context.remove('endpointMap');
41
41
  this.log.debug(`Created context for plugin ${this.config.name}`);
42
+ return;
42
43
  });
43
44
  this.log.debug(`Loading selectDevice for plugin ${this.config.name}`);
44
45
  this._selectDeviceContextReady = this.storage.createStorage('selectDevice').then(async (context) => {
@@ -46,6 +47,7 @@ export class MatterbridgePlatform {
46
47
  for (const device of selectDevice)
47
48
  this.selectDevice.set(device.serial, device);
48
49
  this.log.debug(`Loaded ${this.selectDevice.size} selectDevice for plugin ${this.config.name}`);
50
+ return;
49
51
  });
50
52
  this.log.debug(`Loading selectEntity for plugin ${this.config.name}`);
51
53
  this._selectEntityContextReady = this.storage.createStorage('selectEntity').then(async (context) => {
@@ -53,9 +55,11 @@ export class MatterbridgePlatform {
53
55
  for (const entity of selectEntity)
54
56
  this.selectEntity.set(entity.name, entity);
55
57
  this.log.debug(`Loaded ${this.selectEntity.size} selectEntity for plugin ${this.config.name}`);
58
+ return;
56
59
  });
57
60
  this.ready = Promise.all([this._contextReady, this._selectDeviceContextReady, this._selectEntityContextReady]).then(() => {
58
61
  this.log.debug(`MatterbridgePlatform for plugin ${this.config.name} is fully initialized`);
62
+ return;
59
63
  });
60
64
  }
61
65
  async onStart(reason) {
@@ -1,4 +1,4 @@
1
- import { AnsiLogger, UNDERLINE, UNDERLINEOFF, BLUE, db, er, nf, nt, rs, wr } from './logger/export.js';
1
+ import { AnsiLogger, UNDERLINE, UNDERLINEOFF, BLUE, db, er, nf, nt, rs, wr } from 'node-ansi-logger';
2
2
  import { plg, typ } from './matterbridgeTypes.js';
3
3
  export class PluginManager {
4
4
  _plugins = new Map();
@@ -1,6 +1,3 @@
1
- import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
2
- import { roboticVacuumCleaner } from './matterbridgeDeviceTypes.js';
3
- import { MatterbridgeServer, MatterbridgeServiceAreaServer } from './matterbridgeBehaviors.js';
4
1
  import { RvcRunModeServer } from '@matter/main/behaviors/rvc-run-mode';
5
2
  import { RvcOperationalStateServer } from '@matter/main/behaviors/rvc-operational-state';
6
3
  import { RvcCleanModeServer } from '@matter/main/behaviors/rvc-clean-mode';
@@ -10,6 +7,9 @@ import { RvcCleanMode } from '@matter/main/clusters/rvc-clean-mode';
10
7
  import { RvcOperationalState } from '@matter/main/clusters/rvc-operational-state';
11
8
  import { ModeBase } from '@matter/main/clusters/mode-base';
12
9
  import { OperationalState } from '@matter/main/clusters/operational-state';
10
+ import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
11
+ import { roboticVacuumCleaner } from './matterbridgeDeviceTypes.js';
12
+ import { MatterbridgeServer, MatterbridgeServiceAreaServer } from './matterbridgeBehaviors.js';
13
13
  export class RoboticVacuumCleaner extends MatterbridgeEndpoint {
14
14
  constructor(name, serial, currentRunMode, supportedRunModes, currentCleanMode, supportedCleanModes, currentPhase = null, phaseList = null, operationalState, operationalStateList, supportedAreas, selectedAreas, currentArea) {
15
15
  super(roboticVacuumCleaner, { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);
package/dist/shelly.js CHANGED
@@ -1,5 +1,5 @@
1
+ import { debugStringify } from 'node-ansi-logger';
1
2
  import { WS_ID_SHELLY_MAIN_UPDATE, WS_ID_SHELLY_SYS_UPDATE } from './frontend.js';
2
- import { debugStringify } from './logger/export.js';
3
3
  let verifyIntervalSecs = 15;
4
4
  let verifyTimeoutSecs = 600;
5
5
  export function setVerifyIntervalSecs(seconds) {
@@ -93,6 +93,7 @@ export async function verifyShellyUpdate(matterbridge, api, name) {
93
93
  clearTimeout(timeout);
94
94
  resolve();
95
95
  }
96
+ return;
96
97
  })
97
98
  .catch((error) => {
98
99
  matterbridge.log.error(`Error getting status of ${name}: ${error instanceof Error ? error.message : String(error)}`);
@@ -1,5 +1,5 @@
1
1
  import os from 'node:os';
2
- import { AnsiLogger, idn, rs } from '../logger/export.js';
2
+ import { AnsiLogger, idn, rs } from 'node-ansi-logger';
3
3
  export function getIpv4InterfaceAddress() {
4
4
  let ipv4Address;
5
5
  const networkInterfaces = os.networkInterfaces();
@@ -58,6 +58,7 @@ export function withTimeout(promise, timeoutMillisecs = 10000, reThrow = true) {
58
58
  .then((result) => {
59
59
  clearTimeout(timer);
60
60
  resolve(result);
61
+ return result;
61
62
  })
62
63
  .catch((error) => {
63
64
  clearTimeout(timer);
@@ -1,11 +1,11 @@
1
- import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
2
- import { waterHeater } from './matterbridgeDeviceTypes.js';
3
- import { MatterbridgeServer } from './matterbridgeBehaviors.js';
4
1
  import { ModeBase } from '@matter/main/clusters/mode-base';
5
2
  import { WaterHeaterManagement } from '@matter/main/clusters/water-heater-management';
6
3
  import { WaterHeaterMode } from '@matter/main/clusters/water-heater-mode';
7
4
  import { WaterHeaterManagementServer } from '@matter/main/behaviors/water-heater-management';
8
5
  import { WaterHeaterModeServer } from '@matter/main/behaviors/water-heater-mode';
6
+ import { MatterbridgeServer } from './matterbridgeBehaviors.js';
7
+ import { waterHeater } from './matterbridgeDeviceTypes.js';
8
+ import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
9
9
  export class WaterHeater extends MatterbridgeEndpoint {
10
10
  constructor(name, serial, waterTemperature = 50, targetWaterTemperature = 55, minHeatSetpointLimit = 20, maxHeatSetpointLimit = 80, heaterTypes = { immersionElement1: true }, tankPercentage = 90) {
11
11
  super(waterHeater, { uniqueStorageKey: `${name.replaceAll(' ', '')}-${serial.replaceAll(' ', '')}` }, true);