Support unit-aware target coordinate evaluation - #38
kernelpanic85 wants to merge 1 commit into
Conversation
… presence - Uses each entity's `unit_of_measurement` when available. - Falls back to the card-configured `input_units`. - Persists and restores `input_units` with coordinate sensor state. - Preserves millimetre behavior for legacy unitless entities.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (5)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe integration adds supported input-unit configuration, persistence, state restoration, service validation, and unit-aware coordinate conversion for zone evaluation. ChangesUnit-aware coordinate handling
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Sequence Diagram(s)sequenceDiagram
participant UpdateService
participant LocationStore
participant BinarySensor
participant CoordinateStates
UpdateService->>LocationStore: store supported input_units
BinarySensor->>LocationStore: resolve zone definition
LocationStore-->>BinarySensor: return input_units
BinarySensor->>CoordinateStates: read coordinate states
CoordinateStates-->>BinarySensor: return values and unit metadata
BinarySensor->>BinarySensor: convert coordinates to millimetres
Merge Risk: ⚪ Minimal · up to Configured and entity-provided coordinate units are validated and converted consistently before zone evaluation. No merge-blocking risk was identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 4 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. A rabbit reads each line, Comment |
Support unit-aware target coordinate evaluation
Description
Convert tracked X/Y coordinates to millimetres before evaluating zone presence.
The integration now:
unit_of_measurementwhen available.input_units.input_unitswith coordinate sensor state.Related Issue
I ran into this issue where the target entities reporting in inches were not triggering the binary presence sensors as they were stored in mm.
Related PR: ApolloAutomation/zone-mapper-card#23
Type of Change
Checklist
scripts/lint)Testing
Screenshots (if applicable)
Not applicable.
Summary by CodeRabbit