mydocker/ha-dashboard/README.md

2.9 KiB

HA Dashboard - Operations Panel

Custom Flask application serving as the central operations dashboard for the entire home infrastructure. Aggregates data from Home Assistant, PostgreSQL, Docker and CrowdSec into a single view.

Access

Endpoint Details
Public URL https://hadash.sebson.space
Internal Port 9081 -> 8080
Auth Login required (registration with admin approval)

Configuration

  • Built locally from ./ha-dashboard/Dockerfile (Python 3.12-slim + Flask)
  • Dependencies: flask, psycopg2-binary, requests, docker
  • Environment: DB_HOST, DB_PORT, DB_USER, DB_PASS, HA_URL, HA_TOKEN, SECRET_KEY

Volumes

Mount Container Path Purpose
/var/run/docker.sock - Docker API access (container info, CrowdSec exec)
./backup.log /backup.log Database backup log
./ha-dashboard/auth/ /auth/ User authentication files
./homeassistant/config/ /ha_config/ HA device registry, ZigBee database

Architecture

HA Dashboard (Flask)
  ├── Home Assistant REST API  - entity states, automations, logbook
  ├── PostgreSQL 18            - homeassistant & bitwarden DB sizes
  ├── Docker socket            - container list, exec into crowdsec
  ├── /ha_config/zigbee.db     - ZigBee DB (last_seen, LQI)
  └── /backup.log              - PostgreSQL backup history

API Endpoints

Endpoint Description
/ Main dashboard (SPA)
/api/overview People at home, open windows/doors, temperatures, Mazda status, backup
/api/home Gate state, gate automations, light list with brightness
/api/power Current power consumption (main clamp, NAS, Shelly, Tasmota)
/api/frigate Last 9 Frigate detections (images proxied)
/api/automations HA automation stats, recently triggered
/api/containers All Docker container statuses
/api/crowdsec Active bans and recent alerts
/api/db Database sizes and top 10 tables
/api/bitwarden Vaultwarden stats (password count by type)
/api/zigbee ZigBee devices with last_seen, LQI and battery level
/api/gate/events Gate open events from PostgreSQL
/api/gate/logbook Gate logbook and automations from HA API
/api/scene/all_lights_off Trigger "all lights off" scene
/api/toggle/<entity_id> Toggle any HA entity

Authentication

Two-step: user registers at /register, account requires manual admin approval (creation of file at auth/approved/<username>). Flask sessions keyed by SECRET_KEY.

Approving a User

# Approve a pending user
touch ./ha-dashboard/auth/approved/<username>

# List pending users
ls ./ha-dashboard/auth/pending/

Useful Commands

# Rebuild after code changes
docker compose build ha-dashboard && docker compose up -d ha-dashboard

# Follow logs
docker compose logs -f ha-dashboard