diff --git a/src/rivian/rivian.py b/src/rivian/rivian.py index 0d0ebc6..8bb5a45 100644 --- a/src/rivian/rivian.py +++ b/src/rivian/rivian.py @@ -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 | { @@ -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) diff --git a/tests/test_rivian.py b/tests/test_rivian.py index 634571c..bb3f3ef 100644 --- a/tests/test_rivian.py +++ b/tests/test_rivian.py @@ -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()