Tesla hardware module
Moderator: leecollings
-
- Posts: 33
- Joined: Wednesday 11 November 2020 11:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Sint-Gillis-Waas, Belgium
- Contact:
Re: Tesla hardware module
Hello JanJaap, thank you for the hard work. After a long time there again is hope that communication with the car will be possible through domoticz.
My remarks are not in any way criticism or meant to push you. I only want to keep you posted about possible issues. My experience so far:
Downloaded version 0.6.0 and the errors are gone, as you said. The devices "Charge level" and "Range" are updated regularly, The switch "Charging" also, but never goes "on". Stays off all the time even when charging the car is started in the Tesla-app. The other two "location update needed" and "remaining charge time" do not get updates. I changed the names of all devices because my car's name is a long one and it did not fit the controls, but I saw in the log that my new names appear in the list, so I think that is not a problem. Hope to hear from you soon,kindest regards JP
My remarks are not in any way criticism or meant to push you. I only want to keep you posted about possible issues. My experience so far:
Downloaded version 0.6.0 and the errors are gone, as you said. The devices "Charge level" and "Range" are updated regularly, The switch "Charging" also, but never goes "on". Stays off all the time even when charging the car is started in the Tesla-app. The other two "location update needed" and "remaining charge time" do not get updates. I changed the names of all devices because my car's name is a long one and it did not fit the controls, but I saw in the log that my new names appear in the list, so I think that is not a problem. Hope to hear from you soon,kindest regards JP
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: Tesla hardware module
Hi,
I'm really happy with all feedback. So I won't take it as criticism nor will I ever feel pushed
. I try to check if everything works as expected but I miss things too. So please keep reporting if something isn't working as expected or if you have an idea for more functionality.
Btw I just pushed version 0.7.1 with several improvements, o.a. fixing the issues you mentioned. The only thing I can't fix at this point is the location update, as it is not coming from the Tesla server. The TeslaPy library would need an update for this. As Tesla are changing their server interface, I might need to switch to using an other library at some point, but am not going there yet, as those aren't as nicely documented as TeslaPy......
I'm really happy with all feedback. So I won't take it as criticism nor will I ever feel pushed

Btw I just pushed version 0.7.1 with several improvements, o.a. fixing the issues you mentioned. The only thing I can't fix at this point is the location update, as it is not coming from the Tesla server. The TeslaPy library would need an update for this. As Tesla are changing their server interface, I might need to switch to using an other library at some point, but am not going there yet, as those aren't as nicely documented as TeslaPy......
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
-
- Posts: 33
- Joined: Wednesday 11 November 2020 11:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Sint-Gillis-Waas, Belgium
- Contact:
Re: Tesla hardware module
Downloaded 0.7.2 and for testing purposes put 1;1;1 as polling intervals. Would expect to get new values every minute, but this does not happen. Last update was 9:13 this morning.
To be really useful, we must be able to switch charging on and off (to make efficient use of produced solar power). Do you see this possible to be implemented? Also nice to have would be to control the charging amps (as can be done in the car and in the app).
To be really useful, we must be able to switch charging on and off (to make efficient use of produced solar power). Do you see this possible to be implemented? Also nice to have would be to control the charging amps (as can be done in the car and in the app).
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: Tesla hardware module
Hi,
The Tesla server limits the amount of requests in a given time frame (not uncommon to prevent overload) so there is a lower limit to the polling interval (I think it will be something like 5 minutes but not sure).
I will dive into using the other libraries that will allow sending commands but will take some time. I also want to do something with balancing the solar power with the charger (although I think my charger will be able to do that itself but it will only be installed next week). However, at this moment I guess you're solar panels are not producing nearly enough to charge the car
The Tesla server limits the amount of requests in a given time frame (not uncommon to prevent overload) so there is a lower limit to the polling interval (I think it will be something like 5 minutes but not sure).
I will dive into using the other libraries that will allow sending commands but will take some time. I also want to do something with balancing the solar power with the charger (although I think my charger will be able to do that itself but it will only be installed next week). However, at this moment I guess you're solar panels are not producing nearly enough to charge the car

RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
-
- Posts: 33
- Joined: Wednesday 11 November 2020 11:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Sint-Gillis-Waas, Belgium
- Contact:
Re: Tesla hardware module
Today the solar panels (11 kWp) produced 24 kWh and the home battery is 15,6 kWh, so there was some extra production to put in the car.
But the main raison why I need to control this is because here in Flanders we have that weird system where you pay part of the distribution cost depending on the average quarter hour peak value you produce. It is ± 40 Euro per kW, so if one has an average peak of 17 kW, which is not abnormal when charging a car while the heat pump, laundry machine, dryer and dishwasher are working, you pay around 700 Euro per year on top of the normal distribution costs, taxes and power costs. Peak shaving is very profitable, but to do so every heavy power consumer has to be switchable. I lowered the wall charger from 16 kW to 7 kW, but that still comes on top of the normal consumption, so it has to be switched off, when other devices start working.
But the main raison why I need to control this is because here in Flanders we have that weird system where you pay part of the distribution cost depending on the average quarter hour peak value you produce. It is ± 40 Euro per kW, so if one has an average peak of 17 kW, which is not abnormal when charging a car while the heat pump, laundry machine, dryer and dishwasher are working, you pay around 700 Euro per year on top of the normal distribution costs, taxes and power costs. Peak shaving is very profitable, but to do so every heavy power consumer has to be switchable. I lowered the wall charger from 16 kW to 7 kW, but that still comes on top of the normal consumption, so it has to be switched off, when other devices start working.
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: Tesla hardware module
OK, 24 kWh that is impressive, I was happy with 5 (the last months I hardly got over 1 kWh.....).
Given this payment system I see why it makes sense. Still, it will take some time as the alternative library is much less nicely documented as the TeslaPy library. But I'll give it a go. Might take some weeks though......
Given this payment system I see why it makes sense. Still, it will take some time as the alternative library is much less nicely documented as the TeslaPy library. But I'll give it a go. Might take some weeks though......
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
-
- Posts: 33
- Joined: Wednesday 11 November 2020 11:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Sint-Gillis-Waas, Belgium
- Contact:
Re: Tesla hardware module
Patiently waiting.... No stress!
On a cloudy day I only get 1 or 2 kWh, but when it is sunny in summer when the sun is high, I produce more than 40 kWh per day. Still need the power switch for charging because the car must only consume when there is enough and the home battery is nearly full.
Thanks in advance for your work.
On a cloudy day I only get 1 or 2 kWh, but when it is sunny in summer when the sun is high, I produce more than 40 kWh per day. Still need the power switch for charging because the car must only consume when there is enough and the home battery is nearly full.
Thanks in advance for your work.
-
- Posts: 33
- Joined: Wednesday 11 November 2020 11:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Sint-Gillis-Waas, Belgium
- Contact:
Re: Tesla hardware module
The plugin stopped working. In logfile:
2024-01-27 11:52:57.058 Error: Tesla: Call to function 'onStart' failed, exception details:
2024-01-27 11:52:57.064 Error: Tesla: Traceback (most recent call last):
2024-01-27 11:52:57.065 Error: Tesla: File "/home/pi/domoticz/plugins/TeslaDomoticz/plugin.py", line 374, in onStart
2024-01-27 11:52:57.065 Error: Tesla: _plugin.onStart()
2024-01-27 11:52:57.065 Error: Tesla: File "/home/pi/domoticz/plugins/TeslaDomoticz/plugin.py", line 164, in onStart
2024-01-27 11:52:57.065 Error: Tesla: self.vehicle_list = TeslaServer.get_devices()
2024-01-27 11:52:57.065 Error: Tesla: File "/home/pi/domoticz/plugins/TeslaDomoticz/TeslaDevice.py", line 29, in get_devices
2024-01-27 11:52:57.065 Error: Tesla: vehicles = self.tesla.vehicle_list()
2024-01-27 11:52:57.065 Error: Tesla: File "/usr/local/lib/python3.7/dist-packages/teslapy/__init__.py", line 375, in vehicle_list
2024-01-27 11:52:57.065 Error: Tesla: return [Vehicle(v, self) for v in self.api('VEHICLE_LIST')['response']]
2024-01-27 11:52:57.065 Error: Tesla: File "/usr/local/lib/python3.7/dist-packages/teslapy/__init__.py", line 371, in api
2024-01-27 11:52:57.065 Error: Tesla: **{arg_name: kwargs})
2024-01-27 11:52:57.065 Error: Tesla: File "/usr/local/lib/python3.7/dist-packages/teslapy/__init__.py", line 158, in request
2024-01-27 11:52:57.065 Error: Tesla: response.raise_for_status() # Raise HTTPError, if one occurred
2024-01-27 11:52:57.065 Error: Tesla: File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
2024-01-27 11:52:57.065 Error: Tesla: raise HTTPError(http_error_msg, response=self)
2024-01-27 11:52:57.065 Error: Tesla: requests.exceptions.HTTPError: 412 Client Error: Endpoint is only available on fleetapi. Visit https://developer.tesla.com/docs for more info for url: https://owner-api.teslamotors.com/api/1/vehicles
2024-01-27 11:52:57.058 Error: Tesla: Call to function 'onStart' failed, exception details:
2024-01-27 11:52:57.064 Error: Tesla: Traceback (most recent call last):
2024-01-27 11:52:57.065 Error: Tesla: File "/home/pi/domoticz/plugins/TeslaDomoticz/plugin.py", line 374, in onStart
2024-01-27 11:52:57.065 Error: Tesla: _plugin.onStart()
2024-01-27 11:52:57.065 Error: Tesla: File "/home/pi/domoticz/plugins/TeslaDomoticz/plugin.py", line 164, in onStart
2024-01-27 11:52:57.065 Error: Tesla: self.vehicle_list = TeslaServer.get_devices()
2024-01-27 11:52:57.065 Error: Tesla: File "/home/pi/domoticz/plugins/TeslaDomoticz/TeslaDevice.py", line 29, in get_devices
2024-01-27 11:52:57.065 Error: Tesla: vehicles = self.tesla.vehicle_list()
2024-01-27 11:52:57.065 Error: Tesla: File "/usr/local/lib/python3.7/dist-packages/teslapy/__init__.py", line 375, in vehicle_list
2024-01-27 11:52:57.065 Error: Tesla: return [Vehicle(v, self) for v in self.api('VEHICLE_LIST')['response']]
2024-01-27 11:52:57.065 Error: Tesla: File "/usr/local/lib/python3.7/dist-packages/teslapy/__init__.py", line 371, in api
2024-01-27 11:52:57.065 Error: Tesla: **{arg_name: kwargs})
2024-01-27 11:52:57.065 Error: Tesla: File "/usr/local/lib/python3.7/dist-packages/teslapy/__init__.py", line 158, in request
2024-01-27 11:52:57.065 Error: Tesla: response.raise_for_status() # Raise HTTPError, if one occurred
2024-01-27 11:52:57.065 Error: Tesla: File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
2024-01-27 11:52:57.065 Error: Tesla: raise HTTPError(http_error_msg, response=self)
2024-01-27 11:52:57.065 Error: Tesla: requests.exceptions.HTTPError: 412 Client Error: Endpoint is only available on fleetapi. Visit https://developer.tesla.com/docs for more info for url: https://owner-api.teslamotors.com/api/1/vehicles
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: Tesla hardware module
correct. Tesla deprecated the API that TeslaPy, the undelying library, is using. I'm investigating the upgrade. This requires different way of authentication. Takes some time.....
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: Tesla hardware module
The latest version of the teslapy library has fixed this issue, you need to upgrade that one. I added a check in the plugin that the version of the library is new enough. However upgrading for me failed, so remove and reinstall of teslapy should do it
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
-
- Posts: 33
- Joined: Wednesday 11 November 2020 11:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Sint-Gillis-Waas, Belgium
- Contact:
Re: Tesla hardware module
Removed TeslaPy and reinstalled (version 2.9.0)
After putting in my e-mail address and running 'tesla_prepare' I get this:
Traceback (most recent call last):
File "tesla_prepare.py", line 5, in <module>
vehicles = tesla.vehicle_list()
File "/usr/local/lib/python3.7/dist-packages/teslapy/__init__.py", line 375, in vehicle_list
return [Vehicle(v, self) for v in self.api('VEHICLE_LIST')['response']]
File "/usr/local/lib/python3.7/dist-packages/teslapy/__init__.py", line 371, in api
**{arg_name: kwargs})
File "/usr/local/lib/python3.7/dist-packages/teslapy/__init__.py", line 158, in request
response.raise_for_status() # Raise HTTPError, if one occurred
File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 412 Client Error: Endpoint is only available on fleetapi. Visit https://developer.tesla.com/docs for more info for url: https://owner-api.teslamotors.com/api/1/vehicles
After putting in my e-mail address and running 'tesla_prepare' I get this:
Traceback (most recent call last):
File "tesla_prepare.py", line 5, in <module>
vehicles = tesla.vehicle_list()
File "/usr/local/lib/python3.7/dist-packages/teslapy/__init__.py", line 375, in vehicle_list
return [Vehicle(v, self) for v in self.api('VEHICLE_LIST')['response']]
File "/usr/local/lib/python3.7/dist-packages/teslapy/__init__.py", line 371, in api
**{arg_name: kwargs})
File "/usr/local/lib/python3.7/dist-packages/teslapy/__init__.py", line 158, in request
response.raise_for_status() # Raise HTTPError, if one occurred
File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 412 Client Error: Endpoint is only available on fleetapi. Visit https://developer.tesla.com/docs for more info for url: https://owner-api.teslamotors.com/api/1/vehicles
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: Tesla hardware module
Hi,
Then apparently not all needed chanegs came through, as line 375 of __init__.py should read this:
return [Vehicle(v, self) for v in self.api('PRODUCT_LIST')['response']] if v.get('resource_type') != 'vehicle']
Where the error above still tries to get ('VEHICLE_LIST')['response'], which is the old code.
Btw, I had to do both lines below:
As apparently it was installed in 2 location which were both in the path so it would fall back to the other when one was removed.
Then apparently not all needed chanegs came through, as line 375 of __init__.py should read this:
return [Vehicle(v, self) for v in self.api('PRODUCT_LIST')['response']] if v.get('resource_type') != 'vehicle']
Where the error above still tries to get ('VEHICLE_LIST')['response'], which is the old code.
Btw, I had to do both lines below:
Code: Select all
sudo python3 -m pip uninstall TeslaPy
python3 -m pip uninstall TeslaPy
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
-
- Posts: 33
- Joined: Wednesday 11 November 2020 11:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Sint-Gillis-Waas, Belgium
- Contact:
Re: Tesla hardware module
Uninstalling twice did the trick. Now I get "authenticated your Model 3 called...." but after running 'tesla_prepare', there is no link to the browser as before (Use browser to login. Page Not Found will be shown at success. Enter URL after authentication: https://auth.tesla.com/void/callback?code=.....) and in Domoticz in the log it sais: Tesla: Initialisation failed, check log file and/or run tesla_prepare first
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: Tesla hardware module
you need to pull the latest version of the plugin as there was a small mistake in verifying the version. And as you already have a valid cache.json so no need to do the trick with the URL anymore.
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
-
- Posts: 33
- Joined: Wednesday 11 November 2020 11:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1
- Location: Sint-Gillis-Waas, Belgium
- Contact:
Re: Tesla hardware module
Everything is working now. Thanks!
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: Tesla hardware module
Just pushed a new (minor) update that catches some errors more nicely. Still working on integrating the new API to send commands, but it is slowly progressing. Partly because it ain't easy, partly because of other obligations. So stay tuned......
[edit] oh yeah I forgot, it now reads the actual location and not the destination......
[edit] oh yeah I forgot, it now reads the actual location and not the destination......
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: Tesla hardware module
To update on progress for implementing commands: I've got the new API working in a stand alone script that only retrieves data. This was quite an accomplishment already. Next steps are to get sending commands to work and then to integrate all of that into domoticz.....
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: Tesla hardware module
Small progress update: based on the tesla api example I managed to get it to work almost till the end. I will get to work on integrating this into domoticz, but trying to get this example to work is a precondition for anyone who wants to have the domoticz integration. And yes, it takes some time, so you can get started......
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
-
- Posts: 4
- Joined: Sunday 14 February 2016 12:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Almere, The Netherlands
- Contact:
Re: Tesla hardware module
@JanJaap:
Just today I discovered your plugin and thought I'd give it a try.
I'm using a headless Armbian 24.5.1 Jammy (Ubuntu).
I was able to install python3 libpython3-dev and python3-requests but there was no candidate for libpython3.7-dev so I install libpython3.11-dev
After this I was able to install TeslaPy 2.9.0.
Then I changed Elon's email address to that of my tesla account and ran python3 tesla_prepare but it just sits there with:
"HTTP request sent; waiting for response."
Any ideas what I might be doing wrong?
Just today I discovered your plugin and thought I'd give it a try.
I'm using a headless Armbian 24.5.1 Jammy (Ubuntu).
I was able to install python3 libpython3-dev and python3-requests but there was no candidate for libpython3.7-dev so I install libpython3.11-dev
After this I was able to install TeslaPy 2.9.0.
Then I changed Elon's email address to that of my tesla account and ran python3 tesla_prepare but it just sits there with:
"HTTP request sent; waiting for response."
Any ideas what I might be doing wrong?
-
- Posts: 215
- Joined: Thursday 12 October 2017 20:46
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Dev
- Location: the Netherlands
- Contact:
Re: Tesla hardware module
Hi Ian,
Not really sure what is going wrong (would help if you can post the command line outputs preceding the waiting) but one guess is that the tool is waiting for a response from either the Tesla server or your car. So you could try to run it again after you have accessed your car with the phone app to wake up the car.
Not really sure what is going wrong (would help if you can post the command line outputs preceding the waiting) but one guess is that the tool is waiting for a response from either the Tesla server or your car. So you could try to run it again after you have accessed your car with the phone app to wake up the car.
RPi 3, Domoticz dev version, Aeon ZWave stick (with a whole bunch of slaves), Zigbee using Zigbee2MQTT, Nest thermo, P1 smart meter on RPi Zero
Who is online
Users browsing this forum: No registered users and 1 guest