Repository navigation
Make the Template Substitution Contract Consistent - #163
Conversation
A bench unit with no network reachable reboots every 15 minutes, and only the API side of that pair was overridable per device. The WiFi template now exposes the same knob the API template does. OPERATIONS.md gains the container invocation CI uses to compile a config, which the running instance cannot do for a directory it does not mount, and drops the host paths and home directory that described one machine rather than this repository.
Every template now declares in its own header exactly what it needs and what it exposes, so a consumer reads one file to know the contract. The WiFi reboot timeout reaches the two templates that carry their own wifi: block and never read the substitution, so a bench override on a PLT-1B or a CeilSense takes effect rather than silently doing nothing. Six utility templates declared device_name required and never interpolated it. The API template documented its knob nowhere. The compile recipe grows a guard that keeps a real secrets.yaml from being overwritten, names an absolute mount path, and states where secrets.yaml belongs and what CI checks beyond the compile.
The PLT-1B and CeilSense templates extend a vendor api: block rather than including api.yaml, so api_reboot_timeout resolved nowhere in those trees and a bench override silently left the API rebooting every 15 minutes. rgb_led_pin is an override a consumer reaches for, the v1.0 devkitc board being the documented case, so the four board templates declare it rather than leaving it as undocumented plumbing. The compile recipe keeps its cache between runs, since the build tree lives there and a fresh directory makes every run a cold build.
Apollo sets reboot_timeout 0s in its upstream Core.yaml, and the including side wins on a scalar, so a 15min default here would have moved five deployed plant sensors onto a 15 minute reboot loop whenever Home Assistant is unreachable. The substitution defaults to 0s instead, which leaves behavior where it is and still exposes the knob. The vendor-bridging substitutions are named as machinery in each header that carries them, the bench-unit remedy names the block each timeout reaches rather than claiming the whole tree, and the compile recipe creates its own cache directory.
The README catalog gains the ProS3D pin the template exposes, the bench-unit remedy names the templates that read the two timeouts rather than the block shape, and the CI bullet says a utility include joins the exemption list rather than gaining an example device. The Apollo comment names the substitution it warns about, since sitting above two lines made it read as covering the WiFi default below it. common.yaml lists the encryption key api.yaml needs.
The previous wording dropped both names, leaving a reader told to override something the bullet never identifies. The README bundle list also gains the two includes common.yaml composes but never named.
|
Warning Review limit reachedNext included review available in 53 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (18)
💤 Files with no reviewable changes (5)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe pull request updates template substitution documentation, makes selected API and WiFi reboot timeouts configurable, documents board-specific substitutions, and replaces host-specific operation paths with portable instructions. ChangesTemplate substitution contracts
Configurable reboot timeouts
Path-independent operation and CI documentation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Feature 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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 |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The functional template changes appear consistent and low-risk, with only a minor documentation grammar fix suggested.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
This PR standardizes the “template substitution contract” across the ESPHome template catalog by making reboot timeouts consistently overridable and aligning template headers + documentation with actual substitution usage/definitions.
Changes:
- Add
wifi_reboot_timeoutas an overridable substitution inwifi.yamland in templates that define their ownwifi:block. - Ensure
api_reboot_timeoutis honored in templates that extend a vendor-providedapi:block. - Update template headers and repository docs (
README.md,OPERATIONS.md) to reflect the true required/optional substitution surfaces and remove stale claims.
| File | Description |
|---|---|
| templates/wifi.yaml | Parameterize WiFi reboot_timeout via wifi_reboot_timeout substitution. |
| templates/waveshare-esp32-s3-eth.yaml | Document rgb_led_pin as an optional substitution (and clarify its use). |
| templates/unexpectedmaker-pros3d.yaml | Document rgb_led_pin as an optional substitution (and clarify its use). |
| templates/temperature.yaml | Remove stale “required substitution” header claim (device_name). |
| templates/smarthome-ceilsense.yaml | Add api_reboot_timeout + wifi_reboot_timeout substitutions and wire them into api:/wifi: blocks. |
| templates/rgb-led-status.yaml | Remove stale “required substitution” header claim (device_name). |
| templates/norvi-enet-ae06-r.yaml | Document templates_dir as an optional substitution in header. |
| templates/konnected-blaq.yaml | Document wifi_reboot_timeout as an optional substitution in header. |
| templates/ethernet-sensor.yaml | Remove stale “required substitution” header claim (device_name). |
| templates/esp32-s3-devkitc.yaml | Document rgb_led_pin as an optional substitution in header. |
| templates/debug.yaml | Remove stale “required substitution” header claim (device_name). |
| templates/common.yaml | Update required secrets header to include api_encryption_key. |
| templates/basic.yaml | Remove stale “required substitution” header claim (device_name). |
| templates/apollo-plt-1b.yaml | Add api_reboot_timeout + wifi_reboot_timeout substitutions and wire them into api:/wifi: blocks. |
| templates/api.yaml | Document and define api_reboot_timeout as an optional substitution. |
| templates/adafruit-esp32-s3-feather.yaml | Document rgb_led_pin as an optional substitution (and clarify its use). |
| README.md | Update utility template catalog notes (notably wifi_reboot_timeout and expanded common.yaml composition) and generalize host paths. |
| OPERATIONS.md | Document substitution-header conventions and add a “compile like CI” container invocation; generalize host paths. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The substitution/header contract and documentation updates are consistent with the templates’ actual definitions/usages, and the reboot timeout knobs are correctly wired through with safe defaults.
Review effort: Lite
Findings: None

What
Every template now declares in its own header exactly the substitutions it needs and the ones it exposes, and the WiFi and API reboot timeouts are overridable wherever a template sets one.
wifi_reboot_timeoutjoinsapi_reboot_timeoutas a per-device knob, onwifi.yamland on the three templates that carry their ownwifi:block.api_reboot_timeoutreaches the two vendor templates that extend a vendorapi:block, where it previously resolved nowhere and a bench override silently did nothing.device_namerequired and never interpolated it.api.yamldocumented its own knob nowhere.rgb_led_pinwas undocumented on four board templates although the devkitc notes tell an adopter to override it.OPERATIONS.mdgains the container invocation that compiles a checkout the way CI does, which the running instance cannot do for a directory it does not mount, and the convention the headers follow.OPERATIONS.mdandREADME.mddrop the host paths and the home directory that described one machine rather than this repository.Why
A bench unit with no network reachable reboots every 15 minutes, and only the API half of that pair was overridable. Extending the knob exposed that the documentation and the templates disagreed in both directions, so the sweep covers the contract rather than the one substitution.
Behavior
No deployed device's resolved configuration changes. Apollo sets
reboot_timeout: 0sin its upstreamCore.yamland the including side wins on a scalar, so the PLT-1B template defaults its substitution to0srather than to the fleet's15min. Verified by dumping the resolved config for a deployed plant sensor and a deployed CeilSense before and after.Verification
test/configs validate.test/sonoff-s31.yaml,test/apollo-plt-1b.yaml, andtest/smarthome-ceilsense.yamlcompile, the last two after theapi:change.api.reboot_timeout=30sfrom a device-level override while the default stays0s, and both newly parameterized templates resolvewifi.reboot_timeout=0sfrom an override with the default at15min.!include.Notes
The
commentslabel is on this pull request because the diff adds comment lines in config, which the prose gate otherwise refuses.One thing is deliberately left alone and needs a decision:
OPERATIONS.mddocumentsaht_variantas an exposed PLT-1B override, and the template has never defined it.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation