Tesla Wall Charger Communication Library
Project description
Tesla Wall Charger Director
Python library for basic control of Tesla Wall Chargers in peripheral mode. Tesla Wall Charger protocol was reverse engineered largely from observing communication between a Tesla Wall Charger in controller mode and a Tesla Wall Charger in peripheral mode. The commands to increase/decrease session charge current and commands to open and close contactors were found on the very detailed Tesla Motors Club forum thread
https://teslamotorsclub.com/tmc/threads/new-wall-connector-load-sharing-protocol.72830/
Thank you to everyone that contributed to that thread.
The library does not currently implement any type of capacity sharing, it is assumed the maximum charge current is available to all chargers on the bus. There is no way for the library to check to make sure entered values are sane for a particular installation USE AT YOUR OWN RISK.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Library
An example of the library usage can be found in utility.py. A program can register for new device events and then register for command events that it is interested in. There is a special command event fired called "__ALL_COMMANDS__" that is fired for a device whenever a command has been decoded. The event "TWC_CAR_CONNECTED" is fired when all fragments of a VIN have been received and again when any fragment reverts to null.
Command line
There is a utility mode that allows the library to be used from the command line. It provides reporting of peripheral activity and can be used to open-close contactors, set default and session charge current to a set of pre-defined values and incrementally increase or decrease charge current for an active charge session.
The utility or library can not be used to start or stop a charge session in a way that is resumeable. The Tesla wall chargers do not report battery capacity or state of charge.
From within the module directory, or after the module has been installed help for the utility can be found by running the following command.
pytho3 -m twcdirector.utility --help
Once appropriate options have been selected and the utility is up-and-running it can be exited by hitting CTRL-C which will perform a graceful shutdown.
The up and down arrow keys can be used to select a particular peripheral then the following commands can be sent to the selected peripheral.
Key | Description |
---|---|
d | Open contactors. This will typically put a connected car into an error state and it will need to be unplugged, plugged back in to clear the error |
c | Close contactors. |
1 | Send a default current command of 6A. This has no effect after connection. |
2 | Send a default current command of 10A. This has no effect after connection. |
3 | Send a default current command of 20A. This has no effect after connection. |
4 | Send a default current command of 32A. This has no effect after connection. |
5 | Send a default current command of 0A. This is typically interpreted by the peripheral as 6A, just present for testing. |
6 | Send a session current command of 6A. This sets the limit for the current charge session, can only be used after car is connected. |
7 | Send a session current command of 10A. This sets the limit for the current charge session, can only be used after car is connected. |
8 | Send a session current command of 20A. This sets the limit for the current charge session, can only be used after car is connected. |
9 | Send a session current command of 32A. This sets the limit for the current charge session, can only be used after car is connected. |
0 | Send a session current command of 0A. This is typically interpreted by the peripheral as 6A, just present for testing. |
- | Sends a decrease charge current command. This will only have an effect while charging is in progress. The peripheral alters charging current by a pre-defined amount. |
+ | Sends a increase charge current command. This will only have an effect while charging is in progress. The peripheral alters charging current by a pre-defined amount. |
Protocol Timing
Observations regarding protocol timing.
Controller Discovery
Command | Number | Interval | Notes |
---|---|---|---|
0xE1 | 4 | 1300ms | Controller sends when first powered on then stops |
Peripheral Presence
Command | Interval | Notes |
---|---|---|
0xE2 | 1300ms | Peripheral keeps sending until a controller claims it |
Peripheral request periods
The period seems to be a function of the total number of requests for data excluding the 0xE0 command. Intra command spacing is approximately 1300ms
Command | Period | Response Within | Notes |
---|---|---|---|
0xE0 | 1300ms | 160ms | Controller requests status but does not report |
0xE2 | 200ms - 500ms | 160ms | Controller makes 3 requests on initial discovery then stops |
0xEB | 11800ms | 160ms | Controller reports using the same period |
0xEC | 11800ms | 160ms | Controller reports using the same period |
0xED | 11800ms | 160ms | Controller reports using the same period |
0xEE | 11800ms | 160ms | Controller reports using the same period |
0xEF | 11800ms | 160ms | Controller reports using the same period |
0xF1 | 11800ms | 160ms | Controller reports using the same period |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file twc-director-0.0.1.tar.gz
.
File metadata
- Download URL: twc-director-0.0.1.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b646f231a2d73d45792f16af02f213a17d18f95e4300cb351ab0f21c655aacb |
|
MD5 | ec918d9e95fbd7a1ed3c224eb671d1fa |
|
BLAKE2b-256 | 1b198409c1cd9d1927546c5482b7e630f835024bce87781d7f8f8262ef5155f7 |
File details
Details for the file twc_director-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: twc_director-0.0.1-py3-none-any.whl
- Upload date:
- Size: 17.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 619ccba8b62bf569b6916ff8da81b5e375de861fd289413e506106970c155625 |
|
MD5 | a83e4a39360157344c403d60db41d293 |
|
BLAKE2b-256 | 43fc25cd35e9461bad81525945030178d87dee9935be26392a89c028267a4e9f |