feat: add AM/PM route distinction and clean up legacy device trackers #7

Merged
jrittenh merged 2 commits from feature/cleanup-and-route-labels into main 2026-10-28 22:16:24 -04:00
Owner

This PR cleans up outdated entities and introduces intelligent AM/PM route labeling:

  • AM / PM Route Distinction: Adds get_run_display_name to inspect runName, runDescription, and planned stop times. If a route doesn't have an explicit label, it determines whether it is an morning (AM) or afternoon (PM) route based on stop schedules.
  • Entity Name Clarification: Prevents Home Assistant from generating duplicate _2 entity IDs (e.g., <student>_bus and <student>_bus_2). Entities are now clearly designated (e.g., device_tracker.<student>_bus_am and device_tracker.<student>_bus_pm).
  • Entity Registry Cleanup: Automatically purges obsolete legacy physical bus trackers (myride_*_tracker) from Home Assistant's entity registry during integration setup.
  • Retired Legacy Physical Bus Tracker: Removes raw physical bus trackers in favor of the dynamic student route trackers.
  • Manifest Version: Bumps version to 0.2.2.
  • Unit Tests: Full test coverage for AM/PM resolution, sensor naming, and entity registry cleanup.
This PR cleans up outdated entities and introduces intelligent AM/PM route labeling: - **AM / PM Route Distinction**: Adds `get_run_display_name` to inspect `runName`, `runDescription`, and planned stop times. If a route doesn't have an explicit label, it determines whether it is an morning (AM) or afternoon (PM) route based on stop schedules. - **Entity Name Clarification**: Prevents Home Assistant from generating duplicate `_2` entity IDs (e.g., `<student>_bus` and `<student>_bus_2`). Entities are now clearly designated (e.g., `device_tracker.<student>_bus_am` and `device_tracker.<student>_bus_pm`). - **Entity Registry Cleanup**: Automatically purges obsolete legacy physical bus trackers (`myride_*_tracker`) from Home Assistant's entity registry during integration setup. - **Retired Legacy Physical Bus Tracker**: Removes raw physical bus trackers in favor of the dynamic student route trackers. - **Manifest Version**: Bumps version to `0.2.2`. - **Unit Tests**: Full test coverage for AM/PM resolution, sensor naming, and entity registry cleanup.
chore: bump manifest version to 0.2.2
All checks were successful
Continuous Integration / test (pull_request) Successful in 3m57s
5cba31b1c8
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!7
No description provided.