Skip to content

No-bus days, school-year pause, any account vehicle per profile (v0.6.0) - #5

Merged
aniceberg merged 1 commit into
mainfrom
no-bus-days
Nov 1, 2026
Merged

aniceberg merged 1 commit into
mainfrom
no-bus-days

Conversation

@aniceberg

Copy link
Copy Markdown
Owner

Summary

Set-and-forget handling for days without a bus and for the new school year. Neither Traccar nor Bouncie knows about routes, so BusMonitor goes by whether the vehicle moves.

  • No-bus days (holidays, snow days): until the bus moves (faster than 2 m/s, or more than 200 m from where it was parked), polling drops to once a minute. If it still hasn't moved by the normal arrival time plus the late tolerance, polling stops for the day and the status shows not_running.
  • No false alarms: "running late" and "no GPS fix" are only announced once the bus has moved that day.
  • School-year pause: each profile gets a "School year ends" date, defaulting to the coming June 30. Existing profiles get it through an entry migration (2.1 → 2.2). After that date the profile pauses (season_over), and a Repairs notice asks the parent to confirm the schedule and set the next end date.
  • Relearn the route: a new option on Edit a bus profile forgets that profile's recorded trips. Trips past the 60-day retention are now also dropped when loaded, so last June's trips don't place September's checkpoints.
  • New bus next year: the Bus list now offers every vehicle on the Traccar login or Bouncie account, not only the ones picked at setup.
  • Docs: docs/bouncie.md records the measured Bouncie cadence from two real trips. While driving, every 15 s poll returned a new position that was about 7 s old, so webhooks aren't needed.

Test plan

  • pytest (121 passed): new tests/test_no_service.py, plus a test for switching to a bus that wasn't picked at setup
  • ruff check
  • hassfest (Docker)
  • After updating through HACS: the profiles show a school-year end of 2027-06-30, and on a no-school day the status turns not_running after the give-up time

🤖 Generated with Claude Code

- Until the bus moves that day (faster than 2 m/s, or 200 m from where it was
  parked), poll once a minute. If it hasn't moved by the arrival time plus the
  late tolerance, stop for the day (status not_running).
- "Running late" and "no GPS fix" only after the bus has moved that day, so
  holidays and snow days stay silent.
- Each profile has a "School year ends" date (the coming June 30; existing
  profiles get one via a 2.1 -> 2.2 migration). After it the profile pauses
  (status season_over) and a Repairs notice asks the parent to confirm the new
  schedule. Saving a future date reactivates it.
- "Forget recorded trips and relearn the route" option on Edit a bus profile;
  trips past the 60-day retention are now also dropped when loaded.
- The Bus list offers every vehicle the Traccar login or Bouncie account can
  see, so a new bus next year is just an edit.
- Status stays idle until the bus moves; docs record the measured Bouncie
  cadence (a new position every ~15 s, ~7 s old), so no webhooks are needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-01T01:45:05.114695Z 87d5e99 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 87d5e9943d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

self.reset(now.date())
# keep the latest fix so a stale fix isn't re-processed as new
self.last_fix, self.last_pos, self.prev = fix, pos, prev
self.day_origin = pos # where the bus was parked overnight

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Establish today's parked origin before inferring movement

When a normal school day is followed by a holiday, the retained position is typically the previous arrival at the child's stop: the coordinator stops fetching positions after arrival. Carrying that position into day_origin means a fresh stationary fix at the depot more than 200 m away sets moved_today=True, even though the bus has not moved during today's window. This reproducibly re-enables running-late alerts and fast polling and prevents the holiday give-up logic from taking effect. Establish an appropriate current-day baseline rather than treating the last observed arrival as the overnight parking location.

Useful? React with 👍 / 👎.

@aniceberg
aniceberg merged commit a2d89e2 into main Nov 1, 2026
6 checks passed
@aniceberg
aniceberg deleted the no-bus-days branch November 1, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant