Intent creation: display content (show) + named RTTTL melodies - #260
Merged
Conversation
Adding a display used to produce a dark panel unless the user wrote the ESPHome lambda by hand, and a buzzer needed a raw RTTTL string. show: a declarative widget list (text / value / time) lowered to the display lambda per dialect -- pixel displays (ssd1306, ili9xxx, st7789) get an automatic gfonts font block and y-stepped printf lines, character LCDs print into rows, digit displays (tm1637, max7219) render one value. Value widgets bind other components' readings by id convention; 20 sensor templates now emit per-channel ids. Time widgets bring their own homeassistant time block. An explicit lambda_ still wins. Validation warns on unknown sources/channels/widgets. rtttl gains a capability (play/stop); a play action names a curated melody via args.song (eight reviewed melodies, GET /intent/melodies) with args.rtttl as the raw escape hatch. Unknown songs warn and drop the action instead of emitting a broken play. Examples dogfood both: oled renders its clock through show; the co2-display gains a buzzer playing the alarm melody above 1200ppm CO2 through the new mhz19 co2 channel + on_value_range passthrough. All 68 examples validate under upstream esphome; goldens regenerated (includes catching the kitchen-scale ascii up to the earlier SH1106 rename). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VLucY2SKuBDPFaDAJnnYs1
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two intent-creation features closing the "component added, nothing happens" gap: displays that actually display, and buzzers that play named melodies — both declarative in
design.json, both lowered by the generator, no hand-written lambdas required.Display content:
params.show. A widget list on any display component:Lowered per display dialect (a new
esphome.display_dialectlibrary field): pixel displays (ssd1306, ili9xxx, st7789) get an automaticfont:block (gfonts://Roboto) and y-stepped printf lines; character LCDs (lcd_pcf8574) print into rows; digit displays (tm1637, max7219) render one value. Value widgets bind other components' readings by id convention — single-value sensors publish as<component>, multi-channel as<component>_<channel>— and 20 sensor templates now emit those ids. Time widgets bring their owntime:block. An explicitlambda_always wins. Newshow_*validation warnings explain unknown sources, channels, and widget kinds.Named RTTTL melodies. The rtttl component gains
capability: play/stop; an automation action can sayargs: {song: "doorbell"}and the lowering substitutes the full RTTTL string from a curated eight-melody map (GET /intent/melodies);args: {rtttl: "..."}stays as the raw escape hatch. Unknown songs warn (automation_unknown_song) and drop the action rather than emit a broken play; aplaywith neither arg warns too.Dogfooding: the oled example renders its clock through
show(replacing its hand lambda, font, and time blocks), and co2-display gains a piezo that plays the alarm melody when CO2 crosses 1200ppm — via a newco2capability channel +on_value_rangepassthrough on mhz19. Both pass realesphome config.Goldens regenerated across the board (the full-regen also caught the kitchen-scale ASCII up to the earlier SSD1306→SH1106 rename, and adds goldens for examples that never had them). Validation: all 68 examples pass the gate under 2026.6.5; 1119 Python tests (8 new) pass — the 2 local failures are the known root-sandbox chmod tests, green in CI.
Follow-up candidates: a
showwidget builder in the inspector UI, and melody preview in the automation editor.🤖 Generated with Claude Code
https://claude.ai/code/session_01VLucY2SKuBDPFaDAJnnYs1
Generated by Claude Code