-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TesSense on Raspberry Pi #9
Comments
TesSense isn’t compatible with the current API from Tesla, also, it’s complaining about the AsyncIO call, so perhaps the Pi will not do Async code, but another one of the errors is specifying you want to talk to your second Tesla, if you only have one you should change that line to:
… mycar = tesla.vehicle_list()[0]
On Mar 7, 2024, at 4:11 PM, bbsanders ***@***.***> wrote:
Does TesSense run on a Raspberry with Python 3.12.2? I'm getting the following errors. (I amended the first print statement to print the Python version as well as the TZ.)
US/Central 3.12.2 (main, Mar 5 2024, 10:50:29) [GCC 8.3.0]
Initating connection to Sense...
Traceback (most recent call last):
File "/home/pi/Downloads/TesSense.py", line 454, in
asyncio.run(main())
File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/pi/Downloads/TesSense.py", line 450, in main
await asyncio.gather(*tasks)
File "/home/pi/Downloads/TesSense.py", line 154, in TesSense
mycar = tesla.vehicle_list()[1]
~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
(program exited with code: 1)
Press return to continue
—
Reply to this email directly, view it on GitHub <#9>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AFQ7F532IIDBZSIMKSJIYXLYXD62FAVCNFSM6AAAAABEL5X2JCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE3TKMBUGQYDCNY>.
You are receiving this because you are subscribed to this thread.
|
I'm running on RaspPi 4b with Python 3.11. It the problem is what was pointed out.... you only have 1 tesla and you are referencing a 2nd car. I reproduced the error using mycar = tesla.vehicle_list()[2] I have 2 Tesla so I have 2 copies of the code specifying which car is to be charged: mycar = tesla.vehicle_list()[0] and mycar = tesla.vehicle_list()[1]. I'm not that good at Python to figure out how to specify the car on the command line. I have defined 2 PlugInstance() so Sense can track the power for each car. My Generac Solar system includes a PWRCell battery so I have made other modifications to minimize battery usage and only use excess solar production. |
Thanks to you both. I changed the mycar statement and the program is running to the point where it's trying to change the Tesla's charging amps, but it's getting a "403 Client Error", which I assume is due to the compatibility problem with the current Tesla API. Initating connection to Sense... Charging at 5 amps, with 1927 watts surplus
|
I think this is the issue that you need to modify your teslapy's endpoints.json file. Sorry but I don't remember where I found the discussion and the following fix. Change it to the following: This is all one line. Take care that you maintain the indent, quotes, and comma at the end of the line. |
Thanks. I made that change, but I'm getting the same error. 403 Client Error: Tesla Vehicle Command Protocol required, please refer to the documentation here: https://developer.tesla.com/docs/fleet-api#2023-10-09-rest-api-vehicle-commands-endpoint-deprecation-warning for url: https://owner-api.teslamotors.com/api/1/vehicles/3744432960343986/command/set_charging_amps } It looks like it wants me to use the new Tesla Vehicle Command Protocol. According to their developer page, "All vehicles* will require Tesla Vehicle Command protocol. The REST API will be fully deprecated" as of January 2024. Some vehicles are excluded from the change, though it doesn't look like mine is one of them. I have a Model 3 2023 with Version: v11.1 (2024.2.7). |
Sorry, I don't remember what else I may have tweaked. I don't think our 2018 and 2020 M3 are excluded from the new API's. I had problems with TesSense, TeslaMate, and one of my iPhone apps not working with the API changes in Dec/Jan. You could try deleting your cache.json and force TesSense to get a new token and see if that corrects the issue. I did rebuild my RaspPi in early January so I could clean up some old junk and move to a larger/faster drive. I think that's when I also found the TeslaPy fix I provided. Needing that mod seems to imply that our M3's are using the new API's. Here's the modules I have installed. Some are outdated but everything is working and I didn't see a need to upgrade. |
Tried deleting cache.json, but no joy. I also tried modifying the def vehicle_list(self) section of init.py as suggested by DeLN0 on tdorssers/TeslaPy#156, but no success. Were there any other changes to the endpoints.json file you can remember, specifically to the set_charging_amps section? That seems to be the command generating the error I'm getting. |
Does TesSense run on a Raspberry with Python 3.12.2? I'm getting the following errors. (I amended the first print statement to print the Python version as well as the TZ.)
US/Central 3.12.2 (main, Mar 5 2024, 10:50:29) [GCC 8.3.0]
Initating connection to Sense...
Traceback (most recent call last):
File "/home/pi/Downloads/TesSense.py", line 454, in
asyncio.run(main())
File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/base_events.py", line 685, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/pi/Downloads/TesSense.py", line 450, in main
await asyncio.gather(*tasks)
File "/home/pi/Downloads/TesSense.py", line 154, in TesSense
mycar = tesla.vehicle_list()[1]
~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range
(program exited with code: 1)
Press return to continue
The text was updated successfully, but these errors were encountered: