Skip to content

LD2410s Radar Sensor by NovakIrs #4798

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

Open
wants to merge 10 commits into
base: next
Choose a base branch
from
Open

Conversation

NovakIrs
Copy link

@NovakIrs NovakIrs commented Apr 6, 2025

Description:

Related issue (if applicable): fixes esphome/feature-requests#2872

Pull request in esphome with YAML changes (if applicable): esphome/esphome#8486

  • esphome/esphome#<8486>

Checklist:

  • I am merging into next because this is new documentation that has a matching pull-request in esphome as linked above.
    or

  • I am merging into current because 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.rst when creating new documents for new components or cookbook.

Copy link
Contributor

coderabbitai bot commented Apr 6, 2025

Warning

Rate limit exceeded

@jesserockz has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 27 minutes and 20 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 4de9377 and d464ab8.

⛔ Files ignored due to path filters (2)
  • components/sensor/images/ld2410s.png is excluded by !**/*.png
  • images/ld2410s.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • components/index.rst (2 hunks)

Walkthrough

This pull request adds documentation for the new LD2410s sensor. It introduces an entry in the main documentation index under the "Motion" and "Presence Detection" sections and provides a separate, comprehensive file detailing configuration options, parameters, and examples specific to the LD2410s sensor integration.

Changes

Files Change Summary
components/index.rst, components/sensor/ld2410s.rst Added documentation for the LD2410s sensor. The index file now includes entries for the sensor under "Motion" and "Presence Detection," while the new file explains configuration parameters such as UART settings, binary sensors, sensors, text sensors, numbers, buttons, and select options.

Assessment against linked issues

Objective Addressed Explanation
Support Hi-Link LD2410S (HLK-LD2410S) 24GHz Ultra Low Power Radar Sensor (#2872)

Suggested labels

next

Suggested reviewers

  • nagyrobi
  • jesserockz

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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.

Actionable comments posted: 0

🧹 Nitpick comments (4)
components/index.rst (1)

489-494: New LD2410s Component Entry in Motion Section is Correctly Formatted

The new entry

LD2410s, components/sensor/ld2410s, ld2410s.png, Motion & Presence

is correctly added in the Motion section with the expected syntax and information. Please verify that the image file exists under components/sensor/ and that the component’s capabilities are clearly conveyed by the title.

components/sensor/ld2410s.rst (3)

16-20: Address Minor Grammar and Typographical Errors in the Introduction

There are a few typos and grammatical issues in the introduction text:

  • Change “doesn't always produces” to “doesn't always produce”.
  • Change “manualy calibrate values Threshold, Hold and SNR” to “manually calibrate the Threshold, Hold, and SNR values”.
  • Change “energy vaules reading” to “energy values reading”.

A possible diff is:

-Module provides auto-calibration which doesn't always produces perfect results.
+Module provides auto-calibration which doesn't always produce perfect results.
 
-You can use Factory Reset to load default calibration, or manualy calibrate values Threshold, Hold and SNR for each one of 16 gates.
+You can use Factory Reset to load default calibration, or manually calibrate the Threshold, Hold, and SNR values for each of the 16 gates.
 
-You can enable energy vaules reading for gates by disabling Minimal output.
+You can enable energy values reading for gates by disabling Minimal output.

155-170: Improve Clarity in Text Sensor Descriptions

The text sensor section uses “Usefull” instead of “Useful”. It is recommended to correct this typo in all occurrences to maintain consistency and clarity. For example:

-  Usefull for diagnostic and fine tuning.
+  Useful for diagnostic and fine tuning.

296-302: Review the Description for the Select Option “response_speed”

The configuration variable for response_speed currently has the description “Detected target distance,” which appears to be a copy‐paste error. Please update the description to accurately reflect the purpose of the setting (for example, “Configures the response speed of the sensor” or similar).

A possible diff:

-    - **response_speed** (*Optional*): 
-      Detected target distance.
-      All options from :ref:`Select <config-select>`.
+    - **response_speed** (*Optional*): 
+      Configures the sensor's response speed.
+      All options from :ref:`Select <config-select>`.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 616ec11 and 523a372.

⛔ Files ignored due to path filters (2)
  • components/sensor/images/ld2410s.png is excluded by !**/*.png
  • images/ld2410s.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • components/index.rst (2 hunks)
  • components/sensor/ld2410s.rst (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**`: - Do not generate or add any sequence diagrams

**: - Do not generate or add any sequence diagrams

  • components/index.rst
  • components/sensor/ld2410s.rst
🔇 Additional comments (2)
components/index.rst (1)

592-604: New LD2410s Component Entry in Presence Detection Section is Consistent

The entry

LD2410s, components/sensor/ld2410s, ld2410s.png

appears in the Presence Detection section and is consistent with the Motion section entry. Confirm that the listing meets the overall documentation style guidelines and that the entry appropriately directs users to the detailed documentation file.

components/sensor/ld2410s.rst (1)

304-447: Overall Documentation Structure is Comprehensive

The example configuration and subsequent sections (Button, Example configuration, See Also) are thorough and well-organized. The YAML examples are clear, and the configuration variables are well explained. No major issues were found in these sections.

Copy link

netlify bot commented Apr 6, 2025

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit 473abd3
🔍 Latest deploy log https://app.netlify.com/projects/esphome/deploys/686139f518c0d00008980823
😎 Deploy Preview https://deploy-preview-4798--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

@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.

Actionable comments posted: 0

🧹 Nitpick comments (6)
components/sensor/ld2410s.rst (6)

16-18: Clarify Calibration Language

The sentence "or manually calibrate values Threshold, Hold and SNR for each one of 16 gates" could be rephrased for clarity. Consider changing it to "or manually calibrate the Threshold, Hold, and SNR values for each of the 16 gates."


19-19: Clarify the “Minimal output” Terminology

The line "You can enable energy values reading for gates by disabling Minimal output." may be ambiguous. It would help to briefly clarify what “Minimal output” means in this context (e.g., link to the button configuration or note its effect on energy value updates).


46-54: YAML Snippet Indentation Improvement

The YAML snippet under the "Component" section:

ld2410s:
uart_id: uart_bus

appears to have both lines at the same indentation level. For clarity and to better represent the hierarchy, consider indenting the uart_id under ld2410s: as follows:

-    ld2410s:
-    uart_id: uart_bus
+    ld2410s:
+      uart_id: uart_bus

This change will clearly indicate that uart_id belongs to the ld2410s configuration.


131-174: Typographical Correction in Text Sensor Section

There is a typographical error on line 172: "Updates only if Mininal Updades is disabled." It should be corrected to "Updates only if Minimal Updates is disabled."

Example correction:

-  Updates only if Mininal Updades is disabled.
+  Updates only if Minimal Updates is disabled.

285-304: Remove Duplicate ‘response_speed’ Entry in Select Section

There appears to be a duplicated bullet for response_speed at lines 299-301. Consolidate these entries into a single bullet that includes both the configuration description and its options.

For example:

- **response_speed** (*Optional*): 
- **response_speed** (*Optional*): 
-   Configures the sensor's response speed.
-   All options from :ref:`Select <config-select>`.
+ **response_speed** (*Optional*): Configures the sensor's response speed. All options from :ref:`Select <config-select>`.

364-366: Ensure Consistent YAML Indentation in the Example Configuration

In the complete example configuration, the ld2410s snippet:

ld2410s:
uart_id: uart_bus

would be clearer if the indentation reflects the hierarchy. Consider updating it as follows:

-    ld2410s:
-    uart_id: uart_bus
+    ld2410s:
+      uart_id: uart_bus

This small improvement will enhance readability and reduce potential configuration misunderstandings.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 523a372 and 4de9377.

📒 Files selected for processing (1)
  • components/sensor/ld2410s.rst (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**`: - Do not generate or add any sequence diagrams

**: - Do not generate or add any sequence diagrams

  • components/sensor/ld2410s.rst
🔇 Additional comments (4)
components/sensor/ld2410s.rst (4)

1-3: Title Formatting is Clear

The title "LD2410s Sensor" and its underline are properly formatted according to reStructuredText conventions.


4-7: SEO and Metadata Section Looks Good

The SEO directive and image reference are clearly specified. This will help with search engine indexing and proper visual representation.


22-44: Module Pinouts Table is Well-Structured

The list-table detailing module pinouts is clear and informative. No changes required here.


62-77: UART Configuration Section is Consistent

The UART configuration code block and its explanation are clear and consistent with expected YAML formatting. No issues found here.

@ventrebleu
Copy link

Is this part of ESPHome yet?
I have an LD2410s ready to roll.
Thanks 😄

@NovakIrs
Copy link
Author

NovakIrs commented May 14, 2025

Is this part of ESPHome yet?

I have an LD2410s ready to roll.

Thanks 😄

Hi,
My pool request still waits for official review but it is possible to test and use it from my repository or from my pool request. I can help you with that.
And if you do, please send me default calibration of your ld2410s before tweaking, all three lines of numbers, threshold, hold and SNR. My calibration was modified before I had means to read it so my "factory default" can be improved.

@ventrebleu
Copy link

Is this part of ESPHome yet?
I have an LD2410s ready to roll.
Thanks 😄

Hi, My pool request still waits for official review but it is possible to test and use it from my repository or from my pool request. I can help you with that. And if you do, please send me default calibration of your ld2410s before tweaking, all three lines of numbers, threshold, hold and SNR. My calibration was modified before I had means to read it so my "factory default" can be improved.

I'm struggling to make it work. Details here if you can help: https://community.home-assistant.io/t/esphome-how-to-use-the-hlk-ld2410s/736597/22
Thanks! 🙏🏼

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

As this is a feature matched with a PR in https://github.com/esphome/esphome, please target your PR to the next branch and rebase.

@esphome esphome bot marked this pull request as draft May 28, 2025 05:25
@esphome
Copy link

esphome bot commented May 28, 2025

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@NovakIrs NovakIrs changed the base branch from current to next June 15, 2025 06:24
@probot-esphome probot-esphome bot added next and removed current labels Jun 15, 2025
@NovakIrs NovakIrs marked this pull request as ready for review June 29, 2025 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Hi-Link LD2410S (HLK-LD2410S) 24GHz Ultra Low Power Radar Sensor
3 participants