Repository navigation
Conversation
`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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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'splanTripWithMultiStopV2query) and returns its plans: asummarywith drive, charging and total time, distance and arrival charge, thedriveLegs, and thewaypointswith the charging stops it addedsend_trip_to_vehicle, so a plan matches the trip that would sendTesting
uv run pytest: 374 passed; ruff, mypy and pre-commit cleanNO_ROUTE_FOUNDsend_trip_to_vehicledepartureTimechanged nothing (3 AM and 5 PM Monday gave identical times), so it's left out. Drive times don't account for trafficrequestWaypointsIndexwas always null, so it's left out. The route polylines are left out for sizeNotes
The app's query takes more (route and network preferences, drive mode, trailer profile, adapter). I left those out until something needs them.