Butterfly EDFA Rack: Home Assistant config and dashboard

Fresh repo holding only the Butterfly-rack HA side (the firmware and BOM
live in koheron-esp32-bridge). Contents, pulled from the live HA host:

- configuration.butterfly.yaml: dBm->mW template sensors + the YAML
  dashboard registration, to merge into /config/configuration.yaml
- scripts.butterfly.yaml: the butterfly_edfa_shutdown emergency-off script
- ui-lovelace-butterfly.yaml: the dashboard
- deploy.sh: scp the dashboard, check_config, restart HA
- .gitignore guards against committing the HA DB, logs and secrets

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
James Bateman (hp-laptop)
2026-10-02 13:35:40 +01:00
co-authored by Claude Opus 4.8
commit abcb6b7553
6 changed files with 297 additions and 0 deletions
Executable
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Deploy the Butterfly-rack dashboard to the lab HA host.
#
# ./deploy.sh push dashboard, validate config, restart HA
# ./deploy.sh --dash-only push dashboard only (browser refresh picks it up)
#
# The snippet files (configuration.butterfly.yaml, scripts.butterfly.yaml) are
# merged into /config by hand the first time; this script never edits them on
# the host, so it cannot clobber unrelated config.
set -euo pipefail
HOST="${HA_HOST:-lab@lab-desktop.local}"
CONFIG_DIR="${HA_CONFIG_DIR:-/home/lab/HA/homeassistant}" # bind-mounted as /config
CONTAINER="${HA_CONTAINER:-homeassistant}"
DASH="ui-lovelace-butterfly.yaml"
cd "$(dirname "$0")"
echo "Copying $DASH to $HOST:$CONFIG_DIR/ ..."
scp "$DASH" "$HOST:$CONFIG_DIR/$DASH"
if [[ "${1:-}" == "--dash-only" ]]; then
echo "Dashboard copied. Refresh the browser to see it."
exit 0
fi
echo "Validating config in the container ..."
ssh "$HOST" "docker exec $CONTAINER python -m homeassistant --script check_config -c /config"
echo "Restarting $CONTAINER ..."
ssh "$HOST" "docker restart $CONTAINER"
echo "Done. HA is restarting; the dashboard is at http://lab-desktop.local:8123/butterfly-rack"