the-mace/rivian-python-api

Functions don't seem to work due to a canceled vehicle order on my account.

bwilliam79 opened this issue · 4 comments

When I attempt to run any of the functions (e.g. --vehicles, --state, --last_seen, --ota, --poll, --charging_schedule, --live_charging_session, --live_charging_history) I receive a traceback.

bin/rivian_cli --last_seen

Traceback (most recent call last):
File "/root/rivian-python-api/src/rivian_python_api/rivian_cli.py", line 1214, in
main()
File "/root/rivian-python-api/src/rivian_python_api/rivian_cli.py", line 742, in main
details = order_details(order['id'], verbose)
File "/root/rivian-python-api/src/rivian_python_api/rivian_cli.py", line 129, in order_details
'vehicleId': response_json['data']['order']['vehicle']['vehicleId'],
TypeError: 'NoneType' object is not subscriptable

The trace looks identical for each of these functions. I think this may be because I have a canceled order on my account and it isn't being handled properly. I'm happy to provide additional output if needed. Thanks!

Ok bit of an unusual case with the cancelled order but I added more protection around that area in 7cf05c6

dholt commented

I'm having a similar issue after the fix:

Order details missing key items, found: None Traceback (most recent call last): File "src/rivian_python_api/rivian_cli.py", line 1232, in <module> main() File "src/rivian_python_api/rivian_cli.py", line 765, in main vehicle_id = vehicle['vehicleId'] ~~~~~~~^^^^^^^^^^^^^ KeyError: 'vehicleId'

I don't have a cancelled order but I do have an open R1S reservation and a delivered R1T

I don't see the string vehicleId anywhere in the output from --vehicle_orders

I've noticed an oddity in the "Item" field, I sometimes get R1T and sometimes get PROCWY2KT5 (I had one VIN almost delivered and had to switch to a new VIN)

'VEHICLE_DELIVERED', 'items': [{'__typename': 'OrderItem', 'sku': 'R1T'}, {'__typename': 'OrderItem', 'sku': 'PROCWY2KT5'}]

I added protection for the exception but there's nothing I can really do about them returning odd data or not returning proper information. Does it show any of this stuff in their app or site?

dholt commented

No the app/website don't show that. Your change fixes it enough for me though, thank you