Skip to content

Commit

Permalink
Merge pull request #212 from Luligu/edge
Browse files Browse the repository at this point in the history
Release 2.0.0
  • Loading branch information
Luligu authored Jan 20, 2025
2 parents 97d9629 + d685227 commit a1e3167
Show file tree
Hide file tree
Showing 49 changed files with 4,130 additions and 9,183 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ replay_pid*
migrationV8.txt
migrationV8-answered.txt
matterstorage

matterstorage.backup
coverage
TODO.md
test
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ test
migrationV8.txt
migrationV8-answered.txt
matterstorage
matterstorage.backup

TODO.md
CODEOWNERS
34 changes: 33 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,43 @@ Tamer (https://github.com/tammeryousef1006) has created the Matterbridge Discord

### Breaking Changes

Matterbridge edge is now released. The default mode is still the normal mode to allow the storage conversion. See https://github.com/Luligu/matterbridge/blob/dev/README-EDGE.md to manually switch to edge mode after the conversion is done.
Starting from v. 2.0.0 Matterbridge is running only in mode edge (no parameter needed).
The legacy old api have been removed.

The frontend has a new dark and light mode. The dark mode is now the default mode.
It is possible to change the mode (Classic, Dark or Light) in Settings, Matterbridge settings.

## [2.0.0] - 2025-01-20

### Added

- [behavior]: Added MatterbridgeValveConfigurationAndControlServer behavior with open close command.
- [matterbridge]: Added /memory endpoint for debugging memory use.

### Changed

- [legacy]: Removed MatterbridgeDevice and MatterbridgeEdge classes.
- [factoryreset]: Now it deletes also the backup files and backup directories.
- [mattebridge]: Restyled the Matterbridge class and created the Frontend class that manages the frontend express and websocket api calls.
- [frontend]: Frontend v.2.3.12.
- [iconView]: Improved render for energySensor adding voltage, current and power.
- [iconView]: Improved render for PowerSource adding battery voltage.
- [jest]: Refactor all tests for edge.
- [frontend]: WebSocketProvider added a startTimeout of 300 sec. to start ping.
- [frontend]: WebSocketProvider changed pingIntervalSeconds to 60 sec. and offlineTimeoutSeconds to 50 sec.
- [frontend]: Search on select is no more case sensitive.
- [matterbridge]: Deferred memory intensive tasks after initialization.
- [package]: Optimized all imports from matter.js.
- [package]: Update dependencies.

### Fixed

- [sessions]: Fixed the case when Active session was not reporting correctly.

<a href="https://www.buymeacoffee.com/luligugithub">
<img src="./yellow-button.png" alt="Buy me a coffee" width="120">
</a>

## [1.7.3] - 2025-01-11

### Added
Expand Down
6 changes: 3 additions & 3 deletions frontend/build/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "./static/css/main.cf25d33e.css",
"main.js": "./static/js/main.6bbd1772.js",
"main.js": "./static/js/main.6df4ebe4.js",
"static/js/453.abd36b29.chunk.js": "./static/js/453.abd36b29.chunk.js",
"static/media/roboto-latin-700-normal.woff2": "./static/media/roboto-latin-700-normal.4535474e1cf8598695ad.woff2",
"static/media/roboto-latin-500-normal.woff2": "./static/media/roboto-latin-500-normal.7077203b1982951ecf76.woff2",
Expand Down Expand Up @@ -61,11 +61,11 @@
"static/media/roboto-greek-ext-400-normal.woff": "./static/media/roboto-greek-ext-400-normal.16eb83b4a3b1ea994243.woff",
"index.html": "./index.html",
"main.cf25d33e.css.map": "./static/css/main.cf25d33e.css.map",
"main.6bbd1772.js.map": "./static/js/main.6bbd1772.js.map",
"main.6df4ebe4.js.map": "./static/js/main.6df4ebe4.js.map",
"453.abd36b29.chunk.js.map": "./static/js/453.abd36b29.chunk.js.map"
},
"entrypoints": [
"static/css/main.cf25d33e.css",
"static/js/main.6bbd1772.js"
"static/js/main.6df4ebe4.js"
]
}
2 changes: 1 addition & 1 deletion frontend/build/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><base href="./"><link rel="icon" href="./matterbridge 32x32.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Matterbridge</title><link rel="manifest" href="./manifest.json"/><script defer="defer" src="./static/js/main.6bbd1772.js"></script><link href="./static/css/main.cf25d33e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><base href="./"><link rel="icon" href="./matterbridge 32x32.png"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><title>Matterbridge</title><link rel="manifest" href="./manifest.json"/><script defer="defer" src="./static/js/main.6df4ebe4.js"></script><link href="./static/css/main.cf25d33e.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
1 change: 0 additions & 1 deletion frontend/build/static/js/main.6bbd1772.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions frontend/build/static/js/main.6df4ebe4.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "2.3.11",
"version": "2.3.12",
"private": true,
"homepage": "./",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/components/Devices.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ function ClustersTable({ data, columnVisibility }) {

function Devices() {
const { online, sendMessage, addListener, removeListener } = useContext(WebSocketContext);

const [devices, setDevices] = useState([]);
const [clusters, setClusters] = useState([]);
const [plugin, setPlugin] = useState(null);
Expand Down Expand Up @@ -427,6 +428,7 @@ function Devices() {
}
}, []);

