Refactor Places integration internals#413
Merged
Snuffy2 merged 30 commits intoMay 20, 2026
Merged
Conversation
Move the missing tracker ID check ahead of hass.states.get() so malformed entries skip cleanly without querying Home Assistant states. Add regression coverage for both None and empty tracker IDs through the updater gate.
Reject non-2xx OSM responses before parsing so error payloads are not cached, and add regression coverage for 429/500/503 responses. Ensure the update pipeline rolls back partial state and always finalizes bookkeeping when a phase raises. Clean up synchronous URL-builder tests, intentionally unused test callback parameters, and tracker-dependent tests that now require an explicit configured tracker ID.
Follow the existing is_float validation contract when storing tracker latitude, longitude, and GPS accuracy so Decimal-like values are not dropped after passing validation. Add regression coverage through the updater coordinate path.
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Summary
Refactors the Places integration internals into focused helper modules while preserving the existing entity behavior. The change separates attribute storage, tracker snapshots, location math, OSM requests, config schemas, and update orchestration so the main sensor/updater code is easier to reason about and test.
What Changed
PlacesAttributesas the mutable attribute store and delegated sensor attribute helpers through it.OSMClientfor URL construction, throttled/cached JSON fetches, non-2xx response handling, service-error detection, and stale-cache cleanup.PlacesUpdatePipelineto keep update phase ordering explicit, including rollback/finalization behavior when a phase fails.docs/superpowers/.Reviewer Notes
unknown/unavailablestates still proceed when valid coordinates are present; this preserves the current characterized behavior.Validation
./.venv/bin/python -m pytest(411 passed)./.venv/bin/python -m prek run -a