Description
A MagicMirror² module to connect to a MySQL database, run a select query (one value) and display the result.
Screenshots
Download
https://github.com/tabsl/MMM-MySQLData
Config example
var config = {
modules: [
{
module: "MMM-MySQLData",
position: "top_center",
config: {
id: Math.floor(Math.random() * 100),
host: "YOUR_HOST",
username: "YOUR_USERNAME",
password: "YOUR_PASSWORD",
database: "YOUR_DATABASE_NAME",
port: 3306,
values: [
{
"id": "power_current",
"interval": 60000,
"title": "Current power consumption",
"praefix": "",
"suffix": " w",
"query": "SELECT round(data) AS value FROM power_consumption WHERE type = 'current' ORDER BY date DESC LIMIT 1",
"styles": {
"ok": "< 100",
"warn": "> 1000",
"alert": ">= 10000"
}
},
{
"id": "power_total",
"interval": 720000,
"title": "Total power consumption",
"praefix": "",
"suffix": " kW",
"query": "SELECT round(data/1000) AS value FROM power_consumption WHERE type = 'total' ORDER BY date DESC LIMIT 1",
}
]
}
}
]
}
Changelog
https://raw.githubusercontent.com/tabsl/MMM-MySQLData/main/CHANGELOG.md