rivian-python-client 1.3.1__tar.gz → 1.4.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: rivian-python-client
3
- Version: 1.3.1
3
+ Version: 1.4.1
4
4
  Summary: Rivian API Client (Unofficial)
5
5
  License: MIT
6
6
  Author: Brian Retterer
@@ -16,8 +16,8 @@ Classifier: Programming Language :: Python :: 3.13
16
16
  Provides-Extra: ble
17
17
  Requires-Dist: aiohttp (>=3.0.0)
18
18
  Requires-Dist: backports-strenum (>=1.2.4,<2.0.0) ; python_version < "3.11"
19
- Requires-Dist: bleak (>=0.21,<1.0.0) ; extra == "ble"
20
- Requires-Dist: cryptography (>=41.0.1,<45.0)
19
+ Requires-Dist: bleak (>=0.21,<2.0.0) ; extra == "ble"
20
+ Requires-Dist: cryptography (>=41.0.1,<46.0)
21
21
  Requires-Dist: dbus-fast (>=2.11.0,<3.0.0) ; (sys_platform == "linux") and (extra == "ble")
22
22
  Description-Content-Type: text/markdown
23
23
 
@@ -35,10 +35,11 @@ curl -sSL https://install.python-poetry.org | python3 -
35
35
 
36
36
  ## Setup
37
37
 
38
- Install project dependencies into the poetry virtual environment.
38
+ Install project dependencies into the poetry virtual environment and run pre-commit
39
39
 
40
40
  ```
41
41
  poetry install
42
+ pre-commit install
42
43
  ```
43
44
 
44
45
  ## Run Tests
@@ -12,10 +12,11 @@ curl -sSL https://install.python-poetry.org | python3 -
12
12
 
13
13
  ## Setup
14
14
 
15
- Install project dependencies into the poetry virtual environment.
15
+ Install project dependencies into the poetry virtual environment and run pre-commit
16
16
 
17
17
  ```
18
18
  poetry install
19
+ pre-commit install
19
20
  ```
20
21
 
21
22
  ## Run Tests
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "rivian-python-client"
3
- version = "1.3.1"
3
+ version = "1.4.1"
4
4
  description = "Rivian API Client (Unofficial)"
5
5
  readme = "README.md"
6
6
  authors = ["Brian Retterer <bretterer@gmail.com>"]
