MagicMirror Module: mmm-openhab-table
A MagicMirror2 module that fetches item values from an OpenHAB REST API and displays them as a color-coded table.
Supports temperature, humidity, air quality (PM), barometric pressure, and hot water sensors. Colors update based on value ranges. The idea is to change the row color based on the value.
Barometric pressure color ranges based on: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4684554/
Installation
cd ~/MagicMirror/modules
git clone https://git.juliochegedus.com/spectronet/mmm-openhab-table.gitConfiguration
Add to the modules array in config/config.js:
{
module: 'mmm-openhab-table',
position: 'top_right',
config: {
updateInterval: 600 * 1000,
apiSearch: "http://openhab.example.com:8080/rest/items/",
itemNames: [ "Temp_lagrange_Out", "Temp_terra_Out", "Pressure_proba_Out", "Humidity_lagrange_Out" ]
}
},Configuration Options
| Option | Default | Description |
|---|---|---|
apiSearch |
http://arch-oracle.science.net:8080/rest/items/ |
OpenHAB REST API base URL |
itemNames |
["Temp_lagrange_Out", ...] |
List of OpenHAB item names to fetch |
updateInterval |
600000 |
Refresh interval in ms (default: 10 min) |
retryDelay |
120000 |
Retry delay on fetch failure in ms (default: 2 min) |
initialLoadDelay |
2500 |
Delay before first fetch in ms |
animationSpeed |
1000 |
DOM update animation speed in ms |
Sensor Detection & Units
Item names are matched by pattern to determine units and CSS class coloring:
| Name pattern | Unit displayed | Color classes |
|---|---|---|
Temp* / Water* |
°C | cold / comfy / warm / hot |
*humid* |
% | moist |
*PM* |
µg/M³ | clean / acceptable / heavy / polluted |
| value > 500 (pressure) | hPa | deep / cold / comfy / warm / hot |
Temperature thresholds (°C)
| Range | Class |
|---|---|
| <= 17 | cold |
| 17 – 27 | comfy |
| 27 – 30 | warm |
| >= 30 | hot |
Barometric pressure thresholds (hPa)
| Range | Class |
|---|---|
| < 999 | deep |
| 999 – 1008 | cold |
| 1008 – 1023 | comfy |
| 1023 – 1028 | warm |
| >= 1028 | hot |
Air quality thresholds (µg/M³)
| Range | Class |
|---|---|
| < 3 | clean |
| 3 – 7 | acceptable |
| 7 – 11 | heavy |
| >= 11 | polluted |
Hot water thresholds (°C)
| Range | Class |
|---|---|
| < 45 | cold |
| >= 45 | comfy |
License
MIT — By Spectroman



