feat: add MQTT integration for real-time entity updates

- aiomqtt async client with auto-reconnect and topic store
- MQTT router: GET /api/mqtt, GET /api/mqtt/topic/{path}, POST /api/mqtt/publish
- MQTT entities included in /api/all + WebSocket broadcast
- MqttCard frontend component with category filters, entity list
- Configurable via ENV: MQTT_HOST, MQTT_PORT, MQTT_USERNAME,
  MQTT_PASSWORD, MQTT_TOPICS (comma-separated or JSON array)
- Gracefully disabled when MQTT_HOST is not set

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sam 2026-03-02 10:13:50 +01:00
parent 9f7330e217
commit 89ed0c6d0a
11 changed files with 542 additions and 1 deletions

View file

@ -146,6 +146,17 @@ export const MOCK_DATA: DashboardData = {
lights_on: 3,
lights_total: 8,
},
mqtt: {
connected: true,
entities: [
{ topic: "unraid/daddelolymp/cpu_temp", value: 52, timestamp: Date.now() / 1000 - 5, name: "Cpu Temp", category: "unraid" },
{ topic: "unraid/daddelolymp/array_status", value: "normal", timestamp: Date.now() / 1000 - 12, name: "Array Status", category: "unraid" },
{ topic: "unraid/moneyboy/cpu_temp", value: 41, timestamp: Date.now() / 1000 - 8, name: "Cpu Temp", category: "unraid" },
{ topic: "zigbee2mqtt/wohnzimmer/temperature", value: 21.5, timestamp: Date.now() / 1000 - 30, name: "Temperature", category: "zigbee2mqtt" },
{ topic: "zigbee2mqtt/wohnzimmer/humidity", value: 48, timestamp: Date.now() / 1000 - 30, name: "Humidity", category: "zigbee2mqtt" },
{ topic: "frigate/events/front_door", value: "person", timestamp: Date.now() / 1000 - 120, name: "Front Door", category: "frigate" },
],
},
tasks: {
private: {
open: [