Implement Bodenfeuchte app: MQTT listener, SQLite storage, chart UI, Docker

- Custom Next.js server starts MQTT listener on boot
- Subscribes to zigbee2mqtt/Bodenfeuchte_1, stores soil_moisture in SQLite
- API route /api/data returns last 6 hours of measurements
- Frontend shows current value + Recharts line chart, auto-refresh every 60s
- Dockerfile + docker-compose with persistent volume for SQLite DB

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-15 18:10:18 +02:00
parent de23825cf6
commit 635b3ce598
11 changed files with 1671 additions and 72 deletions
+19
View File
@@ -0,0 +1,19 @@
import { createServer } from 'http';
import { parse } from 'url';
import next from 'next';
import { startMqttListener } from './lib/mqtt-listener';
const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
const handle = app.getRequestHandler();
app.prepare().then(() => {
startMqttListener();
createServer((req, res) => {
const parsedUrl = parse(req.url ?? '/', true);
handle(req, res, parsedUrl);
}).listen(3000, () => {
console.log('> Ready on http://localhost:3000');
});
});