Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/rivian/rivian.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,10 +647,11 @@ async def depart_now(
async def send_location_to_vehicle(
self, vehicle_id: str, location: str
) -> ClientResponse:
"""Send a destination to a vehicle's navigation.
"""Send a destination to a vehicle's navigation, waking it if needed.

`location` is an address, a place, or coordinates as "lat,lng", and Rivian
parses it. A `publishResponse.result` of 0 means the request was accepted.
`location` is an address, a place, coordinates as "lat,lng", or a map link,
and Rivian parses it. A `publishResponse.result` of 0 means the request was
accepted.
"""
url = GRAPHQL_GATEWAY
headers = BASE_HEADERS | {
Expand All @@ -660,8 +661,12 @@ async def send_location_to_vehicle(
}
graphql_json = {
"operationName": "parseAndShareLocationToVehicle",
"query": "mutation parseAndShareLocationToVehicle($str: String!, $vehicleId: String!) { parseAndShareLocationToVehicle(str: $str, vehicleId: $vehicleId) { __typename publishResponse { __typename result } } }",
"variables": {"str": location, "vehicleId": vehicle_id},
"query": "mutation parseAndShareLocationToVehicle($str: String!, $vehicleId: String!, $requiresWakeup: Boolean) { parseAndShareLocationToVehicle(str: $str, vehicleId: $vehicleId, requiresWakeup: $requiresWakeup) { __typename publishResponse { __typename result } } }",
"variables": {
"str": location,
"vehicleId": vehicle_id,
"requiresWakeup": True,
},
}
return await self.__graphql_query(headers, url, graphql_json)

Expand Down
1 change: 1 addition & 0 deletions tests/test_rivian.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ async def test_send_location_to_vehicle(aresponses: ResponsesMockServer) -> None
assert requests[0]["variables"] == {
"str": "123 Main St, Springfield, IL",
"vehicleId": "vehicle_id",
"requiresWakeup": True,
}
await rivian.close()

Expand Down