Bluetooth Low Energy and TWCManager #562
Replies: 9 comments 17 replies
|
That's a very exciting prospect -- thanks for finding that! I believe you still need the API registration in order to register the key on the car to use BLE commands, but this might help us stay in the lowest (and hopefully free) usage tier if we're never actually hitting the cloud API. |
|
Here are some resources I've found while trying to understand Bluetooth programming - http://blog.kevindoran.co/bluetooth-programming-with-python-3/ |
|
Further resources are linked for anyone (@MikeBishop ?) thinking of progressing the Bluetooth API - onokje/node-red-contrib-tesla#67 (comment) The developer states that he has made "a tiny HTTP API to make BLE request to my Tesla". I haven't experimented with the code yet, but he goes on further to explain that no internet access is needed to interact with the vehicle over BLE. |
|
I'll post this here in case it helps anyone... I've managed to get local access to my car via BLE using this program (https://github.com/tesla-local-control/tesla_ble_mqtt_docker) and home assistant. I use it to start and stop charging and let TWCManager determine the amps. I did have to scrape the amps offered from my local TWCManager webpage to use in the home assistant automations. I'll hopefully migrate across to the BLE within TWCManager once it's up and running. |
|
I'm currently using BLE to set the amps and start/stop the charging with a granny charger. It works within home assistant and can be accessed via a web api. I'm assuming this could be easily build into TWC manager (the start and stop). Only thing you need to do is register the device as a key in your car. You can find the project here. Would be really cool to have this integrated with TWCmanager to be able to call this device instead of the fleet api |
|
btw. Maybe another avenue to pursue. TWCManager is already able to push messages to MQTT, why don't we extend that to push a message when the car needs to be turned on or off. This can be picked up by another device abstracting the implementation (bluetooth, fleet API etc...). Or, just extend the HASS implementation to be able to change the state of a switch (to turn on or off) and handle it in HASS. I literally have a switch in the dashboard that is able to turn on or off the charging of the car (via bluetooth). I think the MQTT solution is a bit more elegant, since your not tying into specific implementations but either would be fine actually. |
|
Hi All, With Feb 1 rapidly approaching, and the threat of Tesla API changes/charging looming, I've been doing some work on BLE integration. We've now got native BLE support via the tesla-control binary in the development build today. This covers start/stop charging and charge rate control. The logic used to do this is a little clunky (from a code perspective, not an outcome perspective) and I have a PR under development to better handle the prioritisation of BLE over API. This is coming along well - I am controlling my vehicle's charging almost exclusively with BLE with fallback to API only when BLE fails for any reason (it's radio, so it does happen). I am about to add the ability to configure that prioritisation so that you can effectively cut API calls for start/stop charging/charge rate entirely if you would prefer, and keep it exclusively to BLE (which I intend to do going forward, because for me it has been working well). The TeslaBLE module does not currently support the external ESP-based hardware for tesla BLE, but if it's about as straightforward as the native tesla-control BLE commands, I can't see why it couldn't be handled easily. I simply haven't had time to read up on the protocol/interface yet and don't have one so won't be able to test it once added - but would be great if we have interested testers to help there once I get some support added. I had some temporary documentation previously, but I have now put some "proper" documentation here: https://github.com/ngardiner/TWCManager/blob/main/docs/modules/Vehicle_TeslaBLE.md Certainly appreciate any feedback, if anyone else gets a chance to try it out. I admit that the peering process is a bit inelegant. It's a combination of the UI not being all that refined and it requiring actual physical interaction with the car to add the "card" (and that is a bit buggy too, but eventually works). If anyone gets really stuck I can spend a bit more time on it, but for me it worked fairly well. |
|
@ngardiner currently I'm running node-red and tesla-ble-http-proxy for controlling my docker twcmanager instance. I would like to test your "native" twcmanager implementation to get rid of my tesla-ble-http-proxy container. Is there any possibility for getting a docker image with ble implementation for testing? |
|
I'm getting the same 'NameError: name 'ret' is not defined' error with my Manual installation straight on my Pi Zero 2W |


Uh oh!
There was an error while loading. Please reload this page.
I've been reading the attached article and wondered if this has been considered for TWCManager -
https://shankar-k.medium.com/tesla-developer-api-guide-ble-key-pair-auth-and-vehicle-commands-part-3-485e4a357e7d
TLDR - The new official Tesla API has provision for Bluetooth LE commands including Stop/Start charging and set charging rate. AFAIK, the Raspberry Pi Zero W supports Bluetooth and typically resides in the Tesla Wall Charger within Bluetooth range.
It seems a logical extension to forgo all the API authentication, potential tiered subscription costs etc. and do direct control of charging via Bluetooth?
All reactions