[ultrasonic] Fix timeout issues and deprecate timeout option - #12897
Conversation
Use a fixed 80ms measurement timeout instead of the user-configurable timeout which didn't work reliably due to processing delays on the SR04. The timeout option is deprecated and will be removed in 2026.8.0. π€ Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file: external_components:
- source: github://pr#12897
components: [ultrasonic]
refresh: 1h(Added by the PR bot) |
|
π Hi there! I've automatically requested reviews from codeowners based on the files changed in this PR. @OttoWinter - You've been requested to review this PR as codeowner(s) of 3 file(s) that were modified. Thanks for your time! π |
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #12897 +/- ##
=======================================
Coverage 73.44% 73.44%
=======================================
Files 53 53
Lines 11303 11303
Branches 1534 1534
=======================================
Hits 8302 8302
Misses 2602 2602
Partials 399 399 β View full report in Codecov by Sentry. π New features to boost your workflow:
|
Memory Impact AnalysisComponents:
π Component Memory Breakdown
π Symbol-Level Changes (click to expand)Changed Symbols
This analysis runs automatically when components change. Memory usage is measured from a representative test configuration. |
|
Thanks |
What does this implement/fix?
At least some boards have a delay of 12.3ms before sending the pulse. Now that this component is using interrupts and not busy waiting it doesn't make sense to have a configurable timeout (not saving any time). Use a fixed 80ms measurement timeout instead of the user-configurable timeout which didn't work reliably due to processing delays on the SR04.
The
timeoutoption is deprecated and will be removed in 2026.8.0.Types of changes
Related issue or feature (if applicable):
Pull request in esphome-docs with documentation (if applicable):
Test Environment
Example entry for
config.yaml:Checklist:
tests/folder).If user exposed functionality or configuration variables are added/changed:
π€ Generated with Claude Code