Conversation
- Add ESPHome Version and Firmware Version text sensors for diagnostics - Add statusCheck script for connection status indication - Blue light: Connected to Home Assistant - Green light: Connected to WiFi only - Yellow light: Not connected - Update boot sequence to show connection status before hardware test Removes white startup blink (redundant with connection status). Connection status logic matches BTN-1 implementation. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
WalkthroughAdded boot-status globals, new diagnostic text sensors, a Boot Status LED switch, statusCheck and diagnosticCheck scripts, an api.on_client_connected handler, and updated device on_boot/wifi connect sequences to run statusCheck on first boot when enabled. Changes
Sequence Diagram(s)sequenceDiagram
participant Device as Device (on_boot / wifi.on_connect)
participant API as API (on_client_connected)
participant Script as Script (`statusCheck`)
participant HA as HomeAssistant (ink_ha_connected)
participant WiFi as WiFi (wifi.connected)
participant RGB as RGB Light (rgb_light)
Device->>API: on_client_connected / client connects
API->>Script: delay 1s\nexecute statusCheck
Script->>HA: check ink_ha_connected
Script->>WiFi: check wifi.connected
alt HA connected
Script->>RGB: set color rgba(0,128,255,0.5)
else WiFi only
Script->>RGB: set color rgba(0,128,0,0.5)
else neither
Script->>RGB: set color rgba(255,165,0,0.5)
end
Script->>Script: delay 5s
Script->>RGB: turn off
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Changes "Firmware Version" to "Apollo Firmware Version" for clarity. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changed on_boot priority from -10 to 600 to ensure WiFi is connected before checking connection status. Previously showed yellow (not connected) even when device would successfully connect moments later. Priority 600 runs later in boot sequence, after network initialization. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@Integrations/ESPHome/MTR-1.yaml`:
- Around line 12-15: The on_boot trigger is running statusCheck before WiFi is
connected (so it always reports "not connected"); replace the on_boot block with
the WiFi component's on_connect trigger so statusCheck runs after connection is
established — locate the on_boot block that executes script.execute: statusCheck
and change it to an on_connect trigger under the WiFi component (using
on_connect then: - script.execute: statusCheck), ensuring the statusCheck script
is invoked only after WiFi connects.
Moved statusCheck from on_boot to wifi.on_connect trigger to ensure it only runs after WiFi connection is established. This prevents showing yellow (not connected) status during boot when the device will successfully connect moments later. The on_connect trigger guarantees WiFi is connected when statusCheck runs, so it will correctly show blue (HA connected) or green (WiFi only). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Added api.on_connect trigger to run statusCheck when HA connects This fixes the issue where device showed green even when connected to HA, because WiFi connects before API connection is established - Removed unnecessary update_interval from firmware version sensor (version only changes on firmware update, not during runtime) Now the boot sequence will be: 1. WiFi connects → green light 2. API connects → updates to blue light Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changed from on_connect to on_client_connected which is the correct trigger name for the ESPHome API component. The previous on_connect was causing build failures. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Added mode: restart to allow statusCheck to be interrupted when called again. This fixes cold boot behavior where: - WiFi connects → green light → statusCheck running - API connects → tries to run statusCheck but was ignored (single mode) - Light turns off before showing blue With restart mode, API connection will interrupt the green light and immediately show blue when HA connects. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add first_boot_done global flag to prevent statusCheck from running on subsequent WiFi/HA reconnections. The LED status indicator now only shows once per device power cycle: - Device boots → LED shows connection status (blue/green/yellow) - HA restarts → No LED (flag already set) - WiFi roams → No LED (flag already set) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change statusCheck mode from 'restart' to 'single' to ensure the script always completes (including turn_off) - Add 1s delay to api.on_client_connected for connection stability - Add 10s delay to wifi.on_connect to give HA priority over WiFi-only status The bug was caused by mode:restart cancelling the first script run (with its turn_off) when a second trigger came in, while the guard check caused the second run to skip everything entirely. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Short press (<1s): Shows connection status (blue=HA, green=WiFi, yellow=none) - 1-7s press: Hardware test (unchanged) - 8s+ press: Factory reset (unchanged) Moved first_boot_done guard from statusCheck script to triggers, so manual button press always works while automatic triggers only run once per boot. Matches BTN-1 behavior. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add boot_status_enabled global (persists, ON by default) - Add "Boot Status LED" switch for users to enable/disable boot status - Update button: 2-8s hold runs diagnosticCheck (statusCheck + testScript) - Add diagnosticCheck script: runs statusCheck, waits 3s, runs testScript - Update all triggers to respect boot_status_enabled toggle Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
Integrations/ESPHome/MTR-1.yaml (1)
12-19:⚠️ Potential issue | 🟠 MajorBoot test shows LED before status check due to timing, inverting the desired LED sequence when status is enabled.
On boot (priority 600),
testScriptexecutes immediately ifrunTestis true. However,statusCheckonly runs later when WiFi or API connects and only on first connection (guarded byfirst_boot_doneandboot_status_enabled). This means the test LED displays before the status LED, which conflicts with the intent to show connection status before hardware diagnostics. Whenboot_status_enabledis true, usediagnosticCheckinstead—it explicitly runs status first, then the test.Suggested adjustment
on_boot: priority: 600 then: - if: condition: - lambda: "return id(runTest);" then: - if: condition: - lambda: "return id(boot_status_enabled);" then: - script.execute: diagnosticCheck else: - script.execute: testScriptIntegrations/ESPHome/MTR-1_Factory.yaml (1)
12-19:⚠️ Potential issue | 🟠 MajorGate
testScriptexecution onboot_status_enabledto sequence connection status before hardware test.When both
runTestandboot_status_enabledare true,testScriptruns immediately on boot whilestatusCheckattempts to run ~10 seconds later on WiFi connect. This causes LED display conflicts since both scripts control the RGB light independently. The intended sequence is to show connection status first, then run the hardware test.Use
diagnosticCheckwhenboot_status_enabled=trueto ensurestatusCheck(connection LED) runs beforetestScript(test result LED):Suggested adjustment
on_boot: priority: 600 then: - if: condition: - lambda: "return id(runTest);" then: - - lambda: "id(testScript).execute();" + - if: + condition: + - lambda: "return id(boot_status_enabled);" + then: + - script.execute: diagnosticCheck + else: + - script.execute: testScript
Summary
Adds diagnostic text sensors and connection status indication during boot sequence.
Changes
Testing Status
Ready for local testing and validation on hardware.
Files Modified
Summary by CodeRabbit
New Features
Chores