matterbridge 3.3.4-dev-20251020-4d2dd49 → 3.3.4-dev-20251021-7651f57
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 +9 -0
- package/README-DOCKER.md +4 -1
- package/README-SERVICE.md +4 -3
- package/dist/cli.js +7 -6
- package/dist/devices/airConditioner.js +2 -2
- package/dist/devices/batteryStorage.js +3 -3
- package/dist/devices/dishwasher.js +4 -4
- package/dist/devices/evse.js +6 -5
- package/dist/devices/extractorHood.js +1 -1
- package/dist/devices/heatPump.js +2 -2
- package/dist/devices/laundryDryer.js +3 -3
- package/dist/devices/laundryWasher.js +5 -5
- package/dist/devices/microwaveOven.js +5 -5
- package/dist/devices/oven.js +5 -5
- package/dist/devices/refrigerator.js +4 -4
- package/dist/devices/roboticVacuumCleaner.js +11 -11
- package/dist/devices/solarPower.js +2 -2
- package/dist/devices/speaker.js +2 -1
- package/dist/devices/temperatureControl.js +2 -2
- package/dist/devices/waterHeater.js +6 -6
- package/dist/frontend.js +27 -26
- package/dist/helpers.js +1 -1
- package/dist/matterbridge.js +46 -13
- package/dist/matterbridgeAccessoryPlatform.js +2 -0
- package/dist/matterbridgeBehaviors.js +39 -20
- package/dist/matterbridgeDeviceTypes.js +88 -86
- package/dist/matterbridgeDynamicPlatform.js +2 -0
- package/dist/matterbridgeEndpoint.js +92 -154
- package/dist/matterbridgeEndpointHelpers.js +221 -137
- package/dist/matterbridgePlatform.js +2 -2
- package/dist/update.js +1 -1
- package/dist/utils/format.js +29 -0
- package/dist/utils/jestHelpers.js +7 -3
- package/dist/utils/network.js +0 -26
- package/dist/utils/tracker.js +17 -45
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,10 @@ The project will evolve to a multi-threaded architecture (the CLI will become th
|
|
|
14
14
|
|
|
15
15
|
- matterbridge;
|
|
16
16
|
- frontend;
|
|
17
|
+
- plugins;
|
|
18
|
+
- devices;
|
|
19
|
+
- check_updates;
|
|
20
|
+
- npm_install;
|
|
17
21
|
- all plugins in bridge mode;
|
|
18
22
|
- each plugin in childbridge mode;
|
|
19
23
|
|
|
@@ -33,12 +37,17 @@ Advantages:
|
|
|
33
37
|
|
|
34
38
|
- [frontend]: Added debounce to MatterSettings.
|
|
35
39
|
- [cli]: Bumped `cli` version to 3.0.0 with backport of Traker and Inspector from thread module.
|
|
40
|
+
- [powerSource]: Added MatterbridgePowerSourceServer that initialize the enpointList of the PowerSource cluster.
|
|
41
|
+
- [thread]: Added BroadcastServer to Matterbridge.
|
|
36
42
|
|
|
37
43
|
### Changed
|
|
38
44
|
|
|
39
45
|
- [package]: Updated dependencies.
|
|
46
|
+
- [package]: Optimized @matter imports.
|
|
47
|
+
- [endpoint]: Optimized memory requirements.
|
|
40
48
|
- [matter]: Bumped `matter.js` version to 0.15.6. Thanks matter.js!
|
|
41
49
|
- [frontend]: Bumped `frontend` version to 3.2.3.
|
|
50
|
+
- [thread]: Bumped `BroadcastServer` version to 1.0.1.
|
|
42
51
|
|
|
43
52
|
<a href="https://www.buymeacoffee.com/luligugithub">
|
|
44
53
|
<img src="bmc-button.svg" alt="Buy me a coffee" width="80">
|
package/README-DOCKER.md
CHANGED
|
@@ -53,7 +53,8 @@ This will create the required directories in your home directory if they don't e
|
|
|
53
53
|
cd ~
|
|
54
54
|
mkdir -p ~/Matterbridge
|
|
55
55
|
mkdir -p ~/.matterbridge
|
|
56
|
-
|
|
56
|
+
mkdir -p ~/.mattercert
|
|
57
|
+
sudo chown -R $USER:$USER ~/Matterbridge ~/.matterbridge ~/.mattercert
|
|
57
58
|
```
|
|
58
59
|
|
|
59
60
|
You may need to adapt the script to your setup.
|
|
@@ -77,6 +78,7 @@ The container must have full access to the host network (needed for mdns and Mat
|
|
|
77
78
|
sudo docker run --name matterbridge \
|
|
78
79
|
-v ~/Matterbridge:/root/Matterbridge \
|
|
79
80
|
-v ~/.matterbridge:/root/.matterbridge \
|
|
81
|
+
-v ~/.mattercert:/root/.mattercert \
|
|
80
82
|
--network host --restart always -d luligu/matterbridge:latest
|
|
81
83
|
```
|
|
82
84
|
|
|
@@ -96,6 +98,7 @@ services:
|
|
|
96
98
|
volumes:
|
|
97
99
|
- "${HOME}/Matterbridge:/root/Matterbridge" # Mounts the Matterbridge plugin directory
|
|
98
100
|
- "${HOME}/.matterbridge:/root/.matterbridge" # Mounts the Matterbridge storage directory
|
|
101
|
+
- "${HOME}/.mattercert:/root/.mattercert" # Mounts the Matterbridge certificate directory
|
|
99
102
|
```
|
|
100
103
|
|
|
101
104
|
Copy it in the home directory or edit the existing one to add the matterbridge service.
|
package/README-SERVICE.md
CHANGED
|
@@ -28,9 +28,10 @@ This will create the required directories if they don't exist
|
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
30
|
cd ~
|
|
31
|
-
mkdir -p
|
|
32
|
-
mkdir -p
|
|
33
|
-
|
|
31
|
+
mkdir -p ~/Matterbridge
|
|
32
|
+
mkdir -p ~/.matterbridge
|
|
33
|
+
mkdir -p ~/.mattercert
|
|
34
|
+
sudo chown -R $USER:$USER ~/Matterbridge ~/.matterbridge ~/.mattercert
|
|
34
35
|
```
|
|
35
36
|
|
|
36
37
|
### Then create a systemctl configuration file for Matterbridge
|
package/dist/cli.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
if (process.argv.includes('--loader') || process.argv.includes('-loader'))
|
|
2
|
-
console.log('\u001B[
|
|
2
|
+
console.log('\u001B[32mCli loaded.\u001B[40;0m');
|
|
3
3
|
import { AnsiLogger } from 'node-ansi-logger';
|
|
4
4
|
import { cliEmitter } from './cliEmitter.js';
|
|
5
|
-
import { hasParameter, hasAnyParameter } from './utils/commandLine.js';
|
|
6
5
|
import { Matterbridge } from './matterbridge.js';
|
|
6
|
+
import { hasParameter, hasAnyParameter } from './utils/commandLine.js';
|
|
7
7
|
import { inspectError } from './utils/error.js';
|
|
8
8
|
import { Tracker } from './utils/tracker.js';
|
|
9
9
|
import { Inspector } from './utils/inspector.js';
|
|
10
|
+
import { formatBytes, formatUptime } from './utils/format.js';
|
|
10
11
|
export let instance;
|
|
11
|
-
export const tracker = new Tracker('Cli',
|
|
12
|
-
export const inspector = new Inspector('Cli',
|
|
12
|
+
export const tracker = new Tracker('Cli', false, false);
|
|
13
|
+
export const inspector = new Inspector('Cli', false, false);
|
|
13
14
|
const log = new AnsiLogger({ logName: 'Cli', logTimestampFormat: 4, logLevel: hasParameter('debug') ? "debug" : "info" });
|
|
14
15
|
function startCpuMemoryCheck() {
|
|
15
16
|
log.debug(`Cpu memory check starting...`);
|
|
16
17
|
tracker.start();
|
|
17
18
|
tracker.on('uptime', (os, process) => {
|
|
18
|
-
cliEmitter.emit('uptime',
|
|
19
|
+
cliEmitter.emit('uptime', formatUptime(Math.floor(os)), formatUptime(Math.floor(process)));
|
|
19
20
|
});
|
|
20
21
|
tracker.on('snapshot', (snapshot) => {
|
|
21
|
-
cliEmitter.emit('memory',
|
|
22
|
+
cliEmitter.emit('memory', formatBytes(snapshot.totalMemory), formatBytes(snapshot.freeMemory), formatBytes(snapshot.rss), formatBytes(snapshot.heapTotal), formatBytes(snapshot.heapUsed), formatBytes(snapshot.external), formatBytes(snapshot.arrayBuffers));
|
|
22
23
|
cliEmitter.emit('cpu', snapshot.osCpu, snapshot.processCpu);
|
|
23
24
|
});
|
|
24
25
|
log.debug(`Cpu memory check started`);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ThermostatUserInterfaceConfiguration } from '@matter/
|
|
2
|
-
import { FanControl } from '@matter/
|
|
1
|
+
import { ThermostatUserInterfaceConfiguration } from '@matter/types/clusters/thermostat-user-interface-configuration';
|
|
2
|
+
import { FanControl } from '@matter/types/clusters/fan-control';
|
|
3
3
|
import { airConditioner, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
4
4
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
5
5
|
export class AirConditioner extends MatterbridgeEndpoint {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PowerSourceTag } from '@matter/
|
|
2
|
-
import { DeviceEnergyManagement } from '@matter/
|
|
3
|
-
import { PowerSource } from '@matter/
|
|
1
|
+
import { PowerSourceTag } from '@matter/node';
|
|
2
|
+
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
3
|
+
import { PowerSource } from '@matter/types/clusters/power-source';
|
|
4
4
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
5
5
|
import { deviceEnergyManagement, electricalSensor, batteryStorage, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
6
6
|
export class BatteryStorage extends MatterbridgeEndpoint {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ModeBase } from '@matter/
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { ModeBase } from '@matter/types/clusters/mode-base';
|
|
2
|
+
import { DishwasherMode } from '@matter/types/clusters/dishwasher-mode';
|
|
3
|
+
import { DishwasherModeServer } from '@matter/node/behaviors/dishwasher-mode';
|
|
4
|
+
import { DishwasherAlarmServer } from '@matter/node/behaviors/dishwasher-alarm';
|
|
5
5
|
import { dishwasher, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
6
6
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
7
7
|
import { MatterbridgeOnOffServer, MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
package/dist/devices/evse.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { EnergyEvseMode } from '@matter/types/clusters/energy-evse-mode';
|
|
2
|
+
import { EnergyEvse } from '@matter/types/clusters/energy-evse';
|
|
3
|
+
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
4
|
+
import { ModeBase } from '@matter/types/clusters/mode-base';
|
|
5
|
+
import { EnergyEvseServer } from '@matter/node/behaviors/energy-evse';
|
|
6
|
+
import { EnergyEvseModeServer } from '@matter/node/behaviors/energy-evse-mode';
|
|
6
7
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
7
8
|
import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
8
9
|
import { deviceEnergyManagement, electricalSensor, evse, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResourceMonitoring } from '@matter/
|
|
1
|
+
import { ResourceMonitoring } from '@matter/types/clusters/resource-monitoring';
|
|
2
2
|
import { extractorHood, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
3
3
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
4
4
|
export class ExtractorHood extends MatterbridgeEndpoint {
|
package/dist/devices/heatPump.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { NumberTag, PowerSourceTag } from '@matter/
|
|
2
|
-
import { DeviceEnergyManagement } from '@matter/
|
|
1
|
+
import { NumberTag, PowerSourceTag } from '@matter/node';
|
|
2
|
+
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
3
3
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
4
4
|
import { deviceEnergyManagement, electricalSensor, powerSource, heatPump, temperatureSensor, thermostatDevice } from '../matterbridgeDeviceTypes.js';
|
|
5
5
|
export class HeatPump extends MatterbridgeEndpoint {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LaundryWasherMode } from '@matter/
|
|
2
|
-
import { LaundryDryerControls } from '@matter/
|
|
3
|
-
import { LaundryDryerControlsServer } from '@matter/
|
|
1
|
+
import { LaundryWasherMode } from '@matter/types/clusters/laundry-washer-mode';
|
|
2
|
+
import { LaundryDryerControls } from '@matter/types/clusters/laundry-dryer-controls';
|
|
3
|
+
import { LaundryDryerControlsServer } from '@matter/node/behaviors/laundry-dryer-controls';
|
|
4
4
|
import { laundryDryer, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
5
5
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
6
6
|
import { MatterbridgeLaundryWasherModeServer } from './laundryWasher.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { LaundryWasherControls } from '@matter/
|
|
2
|
-
import { LaundryWasherMode } from '@matter/
|
|
3
|
-
import { ModeBase } from '@matter/
|
|
4
|
-
import { LaundryWasherModeServer } from '@matter/
|
|
5
|
-
import { LaundryWasherControlsServer } from '@matter/
|
|
1
|
+
import { LaundryWasherControls } from '@matter/types/clusters/laundry-washer-controls';
|
|
2
|
+
import { LaundryWasherMode } from '@matter/types/clusters/laundry-washer-mode';
|
|
3
|
+
import { ModeBase } from '@matter/types/clusters/mode-base';
|
|
4
|
+
import { LaundryWasherModeServer } from '@matter/node/behaviors/laundry-washer-mode';
|
|
5
|
+
import { LaundryWasherControlsServer } from '@matter/node/behaviors/laundry-washer-controls';
|
|
6
6
|
import { laundryWasher, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
7
7
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
8
8
|
import { MatterbridgeOnOffServer, MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { OperationalState } from '@matter/
|
|
2
|
-
import { MicrowaveOvenMode } from '@matter/
|
|
3
|
-
import { MicrowaveOvenControl } from '@matter/
|
|
4
|
-
import { MicrowaveOvenControlServer } from '@matter/
|
|
5
|
-
import { MicrowaveOvenModeServer } from '@matter/
|
|
1
|
+
import { OperationalState } from '@matter/types/clusters/operational-state';
|
|
2
|
+
import { MicrowaveOvenMode } from '@matter/types/clusters/microwave-oven-mode';
|
|
3
|
+
import { MicrowaveOvenControl } from '@matter/types/clusters/microwave-oven-control';
|
|
4
|
+
import { MicrowaveOvenControlServer } from '@matter/node/behaviors/microwave-oven-control';
|
|
5
|
+
import { MicrowaveOvenModeServer } from '@matter/node/behaviors/microwave-oven-mode';
|
|
6
6
|
import { microwaveOven, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
7
7
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
8
8
|
import { MatterbridgeServer, MatterbridgeOperationalStateServer } from '../matterbridgeBehaviors.js';
|
package/dist/devices/oven.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ModeBase } from '@matter/
|
|
2
|
-
import { OvenMode } from '@matter/
|
|
3
|
-
import { OperationalState } from '@matter/
|
|
4
|
-
import { OvenModeServer } from '@matter/
|
|
5
|
-
import { OvenCavityOperationalStateServer } from '@matter/
|
|
1
|
+
import { ModeBase } from '@matter/types/clusters/mode-base';
|
|
2
|
+
import { OvenMode } from '@matter/types/clusters/oven-mode';
|
|
3
|
+
import { OperationalState } from '@matter/types/clusters/operational-state';
|
|
4
|
+
import { OvenModeServer } from '@matter/node/behaviors/oven-mode';
|
|
5
|
+
import { OvenCavityOperationalStateServer } from '@matter/node/behaviors/oven-cavity-operational-state';
|
|
6
6
|
import { oven, powerSource, temperatureControlledCabinetHeater } from '../matterbridgeDeviceTypes.js';
|
|
7
7
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
8
8
|
import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ModeBase } from '@matter/
|
|
2
|
-
import { RefrigeratorAndTemperatureControlledCabinetMode } from '@matter/
|
|
3
|
-
import { RefrigeratorAndTemperatureControlledCabinetModeServer } from '@matter/
|
|
4
|
-
import { RefrigeratorAlarmServer } from '@matter/
|
|
1
|
+
import { ModeBase } from '@matter/types/clusters/mode-base';
|
|
2
|
+
import { RefrigeratorAndTemperatureControlledCabinetMode } from '@matter/types/clusters/refrigerator-and-temperature-controlled-cabinet-mode';
|
|
3
|
+
import { RefrigeratorAndTemperatureControlledCabinetModeServer } from '@matter/node/behaviors/refrigerator-and-temperature-controlled-cabinet-mode';
|
|
4
|
+
import { RefrigeratorAlarmServer } from '@matter/node/behaviors/refrigerator-alarm';
|
|
5
5
|
import { powerSource, refrigerator, temperatureControlledCabinetCooler } from '../matterbridgeDeviceTypes.js';
|
|
6
6
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
7
7
|
import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { AreaNamespaceTag } from '@matter/
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import { AreaNamespaceTag } from '@matter/node';
|
|
2
|
+
import { PowerSource } from '@matter/types/clusters/power-source';
|
|
3
|
+
import { RvcRunMode } from '@matter/types/clusters/rvc-run-mode';
|
|
4
|
+
import { RvcCleanMode } from '@matter/types/clusters/rvc-clean-mode';
|
|
5
|
+
import { RvcOperationalState } from '@matter/types/clusters/rvc-operational-state';
|
|
6
|
+
import { ServiceArea } from '@matter/types/clusters/service-area';
|
|
7
|
+
import { ModeBase } from '@matter/types/clusters/mode-base';
|
|
8
|
+
import { OperationalState } from '@matter/types/clusters/operational-state';
|
|
9
|
+
import { RvcRunModeServer } from '@matter/node/behaviors/rvc-run-mode';
|
|
10
|
+
import { RvcOperationalStateServer } from '@matter/node/behaviors/rvc-operational-state';
|
|
11
|
+
import { RvcCleanModeServer } from '@matter/node/behaviors/rvc-clean-mode';
|
|
12
12
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
13
13
|
import { powerSource, roboticVacuumCleaner } from '../matterbridgeDeviceTypes.js';
|
|
14
14
|
import { MatterbridgeServer, MatterbridgeServiceAreaServer } from '../matterbridgeBehaviors.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PowerSourceTag } from '@matter/
|
|
2
|
-
import { DeviceEnergyManagement } from '@matter/
|
|
1
|
+
import { PowerSourceTag } from '@matter/node';
|
|
2
|
+
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
3
3
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
4
4
|
import { deviceEnergyManagement, electricalSensor, solarPower, powerSource } from '../matterbridgeDeviceTypes.js';
|
|
5
5
|
export class SolarPower extends MatterbridgeEndpoint {
|
package/dist/devices/speaker.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { OnOff
|
|
1
|
+
import { OnOff } from '@matter/types/clusters/on-off';
|
|
2
|
+
import { LevelControl } from '@matter/types/clusters/level-control';
|
|
2
3
|
import { speakerDevice } from '../matterbridgeDeviceTypes.js';
|
|
3
4
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
|
4
5
|
export class Speaker extends MatterbridgeEndpoint {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TemperatureControl } from '@matter/
|
|
2
|
-
import { TemperatureControlServer } from '@matter/
|
|
1
|
+
import { TemperatureControl } from '@matter/types/clusters/temperature-control';
|
|
2
|
+
import { TemperatureControlServer } from '@matter/node/behaviors/temperature-control';
|
|
3
3
|
import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
4
4
|
export function createLevelTemperatureControlClusterServer(endpoint, selectedTemperatureLevel = 1, supportedTemperatureLevels = ['Cold', 'Warm', 'Hot', '30°', '40°', '60°', '80°']) {
|
|
5
5
|
endpoint.behaviors.require(MatterbridgeLevelTemperatureControlServer.with(TemperatureControl.Feature.TemperatureLevel), {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ModeBase } from '@matter/
|
|
2
|
-
import { WaterHeaterManagement } from '@matter/
|
|
3
|
-
import { WaterHeaterMode } from '@matter/
|
|
4
|
-
import { DeviceEnergyManagement } from '@matter/
|
|
5
|
-
import { WaterHeaterManagementServer } from '@matter/
|
|
6
|
-
import { WaterHeaterModeServer } from '@matter/
|
|
1
|
+
import { ModeBase } from '@matter/types/clusters/mode-base';
|
|
2
|
+
import { WaterHeaterManagement } from '@matter/types/clusters/water-heater-management';
|
|
3
|
+
import { WaterHeaterMode } from '@matter/types/clusters/water-heater-mode';
|
|
4
|
+
import { DeviceEnergyManagement } from '@matter/types/clusters/device-energy-management';
|
|
5
|
+
import { WaterHeaterManagementServer } from '@matter/node/behaviors/water-heater-management';
|
|
6
|
+
import { WaterHeaterModeServer } from '@matter/node/behaviors/water-heater-mode';
|
|
7
7
|
import { MatterbridgeServer } from '../matterbridgeBehaviors.js';
|
|
8
8
|
import { electricalSensor, powerSource, waterHeater } from '../matterbridgeDeviceTypes.js';
|
|
9
9
|
import { MatterbridgeEndpoint } from '../matterbridgeEndpoint.js';
|
package/dist/frontend.js
CHANGED
|
@@ -4,18 +4,19 @@ import os from 'node:os';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import EventEmitter from 'node:events';
|
|
6
6
|
import { AnsiLogger, stringify, debugStringify, CYAN, db, er, nf, rs, UNDERLINE, UNDERLINEOFF, YELLOW, nt, wr } from 'node-ansi-logger';
|
|
7
|
-
import { Logger, LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, Lifecycle
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { Logger, Diagnostic, LogDestination, LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, Lifecycle } from '@matter/general';
|
|
8
|
+
import { DeviceAdvertiser, DeviceCommissioner, FabricManager } from '@matter/protocol';
|
|
9
|
+
import { FabricIndex } from '@matter/types/datatype';
|
|
10
|
+
import { CommissioningOptions } from '@matter/types/commissioning';
|
|
11
|
+
import { BridgedDeviceBasicInformation } from '@matter/types/clusters/bridged-device-basic-information';
|
|
12
|
+
import { PowerSource } from '@matter/types/clusters/power-source';
|
|
12
13
|
import { MATTER_LOGGER_FILE, MATTER_STORAGE_NAME, MATTERBRIDGE_DIAGNOSTIC_FILE, MATTERBRIDGE_HISTORY_FILE, MATTERBRIDGE_LOGGER_FILE, NODE_STORAGE_DIR, plg } from './matterbridgeTypes.js';
|
|
13
14
|
import { isValidArray, isValidNumber, isValidObject, isValidString, isValidBoolean } from './utils/isvalid.js';
|
|
14
15
|
import { createZip } from './utils/createZip.js';
|
|
15
16
|
import { hasParameter } from './utils/commandLine.js';
|
|
16
17
|
import { withTimeout, wait } from './utils/wait.js';
|
|
17
18
|
import { inspectError } from './utils/error.js';
|
|
18
|
-
import {
|
|
19
|
+
import { formatBytes, formatUptime, formatPercent } from './utils/format.js';
|
|
19
20
|
import { capitalizeFirstLetter, getAttribute } from './matterbridgeEndpointHelpers.js';
|
|
20
21
|
import { cliEmitter, lastOsCpuUsage, lastProcessCpuUsage } from './cliEmitter.js';
|
|
21
22
|
import { generateHistoryPage } from './cliHistory.js';
|
|
@@ -337,22 +338,22 @@ export class Frontend extends EventEmitter {
|
|
|
337
338
|
this.log.debug('Express received /memory');
|
|
338
339
|
const memoryUsageRaw = process.memoryUsage();
|
|
339
340
|
const memoryUsage = {
|
|
340
|
-
rss:
|
|
341
|
-
heapTotal:
|
|
342
|
-
heapUsed:
|
|
343
|
-
external:
|
|
344
|
-
arrayBuffers:
|
|
341
|
+
rss: formatBytes(memoryUsageRaw.rss),
|
|
342
|
+
heapTotal: formatBytes(memoryUsageRaw.heapTotal),
|
|
343
|
+
heapUsed: formatBytes(memoryUsageRaw.heapUsed),
|
|
344
|
+
external: formatBytes(memoryUsageRaw.external),
|
|
345
|
+
arrayBuffers: formatBytes(memoryUsageRaw.arrayBuffers),
|
|
345
346
|
};
|
|
346
347
|
const { default: v8 } = await import('node:v8');
|
|
347
348
|
const heapStatsRaw = v8.getHeapStatistics();
|
|
348
349
|
const heapSpacesRaw = v8.getHeapSpaceStatistics();
|
|
349
|
-
const heapStats = Object.fromEntries(Object.entries(heapStatsRaw).map(([key, value]) => [key,
|
|
350
|
+
const heapStats = Object.fromEntries(Object.entries(heapStatsRaw).map(([key, value]) => [key, formatBytes(value)]));
|
|
350
351
|
const heapSpaces = heapSpacesRaw.map((space) => ({
|
|
351
352
|
...space,
|
|
352
|
-
space_size:
|
|
353
|
-
space_used_size:
|
|
354
|
-
space_available_size:
|
|
355
|
-
physical_space_size:
|
|
353
|
+
space_size: formatBytes(space.space_size),
|
|
354
|
+
space_used_size: formatBytes(space.space_used_size),
|
|
355
|
+
space_available_size: formatBytes(space.space_available_size),
|
|
356
|
+
physical_space_size: formatBytes(space.physical_space_size),
|
|
356
357
|
}));
|
|
357
358
|
const { createRequire } = await import('node:module');
|
|
358
359
|
const require = createRequire(import.meta.url);
|
|
@@ -684,15 +685,15 @@ export class Frontend extends EventEmitter {
|
|
|
684
685
|
this.log.debug('Frontend stopped successfully');
|
|
685
686
|
}
|
|
686
687
|
async getApiSettings() {
|
|
687
|
-
this.matterbridge.systemInformation.totalMemory =
|
|
688
|
-
this.matterbridge.systemInformation.freeMemory =
|
|
689
|
-
this.matterbridge.systemInformation.systemUptime =
|
|
690
|
-
this.matterbridge.systemInformation.processUptime =
|
|
691
|
-
this.matterbridge.systemInformation.cpuUsage = lastOsCpuUsage
|
|
692
|
-
this.matterbridge.systemInformation.processCpuUsage = lastProcessCpuUsage
|
|
693
|
-
this.matterbridge.systemInformation.rss =
|
|
694
|
-
this.matterbridge.systemInformation.heapTotal =
|
|
695
|
-
this.matterbridge.systemInformation.heapUsed =
|
|
688
|
+
this.matterbridge.systemInformation.totalMemory = formatBytes(os.totalmem());
|
|
689
|
+
this.matterbridge.systemInformation.freeMemory = formatBytes(os.freemem());
|
|
690
|
+
this.matterbridge.systemInformation.systemUptime = formatUptime(os.uptime());
|
|
691
|
+
this.matterbridge.systemInformation.processUptime = formatUptime(Math.floor(process.uptime()));
|
|
692
|
+
this.matterbridge.systemInformation.cpuUsage = formatPercent(lastOsCpuUsage);
|
|
693
|
+
this.matterbridge.systemInformation.processCpuUsage = formatPercent(lastProcessCpuUsage);
|
|
694
|
+
this.matterbridge.systemInformation.rss = formatBytes(process.memoryUsage().rss);
|
|
695
|
+
this.matterbridge.systemInformation.heapTotal = formatBytes(process.memoryUsage().heapTotal);
|
|
696
|
+
this.matterbridge.systemInformation.heapUsed = formatBytes(process.memoryUsage().heapUsed);
|
|
696
697
|
const info = {
|
|
697
698
|
homeDirectory: this.matterbridge.homeDirectory,
|
|
698
699
|
rootDirectory: this.matterbridge.rootDirectory,
|
|
@@ -1034,7 +1035,7 @@ export class Frontend extends EventEmitter {
|
|
|
1034
1035
|
diagnosticDestination.context = Diagnostic.Context();
|
|
1035
1036
|
}
|
|
1036
1037
|
diagnosticDestination.context.run(() => diagnosticDestination.add(Diagnostic.message({
|
|
1037
|
-
now:
|
|
1038
|
+
now: new Date(),
|
|
1038
1039
|
facility: 'Server nodes:',
|
|
1039
1040
|
level: MatterLogLevel.INFO,
|
|
1040
1041
|
prefix: Logger.nestingLevel ? '⎸'.padEnd(Logger.nestingLevel * 2) : '',
|
package/dist/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OnOff } from '@matter/
|
|
1
|
+
import { OnOff } from '@matter/types/clusters/on-off';
|
|
2
2
|
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';
|
package/dist/matterbridge.js
CHANGED
|
@@ -7,15 +7,18 @@ import EventEmitter from 'node:events';
|
|
|
7
7
|
import { inspect } from 'node:util';
|
|
8
8
|
import { AnsiLogger, UNDERLINE, UNDERLINEOFF, db, debugStringify, BRIGHT, RESET, er, nf, rs, wr, RED, GREEN, zb, CYAN, nt, BLUE, or } from 'node-ansi-logger';
|
|
9
9
|
import { NodeStorageManager } from 'node-persist-manager';
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import '@matter/nodejs';
|
|
11
|
+
import { Logger, LogLevel as MatterLogLevel, LogFormat as MatterLogFormat, UINT32_MAX, UINT16_MAX, Crypto, Environment, StorageService } from '@matter/general';
|
|
12
|
+
import { FabricAction, PaseClient } from '@matter/protocol';
|
|
13
|
+
import { Endpoint, ServerNode } from '@matter/node';
|
|
14
|
+
import { DeviceTypeId, VendorId } from '@matter/types/datatype';
|
|
15
|
+
import { AggregatorEndpoint } from '@matter/node/endpoints';
|
|
16
|
+
import { BasicInformationServer } from '@matter/node/behaviors/basic-information';
|
|
14
17
|
import { getParameter, getIntParameter, hasParameter } from './utils/commandLine.js';
|
|
15
18
|
import { copyDirectory } from './utils/copyDirectory.js';
|
|
16
19
|
import { createDirectory } from './utils/createDirectory.js';
|
|
17
20
|
import { isValidString, parseVersionString, isValidNumber, isValidObject } from './utils/isvalid.js';
|
|
18
|
-
import {
|
|
21
|
+
import { formatBytes, formatPercent, formatUptime } from './utils/format.js';
|
|
19
22
|
import { withTimeout, waiter, wait } from './utils/wait.js';
|
|
20
23
|
import { dev, MATTER_LOGGER_FILE, MATTER_STORAGE_NAME, MATTERBRIDGE_LOGGER_FILE, NODE_STORAGE_DIR, plg, typ } from './matterbridgeTypes.js';
|
|
21
24
|
import { PluginManager } from './pluginManager.js';
|
|
@@ -24,6 +27,7 @@ import { MatterbridgeEndpoint } from './matterbridgeEndpoint.js';
|
|
|
24
27
|
import { bridge } from './matterbridgeDeviceTypes.js';
|
|
25
28
|
import { Frontend } from './frontend.js';
|
|
26
29
|
import { addVirtualDevices } from './helpers.js';
|
|
30
|
+
import { BroadcastServer } from './broadcastServer.js';
|
|
27
31
|
export class Matterbridge extends EventEmitter {
|
|
28
32
|
systemInformation = {
|
|
29
33
|
interfaceName: '',
|
|
@@ -114,9 +118,35 @@ export class Matterbridge extends EventEmitter {
|
|
|
114
118
|
aggregatorSerialNumber = getParameter('serialNumber');
|
|
115
119
|
aggregatorUniqueId = getParameter('uniqueId');
|
|
116
120
|
advertisingNodes = new Map();
|
|
121
|
+
server;
|
|
117
122
|
constructor() {
|
|
118
123
|
super();
|
|
119
124
|
this.log.logNameColor = '\x1b[38;5;115m';
|
|
125
|
+
this.server = new BroadcastServer('matterbridge', this.log);
|
|
126
|
+
this.server.on('broadcast_message', this.msgHandler.bind(this));
|
|
127
|
+
}
|
|
128
|
+
async msgHandler(msg) {
|
|
129
|
+
if (this.server.isWorkerRequest(msg, msg.type) && (msg.dst === 'all' || msg.dst === 'matterbridge')) {
|
|
130
|
+
this.log.debug(`**Received broadcast request ${CYAN}${msg.type}${db} from ${CYAN}${msg.src}${db}: ${debugStringify(msg)}${db}`);
|
|
131
|
+
switch (msg.type) {
|
|
132
|
+
case 'get_log_level':
|
|
133
|
+
this.server.respond({ ...msg, response: { success: true, level: this.log.logLevel } });
|
|
134
|
+
break;
|
|
135
|
+
case 'set_log_level':
|
|
136
|
+
this.log.logLevel = msg.params.level;
|
|
137
|
+
this.server.respond({ ...msg, response: { success: true, level: this.log.logLevel } });
|
|
138
|
+
break;
|
|
139
|
+
default:
|
|
140
|
+
this.log.warn(`Unknown broadcast request ${CYAN}${msg.type}${wr} from ${CYAN}${msg.src}${wr}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (this.server.isWorkerResponse(msg, msg.type)) {
|
|
144
|
+
this.log.debug(`**Received broadcast response ${CYAN}${msg.type}${db} from ${CYAN}${msg.src}${db}: ${debugStringify(msg)}${db}`);
|
|
145
|
+
switch (msg.type) {
|
|
146
|
+
default:
|
|
147
|
+
this.log.warn(`Unknown broadcast response ${CYAN}${msg.type}${wr} from ${CYAN}${msg.src}${wr}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
120
150
|
}
|
|
121
151
|
static async loadInstance(initialize = false) {
|
|
122
152
|
if (!Matterbridge.instance) {
|
|
@@ -721,14 +751,15 @@ export class Matterbridge extends EventEmitter {
|
|
|
721
751
|
this.systemInformation.osRelease = os.release();
|
|
722
752
|
this.systemInformation.osPlatform = os.platform();
|
|
723
753
|
this.systemInformation.osArch = os.arch();
|
|
724
|
-
this.systemInformation.totalMemory =
|
|
725
|
-
this.systemInformation.freeMemory =
|
|
726
|
-
this.systemInformation.systemUptime =
|
|
727
|
-
this.systemInformation.processUptime =
|
|
728
|
-
this.systemInformation.cpuUsage =
|
|
729
|
-
this.systemInformation.
|
|
730
|
-
this.systemInformation.
|
|
731
|
-
this.systemInformation.
|
|
754
|
+
this.systemInformation.totalMemory = formatBytes(os.totalmem());
|
|
755
|
+
this.systemInformation.freeMemory = formatBytes(os.freemem());
|
|
756
|
+
this.systemInformation.systemUptime = formatUptime(os.uptime());
|
|
757
|
+
this.systemInformation.processUptime = formatUptime(process.uptime());
|
|
758
|
+
this.systemInformation.cpuUsage = formatPercent(0);
|
|
759
|
+
this.systemInformation.processCpuUsage = formatPercent(0);
|
|
760
|
+
this.systemInformation.rss = formatBytes(process.memoryUsage().rss);
|
|
761
|
+
this.systemInformation.heapTotal = formatBytes(process.memoryUsage().heapTotal);
|
|
762
|
+
this.systemInformation.heapUsed = formatBytes(process.memoryUsage().heapUsed);
|
|
732
763
|
this.log.debug('Host System Information:');
|
|
733
764
|
this.log.debug(`- Hostname: ${this.systemInformation.hostname}`);
|
|
734
765
|
this.log.debug(`- User: ${this.systemInformation.user}`);
|
|
@@ -817,6 +848,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
817
848
|
callbackLogLevel = "debug";
|
|
818
849
|
AnsiLogger.setGlobalCallbackLevel(callbackLogLevel);
|
|
819
850
|
this.log.debug(`WebSocketServer logger global callback set to ${callbackLogLevel}`);
|
|
851
|
+
return logLevel;
|
|
820
852
|
}
|
|
821
853
|
getLogLevel() {
|
|
822
854
|
return this.log.logLevel;
|
|
@@ -989,6 +1021,7 @@ export class Matterbridge extends EventEmitter {
|
|
|
989
1021
|
this.frontend.destroy();
|
|
990
1022
|
this.plugins.destroy();
|
|
991
1023
|
this.devices.destroy();
|
|
1024
|
+
this.server.close();
|
|
992
1025
|
if (this.nodeStorage && this.nodeContext) {
|
|
993
1026
|
this.log.debug(`Closing node storage context for ${plg}Matterbridge${db}...`);
|
|
994
1027
|
await this.nodeContext.close();
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
if (process.argv.includes('--loader') || process.argv.includes('-loader'))
|
|
2
|
+
console.log('\u001B[32mMatterbridgeAccessoryPlatform loaded.\u001B[40;0m');
|
|
1
3
|
import { MatterbridgePlatform } from './matterbridgePlatform.js';
|
|
2
4
|
export class MatterbridgeAccessoryPlatform extends MatterbridgePlatform {
|
|
3
5
|
constructor(matterbridge, log, config) {
|