Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Tesla Wall Connector load sharing protocol

This site may earn commission on affiliate links.
Hi All,

Thanks for the effort and time in putting all this together.

I am a bit stuck at this stage. I have set up the raspberry pi. Installed everything as instructed.

Getting 4 red blinking LED's on the wall charger. Logging into the Pi and typing: screen -r TWCManager
gives me: “There is no screen to be resumed matching TWCManager".

Everything installed as documented, even re-did this and get the same error.

When I try to run TWC manager manually using 'python ~TWC/TWCManager.py" I get this error:

File "/home/pi/TWC/TWCManager.py", line 283
def hex_str(s:str):
^
SyntaxError: invalid syntax

Firstly, I don't think my Pi is running TWC Manager at boot (I have modified rc.local with the code to start it at boot).

Secondly, running it manually gives that error.

Thirdly, typing in the IP address into Chrome gives me: Timed out waiting for response from TWCManager script.

Any help would be much appreciated.

Kind regards,

Nick
 
It seems to have a problem with the ":" operator, the "^" with the syntax error above should be pointing to it. If I change that 1 to a , for debugging purposes, and then jumps to line 286, where the same syntax error appears.

Any help would be great!
 
Sorry for the spamming. It seems to be working now without any changes? very strange.

As a side note, I can't log into the TWC using my username and password. It says it is incorrect, but I just used the same for my phone...

Maybe something to do with needing to login to the en_Au site?

Cheers

Nick

It seems to have a problem with the ":" operator, the "^" with the syntax error above should be pointing to it. If I change that 1 to a , for debugging purposes, and then jumps to line 286, where the same syntax error appears.

Any help would be great![/QUOTE
 
Scratch that, it is coming up with the same errors again. I will wait until someone can shed some light on this for me.

Thanks in advance for all the help!

Sorry for the spamming. It seems to be working now without any changes? very strange.

As a side note, I can't log into the TWC using my username and password. It says it is incorrect, but I just used the same for my phone...

Maybe something to do with needing to login to the en_Au site?

Cheers

Nick
 
Im having the same trouble as nick_tassi, strangely enough I'm in Australia too it may just be a coincidence but im getting

File "TWCManager.py", line 283
def hex_str(s:str):
^
SyntaxError: invalid syntax

when I try to run the script, any ideas would be greatly appreciated
 
Im having the same trouble as nick_tassi, strangely enough I'm in Australia too it may just be a coincidence but im getting

File "TWCManager.py", line 283
def hex_str(s:str):
^
SyntaxError: invalid syntax

when I try to run the script, any ideas would be greatly appreciated

Ive determined the problem was the script was not doing started with screen, and by running the script manually using
"python3 ~/TWC/TWCManager.py" it works perfectly, thanks again to all involved in the project!
 
H Compliance,

I figured this out also. By running it as python 3, modifying rc.local I got it working.

In addition I also got some code working to talk to my enphase system, and now I get actual house consumption (minus current charge) to work out total available amps. Worked great yesterday and today. :)
Ive determined the problem was the script was not doing started with screen, and by running the script manually using
"python3 ~/TWC/TWCManager.py" it works perfectly, thanks again to all involved in the project!
 
Has anyone determined if there is a way to have the current set to anything lower than 6a? I’m using 3 phase and 6a is 4500w, I have the script tracking my solar export and during the early morning and late afternoon it stops and starts quite frequently, short of removing 1 or 2 phases from the wall connector is there any other way to have the script charge at lower rates?
 
Has anyone determined if there is a way to have the current set to anything lower than 6a? I’m using 3 phase and 6a is 4500w, I have the script tracking my solar export and during the early morning and late afternoon it stops and starts quite frequently, short of removing 1 or 2 phases from the wall connector is there any other way to have the script charge at lower rates?
IIRC, 6A is the lowest defined pilot signal in the standard. Tesla cars will charge at lower amps but I don't think there's any way to signal it through the charge port.
 
  • Like
Reactions: Compliance!
In winter, I have the TWC running on one phase only. In summer I modify the script again (to charge with solar power only) and switch to 3 phase usage.
The car itself is using one phase only if it comes close to 100%. Though, I think this decision is done by the car and can not be controled by the protocol. It would be very convinient to not have to change the script by hand.
 
Has anyone determined if there is a way to have the current set to anything lower than 6a? I’m using 3 phase and 6a is 4500w, I have the script tracking my solar export and during the early morning and late afternoon it stops and starts quite frequently, short of removing 1 or 2 phases from the wall connector is there any other way to have the script charge at lower rates?


