-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add lambda examples for deep sleep actions #5515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: current
Are you sure you want to change the base?
Conversation
The C++ function names for the deep_sleep actions are not immediately obvious.
WalkthroughAdded lambda usage examples to the deep_sleep documentation that call methods on the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
content/components/deep_sleep.md(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
- Do not generate or add any sequence diagrams
Files:
content/components/deep_sleep.md
🔇 Additional comments (1)
content/components/deep_sleep.md (1)
151-155: Lambda examples look good—verify C++ method names across all three actions.The lambda examples for
deep_sleep.enter,deep_sleep.prevent, anddeep_sleep.alloware a helpful addition for users calling these directly in lambdas. However, I cannot verify thatbegin(true),prevent_deep_sleep(), andenable()are the correct C++ method names without access to the esphome codebase.Please confirm the C++ method names are correct by searching the esphome repository or testing locally. You may also want to verify these names are part of the public API and stable across supported versions.
✅ Deploy Preview for esphome ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
content/components/deep_sleep.md (1)
221-223: Verify indentation consistency for the lambda block.A previous review flagged that the
- lambda: |-line on line 223 (or line 222 in the current state) uses inconsistent indentation compared to theenterandpreventexamples. The current display shows 2-space indentation, which would be consistent with lines 153 and 176, but please verify the actual character count is correct. If this is still using 4 spaces, apply the indentation fix from the previous review.
🧹 Nitpick comments (1)
content/components/deep_sleep.md (1)
220-221: Add blank line for consistent formatting with other action examples.The
allowsection is missing a blank line between the action example and the# in a lambdacomment, whereas both theenterandpreventsections have this blank line. Add a blank line at line 220 to maintain visual consistency.- deep_sleep.allow: deep_sleep_1 # in a lambda - lambda: |- id(deep_sleep_1).enable();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
content/components/deep_sleep.md(4 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
- Do not generate or add any sequence diagrams
Files:
content/components/deep_sleep.md
🔇 Additional comments (1)
content/components/deep_sleep.md (1)
152-154: Lambda examples are well-targeted and address the PR objective.The additions successfully provide lambda equivalents for the three deep_sleep actions with appropriate C++ method calls (
begin(true),prevent_deep_sleep(),enable()). These examples clarify the non-obvious function names as intended by the PR.Also applies to: 176-177, 222-223
Added example of enabling deep sleep in a lambda function.
CodeChimp gave inconsistent results (enable and disable vs prevent and allow)
The C++ function names for the deep_sleep actions are not immediately obvious.
Description:
Related issue (if applicable): fixes
Pull request in esphome with YAML changes (if applicable):
Checklist:
I am merging into
nextbecause this is new documentation that has a matching pull-request in esphome as linked above.or
I am merging into
currentbecause this is a fix, change and/or adjustment in the current documentation and is not for a new component or feature.Link added in
/components/index.rstwhen creating new documents for new components or cookbook.New Component Images
If you are adding a new component to ESPHome, you can automatically generate a standardized black and white component name image for the documentation.
To generate a component image:
Comment on this pull request with the following command, replacing
COMPONENT_NAMEwith your component name in UPPER_CASE format with underscores (e.g.,BME280,SHT3X,DALLAS_TEMP):The ESPHome bot will respond with a downloadable ZIP file containing the SVG image.
Extract the SVG file and place it in the
images/folder of this repository.Use the image in your component's index table entry in
/components/index.rst.Example: For a component called "DHT22 Temperature Sensor", use: