Skip to content

Intent creation: display content (show) + named RTTTL melodies - #260

Merged
moellere merged 1 commit into
mainfrom
claude/magnetic-reed-sensor-detection-y2lt2j
Aug 31, 2026
Merged

Intent creation: display content (show) + named RTTTL melodies#260
moellere merged 1 commit into
mainfrom
claude/magnetic-reed-sensor-detection-y2lt2j

Conversation

@moellere

Copy link
Copy Markdown
Owner

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:

"show": [
  {"kind": "text", "text": "wirestudio"},
  {"kind": "value", "source": "climate", "channel": "temperature", "label": "T", "format": "%.1f", "unit": "C"},
  {"kind": "time", "format": "%H:%M"}
]

Lowered per display dialect (a new esphome.display_dialect library field): pixel displays (ssd1306, ili9xxx, st7789) get an automatic font: 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 own time: block. An explicit lambda_ always wins. New show_* validation warnings explain unknown sources, channels, and widget kinds.

Named RTTTL melodies. The rtttl component gains capability: play/stop; an automation action can say args: {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; a play with 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 new co2 capability channel + on_value_range passthrough on mhz19. Both pass real esphome 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 show widget 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

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
@moellere
moellere marked this pull request as ready for review August 31, 2026 18:28
@moellere
moellere merged commit ac1378a into main Aug 31, 2026
15 checks passed
@moellere
moellere deleted the claude/magnetic-reed-sensor-detection-y2lt2j branch August 31, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants