Skip to content
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

Create pulse-catcher.rst #4782

Open
wants to merge 8 commits into
base: current
Choose a base branch
from

Conversation

AndersWestman
Copy link

@AndersWestman AndersWestman commented Mar 30, 2025

Please be gentle as this is my first PR. :)

Description:

I had a case there I needed to detect an 100us incoming pulse and I couldn't find any function to solve this. After some testing and discussions on the forum and GitHub, this solution turned out to work well. I think it could be nice to add this to the cookbook section in case it will help some other in a similar situation.

Related issue (if applicable): fixes

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

  • esphome/esphome#

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.

Please be gentle as this is my first PR. :)
I had a case there I needed to detect an 100us incoming pulse. I couldn't find any function to solve this.
After some testing and discussions on the forum and GitHub, this solution turned out to work well.
I think it could be nice to add this to the cookbook section in case it will help some other in a similar situation.
I have a small picture (pulses.png) to add as a "thumbnail" but I don't know where and how I should attach that.
Copy link
Contributor

coderabbitai bot commented Mar 30, 2025

Walkthrough

A new documentation file, "Pulse Catcher", has been added to the cookbook. The document explains how to configure and use the pulse_meter sensor to detect fast GPIO pulses. It includes a YAML configuration example that specifies sensor settings, an internal pulse duration filter to reduce log spamming, and a sequence of actions to perform when a pulse is detected (e.g., turning an LED on, waiting 500ms, then turning it off). Related documentation on automations and the pulse_meter component is also referenced.

Changes

File Change Summary
cookbook/pulse-catcher.rst Added a new documentation file detailing the configuration and usage of the pulse_meter sensor for detecting fast pulses and managing actions.
components/index.rst Added a new entry for "Pulse Catcher" in the "Cookbook" section, referencing its documentation path and an associated image file.

Sequence Diagram(s)

sequenceDiagram
    participant Sensor as Pulse Meter
    participant ActionHandler as Action Handler
    participant LED as LED Module

    Sensor->>ActionHandler: Detect fast pulse
    ActionHandler->>LED: Turn on LED
    ActionHandler->>LED: Wait 500ms delay
    ActionHandler->>LED: Turn off LED
Loading

🪧 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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)
cookbook/pulse-catcher.rst (4)

4-7: SEO Block & Image Reference
The SEO directive is properly defined with a description and an image reference ("pulses.png"). Please ensure that the image asset is correctly placed (or attached) according to the documentation guidelines. If necessary, add a note or link on how to manage image assets.


8-10: Introductory Paragraph Clarity
The introductory text clearly explains the purpose of the pulse catcher. Consider rewording “shorter than the usually around 16ms loop time” to “shorter than the typical 16ms loop time” for improved clarity.


13-28: YAML Configuration Example
The YAML configuration sample is well-structured and demonstrates how to configure the pulse_meter sensor. A few suggestions:

  • The commented-out internal_filter parameter is a good hint, but adding a brief explanation about when to enable it might benefit users.
  • The lambda filter returns an empty dictionary (return {};). It may be helpful to add a comment clarifying that this is used to suppress output (thus preventing log spamming) and that users can customize this behavior as needed.

29-35: "See Also" Section & Extra Line
The "See Also" section is clearly formatted with useful references. There appears to be a stray line (line 35) with the number "35"—please remove it if it is unintentional.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0f59453 and 02b2156.

📒 Files selected for processing (1)
  • cookbook/pulse-catcher.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

  • cookbook/pulse-catcher.rst
🔇 Additional comments (2)
cookbook/pulse-catcher.rst (2)

1-2: Title & Header Formatting Looks Good
The "Pulse Catcher" title and its underline are correctly formatted per reStructuredText standards.


11-12: YAML Code Block Directive
The directive for the YAML code block is correctly specified. No issues here.

Copy link

netlify bot commented Mar 31, 2025

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit caf744f
🔍 Latest deploy log https://app.netlify.com/sites/esphome/deploys/67ea690b6ed5690008af62f9
😎 Deploy Preview https://deploy-preview-4782--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 site configuration.

Copy link

netlify bot commented Mar 31, 2025

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit a051e7a
🔍 Latest deploy log https://app.netlify.com/sites/esphome/deploys/67ebe6103c06ab00087c3fa5
😎 Deploy Preview https://deploy-preview-4782--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 site configuration.

Link to new cookbook section "Pulse Catcher"
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 (1)
components/index.rst (1)

1086-1087: New Cookbook Entry: "Pulse Catcher" Added

The new entry for Pulse Catcher is added with the correct reference (cookbook/pulse-catcher) and thumbnail (pulses.png). Please verify that the image file is present in the repository in the expected location so that it renders correctly in the documentation.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 02b2156 and 75ca1cd.

⛔ Files ignored due to path filters (1)
  • images/pulses.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • components/index.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

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.

1 participant