Repository navigation
Conversation
…t one The three radar distance filters returned NAN while no target was seen but never updated last_reported_value. With Reduce DB Reporting on, a target that came back within 4 cm of the last published distance was dropped by the 5 cm delta check, so Radar Still/Moving/Detection Distance stayed unknown and Radar Zone 1-3 and Radar Zone Occupancy read Clear while Radar Still Target was on, until the distance moved 5 cm. Use the NAN state transition pattern: unknown is published once per loss, and the first distance after the target comes back always publishes. The 5 cm delta still applies while a target is tracked. The throttle_with_priority: 1000ms in front of each lambda also had no timeout partner. ESPHome passes on only changed distances, so a final reading that arrived inside the throttle window was lost for good and the distance (and the zones) kept an older value, even with Reduce DB Reporting off. Put timeout: 1s with value: last in front of the throttle, the same pair ESPHome uses for these sensors by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The zone sensors compared the distances sent to Home Assistant. ESPHome runs those filters only when the radar's distance changes, so when a target came back at the distance it had while lost, Radar Still/Moving Distance stayed unknown and Radar Zone 1-3 and Radar Zone Occupancy read Clear while Radar Still Target was on, even with Reduce DB Reporting off. The 1 s throttle and, with Reduce DB Reporting on, the 5 cm delta also left the zones on an older distance, so someone who settled a few cm past a zone edge stayed in the old zone, or in none. Compare the radar's own distances (get_raw_state) instead. While the radar holds a target after a short loss it reports 0 cm, which is not a real position, so a 0 cm distance never counts toward Zone 1. Zones 2 and 3 only count distances above the previous zone's end. This also keeps the timeout added in the previous commit from turning Zone 1 on during that hold. Someone seated right at a zone edge now moves between zones as often as the radar's distance changes, not at most once a second. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. CodeRabbit Verify
|
Draft
2 of 10 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Version: 26.10.12.1 (no change; versioning handled at release time)
What does this implement/fix?
Do not merge until bench-tested on spare units. This is meant for the next normal firmware release after that bench test, not a hotfix.
Radar Still Distance, Radar Moving Distance, Radar Detection Distance and the zone sensors (Radar Zone 1/2/3 Occupancy and Radar Zone Occupancy) could stay unknown, stale or Clear while Radar Still Target was on. Radar Target, Radar Moving Target and Radar Still Target are not touched: they come straight from the radar, and this PR does not change them. The same fix for the MSR-1 is in ApolloAutomation/MSR-1#122.
What went wrong
What changed
9d68d71Publish radar distances again when a target returns, and keep the last one. The three distance filters use a NAN transition pattern: unknown is published once per loss, and the first distance the filter sees after the target returns always publishes. The 5 cm Reduce DB Reporting delta still applies while a target is tracked, so the publish rate while tracking is unchanged. Each throttle now hastimeout: 1swithvalue: lastin front of it, the same pair ESPHome uses for these sensors when no filters are set: after 1 s with no new distance it sends the last one again, once. Fixes 1, 3 and 4, and case 2 for losses under about 1 s.087e69eCheck the radar zones against the radar's own distances. Zone 1-3 compare the radar's own distances (get_raw_state()) instead of the values sent to Home Assistant, so they follow the radar even when the filters did not run or the throttle held a value back. While the radar holds a target after a short loss it reports 0 cm, which is not a real position, so a 0 cm distance never counts toward Zone 1. Zones 2 and 3 only count distances above the previous zone's end. Fixes 2 for the zones, and also the case where someone settles a few cm past a zone edge and stays in the old zone, or in none.The two commits must ship together. With the first commit alone, the timeout sends the radar's 0 cm hold distance through, and Zone 1 turns on for the whole hold (9 s of a 10 s hold in the model). The 0 cm guard in the second commit stops that.
Not changed:
Behavior changes to watch:
How it was validated
esphome config(ESPHome 2026.10.0b3, the version the investigation used) on every device YAML:MSR-2.yaml,MSR-2_BLE.yaml,MSR-2_Factory.yaml,beta-channel/MSR-2.yamlandbeta-channel/MSR-2_BLE.yamlare valid. The only warning is one the current beta already has (esp32_improvon Factory).esphome compile Integrations/ESPHome/MSR-2.yaml(ESP32-C3, ESP-IDF, same ESPHome version): compiled with 0 compiler warnings.apollo-msr-2.binis 0x196f30 bytes with 9% of the app partition free (RAM 47.9%, flash 90.8%).betaagainst a model of ESPHome 2026.10's ld2410 publishing (flags first, then each changed distance), the 1 s settle on the target flags, the sensor filter chain (timeout, throttle_with_priority, lambda) and the template zone sensors. Zone 1 = 0-50 cm, Zone 2 = 50-150 cm, Zone 3 = 150-250 cm, one radar frame every 100 ms:betatodayCI on this PR builds the three CI YAMLs with ESPHome stable, beta and dev.
Bench-test plan (spare units only)
Flash a spare MSR-2 with this branch and put an unpatched unit beside it as a control. Run each step with Reduce DB Reporting off, then again with it on, and note Radar Timeout first.
Types of changes
Checklist / Checklijst:
If user-visible functionality or configuration variables are added/modified:
🤖 Generated with Claude Code