diff --git a/assets/dash-crowd-three.png b/assets/dash-crowd-three.png new file mode 100644 index 0000000..a1fade6 Binary files /dev/null and b/assets/dash-crowd-three.png differ diff --git a/assets/dash-crowd-two.png b/assets/dash-crowd-two.png new file mode 100644 index 0000000..f4b9081 Binary files /dev/null and b/assets/dash-crowd-two.png differ diff --git a/assets/dash-crowd.png b/assets/dash-crowd.png new file mode 100644 index 0000000..f4b9081 Binary files /dev/null and b/assets/dash-crowd.png differ diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..2d77955 --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ +docker build -t rivian-logscale . +docker image tag rivian-logscale sween/rivian-logscale:latest +docker push sween/rivian-logscale:latest \ No newline at end of file diff --git a/src/rivian_api.py b/src/rivian_api.py index 88a8530..0b2c2b7 100644 --- a/src/rivian_api.py +++ b/src/rivian_api.py @@ -48,7 +48,6 @@ def login(self, username, password): "Dc-Cid": f"m-ios-{uuid.uuid4()}", } ) - #print(headers) query = { "operationName": "Login", @@ -128,8 +127,6 @@ def create_csrf_token(self): def raw_graphql_query(self, url, query, headers): response = requests.post(url, json=query, headers=headers) - # print(response.status_code) - # print(response.content) if response.status_code != 200: log.warning(f"Graphql error: Response status: {response.status_code} Reason: {response.reason}") return response @@ -269,9 +266,6 @@ def get_user_information(self): def get_vehicle_state(self, vehicle_id, minimal=False): headers = self.gateway_headers() - - query = "query GetVehicleState($vehicleID: String!) { vehicleState(id: $vehicleID) { __typename gnssLocation { __typename latitude longitude timeStamp } alarmSoundStatus { __typename timeStamp value } timeToEndOfCharge { __typename timeStamp value } doorFrontLeftLocked { __typename timeStamp value } doorFrontLeftClosed { __typename timeStamp value } doorFrontRightLocked { __typename timeStamp value } doorFrontRightClosed { __typename timeStamp value } doorRearLeftLocked { __typename timeStamp value } doorRearLeftClosed { __typename timeStamp value } doorRearRightLocked { __typename timeStamp value } doorRearRightClosed { __typename timeStamp value } windowFrontLeftClosed { __typename timeStamp value } windowFrontRightClosed { __typename timeStamp value } windowFrontLeftCalibrated { __typename timeStamp value } windowFrontRightCalibrated { __typename timeStamp value } windowRearLeftCalibrated { __typename timeStamp value } windowRearRightCalibrated { __typename timeStamp value } closureFrunkLocked { __typename timeStamp value } closureFrunkClosed { __typename timeStamp value } gearGuardLocked { __typename timeStamp value } closureLiftgateLocked { __typename timeStamp value } closureLiftgateClosed { __typename timeStamp value } windowRearLeftClosed { __typename timeStamp value } windowRearRightClosed { __typename timeStamp value } closureSideBinLeftLocked { __typename timeStamp value } closureSideBinLeftClosed { __typename timeStamp value } closureSideBinRightLocked { __typename timeStamp value } closureSideBinRightClosed { __typename timeStamp value } closureTailgateLocked { __typename timeStamp value } closureTailgateClosed { __typename timeStamp value } closureTonneauLocked { __typename timeStamp value } closureTonneauClosed { __typename timeStamp value } wiperFluidState { __typename timeStamp value } powerState { __typename timeStamp value } batteryHvThermalEventPropagation { __typename timeStamp value } vehicleMileage { __typename timeStamp value } brakeFluidLow { __typename timeStamp value } gearStatus { __typename timeStamp value } tirePressureStatusFrontLeft { __typename timeStamp value } tirePressureStatusValidFrontLeft { __typename timeStamp value } tirePressureStatusFrontRight { __typename timeStamp value } tirePressureStatusValidFrontRight { __typename timeStamp value } tirePressureStatusRearLeft { __typename timeStamp value } tirePressureStatusValidRearLeft { __typename timeStamp value } tirePressureStatusRearRight { __typename timeStamp value } tirePressureStatusValidRearRight { __typename timeStamp value } batteryLevel { __typename timeStamp value } chargerState { __typename timeStamp value } batteryLimit { __typename timeStamp value } remoteChargingAvailable { __typename timeStamp value } batteryHvThermalEvent { __typename timeStamp value } rangeThreshold { __typename timeStamp value } distanceToEmpty { __typename timeStamp value } otaAvailableVersionNumber { __typename timeStamp value } otaAvailableVersionWeek { __typename timeStamp value } otaAvailableVersionYear { __typename timeStamp value } otaCurrentVersionNumber { __typename timeStamp value } otaCurrentVersionWeek { __typename timeStamp value } otaCurrentVersionYear { __typename timeStamp value } otaDownloadProgress { __typename timeStamp value } otaInstallDuration { __typename timeStamp value } otaInstallProgress { __typename timeStamp value } otaInstallReady { __typename timeStamp value } otaInstallTime { __typename timeStamp value } otaInstallType { __typename timeStamp value } otaStatus { __typename timeStamp value } otaCurrentStatus { __typename timeStamp value } cabinClimateInteriorTemperature { __typename timeStamp value } cabinPreconditioningStatus { __typename timeStamp value } cabinPreconditioningType { __typename timeStamp value } petModeStatus { __typename timeStamp value } petModeTemperatureStatus { __typename timeStamp value } cabinClimateDriverTemperature { __typename timeStamp value } gearGuardVideoStatus { __typename timeStamp value } gearGuardVideoMode { __typename timeStamp value } gearGuardVideoTermsAccepted { __typename timeStamp value } defrostDefogStatus { __typename timeStamp value } steeringWheelHeat { __typename timeStamp value } seatFrontLeftHeat { __typename timeStamp value } seatFrontRightHeat { __typename timeStamp value } seatRearLeftHeat { __typename timeStamp value } seatRearRightHeat { __typename timeStamp value } chargerStatus { __typename timeStamp value } seatFrontLeftVent { __typename timeStamp value } seatFrontRightVent { __typename timeStamp value } chargerDerateStatus { __typename timeStamp value } driveMode { __typename timeStamp value } } }" - if minimal: query = "query GetVehicleState($vehicleID: String!) { vehicleState(id: $vehicleID) { " \ "cloudConnection { lastSync } " \ @@ -295,6 +289,8 @@ def get_vehicle_state(self, vehicle_id, minimal=False): "gnssLocation { __typename latitude longitude timeStamp } " \ "gnssSpeed { __typename timeStamp value } " \ "gnssBearing { __typename timeStamp value } " \ + "gnssAltitude { __typename timeStamp value } " \ + "gnssError { __typename timeStamp positionVertical positionHorizontal speed bearing } " \ "alarmSoundStatus { __typename timeStamp value } " \ "timeToEndOfCharge { __typename timeStamp value } " \ "doorFrontLeftLocked { __typename timeStamp value } " \ @@ -313,11 +309,14 @@ def get_vehicle_state(self, vehicle_id, minimal=False): "windowFrontRightCalibrated { __typename timeStamp value } " \ "windowRearLeftCalibrated { __typename timeStamp value } " \ "windowRearRightCalibrated { __typename timeStamp value } " \ + "windowsNextAction { __typename timeStamp value } " \ "closureFrunkLocked { __typename timeStamp value } " \ "closureFrunkClosed { __typename timeStamp value } " \ + "closureFrunkNextAction { __typename timeStamp value } " \ "gearGuardLocked { __typename timeStamp value } " \ "closureLiftgateLocked { __typename timeStamp value } " \ "closureLiftgateClosed { __typename timeStamp value } " \ + "closureLiftgateNextAction { __typename timeStamp value } " \ "windowRearLeftClosed { __typename timeStamp value } " \ "windowRearRightClosed { __typename timeStamp value } " \ "closureSideBinLeftLocked { __typename timeStamp value } " \ @@ -385,8 +384,21 @@ def get_vehicle_state(self, vehicle_id, minimal=False): "seatFrontRightVent { __typename timeStamp value } " \ "chargerDerateStatus { __typename timeStamp value } " \ "driveMode { __typename timeStamp value } " \ + "limitedAccelCold { __typename timeStamp value } " \ + "limitedRegenCold { __typename timeStamp value } " \ + "twelveVoltBatteryHealth { __typename timeStamp value } " \ + "serviceMode { __typename timeStamp value } " \ + "trailerStatus { __typename timeStamp value } " \ + "btmFfHardwareFailureStatus { __typename timeStamp value } " \ + "btmIcHardwareFailureStatus { __typename timeStamp value } " \ + "btmLfdHardwareFailureStatus { __typename timeStamp value } " \ + "btmRfHardwareFailureStatus { __typename timeStamp value } " \ + "btmRfdHardwareFailureStatus { __typename timeStamp value } " \ + "carWashMode { __typename timeStamp value } " \ + "chargePortState { __typename timeStamp value } " \ + "chargingTimeEstimationValidity { __typename timeStamp value } " \ + "rearHitchStatus { __typename timeStamp value } " \ "} }" - query = "query GetVehicleState($vehicleID: String!) { vehicleState(id: $vehicleID) { __typename gnssLocation { __typename latitude longitude timeStamp } alarmSoundStatus { __typename timeStamp value } timeToEndOfCharge { __typename timeStamp value } doorFrontLeftLocked { __typename timeStamp value } doorFrontLeftClosed { __typename timeStamp value } doorFrontRightLocked { __typename timeStamp value } doorFrontRightClosed { __typename timeStamp value } doorRearLeftLocked { __typename timeStamp value } doorRearLeftClosed { __typename timeStamp value } doorRearRightLocked { __typename timeStamp value } doorRearRightClosed { __typename timeStamp value } windowFrontLeftClosed { __typename timeStamp value } windowFrontRightClosed { __typename timeStamp value } windowFrontLeftCalibrated { __typename timeStamp value } windowFrontRightCalibrated { __typename timeStamp value } windowRearLeftCalibrated { __typename timeStamp value } windowRearRightCalibrated { __typename timeStamp value } closureFrunkLocked { __typename timeStamp value } closureFrunkClosed { __typename timeStamp value } gearGuardLocked { __typename timeStamp value } closureLiftgateLocked { __typename timeStamp value } closureLiftgateClosed { __typename timeStamp value } windowRearLeftClosed { __typename timeStamp value } windowRearRightClosed { __typename timeStamp value } closureSideBinLeftLocked { __typename timeStamp value } closureSideBinLeftClosed { __typename timeStamp value } closureSideBinRightLocked { __typename timeStamp value } closureSideBinRightClosed { __typename timeStamp value } closureTailgateLocked { __typename timeStamp value } closureTailgateClosed { __typename timeStamp value } closureTonneauLocked { __typename timeStamp value } closureTonneauClosed { __typename timeStamp value } wiperFluidState { __typename timeStamp value } powerState { __typename timeStamp value } batteryHvThermalEventPropagation { __typename timeStamp value } vehicleMileage { __typename timeStamp value } brakeFluidLow { __typename timeStamp value } gearStatus { __typename timeStamp value } tirePressureStatusFrontLeft { __typename timeStamp value } tirePressureStatusValidFrontLeft { __typename timeStamp value } tirePressureStatusFrontRight { __typename timeStamp value } tirePressureStatusValidFrontRight { __typename timeStamp value } tirePressureStatusRearLeft { __typename timeStamp value } tirePressureStatusValidRearLeft { __typename timeStamp value } tirePressureStatusRearRight { __typename timeStamp value } tirePressureStatusValidRearRight { __typename timeStamp value } batteryLevel { __typename timeStamp value } chargerState { __typename timeStamp value } batteryLimit { __typename timeStamp value } remoteChargingAvailable { __typename timeStamp value } batteryHvThermalEvent { __typename timeStamp value } rangeThreshold { __typename timeStamp value } distanceToEmpty { __typename timeStamp value } otaAvailableVersionNumber { __typename timeStamp value } otaAvailableVersionWeek { __typename timeStamp value } otaAvailableVersionYear { __typename timeStamp value } otaCurrentVersionNumber { __typename timeStamp value } otaCurrentVersionWeek { __typename timeStamp value } otaCurrentVersionYear { __typename timeStamp value } otaDownloadProgress { __typename timeStamp value } otaInstallDuration { __typename timeStamp value } otaInstallProgress { __typename timeStamp value } otaInstallReady { __typename timeStamp value } otaInstallTime { __typename timeStamp value } otaInstallType { __typename timeStamp value } otaStatus { __typename timeStamp value } otaCurrentStatus { __typename timeStamp value } cabinClimateInteriorTemperature { __typename timeStamp value } cabinPreconditioningStatus { __typename timeStamp value } cabinPreconditioningType { __typename timeStamp value } petModeStatus { __typename timeStamp value } petModeTemperatureStatus { __typename timeStamp value } cabinClimateDriverTemperature { __typename timeStamp value } gearGuardVideoStatus { __typename timeStamp value } gearGuardVideoMode { __typename timeStamp value } gearGuardVideoTermsAccepted { __typename timeStamp value } defrostDefogStatus { __typename timeStamp value } steeringWheelHeat { __typename timeStamp value } seatFrontLeftHeat { __typename timeStamp value } seatFrontRightHeat { __typename timeStamp value } seatRearLeftHeat { __typename timeStamp value } seatRearRightHeat { __typename timeStamp value } chargerStatus { __typename timeStamp value } seatFrontLeftVent { __typename timeStamp value } seatFrontRightVent { __typename timeStamp value } chargerDerateStatus { __typename timeStamp value } driveMode { __typename timeStamp value } } }" query = { "operationName": "GetVehicleState", @@ -395,7 +407,6 @@ def get_vehicle_state(self, vehicle_id, minimal=False): 'vehicleID': vehicle_id, }, } - response = self.raw_graphql_query(url=RIVIAN_GATEWAY_PATH, query=query, headers=headers) return response.json() @@ -408,9 +419,7 @@ def get_vehicle_last_connection(self, vehicle_id): 'vehicleID': vehicle_id, }, } - response = self.raw_graphql_query(url=RIVIAN_GATEWAY_PATH, query=query, headers=headers) - print(response) return response.json() def plan_trip(self, vehicle_id, starting_soc, starting_range_meters, origin_lat, origin_long, dest_lat, dest_long): @@ -641,4 +650,4 @@ def send_vehicle_command(self, vehicle_id, command, vasPhoneId, deviceId, vehicl }, } response = self.raw_graphql_query(url=RIVIAN_GATEWAY_PATH, query=query, headers=headers) - return response.json() + return response.json() \ No newline at end of file