diff --git a/.github/example.png b/.github/example.png index 57d9f66..0c7d5b1 100644 Binary files a/.github/example.png and b/.github/example.png differ diff --git a/CHANGELOG.md b/CHANGELOG.md index e2d72fc..fa9f134 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # MMM-SystemMonitor Change Log All notable changes to this project will be documented in this file. -This project adheres to [Semantic Versioning](http://semver.org/). -## [1.0.0] -First public release +## [1.0.1] + +First public release of my fork diff --git a/MMM-SystemMonitor.js b/MMM-SystemMonitor.js index 5408cd0..884dda5 100644 --- a/MMM-SystemMonitor.js +++ b/MMM-SystemMonitor.js @@ -5,6 +5,7 @@ * * By Ben Konsemüller * MIT Licensed. + * forked by modo */ Module.register("MMM-SystemMonitor", { @@ -72,8 +73,21 @@ Module.register("MMM-SystemMonitor", { }, uptimeFormat(uptimeInSeconds) { - return moment.utc(1000 * uptimeInSeconds).format('HH[h] mm[m] ss[s]'); - }, + // 1. Ensure we have a number. + // If getUptimeSeconds returns a string "2927104.98", parseFloat fixes it. + const totalSeconds = Math.floor(parseFloat(uptimeInSeconds)); + + if (isNaN(totalSeconds)) return "Unknown"; + + // 2. Calculate units manually + const days = Math.floor(totalSeconds / 86400); + const hours = Math.floor((totalSeconds % 86400) / 3600); + const minutes = Math.floor((totalSeconds % 3600) / 60); + const seconds = totalSeconds % 60; + + // 3. Return formatted string + return `${days}d ${hours}h ${minutes}m ${seconds}s`; +}, convertTemperature(temperature) { switch(this.config.units) { diff --git a/README.md b/README.md index 76bfaaf..728b514 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,14 @@ This is a module for the [MagicMirror²](https://github.com/MichMich/MagicMirror/). +Forked from [the original](https://github.com/btastic/MMM-SystemMonitor) + +## Changes +Free RAM is now avabile not double counting cache twice. + +Uptime method improved + + ![screenshot](.github/example.png) This module will display your current system stats. @@ -17,15 +25,14 @@ cd ~/MagicMirror/modules Clone this repository: ```bash -git clone https://github.com/btastic/MMM-SystemMonitor +git clone https://github.com/modo-github/MMM-SystemMonitor + ``` ## Using the module To use this module, add the following configuration block to the modules array in the `config/config.js` file: ```js -var config = { - modules: [ { module: 'MMM-SystemMonitor', position: 'top_left', @@ -34,13 +41,11 @@ var config = { cpuThermalZone: 0, units: config.units, } - } - ] -} + }, ``` ## Supported hardware -- Raspberry Pi 3 (tested) +- Raspberry Pi cm5 (tested) - Probably works on other Raspberry Pi's ## CPU Thermal Zone @@ -65,7 +70,3 @@ will output the current temperature. This is what this module will use to displa | `updateInterval` | *Optional*
The time interval between UI updates.

**Type:** `int`(milliseconds)
**Default:** 60000 milliseconds (60 seconds) | `cpuThermalZone` | *Optional*
Use the cpu thermal zone index.

**Type:** `int`
**Default:** 0 | `units` | *Optional*
Use either 'metric' or 'imperial' to display the temperature.

**Type:** `string (metric\|imperial)`
**Default:** Inherit from config.js - -## Available localizations -- English (en) -- German (de) \ No newline at end of file diff --git a/node_helper.js b/node_helper.js index c06c2eb..ba57967 100644 --- a/node_helper.js +++ b/node_helper.js @@ -3,6 +3,7 @@ * * By Ben Konsemüller * MIT Licensed. + * Forked by modo */ const Log = require("logger"); @@ -46,7 +47,7 @@ module.exports = NodeHelper.create({ }, async getAvailableMemoryPercentage() { - return await this.exec("free | awk '/^Mem/ { print (($4+$7)/$2 * 100) }'"); + return await this.exec("free | awk '/^Mem/ { print ($7/$2 * 100) }'"); }, async getUptimeSeconds() { @@ -59,6 +60,7 @@ module.exports = NodeHelper.create({ return result.split(" ")[0]; }, + async getAvailableSpacePercentage() { return await this.exec("df | awk '$6 == \"/\" {print $5}'"); }, @@ -74,3 +76,4 @@ module.exports = NodeHelper.create({ return stdout; } }); + diff --git a/package.json b/package.json index bb46a19..5800423 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,14 @@ { "name": "MMM-SystemMonitor", - "version": "1.0.0", + "version": "1.0.1", "description": "A SystemMonitor plugin for MagicMirror².", "main": "MMM-SystemMonitor.js", "author": "Ben Konsemüller", + "forker": "modo", "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/btastic/MMM-SystemMonitor" + "url": "git+https://github.com/modo-github/MMM-SystemMonitor" }, "keywords": [ "magic mirror", @@ -15,11 +16,11 @@ "SystemMonitor", "module" ], - "contributors": "https://github.com/btastic/MMM-SystemMonitor/graphs/contributors", + "contributors": "https://github.com/modo-github/MMM-SystemMonitor/graphs/contributors", "bugs": { - "url": "https://github.com/btastic/MMM-SystemMonitor/issues" + "url": "https://github.com/modo-github/MMM-SystemMonitor/issues" }, - "homepage": "https://github.com/btastic/MMM-SystemMonitor#readme", + "homepage": "https://github.com/modo-github/MMM-SystemMonitor#readme", "devDependencies": { "grunt": "latest", "grunt-eslint": "latest", diff --git a/templates/MMM-SystemMonitor.njk b/templates/MMM-SystemMonitor.njk index 4105073..07fcd8f 100644 --- a/templates/MMM-SystemMonitor.njk +++ b/templates/MMM-SystemMonitor.njk @@ -5,36 +5,36 @@ {% else %}
-
+
{{ "CPU TEMP" | translate | safe }}
-
+
{{ data.cpu_temp | round | convertTemperature }}
-
+
{{ "FREE MEMORY" | translate | safe }}
-
+
{{ data.available_memory | round }}%
-
+
{{ "UPTIME" | translate | safe }}
-
+
{{ data.uptime | uptime }}
-
+
{{ "FREE DISK SPACE" | translate | safe }}
-
+
{{ data.available_space }}
-{% endif %} \ No newline at end of file +{% endif %} diff --git a/translations/de.json b/translations/de.json deleted file mode 100644 index eceddb6..0000000 --- a/translations/de.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "CPU TEMP": "CPU Temperatur", - "FREE MEMORY": "Freier Arbeitsspeicher", - "UPTIME": "Uptime", - "FREE DISK SPACE": "Freier Speicherplatz" -} diff --git a/translations/en.json b/translations/en.json index bfe7464..8a64250 100644 --- a/translations/en.json +++ b/translations/en.json @@ -1,6 +1,6 @@ { - "CPU TEMP": "CPU temperature", - "FREE MEMORY": "Free memory", + "CPU TEMP": "CPU Temp", + "FREE MEMORY": "Free RAM", "UPTIME": "Uptime", - "FREE DISK SPACE": "Free disk space" + "FREE DISK SPACE": "Free space" }