Repository navigation
v1.4.2-beta1: Authorization Fix + GraphQL Migration
Pre-release
Pre-release
v1.4.2-beta1 - GraphQL Migration & Authorization Fix
This is a beta release for testing. Please report any issues.
Major Changes
GraphQL Client Migration
- Migrated from manual REST-style GraphQL to
gqllibrary v3.5.3 with DSL support - Added static GraphQL schema definition to avoid introspection overhead
- 6 methods converted to type-safe DSL approach (authentication, phone enrollment, vehicle commands)
- 15+ methods still use legacy
__graphql_query()for backward compatibility withClientResponsereturns
Authorization Fix (CRITICAL)
- Removed Authorization: Bearer tokens entirely to match official Android app behavior
- Android app (
com.rivian.android.consumer) uses only session tokens (U-Sess), never Bearer tokens - This prevents UNAUTHENTICATED errors after 2 hours when access tokens expire
- Session tokens remain valid indefinitely, providing stable authentication
Removed Non-Working Functionality
- Removed
refresh_access_token()method (refreshUserSession mutation doesn't exist in Rivian's API) - Simplified token refresh to only handle CSRF tokens
- Removed retry logic from GraphQL execution (not needed without Bearer tokens)
Breaking Changes
- Removed
refresh_access_token()method - no longer needed and never worked - Changed internal
_execute_with_retry()to_execute_async()- internal API only - Removed 4 related tests for non-existent refresh functionality
Fixes
- Fixed websockets dependency conflict with Home Assistant integrations
- Removed
websocketsextra from gql dependency - Added explicit
websockets>=13.0,<16.0dependency - Now compatible with HA 2025.10.4 and other integrations
- Removed
- Simplified error handling in
_handle_gql_error()- removed unnecessary retry logic
Testing
- All 27 tests passing (removed 4 tests for non-existent refresh functionality)
- Tested with Home Assistant integration
- Compatible with HA 2025.10.4 dependency constraints
Installation
# For Home Assistant (Container/Docker)
docker exec homeassistant pip install --upgrade git+https://github.com/jrgutier/rivian-python-client.git@v1.4.2-beta1
# For HA OS (via SSH)
ha addons ssh --host homeassistant
apk add git
pip install --upgrade git+https://github.com/jrgutier/rivian-python-client.git@v1.4.2-beta1
# For standard Python projects
pip install git+https://github.com/jrgutier/rivian-python-client.git@v1.4.2-beta1Files Changed (11 files, 3018 insertions, 757 deletions)
Core Implementation:
src/rivian/rivian.py- GraphQL client migration, removed Bearer tokens, removed refresh_access_token()src/rivian/schema.py- Static GraphQL schema for DSL (removed refreshUserSession)src/rivian/const.py- Added CLIMATE_HOLD_ON/OFF commands
Tests:
tests/rivian_test.py- Updated for gql client, removed 4 non-working teststests/responses.py- Updated mock responses, removed REFRESH_TOKEN_RESPONSE
Dependencies:
pyproject.toml- Added gql with aiohttp extra, fixed websockets dependencypoetry.lock- Updated to websockets 15.0.1
Documentation:
CLAUDE.md- Comprehensive development guideREADME.md- Updated examples and installationCHANGELOG.md- Full changelog
What to Test
- Authentication flow - Login with username/password, OTP validation
- Vehicle commands - Climate hold, door locks, charging
- GraphQL queries - Vehicle state, user info, charging sessions
- Token persistence - Long-running sessions (no more 2-hour logouts)
- Home Assistant integration - Install and verify no dependency conflicts
Known Limitations
- Access token refresh is not supported (Rivian's API doesn't provide this)
- However, the client no longer sends Bearer tokens, so access token expiration doesn't cause failures
- Session tokens (U-Sess) remain valid indefinitely
🤖 Generated with Claude Code