Files
butterfly-edfa-rack-firmware/homeassistant
James Bateman (hp-laptop)andClaude Opus 4.8 c2a004d6f1 Rename project to butterfly-edfa-rack; broaden descriptions beyond Koheron
The repo bridges both instruments (Koheron CTL200 seed + Agiltron M511
EDFA), so 'koheron-esp32-bridge' was too narrow. Align the repo name and
descriptions to the identifier the whole stack already uses
(butterfly_edfa_rack): README title, Makefile/platformio headers, and the
homeassistant/ copies. Device id, MQTT topics and entity ids are
unchanged, so no reflash or lost HA history. Sibling HA repo renamed to
butterfly-edfa-rack-homeassistant.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-10-02 16:33:51 +01:00
..

Home Assistant integration

Config for presenting the Butterfly EDFA Rack in Home Assistant. The rack's sensors, switches and numbers are auto-discovered over MQTT (the firmware publishes homeassistant/.../config topics), so these files only add what discovery cannot: derived mW power sensors and a dedicated dashboard.

Target: the HA instance on the lab broker host (192.168.0.102), running in Docker with its config bind-mounted at ~/HA/homeassistant/ (that is HA's /config).

Files

File Goes to Purpose
configuration.snippet.yaml merge into /config/configuration.yaml MQTT template sensors (dBm→mW for the EDFA input, pre-amp and output PDs) + the butterfly-rack YAML dashboard registration
scripts.snippet.yaml merge into /config/scripts.yaml butterfly_edfa_shutdown emergency-off script
ui-lovelace-butterfly.yaml copy to /config/ui-lovelace-butterfly.yaml the dashboard itself (graphs of power in mW + temperatures, dual dBm/mW output readout, staged seed/booster controls, emergency-off)

The *.snippet.yaml files hold top-level keys (mqtt:, lovelace:, and the script) to merge into the matching HA files — they are not standalone configs. ui-lovelace-butterfly.yaml is copied whole.

Deploy

From this directory, with the HA container named homeassistant:

host=lab@192.168.0.102
scp ui-lovelace-butterfly.yaml $host:/tmp/
ssh $host 'docker cp /tmp/ui-lovelace-butterfly.yaml homeassistant:/config/ui-lovelace-butterfly.yaml'
# then hand-merge the two snippets into /config/configuration.yaml and
# /config/scripts.yaml, and validate + restart:
ssh $host 'docker exec homeassistant python -m homeassistant --script check_config -c /config'
ssh $host 'docker restart homeassistant'

The dashboard reloads on browser refresh; changes to configuration.yaml/scripts.yaml need the restart. The dashboard appears in the sidebar as Butterfly EDFA Rack (/butterfly-rack).

Notes

  • The *_mw sensors are grouped onto the same butterfly_edfa_rack device via the shared identifiers.
  • mW figures are derived from the internal-PD dBm telemetry, which reads ~0.5 dB optimistic — indicative, not calibrated.
  • The seed temperature setpoint is the CTL200 thermistor resistance (rtset, ohms); the °C readout is a firmware-side NTC β-model. See the repo root README.