if(debug) console.log('Devices rendering...');
if (!online) {
return ( <Connecting /> );
}
Expand Down
27 changes: 18 additions & 9 deletions frontend/src/components/DevicesIcons.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const switchDeviceTypes = [0x0103, 0x0104, 0x0105];
const onOffDeviceTypes = [0x0100, 0x0101, 0x010c, 0x010a, 0x010b, 0x0103, 0x0104, 0x0105];

function Render({ icon, iconColor, cluster, value, unit }) {
console.log(`Render cluster "${cluster.clusterName}.${cluster.attributeName}" value(${typeof(value)}-${isNaN(value)}) "${value}" unit "${unit}"`);
if(debug) console.log(`Render cluster "${cluster.clusterName}.${cluster.attributeName}" value(${typeof(value)}-${isNaN(value)}) "${value}" unit "${unit}"`);

return (
<Box key={`${cluster.clusterId}-${cluster.attributeId}-box`} sx={valueBoxSx}>
Expand All @@ -91,11 +91,14 @@ function Render({ icon, iconColor, cluster, value, unit }) {
};

function Device({ device, endpoint, id, deviceType, clusters }) {
const airQualityLookup = ['Unknown', 'Good', 'Fair', 'Moderate', 'Poor', 'VeryPoor', 'ExtremelyPoor'];
const airQualityLookup = ['Unknown', 'Good', 'Fair', 'Moderate', 'Poor', 'VeryPoor', 'Ext.Poor'];
let details = '';

console.log(`Device "${device.name}" endpoint "${endpoint}" id "${id}" deviceType "0x${deviceType.toString(16).padStart(4, '0')}" clusters (${clusters?.length}):`, clusters);

// PowerSource
deviceType===0x0011 && clusters.filter(cluster => cluster.clusterName === 'PowerSource' && cluster.attributeName === 'batVoltage').map(cluster => details = `${cluster.attributeLocalValue} mV`);

// LevelControl
onOffDeviceTypes.includes(deviceType) && clusters.filter(cluster => cluster.clusterName === 'LevelControl' && cluster.attributeName === 'currentLevel').map(cluster => details = `Level ${cluster.attributeValue}`);

Expand All @@ -109,6 +112,12 @@ function Device({ device, endpoint, id, deviceType, clusters }) {
// SmokeCoAlarm
deviceType===0x0076 && clusters.filter(cluster => cluster.clusterName === 'SmokeCoAlarm' && cluster.attributeName === 'coState').map(cluster => details = `${cluster.attributeLocalValue===0?'No CO detected':'CO alarm!'}`);

// ElectricalPowerMeasurement
deviceType===0x0510 && clusters.filter(cluster => cluster.clusterName === 'ElectricalPowerMeasurement' && cluster.attributeName === 'voltage').map(cluster => details = `${cluster.attributeLocalValue/1000} V, `);
deviceType===0x0510 && clusters.filter(cluster => cluster.clusterName === 'ElectricalPowerMeasurement' && cluster.attributeName === 'activeCurrent').map(cluster => details = details +`${cluster.attributeLocalValue/1000} A, `);
deviceType===0x0510 && clusters.filter(cluster => cluster.clusterName === 'ElectricalPowerMeasurement' && cluster.attributeName === 'activePower').map(cluster => details = details +`${cluster.attributeLocalValue/1000} W`);


/*
*/
return (
Expand Down Expand Up @@ -242,6 +251,10 @@ export function DevicesIcons({filter}) {
const [clusters, setClusters] = useState({}); // { serial: [ { endpoint, id, clusterName, clusterId, attributeName, attributeId, attributeValue } ] }
const [filteredDevices, setFilteredDevices] = useState(devices);

const handleDialogToggle = () => {
setDialogOpen(!dialogOpen);
};

useEffect(() => {
const handleWebSocketMessage = (msg) => {
if (msg.src === 'Matterbridge' && msg.dst === 'Frontend') {
Expand Down Expand Up @@ -278,7 +291,7 @@ export function DevicesIcons({filter}) {
if(!endpoints[serial].find((e) => e.endpoint === cluster.endpoint)) {
endpoints[serial].push({ endpoint: cluster.endpoint, id: cluster.id, deviceTypes: cluster.deviceTypes });
}
if(['FixedLabel', 'Descriptor', 'Identify', 'Groups', 'PowerTopology', 'ElectricalPowerMeasurement'].includes(cluster.clusterName)) continue;
if(['FixedLabel', 'Descriptor', 'Identify', 'Groups', 'PowerTopology'].includes(cluster.clusterName)) continue;
clusters[serial].push(cluster);
}
setEndpoints({ ...endpoints });
Expand All @@ -298,7 +311,7 @@ export function DevicesIcons({filter}) {
removeListener(handleWebSocketMessage);
if(debug) console.log('DevicesIcons useEffect webSocket unmounted');
};
}, []);
}, [addListener, removeListener, sendMessage]);

useEffect(() => {
if(debug) console.log('DevicesIcons useEffect online mounting');
Expand All @@ -315,10 +328,6 @@ export function DevicesIcons({filter}) {
};
}, [online, sendMessage]);

const handleDialogToggle = () => {
setDialogOpen(!dialogOpen);
};

useEffect(() => {
if(filter === '') {
setFilteredDevices(devices);
Expand All @@ -328,8 +337,8 @@ export function DevicesIcons({filter}) {
setFilteredDevices(filteredDevices);
}, [devices, filter]);

if(debug) console.log('DevicesIcons rendering...');
return (

<>
<Dialog open={dialogOpen} onClose={handleDialogToggle}
PaperProps={{
Expand Down
Loading

0 comments on commit a1e3167

Please sign in to comment.