feat: web dashboard for live device data

Small companion service that receives SNEK callbacks, decodes Sens'it
Discovery payloads for all 6 modes (Standby, Temperature, Light, Door,
Vibration, Magnet), stores in SQLite, and serves a responsive dashboard.

Backend (Python Flask):
- POST /webhook: receive SNEK callback
- GET /api/devices, /api/messages, /api/decode
- GET /events: Server-Sent Events for live push
- SQLite persistence at /data/messages.db

Frontend:
- Tailwind CSS via CDN, Chart.js for temp/humidity graph
- Live updates via SSE
- Device cards with icons per mode
- Message log with human-readable summaries

Deploy:
- Separate deployment (snek-dashboard) with own PVC
- LoadBalancer on 192.168.1.213:80
- SNEK callback URL: http://snek-dashboard.snek.svc.cluster.local/webhook

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-03 17:43:11 +02:00
parent c7ab02cc59
commit a77776d6d8
6 changed files with 570 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: dashboard-data
namespace: snek
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: snek-dashboard
namespace: snek
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: snek-dashboard
template:
metadata:
labels:
app: snek-dashboard
spec:
containers:
- name: dashboard
image: 192.168.1.100:30500/snek-dashboard:latest
imagePullPolicy: Always
ports:
- containerPort: 3000
name: http
env:
- name: DB_PATH
value: /data/messages.db
volumeMounts:
- name: data
mountPath: /data
readinessProbe:
httpGet:
path: /healthz
port: 3000
initialDelaySeconds: 5
periodSeconds: 10
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 500m
memory: 256Mi
volumes:
- name: data
persistentVolumeClaim:
claimName: dashboard-data
---
apiVersion: v1
kind: Service
metadata:
name: snek-dashboard
namespace: snek
spec:
type: LoadBalancer
loadBalancerIP: 192.168.1.213
selector:
app: snek-dashboard
ports:
- name: http
port: 80
targetPort: 3000