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.
check_green_energy for SolarEdge solar systems:
  1. Login to your account on SolarEdge
  2. Click Admin -> Site Access -> API Access and generate API or copy that if you have one already
  3. Edit TWCManager.py and make the following changes...
lines to changed in check_green_energy() function...​

search for greenEnergyData = run_process(... and replace with:
greenEnergyData = run_process('curl -s -m 60 "https://monitoringapi.solaredge.com/site/<YOUR_SITE_ID>/overview?api_key=<YOUR_API_KEY>')

search for m = re.search(b'... and replace with:

m = re.search(b'.*\"power\"\:[0-9\,\.]*)\}.*', greenEnergyData, re.MULTILINE)
hello,

is this api url still correct?
 
check_green_energy for SolarEdge solar systems:
  1. Login to your account on SolarEdge
  2. Click Admin -> Site Access -> API Access and generate API or copy that if you have one already
  3. Edit TWCManager.py and make the following changes...
lines to changed in check_green_energy() function...​

search for greenEnergyData = run_process(... and replace with:
greenEnergyData = run_process('curl -s -m 60 "https://monitoringapi.solaredge.com/site/<YOUR_SITE_ID>/overview?api_key=<YOUR_API_KEY>')

search for m = re.search(b'... and replace with:

m = re.search(b'.*\"power\"\:[0-9\,\.]*)\}.*', greenEnergyData, re.MULTILINE)


is it possible that your code is missing " at the end of the line?
 
Just for logging purposes, in the FB EB status message after the voltage for each phase there seems to be the amperages (multiplied by two).
Starting to charge on a 3-phase 13A circuit:
Code:
[2020-04-11 21:30:43] STATS - 5 kWh 234V 234V 236V 0A 0A 0A == eb95410000000500ea00ea00ec000000000086
[2020-04-11 21:30:45] STATS - 5 kWh 234V 234V 237V 0A 0A 0A == eb95410000000500ea00ea00ed000000000087
[2020-04-11 21:30:47] STATS - 5 kWh 235V 234V 237V 0.5A 0A 0A == eb95410000000500eb00ea00ed010000000089
[2020-04-11 21:30:49] STATS - 5 kWh 235V 234V 237V 0A 0A 0A == eb95410000000500eb00ea00ed000000000088
[2020-04-11 21:30:51] STATS - 5 kWh 234V 233V 237V 1A 0A 0A == eb95410000000500ea00e900ed020000000088
[2020-04-11 21:30:53] STATS - 5 kWh 232V 234V 237V 3.5A 0A 0A == eb95410000000500e800ea00ed07000000008c
[2020-04-11 21:30:55] STATS - 5 kWh 231V 234V 237V 5A 0.5A 0A == eb95410000000500e700ea00ed0a010000008f
[2020-04-11 21:30:57] STATS - 5 kWh 231V 235V 237V 5A 0A 0A == eb95410000000500e700eb00ed0a000000008f
[2020-04-11 21:30:59] STATS - 5 kWh 230V 231V 238V 6.5A 6A 0A == eb95410000000500e600e700ee0d0c0000009a
[2020-04-11 21:31:01] STATS - 5 kWh 230V 230V 239V 8A 9A 0A == eb95410000000500e600e600ef1012000000a3
[2020-04-11 21:31:03] STATS - 5 kWh 229V 228V 239V 10A 10A 0.5A == eb95410000000500e500e400ef1414010000a7
[2020-04-11 21:31:05] STATS - 5 kWh 229V 228V 239V 10A 10.5A 0A == eb95410000000500e500e400ef1415000000a7
[2020-04-11 21:31:07] STATS - 5 kWh 229V 230V 231V 12A 12A 13A == eb95410000000500e500e600e718181a0000c2
[2020-04-11 21:31:09] STATS - 5 kWh 229V 228V 231V 13A 13A 13.5A == eb95410000000500e500e400e71a1a1b0000c5
[2020-04-11 21:31:11] STATS - 5 kWh 229V 228V 231V 13A 13A 13.5A == eb95410000000500e500e400e71a1a1b0000c5
[2020-04-11 21:31:13] STATS - 5 kWh 229V 230V 231V 13A 13A 13.5A == eb95410000000500e500e600e71a1a1b0000c7
[2020-04-11 21:31:15] STATS - 5 kWh 229V 230V 231V 13A 13A 13.5A == eb95410000000500e500e600e71a1a1b0000c7
 
Last edited:
If someone is looking for a load balanced version of the TWCManager.
BitterAndReal/TWCManager

I used the following Raspberry pi zero shield to measure the utility mains current.
RPIZ CT3V1 - lechacal

The mains current is used to protect the mains fuse and to charge with left over green energy.

Is it easy to setup two of those and measure?
I Want one of them to track my current from my solar panels and one for the mains to "track green energy" but im not really a software guy more of a hardware guy.
Best regards
 
Is it easy to setup two of those and measure?
I Want one of them to track my current from my solar panels and one for the mains to "track green energy" but im not really a software guy more of a hardware guy.
Best regards
It is quite easy to setup for mains measuring. I documented it a on github.
BitterAndReal/TWCManager

If you want to display your solar panel production that has nothing to do with the TWCManager but could be done with the same hardware if you want to write code for it. Maybe it's easier to use dedicated hardware and software to do the visualisation and logging of your solar production.
 
I dont want to display my solar, i just want to measure it and take (solar power - mains=charge car) so my take from the grid is about 0W
But i havent found any way to get the data from my SMA inverter so i thought it might be easier to use 2 pi and measure on both mains and inverter cables and then do the calculation to know how much amps to put in my car.
It sounds easy on paper but i know it canbe hard to do.
 
I dont want to display my solar, i just want to measure it and take (solar power - mains=charge car) so my take from the grid is about 0W
But i havent found any way to get the data from my SMA inverter so i thought it might be easier to use 2 pi and measure on both mains and inverter cables and then do the calculation to know how much amps to put in my car.
It sounds easy on paper but i know it canbe hard to do.
That is exactly what I'm doing. You don't need measure solar production if you're measuring the mains.
If the mains current is negative your sending electricity to the grid which can be used to charge the car.
 
Hey guys

I am new to this forum and I think this is an amazing project!
I would like to change it a bit, since I'm not using a Powerwall, but a TWC and have a huge solar array soon (25kWp). My inverter will give me a JSON-API to read-out it's realtime-data, so that should be easy.
Any remarks on what I should keep in mind? Any pointers where I must change methods in the code?

Thanks so much,
Raphael

Hi Raphael,
this?
dracoventions/TWCManager
 
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.


I have added a couple of lines to the TWCManager.py which allow me to:
- Read the grid smartmeter value via modbus TCP (Fronius Inverter)
- Read from iobroker the instant power of my home made powerwall
- Send to a remote server influxdb the instant power being delivered to the vehicle

This allows nice graphs using grafana :) very proud of the performance of this system! Charged today around 30kWh into the Tesla, could have been more but was not necessary.

power-view
 
This morning I read in the newspaper that the Europe will me possible too stabilize the grid by delivering energy back too the grid! Tesla is named as testing this!!!!!

Is this the explanation for the 3gen TWC with WiFi??????

Interesting development. I see this as the future or smart grids, but Tesla historically wasn't as supportive.

The 3G TWC is just normal evolution in product design - improving Design for Manufacture (DFM) and costing down. I doubt it has the electronics inside it to convert the DC from the car back into AC and synchronise with the grid.

There are products out there already such as the Wall Box Quasar. Potentially, all Tesla need is the software to negotiate bi-directional DC charging (and connect the HV pins on the charge port to battery).
 
  • Informative
Reactions: Watts_Up
This morning I read in the newspaper that the Europe will me possible too stabilize the grid by delivering energy back too the grid! Tesla is named as testing this!!!!!

Is this the explanation for the 3gen TWC with WiFi??????
These types of projects use Tesla's Powerwall or Powerpack. As @Craig 128 pointed out, there is no DC->AC inverter in the car or Wall Connector. The necessary hardware simply isn't there.
I doubt it has the electronics inside it to convert the DC from the car back into AC and synchronise with the grid.
It doesn't - no mention of such hardware in the manual, and you couldn't do it at the $500 USD price point, anyway.
 
I would be grateful for anyone to look at this for me.

nick_tassi I followed up and found a bug with the Timeout of the function where it would stick at last set. Rather than rewrite, i just added a bug handling function. I've not seen the bug pop up again, but have only ran it 2 days.

the "6 amp charge" bug i think is in the HTML where the car is "finished charging, unplugged, or waking up" and allows 6 amps, even though the GreenEnergy says 0 is available. Mine pulls every minute, so it turns off within a minute. I'm not to worried, but have confirmed there is a bug. I think those functions were all put together for some reason. May need a deeper dive.

other notes: added actual voltage from the Envoy, not just assume 240. also added a bias of .1 (100 Watts) to try and not export any to the grid.
 

Attachments

  • TWCManager_2020_04_25.py.zip
    44.9 KB · Views: 70
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.
Hello,

How far are you come with your project?
 
Interesting development. I see this as the future or smart grids, but Tesla historically wasn't as supportive.

The 3G TWC is just normal evolution in product design - improving Design for Manufacture (DFM) and costing down. I doubt it has the electronics inside it to convert the DC from the car back into AC and synchronise with the grid.

There are products out there already such as the Wall Box Quasar. Potentially, all Tesla need is the software to negotiate bi-directional DC charging (and connect the HV pins on the charge port to battery).

here in the Netherlands Tesla has tested grid directional with the grid operator. So it’s possible!