You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Promote develop to main: Template Substitution Contract - #164
Promotes #163, #165, #166, and #167 to main, which make the template substitution contract consistent across the catalog and the compile recipe portable.
wifi_reboot_timeout joins api_reboot_timeout as a per-device knob, and both now resolve on every template that sets a reboot timeout.
Each template header declares exactly what it needs, what it exposes, and what is machinery, and OPERATIONS.md states that convention.
OPERATIONS.md gains the container invocation that compiles a checkout the way CI does.
OPERATIONS.md and README.md drop the host paths and the home directory that described one machine rather than this repository.
Behavior
No deployed device's resolved configuration changes. Apollo sets reboot_timeout: 0s upstream and the including side wins on a scalar, so the PLT-1B template defaults its own substitution to 0s rather than to the fleet's 15min. Confirmed by dumping the resolved config for a deployed plant sensor and a deployed CeilSense.
Verification
Carried from the feature pull request, where all 24 test/ configs validate, three example devices compile, and a four-way audit of all 38 templates reports no contract defect.
Notes
#165 closes the finding this promotion's first review raised. OPERATIONS.md documented aht_variant as an exposed PLT-1B override that no template has ever defined, and the list now names the four the template actually exposes. It also corrects an SCD41 attributed to the PLT-1B, a sensor that board does not carry.
#166 closes the two findings this promotion's second review raised. The compile recipe generated secrets.yaml with sed -i, which BSD sed on macOS reads differently, and now writes through a temp file with no -i form and fails closed on every error. The adopter clone instruction named develop against every other @main instruction, and now defaults to main.
#167 closes the finding this promotion's third review raised. The recipe carried on into docker run after a failed secrets step, and now skips the compile with a non-zero status instead.
#165 merged over a pull request review digest that could not read two Copilot summary shapes, on the maintainer's explicit approval. Its content was clean on the head it merged, and the reader is tracked in ptr727/ProjectTemplate#1701.
* Add wifi_reboot_timeout and Document CI-Parity Compiles
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.
* Make the Template Substitution Contract Consistent
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.
* Expose the API Reboot Timeout on the Vendor Templates
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.
* Keep Apollo's Own API Reboot Timeout as the Template Default
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.
* Correct the Substitution Documentation Against the Tree
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.
* Name the Two Reboot Substitutions in the Bench Remedy
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.
* Fix the Possessive in the Compile Recipe Introduction
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
OPERATIONS.md documents an Apollo PLT-1B substitution (aht_variant) that is not implemented by the corresponding template, so the published contract is internally inconsistent.
Review effort: Lite Findings: None
What changed in this PR
Promotes the template substitution contract updates from develop to main, making reboot-timeout knobs and template header substitution declarations consistent across the template catalog and documenting local CI-equivalent compile steps.
Changes:
Add wifi_reboot_timeout alongside api_reboot_timeout and wire both through templates that set reboot timeouts.
Align multiple template headers with the “required / optional / machinery” substitution contract and document additional exposed knobs (e.g., rgb_led_pin, templates_dir).
Update OPERATIONS.md / README.md to remove host-specific paths and document a container-based compile workflow matching CI.
File
Description
templates/wifi.yaml
Parameterize WiFi reboot timeout via wifi_reboot_timeout.
templates/waveshare-esp32-s3-eth.yaml
Document and default rgb_led_pin for RGB LED status integration.
templates/unexpectedmaker-pros3d.yaml
Document rgb_led_pin as an optional override and annotate its usage.
templates/temperature.yaml
Remove stale “device_name required” header contract claim.
templates/smarthome-ceilsense.yaml
Add api_reboot_timeout / wifi_reboot_timeout knobs and wire them into api:/wifi: blocks.
templates/rgb-led-status.yaml
Remove stale “device_name required” header contract claim.
templates/norvi-enet-ae06-r.yaml
Document templates_dir as an optional substitution knob.
templates/konnected-blaq.yaml
Document wifi_reboot_timeout and clarify machinery substitutions for vendor package bridging.
templates/ethernet-sensor.yaml
Remove stale “device_name required” header contract claim.
templates/esp32-s3-devkitc.yaml
Document rgb_led_pin as an optional substitution knob.
templates/debug.yaml
Remove stale “device_name required” header contract claim.
templates/common.yaml
Update required secrets list to reflect composed includes (adds api_encryption_key).
templates/basic.yaml
Remove stale “device_name required” header contract claim.
templates/apollo-plt-1b.yaml
Add api_reboot_timeout / wifi_reboot_timeout knobs and wire them into api:/wifi: blocks.
templates/api.yaml
Document api_reboot_timeout and ensure it is consistently defined and used.
templates/adafruit-esp32-s3-feather.yaml
Document and default rgb_led_pin for RGB LED status integration.
README.md
Update template catalog descriptions and make usage paths host-agnostic.
* Drop the Apollo Substitution No Template Defines
aht_variant is documented as an exposed per-plant override and has never
existed in any template, so the published contract names a knob a reader
cannot set. Apollo hardcodes variant AHT20 in its own package, and no unit
in the fleet carries an AHT10.
The list now names the four substitutions the template actually exposes,
and the NVS wipe requirement is scoped to the two first-boot values it
applies to rather than to the reboot timeouts, which take effect on a
reflash.
* Qualify the Apollo Reboot Loop and the NVS Reset Routes
The reboot claim held only for a unit Prevent Sleep keeps awake, since a
sleeping unit resets at the 90 second wake window before a longer timeout
elapses. Apollo also ships a factory reset button, so a USB erase is not
the only way to move a stored first-boot value. The first two bullets now
state their defaults like the other two.
* Bound the Factory Reset Route to an Awake Unit
The factory reset reads as a ready alternative to the USB erase, and it is
not one on the deployed sleeping unit the paragraph is about, which has no
wakeup pin. The template comment also still carried the unqualified reboot
claim the section narrowed.
* Drop the Factory Reset Aside and Correct the Watchdog Comment
Every accurate form of the factory reset aside needs preconditions this
section is not about, so the paragraph keeps the USB route it always had.
The header comment also said 0s keeps a sensor awake, which Prevent Sleep
does, where 0s only disables the API reboot watchdog.
* Drop the False Necessity From the NVS Wipe Instruction
Apollo ships a factory reset that clears preferences too, so naming the
USB erase as the only route was wrong. The instruction now gives the route
without claiming it is the sole one.
* Attribute the Two Upstream Constants to Their Sources
* Read the Prevent Sleep Default and Its Values in One Pass
* State What Moving the Apollo API Timeout Does
* Condition the Apollo Reboot Cycle on an Awake Unit
* Name What Is Compared to the Apollo Run Duration
* Add the Relative Pronoun to the Awake Unit Condition
* Attribute the Humidity Observation to the Sensor the Board Has
The bullet reports tuning tried on the Apollo PLT-1B and then names an
SCD41, which that board does not carry. Its air sensor is the AHT that
Apollo pins to variant AHT20, and the only SCD4x in the tree is the
CeilSense's. The sentence now names the one sensor the claim was observed
on, which also settles the singular verb the compound subject carried.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🔵 Needs a closer look
The docs include at least two correctness/portability issues (macOS-incompatible sed -i usage and a develop-branch clone instruction that conflicts with the repository’s @main consumption guidance).
Review effort: Lite Findings: None
Previously missed (2)
In code that hasn't changed since last review
Use portable in-place editing for secrets.yaml
OPERATIONS.md:93
Fix (medium): Use a cross-platform in-place edit for secrets.yaml.
sed -i has different semantics on GNU vs BSD/macOS sed, but the repo contract assumes Windows + macOS + Linux support, so this command will fail for macOS users running the CI-matching container compile recipe.
Use a suffix form (-i.bak) and remove the backup so the command works on both sed variants.
Change clone instructions to use main branch
README.md:245
Fix (medium): Align the clone command with the repository’s published @main usage.
This README section tells users to clone the develop branch into their ESPHome config directory. Elsewhere in the README and in the templates’ external-usage headers, the documented consumption form is consistently @main, so cloning develop here is a surprising default for adopters and can lead to pulling in unreleased changes.
Prefer cloning main in the default instructions (or explain why develop is required if that is intentional).
* Make the Compile Recipe and the Clone Instruction Portable
GNU and BSD sed disagree on a bare -i, which BSD reads as taking the next
argument as a backup suffix, so the recipe's placeholder substitution
failed on macOS, a supported platform. The step now writes sed's output to
a mktemp file and moves it into place, so it uses no -i form and never
touches a sibling path such as a secrets.yaml.bak someone moved aside.
It also fails closed. The key, the template's placeholder, the
substitution, and the move are one condition, so an empty key, a missing
or placeholder-free template, or a failed mv leaves no secrets.yaml for
the guard to keep on every later run, and the temp file is removed on any
failure.
The adopter clone instruction named develop while every other consumption
instruction in the README and the template headers names main. It now
defaults to main, and keeps develop as the route for tracking changes
before they are promoted.
* Give the Secrets Temp File an Explicit Template
A bare mktemp fails on implementations that require a template, and the
file's own lint recipe already names one under /tmp, so this matches it.
* Check mktemp Inside the Secrets Condition
A failed mktemp left tmp empty, so the redirect failed with an unrelated
error before the step's own message. mktemp now runs inside the condition,
only after the key and the template check pass, and the cleanup runs only
when a temp file exists.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🟡 Changes recommended
The new compile recipe continues after a secrets.yaml generation failure, which can mask the root cause and wastes time running an expected-to-fail compile.
Get a fresh assessment by requesting another Copilot review.
A failed secrets step printed its message and then carried on into docker
run, which failed later on a missing secret, a long way from the cause.
The run is now gated on secrets.yaml existing, so a failed generation
stops there with a non-zero status. An exit would close the terminal of
anyone pasting the recipe, which the gate avoids.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🟢 Approval recommended
The changes consistently apply the documented substitution contract across templates and documentation without introducing unresolved correctness issues.
Answering the three findings the rounds on 84611aa7 and 3415c8c7 raised against this promotion. Two sat in a "Previously missed" block that opened no thread, and the third thread was resolved by the reviewer before a reply landed, so all three are answered here.
Use portable in-place editing for secrets.yaml, OPERATIONS.md: fixed in 3415c8c via #166. BSD sed reads the argument after a bare -i as a backup suffix, so the step failed on macOS. It now writes sed's output to a mktemp /tmp/esphome-secrets.XXXXXX file and moves it into place, with no -i form at all. It also fails closed: the key, the template's placeholder, the temp file, the substitution, and the move are one condition, so any failure leaves no secrets.yaml behind and removes the temp file. That was run as written under bash and dash across six cases, including a failing openssl, mv, and mktemp.
Change clone instructions to use main branch, README.md: fixed in 3415c8c via #166. The adopter instruction now defaults to -b main, matching every @main usage header, and keeps -b develop as the route for tracking changes before they are promoted.
Exit early when secrets.yaml generation fails, OPERATIONS.md: fixed in f2f1d22 via #167. The docker run is gated on secrets.yaml existing, so a failed generation stops before the compile with a non-zero status. A gate rather than exit, because an exit would close the terminal of anyone pasting the recipe. That was run with docker stubbed under bash and dash: it runs when secrets are generated or already present, and is skipped when generation fails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commentsPermits the comment lines the pull request adds or edits, which the prose gate otherwise refuses
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Promotes #163, #165, #166, and #167 to
main, which make the template substitution contract consistent across the catalog and the compile recipe portable.wifi_reboot_timeoutjoinsapi_reboot_timeoutas a per-device knob, and both now resolve on every template that sets a reboot timeout.OPERATIONS.mdstates that convention.OPERATIONS.mdgains the container invocation that compiles a checkout the way CI does.OPERATIONS.mdandREADME.mddrop the host paths and the home directory that described one machine rather than this repository.Behavior
No deployed device's resolved configuration changes. Apollo sets
reboot_timeout: 0supstream and the including side wins on a scalar, so the PLT-1B template defaults its own substitution to0srather than to the fleet's15min. Confirmed by dumping the resolved config for a deployed plant sensor and a deployed CeilSense.Verification
Carried from the feature pull request, where all 24
test/configs validate, three example devices compile, and a four-way audit of all 38 templates reports no contract defect.Notes
#165 closes the finding this promotion's first review raised.
OPERATIONS.mddocumentedaht_variantas an exposed PLT-1B override that no template has ever defined, and the list now names the four the template actually exposes. It also corrects an SCD41 attributed to the PLT-1B, a sensor that board does not carry.#166 closes the two findings this promotion's second review raised. The compile recipe generated
secrets.yamlwithsed -i, which BSD sed on macOS reads differently, and now writes through a temp file with no-iform and fails closed on every error. The adopter clone instruction nameddevelopagainst every other@maininstruction, and now defaults tomain.#167 closes the finding this promotion's third review raised. The recipe carried on into
docker runafter a failed secrets step, and now skips the compile with a non-zero status instead.#165 merged over a pull request review digest that could not read two Copilot summary shapes, on the maintainer's explicit approval. Its content was clean on the head it merged, and the reader is tracked in ptr727/ProjectTemplate#1701.
🤖 Generated with Claude Code