diff --git a/homeassistant/ui-lovelace-butterfly.yaml b/homeassistant/ui-lovelace-butterfly.yaml index 38932c4..ae42c95 100644 --- a/homeassistant/ui-lovelace-butterfly.yaml +++ b/homeassistant/ui-lovelace-butterfly.yaml @@ -1,42 +1,275 @@ -# Butterfly EDFA Rack (MOPA) — YAML-mode dashboard. +# Butterfly EDFA Rack (MOPA) — laser control panel. # Registered in configuration.yaml (lovelace: dashboards: butterfly-rack). -# Entities auto-discovered over MQTT; the *_mw power sensors are MQTT template -# sensors defined in configuration.yaml (dBm -> mW). +# +# Entities are auto-discovered over MQTT; the *_mw power sensors are MQTT +# template sensors defined in configuration.butterfly.yaml (dBm -> mW). +# Styling uses card-mod (installed via HACS). +# +# Two tabs: +# Control — the panel: status strip, output readout, the two +# stages, emergency stop. Everything you touch. +# Diagnostics & Trends — the history graphs plus network / TEC / error +# detail, kept off the control tab so it stays clean. title: Butterfly Rack views: - - title: MOPA - path: mopa + # =================================================================== + # TAB 1 — CONTROL PANEL + # =================================================================== + - title: Control + path: control icon: mdi:laser-pointer - cards: - - type: vertical-stack - title: Butterfly EDFA Rack (MOPA, 1550 nm, Class 4) + type: sections + max_columns: 2 + sections: + # ---- Rack status (full width) ----------------------------------- + - type: grid + column_span: 2 cards: - # ===== Graphs at the top: powers (mW) and temperatures ===== + - type: heading + heading: Butterfly EDFA Rack + heading_style: title + icon: mdi:laser-pointer + - type: heading + heading: 1550 nm MOPA · Class 4 · invisible 1550 nm — treat output as hazardous + heading_style: subtitle + - type: glance + state_color: true + columns: 4 + grid_options: + columns: 12 + # Read-only status lamps. The actual on/off toggles live in the + # Seed and Booster stage cards below (tap_action: none here so this + # strip does not duplicate those controls). + entities: + - entity: binary_sensor.butterfly_edfa_rack_seed_link + name: Seed link + tap_action: + action: none + - entity: binary_sensor.butterfly_edfa_rack_amp_link + name: Amp link + tap_action: + action: none + - entity: binary_sensor.butterfly_edfa_rack_seed_laser_enabled + name: Seed + tap_action: + action: none + - entity: switch.butterfly_edfa_rack_amp_pump + name: Booster + tap_action: + action: none + - type: tile + entity: sensor.butterfly_edfa_rack_amp_warnings + name: Status + icon: mdi:alert-decagram + grid_options: + columns: 12 + card_mod: + style: | + ha-card { + {% set w = states('sensor.butterfly_edfa_rack_amp_warnings') %} + {% if w in ['none','Pump is OFF','unknown','unavailable'] or w == '' %} + --tile-color: var(--green-color, #43a047); + {% else %} + --tile-color: var(--red-color, #e53935); + {% endif %} + } + + # ---- Output readout --------------------------------------------- + - type: grid + column_span: 1 + cards: + - type: heading + heading: Output + heading_style: subtitle + icon: mdi:arrow-left-bold + - type: tile + entity: sensor.butterfly_edfa_rack_output_power_mw + name: Output power + icon: mdi:arrow-left-bold + grid_options: + columns: 12 + card_mod: + style: | + ha-card { --tile-color: var(--cyan-color, #00acc1); } + - type: tile + entity: sensor.butterfly_edfa_rack_output_power + name: Output dBm + icon: mdi:sine-wave + grid_options: + columns: 6 + - type: tile + entity: sensor.butterfly_edfa_rack_amp_input_power_mw + name: EDFA in + icon: mdi:arrow-right-bold + grid_options: + columns: 6 + + # ---- Stage 1: seed ---------------------------------------------- + - type: grid + column_span: 1 + cards: + - type: heading + heading: Seed · Stage 1 (CTL200) + heading_style: subtitle + icon: mdi:alpha-s-circle-outline + - type: entities + state_color: true + entities: + - entity: switch.butterfly_edfa_rack_seed_laser + name: Seed laser (ON first) + - entity: number.butterfly_edfa_rack_seed_set_current + name: Set current (mA) + - entity: number.butterfly_edfa_rack_seed_thermistor_setpoint + name: Temp setpoint (Ω) + - type: tile + entity: sensor.butterfly_edfa_rack_seed_current + name: Current + icon: mdi:current-dc + grid_options: + columns: 6 + - type: tile + entity: sensor.butterfly_edfa_rack_seed_temperature + name: Seed temp + icon: mdi:thermometer + grid_options: + columns: 6 + - type: tile + entity: sensor.butterfly_edfa_rack_seed_photodiode_current + name: Monitor PD + icon: mdi:current-dc + grid_options: + columns: 6 + + # ---- Stage 2: booster ------------------------------------------- + - type: grid + column_span: 1 + cards: + - type: heading + heading: Booster · Stage 2 (M511, ACC) + heading_style: subtitle + icon: mdi:alpha-b-circle-outline + - type: entities + state_color: true + entities: + - entity: switch.butterfly_edfa_rack_amp_pump + name: Pump enable + - entity: number.butterfly_edfa_rack_amp_pump_current + name: Pump-1 set (mA) + # Lifts the pump-1 clamp from 4000 mA (1 W) to the 8000 mA max. + # Unavailable until the override firmware is flashed. + - entity: switch.butterfly_edfa_rack_amp_pump_override + name: Pump limit override (→ 8000 mA) + - type: tile + entity: sensor.butterfly_edfa_rack_amp_pump_1_current + name: Pump-1 current + icon: mdi:current-dc + grid_options: + columns: 6 + - type: tile + entity: sensor.butterfly_edfa_rack_amp_module_temperature + name: Module temp + icon: mdi:thermometer + grid_options: + columns: 6 + + # ---- Emergency (full width) ------------------------------------- + - type: grid + column_span: 2 + cards: + - type: heading + heading: Emergency + heading_style: subtitle + icon: mdi:alarm-light + - type: horizontal-stack + cards: + - type: button + name: PUMP OFF + icon: mdi:power-off + icon_height: 44px + show_state: false + tap_action: + action: call-service + service: switch.turn_off + target: + entity_id: switch.butterfly_edfa_rack_amp_pump + card_mod: &estop_amber + style: | + ha-card { + background: #e67e22; + color: #fff; + --primary-text-color: #fff; + --paper-item-icon-color: #fff; + font-weight: 700; + letter-spacing: 0.04em; + } + - type: button + name: SEED OFF + icon: mdi:power-off + icon_height: 44px + show_state: false + tap_action: + action: call-service + service: switch.turn_off + target: + entity_id: switch.butterfly_edfa_rack_seed_laser + card_mod: *estop_amber + - type: button + name: SHUTDOWN + icon: mdi:alarm-light + icon_height: 44px + show_state: false + tap_action: + action: call-service + service: script.butterfly_edfa_shutdown + confirmation: + text: Ramp pump to 0, disable booster, then seed? + card_mod: + style: | + ha-card { + background: #c0392b; + color: #fff; + --primary-text-color: #fff; + --paper-item-icon-color: #fff; + font-weight: 800; + letter-spacing: 0.06em; + } + + # =================================================================== + # TAB 2 — DIAGNOSTICS & TRENDS + # =================================================================== + - title: Diagnostics & Trends + path: diagnostics + icon: mdi:chart-line + type: sections + max_columns: 3 + sections: + - type: grid + column_span: 2 + cards: + - type: heading + heading: Trends + heading_style: subtitle + icon: mdi:chart-line - type: history-graph - title: EDFA output & pre-amp PD (mW) + title: Output & pre-amp PD (mW) hours_to_show: 1 entities: - entity: sensor.butterfly_edfa_rack_output_power_mw name: Output PD - entity: sensor.butterfly_edfa_rack_pre_amp_power_mw name: Pre-amp PD - - type: history-graph title: EDFA input PD (mW) — seed after attenuators hours_to_show: 1 entities: - entity: sensor.butterfly_edfa_rack_amp_input_power_mw name: EDFA input - - # Seed-side signal: CTL200 monitor photodiode current. Tracks seed - # output relatively; NOT a calibrated optical power. - type: history-graph title: Seed monitor PD (mA — relative, uncalibrated) hours_to_show: 1 entities: - entity: sensor.butterfly_edfa_rack_seed_photodiode_current name: Seed monitor PD - - type: history-graph title: Temperatures (°C) hours_to_show: 1 @@ -50,87 +283,54 @@ views: - entity: sensor.butterfly_edfa_rack_amp_pre_amp_temperature name: Amp pre-amp - # ===== Status + headline values ===== - - type: glance - columns: 3 + - type: grid + column_span: 1 + cards: + - type: heading + heading: Seed detail + heading_style: subtitle + icon: mdi:alpha-s-circle-outline + - type: entities entities: - - entity: binary_sensor.butterfly_edfa_rack_seed_link - name: Seed link - - entity: binary_sensor.butterfly_edfa_rack_amp_link - name: Amp link + - entity: sensor.butterfly_edfa_rack_seed_voltage + name: Seed voltage + - entity: sensor.butterfly_edfa_rack_seed_thermistor + name: Thermistor (actual) + - entity: sensor.butterfly_edfa_rack_seed_tec_current + name: TEC current + - entity: sensor.butterfly_edfa_rack_seed_tec_voltage + name: TEC voltage + - entity: sensor.butterfly_edfa_rack_seed_board_temperature + name: Board temp + - entity: sensor.butterfly_edfa_rack_seed_error_code + name: Error code + - type: heading + heading: Amp detail + heading_style: subtitle + icon: mdi:alpha-b-circle-outline + - type: entities + entities: + - entity: sensor.butterfly_edfa_rack_amp_input_power + name: Input power (dBm) + - entity: sensor.butterfly_edfa_rack_amp_pre_amp_power + name: Pre-amp power (dBm) + - entity: sensor.butterfly_edfa_rack_amp_pre_amp_current + name: Pre-amp current + - entity: sensor.butterfly_edfa_rack_amp_pre_amp_temperature + name: Pre-amp temp + - entity: sensor.butterfly_edfa_rack_amp_tec_current + name: TEC current - entity: sensor.butterfly_edfa_rack_amp_warnings name: Warnings - - - type: glance - title: Power now (internal PDs, indicative) - columns: 3 - entities: - - entity: sensor.butterfly_edfa_rack_amp_input_power_mw - name: EDFA in mW - - entity: sensor.butterfly_edfa_rack_output_power - name: Out dBm - - entity: sensor.butterfly_edfa_rack_output_power_mw - name: Out mW - - # ===== Stage 1: seed (Koheron CTL200) ===== + - type: heading + heading: Bridge (ESP32) + heading_style: subtitle + icon: mdi:chip - type: entities - title: Stage 1 — Seed (turn on FIRST) - state_color: true entities: - - entity: switch.butterfly_edfa_rack_seed_laser - name: Seed laser - - entity: number.butterfly_edfa_rack_seed_set_current - name: Seed current set (<= 300 mA) - - entity: sensor.butterfly_edfa_rack_seed_current - name: Seed current (actual) - - entity: number.butterfly_edfa_rack_seed_thermistor_setpoint - name: Seed temp setpoint (Ω, rtset) - - entity: sensor.butterfly_edfa_rack_seed_temperature - name: Seed temperature (from thermistor) - - entity: sensor.butterfly_edfa_rack_seed_photodiode_current - name: Seed monitor PD (mA, relative) - - # ===== Stage 2: booster (Agiltron M511, ACC) ===== - - type: entities - title: Stage 2 — Booster (ACC; ramp gently, settles 2-4 s) - state_color: true - entities: - - entity: switch.butterfly_edfa_rack_amp_pump - name: Booster pump enable - - entity: number.butterfly_edfa_rack_amp_pump_current - name: Pump-1 current set (<= 4000 mA ~ 1 W) - - entity: sensor.butterfly_edfa_rack_amp_pump_1_current - name: Pump-1 current (actual) - - entity: sensor.butterfly_edfa_rack_amp_module_temperature - name: Module temp - - # ===== Emergency off ===== - - type: horizontal-stack - cards: - - type: button - name: PUMP OFF - icon: mdi:power-off - icon_height: 40px - tap_action: - action: call-service - service: switch.turn_off - target: - entity_id: switch.butterfly_edfa_rack_amp_pump - - type: button - name: SEED OFF - icon: mdi:power-off - icon_height: 40px - tap_action: - action: call-service - service: switch.turn_off - target: - entity_id: switch.butterfly_edfa_rack_seed_laser - - type: button - name: SHUTDOWN - icon: mdi:alarm-light - icon_height: 40px - tap_action: - action: call-service - service: script.butterfly_edfa_shutdown - confirmation: - text: Ramp pump to 0, disable booster, then seed? + - entity: sensor.butterfly_edfa_rack_ip_address + name: IP address + - entity: sensor.butterfly_edfa_rack_wifi_signal + name: WiFi signal + - entity: sensor.butterfly_edfa_rack_uptime + name: Uptime