home-assistant-rivian: Unknown Exception (DATA_ERROR) causing truck location to flip between Unavailable and actual location
I think something might have changed with the API (again…), as right about the same time they were pushing updates for the January delivery estimates, I started seeing the truck’s location drop to “unavailable” and flip back-and-forth between that and it’s actual location.
Note that everything else appears to be updating normally.

It changes pretty frequently, too. This isn’t causing me any grief as of yet (and I’m finally using a different login), but I figured I’d file an issue in case it’s happening to someone else as well. The history chart shows that well (the truck was only away from home twice on this chart, the rest is unavailable):

The error looks like this (I’m going to try to scrub the private information, so it might be a bit messed up):
This error originated from a custom integration.
Logger: custom_components.rivian
Source: custom_components/rivian/__init__.py:222
Integration: Rivian (Unofficial) (documentation)
First occurred: 10:28:36 AM (2796 occurrences)
Last logged: 3:07:07 PM
Unexpected error fetching rivian data: Error communicating with API
Traceback (most recent call last):
File "/config/custom_components/rivian/__init__.py", line 185, in _update_api_data
vehicle_info = await self._api.get_vehicle_state(
File "/usr/local/lib/python3.10/site-packages/rivian/rivian.py", line 485, in get_vehicle_state
return await self.__graphql_query(headers, url, graphql_json)
File "/usr/local/lib/python3.10/site-packages/rivian/rivian.py", line 600, in __graphql_query
raise exception
File "/usr/local/lib/python3.10/site-packages/rivian/rivian.py", line 562, in __graphql_query
raise RivianDataError(
rivian.exceptions.RivianDataError: (200, {'errors': [{'extensions': {'code': 'DATA_ERROR'}, 'message': 'See server logs for error details'}], 'data': {'vehicleState': None}}, {'User-Agent': 'RivianApp/707 CFNetwork/1237 Darwin/20.4.0', 'Accept': 'application/json', 'Content-Type': 'application/json', 'A-Sess': '[[snipped]]', 'U-Sess': '[[snipped]]'}, {'operationName': 'GetVehicleState', 'query': 'query GetVehicleState($vehicleID: String!) {\n vehicleState(id: $vehicleID) {\n batteryHvThermalEvent {\n timeStamp\n value\n }\nbatteryHvThermalEventPropagation {\n timeStamp\n value\n }\nbatteryLevel {\n timeStamp\n value\n }\nbatteryLimit {\n timeStamp\n value\n }\nbrakeFluidLow {\n timeStamp\n value\n }\ncabinClimateDriverTemperature {\n timeStamp\n value\n }\ncabinClimateInteriorTemperature {\n timeStamp\n value\n }\ncabinPreconditioningType {\n timeStamp\n value\n }\ndistanceToEmpty {\n timeStamp\n value\n }\ndriveMode {\n timeStamp\n value\n }\ngearStatus {\n timeStamp\n value\n }\ngearGuardVideoMode {\n timeStamp\n value\n }\ngearGuardVideoStatus {\n timeStamp\n value\n }\ngearGuardVideoTermsAccepted {\n timeStamp\n value\n }\notaAvailableVersion {\n timeStamp\n value\n }\notaAvailableVersionNumber {\n timeStamp\n value\n }\notaAvailableVersionWeek {\n timeStamp\n value\n }\notaAvailableVersionYear {\n timeStamp\n value\n }\notaCurrentStatus {\n timeStamp\n value\n }\notaCurrentVersion {\n timeStamp\n value\n }\notaCurrentVersionNumber {\n timeStamp\n value\n }\notaCurrentVersionWeek {\n timeStamp\n value\n }\notaCurrentVersionYear {\n timeStamp\n value\n }\notaDownloadProgress {\n timeStamp\n value\n }\notaInstallDuration {\n timeStamp\n value\n }\notaInstallProgress {\n timeStamp\n value\n }\notaInstallReady {\n timeStamp\n value\n }\notaInstallTime {\n timeStamp\n value\n }\notaInstallType {\n timeStamp\n value\n }\notaStatus {\n timeStamp\n value\n }\npetModeTemperatureStatus {\n timeStamp\n value\n }\npowerState {\n timeStamp\n value\n }\nrangeThreshold {\n timeStamp\n value\n }\nremoteChargingAvailable {\n timeStamp\n value\n }\ntimeToEndOfCharge {\n timeStamp\n value\n }\ntirePressureStatusFrontLeft {\n timeStamp\n value\n }\ntirePressureStatusFrontRight {\n timeStamp\n value\n }\ntirePressureStatusRearLeft {\n timeStamp\n value\n }\ntirePressureStatusRearRight {\n timeStamp\n value\n }\nvehicleMileage {\n timeStamp\n value\n }\nwindowFrontLeftCalibrated {\n timeStamp\n value\n }\nwindowFrontRightCalibrated {\n timeStamp\n value\n }\nwindowRearLeftCalibrated {\n timeStamp\n value\n }\nwindowRearRightCalibrated {\n timeStamp\n value\n }\nalarmSoundStatus {\n timeStamp\n value\n }\ncabinPreconditioningStatus {\n timeStamp\n value\n }\nchargerState {\n timeStamp\n value\n }\nchargerStatus {\n timeStamp\n value\n }\nclosureFrunkClosed {\n timeStamp\n value\n }\nclosureFrunkLocked {\n timeStamp\n value\n }\nclosureLiftgateClosed {\n timeStamp\n value\n }\nclosureLiftgateLocked {\n timeStamp\n value\n }\nclosureSideBinLeftClosed {\n timeStamp\n value\n }\nclosureSideBinLeftLocked {\n timeStamp\n value\n }\nclosureSideBinRightClosed {\n timeStamp\n value\n }\nclosureSideBinRightLocked {\n timeStamp\n value\n }\nclosureTailgateClosed {\n timeStamp\n value\n }\nclosureTailgateLocked {\n timeStamp\n value\n }\nclosureTonneauClosed {\n timeStamp\n value\n }\nclosureTonneauLocked {\n timeStamp\n value\n }\ndefrostDefogStatus {\n timeStamp\n value\n }\ndoorFrontLeftClosed {\n timeStamp\n value\n }\ndoorFrontLeftLocked {\n timeStamp\n value\n }\ndoorFrontRightClosed {\n timeStamp\n value\n }\ndoorFrontRightLocked {\n timeStamp\n value\n }\ndoorRearLeftClosed {\n timeStamp\n value\n }\ndoorRearLeftLocked {\n timeStamp\n value\n }\ndoorRearRightClosed {\n timeStamp\n value\n }\ndoorRearRightLocked {\n timeStamp\n value\n }\ngearGuardLocked {\n timeStamp\n value\n }\npetModeStatus {\n timeStamp\n value\n }\nseatFrontLeftHeat {\n timeStamp\n value\n }\nseatFrontLeftVent {\n timeStamp\n value\n }\nseatFrontRightHeat {\n timeStamp\n value\n }\nseatFrontRightVent {\n timeStamp\n value\n }\nseatRearLeftHeat {\n timeStamp\n value\n }\nseatRearRightHeat {\n timeStamp\n value\n }\nseatThirdRowLeftHeat {\n timeStamp\n value\n }\nseatThirdRowRightHeat {\n timeStamp\n value\n }\nsteeringWheelHeat {\n timeStamp\n value\n }\ntirePressureStatusValidFrontLeft {\n timeStamp\n value\n }\ntirePressureStatusValidFrontRight {\n timeStamp\n value\n }\ntirePressureStatusValidRearLeft {\n timeStamp\n value\n }\ntirePressureStatusValidRearRight {\n timeStamp\n value\n }\nwindowFrontLeftClosed {\n timeStamp\n value\n }\nwindowFrontRightClosed {\n timeStamp\n value\n }\nwindowRearLeftClosed {\n timeStamp\n value\n }\nwindowRearRightClosed {\n timeStamp\n value\n }\nwiperFluidState {\n timeStamp\n value\n }\ngnssLocation {\n latitude\n longitude\n timeStamp\n }\n}}', 'variables': {'vehicleID': '[[snipped]]'}})
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/config/custom_components/rivian/__init__.py", line 213, in _async_update_data
return await self._update_api_data()
File "/config/custom_components/rivian/__init__.py", line 208, in _update_api_data
raise Exception("Error communicating with API") from err
Exception: Error communicating with API
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 239, in _async_refresh
self.data = await self._async_update_data()
File "/config/custom_components/rivian/__init__.py", line 222, in _async_update_data
raise Exception("Error communicating with API") from err
Exception: Error communicating with API
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 19 (9 by maintainers)
I was having the same issue. I updated
manifest.jsonin mycustom_components/rivianfolder to requirerivian-python-client>=0.1.9, which forced the underlying client to update. I submitted a PR #56.I put in a pull request this morning. The device_tracker was actually receiving the correct previous state, but it appeared that HA was marking the device unavailable. I just had it check the timestamp for differences before updating and it appears to hold state now. I agree on the UPDATE_INTERVAL, either that or I actually like how the teslamate used to do it, which would poll based on vehicle power state (ie. standby=15, sleep=30, go=1)
Correct. UPDATE_INTERVAL inside const.py set to 60, and no more errors.
I have been looking at the logs, and on mine at least, its approximately every minute it connects to the API with a valid response, then immediately has 8-9 requests with invalid data (5 sec interval related), then connects again. I modified the rivian-py-client locally just to return rather than throw the error, and that at least stops the location sensor from going unavailable, but it seems more like an issue with the API. I initially thought possibly from the software update that I don’t yet have on my truck since this issue started around the day they started rolling it out, last week for me?
I understand that… I just thought it was interesting that I’ve been seeing the Truck’s GPS location go to unknown over and over… I was assuming it was doing that when it failed to talk to the API server, but now I think it may be unknown at Rivian’s side as well…??