Skip to content

Add planning a trip - #261

Open
ibain wants to merge 1 commit into
bretterer:mainfrom
ibain:feat/plan-trip
Open

ibain wants to merge 1 commit into
bretterer:mainfrom
ibain:feat/plan-trip

Conversation

@ibain

@ibain ibain commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Why

The app's trip planner knows how long a trip takes with charging stops, and nothing in the client reaches it. I'd like to use it for a "when do I need to leave" action in the Home Assistant integration, as mentioned in bretterer/home-assistant-rivian#374.

What

  • plan_trip(vehicle_id, origin, stops, min_arrival_soc=20, starting_soc=None) asks the planner (the app's planTripWithMultiStopV2 query) and returns its plans: a summary with drive, charging and total time, distance and arrival charge, the driveLegs, and the waypoints with the charging stops it added
  • Same origin, stops and minimum arrival charge as send_trip_to_vehicle, so a plan matches the trip that would send
  • Read-only: nothing goes to the vehicle, and it doesn't need a paired phone key

Testing

  • uv run pytest: 374 passed; ruff, mypy and pre-commit clean
  • Against the API, with a 2022 R1T on the account, Santa Barbara to San Francisco:
    • One plan each time. A point in the ocean gave no plans and status NO_ROUTE_FOUND
    • Without a starting charge the planner assumes 100%
    • The arrival charge is honored: 20 and 50 arrived at exactly that, with more charging. Left to itself the planner aims for 2%, which is why the default here is 20 like send_trip_to_vehicle
    • departureTime changed nothing (3 AM and 5 PM Monday gave identical times), so it's left out. Drive times don't account for traffic
    • requestWaypointsIndex was always null, so it's left out. The route polylines are left out for size

Notes

The app's query takes more (route and network preferences, drive mode, trailer profile, adapter). I left those out until something needs them.

`plan_trip` asks Rivian's trip planner (the app's
`planTripWithMultiStopV2` query) for a trip from an origin through one
or more stops: drive, charging and total time, distance, the charge on
arrival, and the charging stops it adds. Nothing is sent to the vehicle
and it doesn't need a paired phone key.

It takes the same origin, stops and minimum arrival charge as
`send_trip_to_vehicle`, so a plan matches the trip that would send.

Tested against the API:
- one plan came back each time, or none with status NO_ROUTE_FOUND
- without a starting charge the planner assumes 100%
- the arrival charge is honored (20 and 50 arrived at exactly that);
  left to itself the planner aims for 2%
- `departureTime` changed nothing (3 AM and 5 PM gave the same times),
  so it is left out, and drive times don't account for traffic
- `requestWaypointsIndex` was always null, so it is left out
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