@@ -12,18 +12,19 @@ packages = [
12
12
  [tool.poetry.dependencies]
13
13
  python = ">=3.9,<3.14"
14
14
  aiohttp = ">=3.0.0"
15
- cryptography = ">=41.0.1,<45.0"
15
+ cryptography = ">=41.0.1,<46.0"
16
16
  backports-strenum = { version = "^1.2.4", python = "<3.11" }
17
- bleak = { version = ">=0.21,<1.0.0", optional = true }
17
+ bleak = { version = ">=0.21,<2.0.0", optional = true }
18
18
  dbus-fast = {version = "^2.11.0", optional = true, platform = "linux"}
19
19
 
20
20
  [tool.poetry.group.dev.dependencies]
21
21
  pytest = ">=7.1.2,<9.0.0"
22
- pytest-asyncio = ">=0.18.3,<0.26.0"
23
- python-dotenv = ">=0.20,<1.1"
22
+ pytest-asyncio = ">=0.18.3,<1.1.0"
23
+ python-dotenv = ">=0.20,<1.2"
24
24
  aresponses = ">=2.1.5,<4.0.0"
25
25
  mypy = ">=1.7.0,<2.0.0"
26
- ruff = ">=0.4,<0.9"
26
+ ruff = ">=0.4,<0.13"
27
+ pre-commit = "^4.1.0"
27
28
 
28
29
  [tool.poetry.extras]
29
30
  ble = ["bleak", "dbus-fast"]
@@ -34,15 +34,26 @@ VEHICLE_STATE_PROPERTIES: Final[set[str]] = {
34
34
  # VehicleCloudConnection
35
35
  "cloudConnection",
36
36
  # VehicleLocation
37
+ "geoLocation",
37
38
  "gnssLocation",
38
- # TimeStamped(String|Float|Int)
39
+ "gnssError",
40
+ # TimeStamped(String|[Nullable]Float|Int)
41
+ "activeDriverName",
39
42
  "alarmSoundStatus",
40
43
  "batteryCapacity",
44
+ "batteryCellType",
41
45
  "batteryHvThermalEvent",
42
46
  "batteryHvThermalEventPropagation",
43
47
  "batteryLevel",
44
48
  "batteryLimit",
49
+ "batteryNeedsLfpCalibration",
45
50
  "brakeFluidLow",
51
+ "btmFfHardwareFailureStatus",
52
+ "btmIcHardwareFailureStatus",
53
+ "btmLfdHardwareFailureStatus",
54
+ "btmOcHardwareFailureStatus",
55
+ "btmRfdHardwareFailureStatus",
56
+ "btmRfHardwareFailureStatus",
46
57
  "cabinClimateDriverTemperature",
47
58
  "cabinClimateInteriorTemperature",
48
59
  "cabinPreconditioningStatus",
@@ -51,6 +62,8 @@ VEHICLE_STATE_PROPERTIES: Final[set[str]] = {
51
62
  "chargerDerateStatus",
52
63
  "chargerState",
53
64
  "chargerStatus",
65
+ "chargePortState",
66
+ "chargingDisabledAll",
54
67
  "closureFrunkClosed",
55
68
  "closureFrunkLocked",
56
69
  "closureFrunkNextAction",
@@ -88,6 +101,8 @@ VEHICLE_STATE_PROPERTIES: Final[set[str]] = {
88
101
  "gnssAltitude",
89
102
  "gnssBearing",
90
103
  "gnssSpeed",
104
+ "limitedRegenCold",
105
+ "limitedAccelCold",
91
106
  "otaAvailableVersion",
92
107
  "otaAvailableVersionGitHash",
93
108
  "otaAvailableVersionNumber",
@@ -110,6 +125,7 @@ VEHICLE_STATE_PROPERTIES: Final[set[str]] = {
110
125
  "petModeTemperatureStatus",
111
126
  "powerState",
112
127
  "rangeThreshold",
128
+ "rearHitchStatus",
113
129
  "remoteChargingAvailable",
114
130
  "seatFrontLeftHeat",
115
131
  "seatFrontLeftVent",
@@ -145,16 +161,38 @@ VEHICLE_STATE_PROPERTIES: Final[set[str]] = {
145
161
  "wiperFluidState",
146
162
  }
147
163
 
164
+ VEHICLE_STATES_SUBSCRIPTION_ONLY_PROPERTIES: Final[set[str]] = {
165
+ # TimeStamped(String|[Nullable]Float|Int)
166
+ "activeDriverName",
167
+ "chargingDisabledACFaultState",
168
+ "chargingTimeEstimationValidity",
169
+ "chargingTripTargetSoc",
170
+ "chargingTripTargetMinsRemaining",
171
+ "closureChargePortDoorNextAction",
172
+ "coldRangeNotification",
173
+ "tirePressureFrontLeft",
174
+ "tirePressureFrontRight",
175
+ "tirePressureRearLeft",
176
+ "tirePressureRearRight",
177
+ }
178
+
179
+ VEHICLE_STATES_SUBSCRIPTION_PROPERTIES = (
180
+ VEHICLE_STATE_PROPERTIES | VEHICLE_STATES_SUBSCRIPTION_ONLY_PROPERTIES
181
+ )
182
+
148
183
 
149
184
  class VehicleCommand(StrEnum):
150
185
  """Supported vehicle commands."""
151
186
 
152
187
  WAKE_VEHICLE = "WAKE_VEHICLE"
153
- HONK_AND_FLASH_LIGHTS = "HONK_AND_FLASH_LIGHTS"
154
188
  UNLOCK_USER_PREFERENCES_AND_DISABLE_ALARM = (
155
189
  "UNLOCK_USER_PREFERENCES_AND_DISABLE_ALARM"
156
190
  )
157
191
 
192
+ HONK_AND_FLASH_LIGHTS = "HONK_AND_FLASH_LIGHTS"
193
+ ACTIVATE_EXTERNAL_SOUND = "ACTIVATE_EXTERNAL_SOUND"
194
+ FLASH_EXTERNAL_LIGHTS = "FLASH_EXTERNAL_LIGHTS"
195
+
158
196
  # Charging
159
197
  CHARGING_LIMITS = "CHARGING_LIMITS"
160
198
  START_CHARGING = "START_CHARGING"
@@ -172,6 +210,9 @@ class VehicleCommand(StrEnum):
172
210
  CABIN_PRECONDITIONING_SET_TEMP = "CABIN_PRECONDITIONING_SET_TEMP"
173
211
  VEHICLE_CABIN_PRECONDITION_DISABLE = "VEHICLE_CABIN_PRECONDITION_DISABLE"
174
212
  VEHICLE_CABIN_PRECONDITION_ENABLE = "VEHICLE_CABIN_PRECONDITION_ENABLE"
213
+ # Gen2 HVAC Controls
214
+ CABIN_HVAC_THIRD_ROW_LEFT_SEAT_HEAT = "CABIN_HVAC_THIRD_ROW_LEFT_SEAT_HEAT"
215
+ CABIN_HVAC_THIRD_ROW_RIGHT_SEAT_HEAT = "CABIN_HVAC_THIRD_ROW_RIGHT_SEAT_HEAT"
175
216
 
176
217
  # Closures
177
218
  LOCK_ALL_CLOSURES_FEEDBACK = "LOCK_ALL_CLOSURES_FEEDBACK"
@@ -195,6 +236,10 @@ class VehicleCommand(StrEnum):
195
236
  # Liftgate/tailgate
196
237
  OPEN_LIFTGATE_UNLATCH_TAILGATE = "OPEN_LIFTGATE_UNLATCH_TAILGATE"
197
238
 
239
+ # Chargeport door
240
+ OPEN_CHARGE_PORT_DOOR = "OPEN_CHARGE_PORT_DOOR"
241
+ CLOSE_CHARGE_PORT_DOOR = "CLOSE_CHARGE_PORT_DOOR"
242
+
198
243
  # OTA
199
244
  OTA_INSTALL_NOW_ACKNOWLEDGE = "OTA_INSTALL_NOW_ACKNOWLEDGE"
200
245
 
@@ -15,7 +15,13 @@ from warnings import warn
15
15
  import aiohttp
16
16
  from aiohttp import ClientResponse, ClientWebSocketResponse
17
17
 
18
- from .const import LIVE_SESSION_PROPERTIES, VEHICLE_STATE_PROPERTIES, VehicleCommand
18
+ from .const import (
19
+ LIVE_SESSION_PROPERTIES,
20
+ VEHICLE_STATE_PROPERTIES,
21
+ VEHICLE_STATES_SUBSCRIPTION_ONLY_PROPERTIES,
22
+ VEHICLE_STATES_SUBSCRIPTION_PROPERTIES,
23
+ VehicleCommand,
24
+ )
19
25
  from .exceptions import (
20
26
  RivianApiException,
21
27
  RivianApiRateLimitError,
@@ -51,12 +57,16 @@ BASE_HEADERS = {
51
57
  "Apollographql-Client-Name": APOLLO_CLIENT_NAME,
52
58
  }
53
59
 
54
- CLOUD_CONNECTION_TEMPLATE = "{ lastSync }"
55
- LOCATION_TEMPLATE = "{ latitude longitude timeStamp }"
60
+ CLOUD_CONNECTION_TEMPLATE = "{ lastSync isOnline }"
61
+ LOCATION_TEMPLATE = "{ latitude longitude timeStamp isAuthorized }"
62
+ LOCATION_ERROR_TEMPLATE = (
63
+ "{ timeStamp positionVertical positionHorizontal speed bearing }"
64
+ )
56
65
  VALUE_TEMPLATE = "{ timeStamp value }"
57
66
  TEMPLATE_MAP = {
58
67
  "cloudConnection": CLOUD_CONNECTION_TEMPLATE,
59
68
  "gnssLocation": LOCATION_TEMPLATE,
69
+ "gnssError": LOCATION_ERROR_TEMPLATE,
60
70
  }
61
71
 
62
72
  LIVE_SESSION_VALUE_RECORD_KEYS = {
@@ -405,6 +415,15 @@ class Rivian:
405
415
  """Get vehicle state."""
406
416
  if not properties:
407
417
  properties = VEHICLE_STATE_PROPERTIES
418
+ elif (
419
+ subscription_properties
420
+ := VEHICLE_STATES_SUBSCRIPTION_ONLY_PROPERTIES.intersection(properties)
421
+ ):
422
+ _LOGGER.warning(
423
+ "Subscription only properties have been identified and removed: %s",
424
+ ", ".join(subscription_properties),
425
+ )
426
+ properties.difference_update(subscription_properties)
408
427
 
409
428
  url = GRAPHQL_GATEWAY
410
429
 
@@ -582,7 +601,7 @@ class Rivian:
582
601
  ) -> Callable | None:
583
602
  """Open a web socket connection to receive updates."""
584
603
  if not properties:
585
- properties = VEHICLE_STATE_PROPERTIES
604
+ properties = VEHICLE_STATES_SUBSCRIPTION_PROPERTIES
586
605
 
587
606
  try:
588
607
  await self._ws_connect()
@@ -714,5 +733,7 @@ class Rivian:
714
733
 
715
734
  def _build_vehicle_state_fragment(self, properties: set[str]) -> str:
716
735
  """Build GraphQL vehicle state fragment from properties."""
717
- frag = " ".join(f"{p} {TEMPLATE_MAP.get(p,VALUE_TEMPLATE)}" for p in properties)
736
+ frag = " ".join(
737
+ f"{p} {TEMPLATE_MAP.get(p, VALUE_TEMPLATE)}" for p in properties
738
+ )
718
739
  return f"{{ {frag} }}"
@@ -1,3 +1,5 @@
1
+ directive @subscriptionOnly on FIELD_DEFINITION
2
+
1
3
  type Query {
2
4
  currentUser: User
3
5
  delivery(orderId: ID!): Delivery
@@ -44,6 +46,7 @@ type Mutation {
44
46
  ): MobileLoginResponse
45
47
  logout: LogoutResponse
46
48
  resendOTPCode(otpToken: String!): ResendOTPCodeResponse
49
+ sendTripToVehicle(attrs: SendTripToVehicleInput!): OK
47
50
  sendVehicleCommand(attrs: VehicleCommandAttributes!): SendVehicleCommandState
48
51
  setChargingSchedules(
49
52
  vehicleId: String!
@@ -206,6 +209,8 @@ type ChargingLiveData {
206
209
  price: Float
207
210
  currency: String
208
211
  isFreeSession: Boolean
212
+ vehicleChargerState: String!
213
+ startTime: Float!
209
214
  }
210
215
 
211
216
  type ChargingSchedule {
@@ -534,6 +539,7 @@ type VehicleLocation implements TimeStamped {
534
539
  latitude: Float!
535
540
  longitude: Float!
536
541
  isAuthorized: Boolean
542
+ consentStatus: String
537
543
  }
538
544
 
539
545
  type VehicleLocationError implements TimeStamped {
@@ -575,19 +581,24 @@ type VehicleMobileImageOverlay {
575
581
  }
576
582
 
577
583
  type VehicleState {
584
+ activeDriverName: TimeStampedString @subscriptionOnly
585
+
578
586
  alarmSoundStatus: TimeStampedString
579
587
 
580
588
  batteryCapacity: TimeStampedFloat
589
+ batteryCellType: TimeStampedString
581
590
  batteryHvThermalEvent: TimeStampedString
582
591
  batteryHvThermalEventPropagation: TimeStampedString
583
592
  batteryLevel: TimeStampedFloat
584
593
  batteryLimit: TimeStampedInt
594
+ batteryNeedsLfpCalibration: TimeStampedInt
585
595
 
586
596
  brakeFluidLow: TimeStampedString
587
597
 
588
598
  btmFfHardwareFailureStatus: TimeStampedString
589
599
  btmIcHardwareFailureStatus: TimeStampedString
590
600
  btmLfdHardwareFailureStatus: TimeStampedString
601
+ btmOcHardwareFailureStatus: TimeStampedString
591
602
  btmRfdHardwareFailureStatus: TimeStampedString
592
603
  btmRfHardwareFailureStatus: TimeStampedString
593
604
 
@@ -603,9 +614,14 @@ type VehicleState {
603
614
  chargerState: TimeStampedString
604
615
  chargerStatus: TimeStampedString
605
616
  chargingDisabledAC: TimeStampedInt
617
+ chargingDisabledACFaultState: TimeStampedInt @subscriptionOnly
606
618
  chargingDisabledAll: TimeStampedInt
607
619
  chargingTimeEstimationValidity: TimeStampedString
608
620
 
621
+ chargingTripTargetSoc: TimeStampedInt
622
+ chargingTripTargetMinsRemaining: TimeStampedInt
623
+
624
+ closureChargePortDoorNextAction: TimeStampedString @subscriptionOnly
609
625
  closureFrunkClosed: TimeStampedString
610
626
  closureFrunkLocked: TimeStampedString
611
627
  closureFrunkNextAction: TimeStampedString
@@ -627,6 +643,8 @@ type VehicleState {
627
643
 
628
644
  cloudConnection: VehicleCloudConnection
629
645
 
646
+ coldRangeNotification: TimeStampedString @subscriptionOnly
647
+
630
648
  defrostDefogStatus: TimeStampedString
631
649
 
632
650
  distanceToEmpty: TimeStampedInt
@@ -648,6 +666,8 @@ type VehicleState {
648
666
  gearGuardVideoTermsAccepted: TimeStampedString
649
667
  gearStatus: TimeStampedString
650
668
 
669
+ geoLocation: TimeStampedString
670
+
651
671
  gnssAltitude: TimeStampedNullableFloat
652
672
  gnssBearing: TimeStampedFloat
653
673
  gnssError: VehicleLocationError
@@ -702,10 +722,10 @@ type VehicleState {
702
722
 
703
723
  timeToEndOfCharge: TimeStampedFloat
704
724
 
705
- tirePressureFrontLeft: TimeStampedNullableFloat # only available via subscription
706
- tirePressureFrontRight: TimeStampedNullableFloat # only available via subscription
707
- tirePressureRearLeft: TimeStampedNullableFloat # only available via subscription
708
- tirePressureRearRight: TimeStampedNullableFloat # only available via subscription
725
+ tirePressureFrontLeft: TimeStampedNullableFloat @subscriptionOnly
726
+ tirePressureFrontRight: TimeStampedNullableFloat @subscriptionOnly
727
+ tirePressureRearLeft: TimeStampedNullableFloat @subscriptionOnly
728
+ tirePressureRearRight: TimeStampedNullableFloat @subscriptionOnly
709
729
  tirePressureStatusFrontLeft: TimeStampedString
710
730
  tirePressureStatusFrontRight: TimeStampedString
711
731
  tirePressureStatusRearLeft: TimeStampedString