Giter Club home page Giter Club logo

Comments (10)

the-mace avatar the-mace commented on July 18, 2024

Hi there, can you provide the output and what you're expecting to see?

from rivian-python-api.

edman007 avatar edman007 commented on July 18, 2024

Sorry, here is the output when I run --state

$ ./bin/rivian_cli --state
Didn't find vehicle ID None

But when I provide the vehicle ID, it works

$ ./bin/rivian_cli --state --vehicle_id 01-23456789
Vehicle State:
Power State: sleep
Drive Mode: everyday
Gear Status: park
Odometer: 511.1 mi
Location: 40.0000, -70.0000
Speed: 0.0 mi/h
Battery:
   Battery Level: 65.9%
   Range: 206.3 mi
   Battery Limit: 71.0%
   Battery Capacity: 130.654999 kW
   Charging state: charging_complete
   Charger status: chrgr_sts_connected_no_chrg
   Time to end of charge: 0
OTA:
   Current Version: 2023.42.01
   Available version: 0.0.0
   Status: Idle
   Install type: Convenience
   Duration: 0
   Download progress: 0
   Install ready: ota_available
   Install progress: 0
   Install time: 0
   Current Status: Install_Success
Climate:
   Climate Interior Temp: 51.8ºF
   Climate Driver Temp: 68.0ºF
   Cabin Preconditioning Status: undefined
   Cabin Preconditioning Type: NONE
   Defrost: Off
   Steering Wheel Heat: Off
   Pet Mode: Disabled
Security:
   Alarm active: false
   Gear Guard Video: Enabled
   Gear Guard Mode: Away_From_Home
   Last Alarm: 11/21/2023, 14:38PM EST
   Gear Guard Locked: False
Doors:
   Front left locked: True
   Front left closed: True
   Front right locked: True
   Front right closed: True
   Rear left locked: True
   Rear left closed: True
   Rear right locked: True
   Rear right closed: True
Windows:
   Front left closed: True
   Front right closed: True
   Rear left closed: True
   Rear right closed: True
Seats:
   Front left Heat: False
   Front right Heat: False
   Rear left Heat: False
   Rear right Heat: False
Storage:
   Frunk:
      Frunk locked: True
      Frunk closed: True
   Lift Gate:
      Lift Gate Locked: True
      Lift Gate Closed: signal_not_available
   Tonneau:
      Tonneau Locked: signal_not_available
      Tonneau Closed: signal_not_available
Maintenance:
   Wiper Fluid: normal
   Tire pressures:
      Front Left: OK
      Front Right: OK
      Rear Left: OK
      Rear Right: OK

Doing some debug stuff, I see that the vehicle id is provided only via user info:

$ ./bin/rivian_cli --user

