Skip to content

Add send_location_to_vehicle - #230

Open
jrgutier wants to merge 1 commit into
bretterer:mainfrom
jrgutier:up/send-location
Open

jrgutier wants to merge 1 commit into
bretterer:mainfrom
jrgutier:up/send-location

Conversation

@jrgutier

Copy link
Copy Markdown
Collaborator

Summary

Adds Rivian.send_location_to_vehicle(location, vehicle_id), which sends a destination to a vehicle's navigation with the parseAndShareLocationToVehicle mutation. location is an address, a place, or "lat,lng", and Rivian parses it server side. The integration needs this for a "Send destination" notify entity.

Changes

  • src/rivian/rivian.py: send_location_to_vehicle, placed after the departure schedule methods and built the same way (inline BASE_HEADERS | {Csrf-Token, A-Sess, U-Sess}, a one-line query, __graphql_query). It returns the ClientResponse. A publishResponse.result of 0 means Rivian accepted the request.
  • tests/responses.py: SEND_LOCATION_TO_VEHICLE_RESPONSE.
  • tests/test_rivian.py: test_send_location_to_vehicle checks the request variables (str, vehicleId) and the result.

Testing

PYTHONPATH=src pytest -q -p no:cacheprovider && ruff check . && ruff format --check . && mypy src/rivian

233 passed (232 at 67ba96f, plus 1 new). Ruff and mypy are clean.

Notes

  • The mutation's selection matches the one in our fork (jrgutier/home-assistant-rivian), plus __typename to match this client's other mutations. Our fork's test fixture gives the response types as ParseAndShareLocationToVehicleResponse and PublishResponse. The mutation is not in our captured gateway schema, so the selection was not checked against a schema.
  • Not re-verified on hardware for this PR. What a non-zero result, or an address Rivian can't parse, returns is unknown.

Send a destination (an address, a place, or "lat,lng") to a vehicle's
navigation with the parseAndShareLocationToVehicle mutation, which Rivian
parses server side. Lets the integration offer a send-destination entity.
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