Skip to content

Fix schema validation errors in entity domain and light docs#6182

Merged
jesserockz merged 2 commits intoesphome:currentfrom
swoboda1337:fix/entity-domain-docs-schema
Mar 1, 2026
Merged

Fix schema validation errors in entity domain and light docs#6182
jesserockz merged 2 commits intoesphome:currentfrom
swoboda1337:fix/entity-domain-docs-schema

Conversation

@swoboda1337
Copy link
Member

Summary

Templatable additions (verified against ESPHome Python source — all use cv.templatable()):

  • cover/index: Add [templatable] to stop, state, position, tilt in cover.control action
  • valve/index: Add [templatable] to stop, state, position in valve.control action
  • event/index: Add [templatable] to event_type in event.trigger action
  • update/index: Add [templatable] to force_update in update.perform action
  • speaker/index: Add [templatable] to data in speaker.play action
  • speaker/mixer: Fix plain "templatable" text to proper [templatable] link for decibel_reduction, duration
  • media_player/speaker: Add [templatable] to announcement, enqueue in play action

Required/Optional fixes (verified against ESPHome Python source):

  • cover/current_based: open_obstacle_current_threshold, close_obstacle_current_threshold Required→Optional (cv.Optional in schema); close_action Optional→Required (cv.Required in schema)
  • cover/time_based: close_action Optional→Required (cv.Required in schema)
  • light/esp32_rmt_led_strip: chipset Required→Optional (cv.Optional — not required when specifying manual timings)
  • light/neopixelbus: pin, clock_pin, data_pin Required→Optional (cv.Optional — conditionally required based on chipset type)
  • light/rp2040_pio_led_strip: chipset Required→Optional (cv.Optional in schema)
  • light/status_led: pin Optional→Required (cv.Required in schema)

Test plan

  • Verify CI schema validation passes for the modified files
  • Verify docs render correctly

🤖 Generated with Claude Code

Templatable additions:
- cover/index: Add [templatable] to stop, state, position, tilt in cover.control action
- valve/index: Add [templatable] to stop, state, position in valve.control action
- event/index: Add [templatable] to event_type in event.trigger action
- update/index: Add [templatable] to force_update in update.perform action
- speaker/index: Add [templatable] to data in speaker.play action
- speaker/mixer: Fix plain "templatable" text to proper [templatable] link for decibel_reduction, duration
- media_player/speaker: Add [templatable] to announcement, enqueue in play_on_device_media_file action

Required/Optional fixes:
- cover/current_based: open_obstacle_current_threshold, close_obstacle_current_threshold Required→Optional; close_action Optional→Required
- cover/time_based: close_action Optional→Required
- light/esp32_rmt_led_strip: chipset Required→Optional (not required when specifying manual timings)
- light/neopixelbus: pin, clock_pin, data_pin Required→Optional (conditionally required based on chipset)
- light/rp2040_pio_led_strip: chipset Required→Optional
- light/status_led: pin Optional→Required

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 1, 2026 02:05
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 1, 2026

Walkthrough

Documentation updates across multiple ESPHome components to adjust configuration field requirements and add templatable annotations to various configuration options and fields.

Changes

