Update light.md to mention toggle support#2986
Update light.md to mention toggle support#2986ams2990 wants to merge 2 commits intohome-assistant:masterfrom
Conversation
Also fix a missing block quote close.
📝 WalkthroughWalkthroughDocumentation update to the light entity file adds a new example demonstrating how to toggle light devices using an async_toggle method. The change includes a closing code fence correction and a tip for no-sync toggle behavior. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/core/entity/light.md`:
- Around line 174-187: The doc incorrectly states sync toggle isn't supported;
update the Toggle Light Device section for LightEntity to reflect that toggle()
is available (inherited from ToggleEntity) and show both sync and async variants
(toggle and async_toggle) or explicitly state toggle is inherited and recommend
implementing turn_on/turn_off instead; reference LightEntity, ToggleEntity,
toggle(), async_toggle(), turn_on, and turn_off so readers can find the
implementation points.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 43776e2b-e9a5-4be3-ac2f-9615a0394669
📒 Files selected for processing (1)
docs/core/entity/light.md
|
|
||
| ```python | ||
| class MyLightEntity(LightEntity): | ||
| async def async_toggle(self, **kwargs): |
There was a problem hiding this comment.
Should we mention that integrations only need to implement this if the API that is integrated directly supports toggling the state of the device? If the API only supports turning on and off, integrations should not implement the async_toggle method. The base class has a default implementation that falls back on turn_on and turn_off.
Also fix a missing block quote close.
Proposed change
Update light documentation to match home-assistant/core#156196.
Type of change
Checklist
Additional information
Summary by CodeRabbit