{'data': {'user': {'email': {'email': 'edman007}, 'phone': None, 'firstName': 'API', 'lastName': 'Man', 'addresses': [], 'newsletterSubscription': False, 'smsSubscription': True, 'registrationChannels2FA': {'TEXT': False}, 'userId': '02-23456789-blah, 'vehicles': [{'id': '01-23456789', 'highestPriorityRole': 'DRIVER', '__typename': 'RivianIdVehicle'}], 'invites': [], 'orderSnapshots': []}}}

User details:
userId: 02-23456789-blah
email: edman007
firstName: API
lastName: Man
newsletterSubscription: False
smsSubscription: True
registrationChannels2FA TEXT: False

Also, the pretty print for the phone doesn't work, I had to comment out this line 'phone': response_json['data']['user']['phone']['formatted'], in get_user() of rivian_cli.py

The code says it can't find the vehicle id because it does a query for vehicle orders and doesn't find anything because I never had an order, but I do have a vehicle assigned on the user profile. It should probably use the user info command to query their vehicles, not the orders which they might not have.

I expect it to work without specifying a vehicle id as there is only one vehicle on the account.

from rivian-python-api.

the-mace avatar the-mace commented on July 18, 2024

If you don't provide a vehicleId it tries to figure it out (basically taking first one) from the vehicle_orders. It seems something in there isn't right, can you show what that looks like by running ./bin/rivian_cli --vehicles ?

Should look something like this:

vehicleId: 01-2764xxxx
vin: 7FCTGAAA8PN0xxxxx
modelYear: 2023
make: RIVIAN
model: R1T
Battery: Large battery pack
Paint: Limestone exterior color
Interior: Black Mountain + Dark Ash Wood interior
Drive system: Quad-Motor AWD
Accessories: Tow Hooks
Package: Adventure Package
Region: United States of America
Wheels and tires: 20" All-Terrain wheel and tire

The --vehicles option gets info from --vehicle_orders which may also provide some hints as to whats going wrong.

For me at least the user ID doesn't look anything like the vehicle ID:
userId: 02-652ecef0-e2a5-4d93-97e8-2dfez1344c27-9829703b

What was the error you got for the phone? It works for me. I added some protection around it.

from rivian-python-api.

edman007 avatar edman007 commented on July 18, 2024

Sorry, the user ID and vehicle ID, lat, lon i censored (and didn't feel like typing that much stuff), so those might not be in the exact format I actually see.

Anyways, when I run that --vehicles I get:

$ ./bin/rivian_cli --vehicles
Didn't find vehicle ID None

Also, I didn't login on that account via the app yet, doesn't seem like the API requires it...

And the error for the phone was:

Traceback (most recent call last):
  File "/home/edman007/docs/projects/rivian-api-tool/rivian-python-api/src/rivian_python_api/rivian_cli.py", line 1232, in <module>
    main()
  File "/home/edman007/docs/projects/rivian-api-tool/rivian-python-api/src/rivian_python_api/rivian_cli.py", line 885, in main
    user = get_user(args.verbose)
  File "/home/edman007/docs/projects/rivian-api-tool/rivian-python-api/src/rivian_python_api/rivian_cli.py", line 398, in get_user
    'phone': response_json['data']['user']['phone']['formatted'],
TypeError: 'NoneType' object is not subscriptable

With that update I still get:

Traceback (most recent call last):
  File "/home/edman007/docs/projects/rivian-api-tool/rivian-python-api/src/rivian_python_api/rivian_cli.py", line 1234, in <module>
    main()
  File "/home/edman007/docs/projects/rivian-api-tool/rivian-python-api/src/rivian_python_api/rivian_cli.py", line 887, in main
    user = get_user(args.verbose)
  File "/home/edman007/docs/projects/rivian-api-tool/rivian-python-api/src/rivian_python_api/rivian_cli.py", line 400, in get_user
    and 'formatted' in response_json['data']['user']['phone'] else None,
TypeError: argument of type 'NoneType' is not iterable

from rivian-python-api.

the-mace avatar the-mace commented on July 18, 2024

Ok I added more protection for the phone thing.

I'd try that --vehicle_orders option next

from rivian-python-api.

edman007 avatar edman007 commented on July 18, 2024

Now the phone and --user stuff works, as for --vehicle_orders:

$ ./bin/rivian_cli --vehicle_orders
No Vehicle Orders found

Like I said, the vehicle ID seems to only be returned with the --user (see the json debug stuff I inserted into it on the original post)

from rivian-python-api.

the-mace avatar the-mace commented on July 18, 2024

Ah can you run it with the --verbose option, like: ./bin/rivian_cli --vehicle_orders --verbose

from rivian-python-api.

edman007 avatar edman007 commented on July 18, 2024

sorry, should have known that:

$ ./bin/rivian_cli --vehicle_orders --verbose
orders:
{'data': {'orders': {'__typename': 'OrderSearch', 'data': []}}}
No Vehicle Orders found

from rivian-python-api.

the-mace avatar the-mace commented on July 18, 2024

Hmm, that's interesting so they're showing no vehicle order. I think we can make it fall back to checking the user record for a vehicle ID if it doesnt find it in vehicle orders. I made that change so give that a shot

from rivian-python-api.

edman007 avatar edman007 commented on July 18, 2024

Yup, tested, that works fine! Fixed!

from rivian-python-api.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.