I had my sparky put in a switch, that would turn phases 2/3 off for this reason. Usage is that i have it in single phase most of the time, but can quickly switch it to 3p32a for full 22kw charging for the odd occasion where i want juice quickly.
 
I've been recently looking at the WiFi controlled relay module below for another purpose. It would seem to be a reasonable solution to the problem of shutting down charging completely when needed. You would simply route the pilot signal through it and connect or disconnect it as needed.

61u6%2B8LscML._SL1000_.jpg

https://www.amazon.com/MHCOZY-Wireless-Switch-applied-control/dp/B0752P57ZG
 
What the WHAT?! A manufacturer sharing details of connector pinouts? In 2017?! Fake news!

Good find though.

It verifies stuff I surmised but nothing jumps out as new info useful to this particular project... It hints at the meaning of the 4 colored wires leading to the charger handle (CNA5):
Purple: VEH PILOT (Pilot pin)
Blue: S3V3-UHF (3.3V power)
Black: THERM-VEH-POS (temperature monitor?)
Orange: VEH_PROX (Proximity pin)


Any of y'all know how to decode the white and green wires ?
 

Attachments

  • Screenshot 2019-02-23 18.40.16.png
    Screenshot 2019-02-23 18.40.16.png
    305.9 KB · Views: 213
  • Screenshot 2019-02-22 20.35.10.png
    Screenshot 2019-02-22 20.35.10.png
    2 MB · Views: 135
  • Screenshot 2019-02-22 20.34.26.png
    Screenshot 2019-02-22 20.34.26.png
    1 MB · Views: 128
Hi, interesting project, thanks for the lots of work that has been done!

I have a slightly different use case compared to using green energy: I'm looking to use this to smart load balance my TWC with my house-usage. So basically limiting the maximum amount of current to the TWC if other equipment in my house needs the energy, thus protecting blowing the main fuses of the house.

I already have a script running on a Raspberry Pi that reads the live power consumption of my house with a DSMR-compatible meter. This script also has an API to read the actual live consumption. So what I guess I have to do, is hook this someway into the check_green_energy routine.

Now I'm not a programmer (but can do some tweaking), so question is: has somebody done this already, or has a more simple solution for this running?

Another question is: I also have a Rasberry Pi reading a Modbus-compatible energy meter measuring the power to the wall charger, so I can have real-time/historical reporting on the usage of the charging of the car. This also uses a RS-485 bus.
As the TWC is also using RS-485, would it be possible (is the TWC also using Modbus?) and safe to daisy chain this to the same bus-wiring?
 
It is serial, but at physical level the signals are defined by the RS-485 standard, which allows a bus-topology. If Tesla adheres to the widely used Modbus-standard for these kind of applications at protocol level, I would think that they should be able to connect to the same bus and talk to each other or any other host.
 
I've read through this thread now. Great work!

Personally, I'm planning to build a simple ESP8266-interface using MQTT to integrate the charger to my Home Automation System running InfluxDB, Grafana and openHAB.

I'm trying to collect and create a complete list of commands/response messages based on this thread and comments in the code of TWCManager from CDragon. Is this already exsisting? I've got my own and plan to put it in an public Google-doc if anyone interested.
 
  • Like
Reactions: M_VdM
Nice project!
I followed the TCWManager pdf but it script wasn't autostarting from rc.local: it didn't show up in screen -r.
I chmod ~/TWC/TWCManager.py to 744 to make it executable and now everything works fine.

I have a off-grid project:
~6000W of solar panels connected to a 1 fase inverter of 5000W AC.
This inverter (MPP Solar 5048 MG) supports a batteryless setup(!)

So, the game is now to track the voltage going down if there is less sun available (clouds etc) and adjust the Amps automatically.
 
@cdragen: I tried to print the Voltage on the index.php, but couldn't figure out how. I used $voltsPhaseA, but that doesn't give anything.
How could I do this in the py script:
if the voltage => 240V add 1A
if the voltage =< 200V substract 1A
 
@CDragon
hahaha, I misspelled your name in the previous post.
As I don't see an option to edit, this is the 3rd post in a row ;-)
Something strange I noticed:
When I up the Amps through the webpage (I edited it to be able to change amps by 1A from 6-20A), when I for example change the amps from 10A to 13A, the 'available amps' first jump to 16A, before going down to 13A!
How is that possible?
In my case that causes the TWC to cut the charging as the Voltage dropped too much.