feat: proximity-based route tracking and distance sensors #4

Merged
jrittenh merged 5 commits from feature/proximity-and-route-tracking into main 2026-10-26 17:17:23 -04:00
Owner

This PR introduces proximity-based route tracking and distance sensors:

  • Distance & Math Utilities: Added haversine_distance, meters_to_miles, meters_to_feet in const.py with full unit tests.
  • Proximity Stop Completion: The coordinator calculates distance between live bus GPS updates and stop coordinates, automatically marking stops within 150m as completed.
  • Date Rollover: Resets completed stops on daily rollover.
  • SignalR Re-auth & Event Bus: Refreshes expired Cognito tokens on 401 during SignalR negotiation and fires myride_telemetry_updated events.
  • SignalR ETA Persistence: Caches live SignalR ETA updates across subsequent REST poll cycles.
  • Sensors:
    • MyRideDistanceSensor: Exposes real-time distance in miles, feet, and meters with approaching/departing trend.
    • MyRideNextStopSensor: Auto-advances based on proximity stop completion and reports 'Completed' when all stops finish.
  • Device Tracker: Exposes GPS accuracy property and extra state attribute.
  • Tests: Comprehensive unit tests covering all new coordinator, sensor, tracker, and math features.
This PR introduces proximity-based route tracking and distance sensors: - **Distance & Math Utilities**: Added `haversine_distance`, `meters_to_miles`, `meters_to_feet` in `const.py` with full unit tests. - **Proximity Stop Completion**: The coordinator calculates distance between live bus GPS updates and stop coordinates, automatically marking stops within 150m as completed. - **Date Rollover**: Resets completed stops on daily rollover. - **SignalR Re-auth & Event Bus**: Refreshes expired Cognito tokens on 401 during SignalR negotiation and fires `myride_telemetry_updated` events. - **SignalR ETA Persistence**: Caches live SignalR ETA updates across subsequent REST poll cycles. - **Sensors**: - `MyRideDistanceSensor`: Exposes real-time distance in miles, feet, and meters with approaching/departing trend. - `MyRideNextStopSensor`: Auto-advances based on proximity stop completion and reports 'Completed' when all stops finish. - **Device Tracker**: Exposes GPS accuracy property and extra state attribute. - **Tests**: Comprehensive unit tests covering all new coordinator, sensor, tracker, and math features.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jrittenh/ha-myride!4
No description provided.