diff --git a/common/status_led.yaml b/common/status_led.yaml index 7e79ec7..008c62f 100644 --- a/common/status_led.yaml +++ b/common/status_led.yaml @@ -2,6 +2,7 @@ # Status on a visible RGB light, which stays a normal light otherwise: # network down red, slow blink # no API client (HA) orange, slow blink +# component error purple, steady (only with show_errors: "true", for a dedicated status LED) # OTA blue, fast blink; green when done, 3 red blinks on error # back to normal green for 1 s, then the light goes back to how it was # packages: @@ -12,6 +13,7 @@ # Needs the ota id ota_esphome (common/ota_esp32.yaml). defaults: brightness: "0.3" + show_errors: "false" # a failed component would take over a display or a shared light for good globals: - id: status_led_active @@ -71,12 +73,15 @@ interval: static uint8_t tick = 0; tick++; bool slow = (tick / 2) % 2 == 0; // 1 s on, 1 s off - bool problem = !network::is_connected() || !api::global_api_server->is_connected(); + bool error = ${show_errors} && (App.get_app_state() & STATUS_LED_ERROR); + bool problem = !network::is_connected() || !api::global_api_server->is_connected() || error; if (problem) id(status_led_restore)->stop(); if (!network::is_connected()) { id(status_led_show)->execute(1.0f, 0.0f, 0.0f, slow); } else if (!api::global_api_server->is_connected()) { id(status_led_show)->execute(1.0f, 0.4f, 0.0f, slow); + } else if (error) { + id(status_led_show)->execute(0.6f, 0.0f, 1.0f, true); } else if (id(status_led_active) && !id(status_led_restore)->is_running()) { id(status_led_restore)->execute(true); } diff --git a/common/status_led_atom.yaml b/common/status_led_atom.yaml index 1ced824..ade1cba 100644 --- a/common/status_led_atom.yaml +++ b/common/status_led_atom.yaml @@ -5,6 +5,7 @@ packages: file: status_led.yaml vars: light_id: atom_led + show_errors: "true" # dedicated status LED light: - platform: esp32_rmt_led_strip