-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Enhance analog_threshold.md with alternative example #5491
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
Added alternative usage example for binary sensor configuration.
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.
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.
|
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
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.
Pull Request Overview
This PR adds an alternative configuration example to the analog_threshold binary sensor documentation, demonstrating how to achieve similar functionality using a template binary sensor with condition expressions.
Key Changes:
- Added example showing template binary sensor with
sensor.in_rangecondition as an alternative to the analog_threshold component
| id: engine_running | ||
| condition: | ||
| sensor.in_range: |
Copilot
AI
Oct 16, 2025
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.
The alternative example is incomplete and may confuse users. It's missing the required sensor_id parameter for the sensor.in_range condition to specify which sensor to monitor. Consider adding this parameter and optionally the name field to make the example more complete and parallel to the original example above.
| id: engine_running | |
| condition: | |
| sensor.in_range: | |
| id: engine_running | |
| name: "Engine Running" | |
| condition: | |
| sensor.in_range: | |
| sensor_id: motor_current_sensor |
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.
Fixed: f8676ba
| threshold: 0.5 | ||
| ``` | ||
| As an alternative to using this component you may use {{< docref "components/binary_sensor/template" >}} with [condition expressions](#config-condition): |
Copilot
AI
Oct 16, 2025
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.
The anchor link #config-condition appears to be invalid as there is no corresponding section with that ID in this document. Either remove the anchor or link to the correct documentation page where condition expressions are explained.
| As an alternative to using this component you may use {{< docref "components/binary_sensor/template" >}} with [condition expressions](#config-condition): | |
| As an alternative to using this component you may use {{< docref "components/binary_sensor/template" >}} with [condition expressions](https://esphome.io/components/binary_sensor/template.html#condition): |
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.
I've tested it and it still works. This way of referencing this document is used in many places.
|
@esphome it is not true. It is not related to new feature. |
✅ Deploy Preview for esphome ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Updated the configuration for the binary sensor to include a name and corrected the condition sensor ID.
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.
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.
Base branch has been corrected - dismissing previous review.
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds an alternative documentation example for the analog_threshold binary_sensor showing a template-based binary_sensor using Changes
Sequence Diagram(s)(omitted — documentation-only change, no control-flow modifications) Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 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 as they are similar to previous 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/binary_sensor/analog_threshold.md(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
- Do not generate or add any sequence diagrams
Files:
content/components/binary_sensor/analog_threshold.md
Added alternative usage example for binary sensor configuration.
Honestly, I was surprised that Binary Template supports the
conditionparameter, as it's a fairly new feature (~1 year ago, PR: PR-7561 ). So I'm adding it here because I think it could be an interesting replacement in many cases, as the condition feature is a bit more advanced, but still allows for all configuration to be in YAML.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: