Skip to content

Add sending and ending trips - #248

Merged
natekspencer merged 2 commits into
bretterer:mainfrom
walthowd:feat/trips
Nov 15, 2026
Merged

natekspencer merged 2 commits into
bretterer:mainfrom
walthowd:feat/trips

Conversation

@walthowd

@walthowd walthowd commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor
  • send_trip_to_vehicle: sends stops like the app's trip planner. The vehicle plans the route and charging stops, with a minimum arrival charge.
  • end_trip: ends the current trip (parallax.encode_end_trip, new UpdatedTrip schema)

Neither needs a paired phone key.

Tested

2026 R1S (Gen 2), 2026.36.01:

  • One-stop trips showed up in navigation, and end_trip ended them
  • The app's "Preferred Networks" made no difference to the vehicle's charging stop, so there's no network parameter
  • A trip sent while another was active was ignored until end_trip

Not tested: multiple stops, Gen 1

- `send_trip_to_vehicle` sends stops the way the Rivian app's trip planner
  does. The vehicle plans the route and charging stops itself, arriving
  with at least the given charge, at chargers of the given networks
  (`CHARGING_NETWORKS`, named like the app's charging filter; all by
  default, as the app sends without a filter).
- `end_trip` ends the trip the vehicle is navigating, with an unsigned
  `sendParallaxPayload` on `c2v_navigation.trip_copilot.updated_trip`.
  `parallax.encode_end_trip` builds it from a new `UpdatedTrip` schema, in
  the same envelope as a signed command.

Neither needs a paired phone key.

Verified against a 2026 R1S (Gen 2) running 2026.36.01: a one-stop trip
appeared in the vehicle's navigation, and `end_trip` ended it. Not tested:
several stops, a network filter, Gen 1 vehicles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxWHBTrHU6eTPotwMWgtJF

@natekspencer natekspencer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, this works well and the validation is thorough. One small thing:

networks=[] is ambiguous. It passes validation and sends an empty networks list, while the docstring only describes None (all networks). Whether the API treats an empty filter as "no chargers" or "all" isn't stated, so callers can't tell what they'll get. Either raise RivianBadRequestError for an empty list, or document what it does (ideally after checking it on the vehicle), with a test for it.

This also needs a rebase once the other ready PRs land (additive conflicts in parallax/__init__.py, rivian.py and tests/test_rivian.py).

The networks are the Rivian app's "Preferred Networks", a soft
preference rather than a filter. On a 2026 R1S (Gen 2, 2026.36.01) they
made no visible difference: a trip to St. Louis planned the same Tesla
stop with Tesla only, Electrify America only and all networks, and an
Electrify America only trip went to a ChargeLab charger. `networks` is
gone, and every network id is sent, as the Rivian app does by default.

A trip sent while the vehicle navigates another one was ignored until
`end_trip`, so the docstring now says to end it first.
@walthowd

Copy link
Copy Markdown
Contributor Author

Good call. Dug into it with the truck and the app. "networks" is the app's Preferred Networks, a soft preference (preference: 1), not a filter. The app's own planner mostly ignores it too: STL→KC with IONNA preferred routes through a Rivian Adventure Network site and never an IONNA one, even though there's one on the way. And the truck plans its own stops anyway: Tesla only, EA only and all networks gave the identical stop, and one EA-only trip went to a ChargeLab charger. So I dropped networks and always send the full list like the app's default; the test checks that list.

Also found a new trip is ignored while one's active, so the docstring now says to end it first. I'll drop the matching option from home-assistant-rivian#347.

@natekspencer

natekspencer commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Also found a new trip is ignored while one's active

Does the service still accept it and return True even if the vehicle will ignore it?

Update: I tested this myself on the truck, and it does. With a trip to one stop active, sending a trip to a second stop returned True, but the vehicle kept navigating to the first stop for the 90 seconds I watched. After end_trip, the same second trip was picked up within about 10 seconds. So callers can't rely on the return value; they need to end any active trip first, as the docstring now says.

@natekspencer natekspencer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for testing that against the truck. Dropping the preference that has no visible effect and always sending the app's default list is the right call, and the note about ending an active trip first is helpful.

@natekspencer
natekspencer merged commit 694fdbd into bretterer:main Nov 15, 2026
6 checks passed
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.

2 participants