Skip to content

Edit a bus profile: rename, move the stop, change the schedule (v0.5.2) - #3

Merged
aniceberg merged 1 commit into
mainfrom
edit-profile
Oct 29, 2026
Merged

aniceberg merged 1 commit into
mainfrom
edit-profile

Conversation

@aniceberg

Copy link
Copy Markdown
Owner

What

Adds Configure → Edit a bus profile. You pick a profile, and a form opens filled in with its current settings:

  • name: renames the route, e.g. "Daniel's bus"
  • bus: the tracked vehicle
  • stop: location and arrival radius, set on the map or with Use the bus's current position
  • arrival time and grace minutes
  • watch window, days, and the no-fix (offline) alert

The profile id stays the same, so the following keep working:

  • checkpoints and recorded trips
  • entity IDs, whose display names update after the rename
  • scripts and automations that use profile: <id>, like the "Where is the bus" script.

Add and Edit now share one form (_profile_schema) and one builder (_profile_fields), so they can't drift apart. Edit merges onto the stored profile, so it keeps checkpoints and any other stored keys.

Why

Before this, a profile couldn't be changed after it was created. Renaming a route or moving the stop meant deleting the profile, which also lost its checkpoints and trip history, and changed its id.

Reviewer notes

  • A new name that matches another profile's name or id is rejected with name_exists.
  • Changing the bus keeps the old recorded trips, which belong to the previous vehicle. That seemed better than silently deleting history.
  • The map panel still shows the stop but can't drag it. Dragging could be a follow-up.

Tests

ruff, pytest (100 tests) and hassfest (run locally in Docker) all pass. New tests:

  • a rename keeps the id, checkpoints and entity id, and updates the friendly name and schedule
  • moving the stop with a new radius, arrival time and grace
  • a name that clashes with another profile is rejected.

🤖 Generated with Claude Code

….5.2)

Configure -> "Edit a bus profile" changes the name, bus, stop (map pick
with radius, or the bus's current position), expected arrival and grace,
watch window, days and offline alert. The profile id stays the same, so
checkpoints, recorded trips, entity IDs and scripts using profile: <id>
keep working. Add and Edit share one form.

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

chatgpt-codex-connector Bot commented Oct 29, 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-10-29T14:51:25.183565Z b81da97 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.

@aniceberg
aniceberg merged commit b289e94 into main Oct 29, 2026
6 checks passed

@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: b81da9784b

ℹ️ 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".

Comment on lines +400 to +403
fields = self._profile_fields(user_input, loc)
fields["stop"] = {**(current.get("stop") or {}), **fields["stop"]}
profiles[pid] = {**current, **fields}
return self._save(profiles)

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 Reset live trip state when changing the bus or stop

If today's tracker has already marked the bus as arrived, changing its vehicle or moving its stop saves the new configuration but retains the old arrival state. The options update reloads the entry, and BusMonitorCoordinator.async_load() restores that snapshot by the unchanged profile ID without checking the vehicle or stop. Consequently, TripTracker.wants_position() remains false and update() suppresses further arrival/checkpoint alerts for the rest of the day, even though the newly selected bus has not reached the newly configured stop. Invalidate the affected live trip state on these changes while retaining completed trip history and preserving state for rename-only edits.

Useful? React with 👍 / 👎.

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