Cohort / File(s) Summary
Cover Configuration Fields
src/content/docs/components/cover/current_based.mdx, src/content/docs/components/cover/time_based.mdx
Updated required/optional status: open_obstacle_current_threshold and close_obstacle_current_threshold changed from Required to Optional; close_action changed from Optional to Required.
Cover Component
src/content/docs/components/cover/index.mdx
Marked stop, state, position, and tilt as templatable configuration fields with links to templates documentation.
Light Components
src/content/docs/components/light/esp32_rmt_led_strip.mdx, src/content/docs/components/light/neopixelbus.mdx, src/content/docs/components/light/rp2040_pio_led_strip.mdx
Adjusted pin and chipset required/optional semantics: neopixelbus pins changed from Required to Optional; chipset field changed from Required to Optional for ESP32 RMT and RP2040 PIO components; added SM16703 chipset support for RP2040 PIO.
Event & Valve Components
src/content/docs/components/event/index.mdx, src/content/docs/components/valve/index.mdx
Marked event_type and valve control configuration fields (stop, state, position) as templatable with documentation references.
Speaker & Media Player Components
src/content/docs/components/media_player/speaker.mdx, src/content/docs/components/speaker/index.mdx, src/content/docs/components/speaker/mixer.mdx, src/content/docs/components/update/index.mdx
Added templatable annotations to annunciation, enqueue, data, force_update, decibel_reduction, and duration configuration fields with proper documentation references.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • esphome/esphome-docs#3891: Modifies event trigger documentation event_type entry, consistent with this PR's event_type templatable annotation.
  • esphome/esphome-docs#5814: Updates current_based cover documentation in the same file, addressing related configuration field definitions.
  • esphome/esphome-docs#4406: Modifies current_based cover configuration options, overlapping with this PR's required/optional semantic changes.

Suggested reviewers

  • jesserockz
  • bdraco
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly describes the main purpose of the PR: fixing schema validation errors in documentation for entity domain and light components.
Description check ✅ Passed The description provides comprehensive details about templatable additions and required/optional fixes across multiple files, with verification notes and a test plan.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@netlify
Copy link

netlify bot commented Mar 1, 2026

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit 56d5df3
🔍 Latest deploy log https://app.netlify.com/projects/esphome/deploys/69a48cbd99d5da0008a02396
😎 Deploy Preview https://deploy-preview-6182--esphome.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates ESPHome documentation option metadata to match the underlying Python schemas, resolving schema validation errors in several entity-domain and light component docs.

Changes:

  • Mark multiple automation/action options as [templatable](/automations/templates) where the schema uses cv.templatable().
  • Correct Required vs Optional markers for several cover and light platform options to reflect their actual schema requirements.
  • Normalize “templatable” text in speaker mixer docs to the standard [templatable] link format.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/content/docs/components/valve/index.mdx Add [templatable] markers to valve.control options (stop, state, position).
src/content/docs/components/update/index.mdx Mark update.perform’s force_update as templatable.
src/content/docs/components/speaker/mixer.mdx Replace plain “templatable” text with proper [templatable] links for action options.
src/content/docs/components/speaker/index.mdx Mark speaker.play’s data as templatable.
src/content/docs/components/media_player/speaker.mdx Mark announcement and enqueue as templatable for the play-on-device action.
src/content/docs/components/light/status_led.mdx Correct pin to Required.
src/content/docs/components/light/rp2040_pio_led_strip.mdx Correct chipset to Optional.
src/content/docs/components/light/neopixelbus.mdx Correct pin / clock_pin / data_pin to Optional (conditionally required in practice).
src/content/docs/components/light/esp32_rmt_led_strip.mdx Correct chipset to Optional (not required with manual timings).
src/content/docs/components/event/index.mdx Mark event_type in event.trigger as templatable.
src/content/docs/components/cover/time_based.mdx Correct close_action to Required.
src/content/docs/components/cover/index.mdx Add templatable markers to cover.control options (stop, state, position, tilt).
src/content/docs/components/cover/current_based.mdx Fix Required/Optional status for obstacle thresholds and make close_action Required.

Comment on lines 35 to 36
- **pin** (**Required**, [Pin Schema](/guides/configuration-types#pin-schema)): The GPIO pin to control the LED on.
- **output** (*Optional*, [ID](/guides/configuration-types#id)): The id of the binary [Output Component](/components/output/) to use for this light.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of pin or output are required. Maybe we need a new way to express these kind of validations?

@swoboda1337 swoboda1337 requested a review from jesserockz March 1, 2026 19:00
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
src/content/docs/components/light/rp2040_pio_led_strip.mdx (1)

26-31: Consider adding clarifying text for when chipset is not required.

For consistency with the esp32_rmt_led_strip.mdx documentation, consider adding explanatory text indicating that chipset is not required when specifying manual timings. This helps users understand the conditional requirement.

📝 Suggested documentation improvement
-- **chipset** (*Optional*, enum): The chipset to apply known timings from.
+- **chipset** (*Optional*, enum): The name of the chipset used; determines signal timing. Not required if
+  specifying the [timings manually](`#manual-timings`).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/docs/components/light/rp2040_pio_led_strip.mdx` around lines 26 -
31, Add a short clarifying sentence to the description of the chipset option
explaining that the chipset field is optional only when manual timings are
provided; e.g., state that if users supply explicit timing values (manual
timings) the chipset selection is not required, mirroring the guidance used in
esp32_rmt_led_strip.mdx so readers understand the conditional requirement for
chipset versus manual timings.
src/content/docs/components/speaker/index.mdx (1)

143-146: Pre-existing RST-style note syntax should use GitHub-flavored alerts.

The .. note: syntax is RST format. Per coding guidelines, MDX files should use GitHub-flavored alert syntax.

Suggested fix
-.. note:
-
-Between the time `speaker.is_playing` is false and `speaker.is_stopped` is true the 'speaker' component is closing down structures that where used to play the data correctly. *It better to check if the speaker is stopped then that if it plays.*
+> [!NOTE]
+> Between the time `speaker.is_playing` is false and `speaker.is_stopped` is true, the speaker component is closing down structures that were used to play the data correctly. *It is better to check if the speaker is stopped than if it plays.*

As per coding guidelines: "Use GitHub-flavored alert syntax (> [!NOTE], > [!WARNING], > [!TIP]) for alert boxes in MDX"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/content/docs/components/speaker/index.mdx` around lines 143 - 146,
Replace the RST-style note starting with the literal ".. note:" (which contains
the sentence about checking speaker.is_stopped vs speaker.is_playing and the
explanation about closing down structures) with a GitHub-flavored alert using
the blockquote alert syntax (e.g., start the block with "> [!NOTE]" followed by
the same explanatory text), preserving the original wording about
speaker.is_playing and speaker.is_stopped and any emphasis; ensure the alert
uses MDX-compatible markdown rather than RST.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/content/docs/components/light/rp2040_pio_led_strip.mdx`:
- Around line 26-31: Add a short clarifying sentence to the description of the
chipset option explaining that the chipset field is optional only when manual
timings are provided; e.g., state that if users supply explicit timing values
(manual timings) the chipset selection is not required, mirroring the guidance
used in esp32_rmt_led_strip.mdx so readers understand the conditional
requirement for chipset versus manual timings.

In `@src/content/docs/components/speaker/index.mdx`:
- Around line 143-146: Replace the RST-style note starting with the literal "..
note:" (which contains the sentence about checking speaker.is_stopped vs
speaker.is_playing and the explanation about closing down structures) with a
GitHub-flavored alert using the blockquote alert syntax (e.g., start the block
with "> [!NOTE]" followed by the same explanatory text), preserving the original
wording about speaker.is_playing and speaker.is_stopped and any emphasis; ensure
the alert uses MDX-compatible markdown rather than RST.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d5dff81 and 56d5df3.

📒 Files selected for processing (12)
  • src/content/docs/components/cover/current_based.mdx
  • src/content/docs/components/cover/index.mdx
  • src/content/docs/components/cover/time_based.mdx
  • src/content/docs/components/event/index.mdx
  • src/content/docs/components/light/esp32_rmt_led_strip.mdx
  • src/content/docs/components/light/neopixelbus.mdx
  • src/content/docs/components/light/rp2040_pio_led_strip.mdx
  • src/content/docs/components/media_player/speaker.mdx
  • src/content/docs/components/speaker/index.mdx
  • src/content/docs/components/speaker/mixer.mdx
  • src/content/docs/components/update/index.mdx
  • src/content/docs/components/valve/index.mdx

@jesserockz jesserockz merged commit 7926693 into esphome:current Mar 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants