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.
I found that because solar amps fluctuates frequently, the car was not starting because TWCManager won't start the car if the desired amps changes within a minute. I have build something in to hold the green amps request steady until we get the car to start charging unless it drops below the 6A threshold.
 

Attachments

  • TWCManager.zip
    47.1 KB · Views: 90
All - can someone point me to which 'data cable' you have used to load balance the two Wall Connectors? I just added a second Tesla and have a second wall connector coming our way and my electrician told me to order the data cable... I need about 30 ft between the 2 wall connectors.

Thank you!

I just went to Home Depot and got "Speaker Wire" that they sell by the foot. I just made sure it was the correct AWG recommended in the WC installation guide and I told Home Depot how many feet I needed. I got everything installed and it works fine.
 
yesterday i just installed a second TWC and the TWC Manager displays one of the TWC but twice.
when i reboot the PI where TWCManager is running it randomly displays one of the TWC twice (see attachment)
any suggestions?
 

Attachments

  • TWCManager.png
    TWCManager.png
    113 KB · Views: 184
Hi everyone,

I thought I'd share my mods to TWCManager for Powerwall users.

Firstly, many thanks to CDragon for this.

Basically I wanted to use Excess solar to charge the car but only when the Powerwall couldn't store it. As the Powerwall can charge at lower amps than the car, if you think of the curve of solar output through the day, we want to hold back some Powerwall chargin until the latter part of the day when it would not be possible to charge the car (as below 6A).

So this mod uses the Powerwall Gateway to read the solar production and grid export power. The grid export is added to any current TWC car charging power to give the new value for the available green energy. So if we start importing energy from the grid the TWC amps will reduce, and if we start exporting energy the amps will increase. I fixed a couple of problems the code was giving me that was preventing with the car charging handling - these are all commented. CDragon may find these useful for the base code.
...

You are a legend, i was just about to start googling this as I have just built my unit for install tomorrow and was going to find out how to read off the power wall to see if we could charge when exporting, rather than importing from the grid. Will test this out over the next few days.

Do you log anything to the CLI so I know if its calling the PW for its information?
 
Fantastic stuff here!

I recently had my Enphase system installed, and would like to install the above, but I am a python noob and not sure how to get the output of my solar system correctly working on the TWC code. Here is the IP details and the output. I want to use the net-consumption wNow. Another way is that it could take the simple output of production and consumption and do the maths within the TWC, but that requires polling the envoy twice. Any help would be great.

http://192.168.86.151/production.json?details=1&classic=1

Returns:

{"production":[{"type":"inverters","activeCount":31,"readingTime":0,"wNow":0,"whLifetime":10629163},

{"type":"eim","activeCount":1,"measurementType":"production","readingTime":1498135971,"wNow":-68.327,"whLifetime":9536841.306,"varhLeadLifetime":0.397,"varhLagLifetime":3369487.327,"vahLifetime":11422860.052,"rmsCurrent":1.604,"rmsVoltage":243.565,"reactPwr":382.788,"apprntPwr":390.483,"pwrFactor":-0.19,"whToday":22954.306,"whLastSevenDays":88648.306,"vahToday":29497.052,"varhLeadToday":0.397,"varhLagToday":10781.327,"lines":[{"wNow":-68.327,"whLifetime":9536841.306,"varhLeadLifetime":0.397,"varhLagLifetime":3369487.327,"vahLifetime":11422860.052,"rmsCurrent":1.604,"rmsVoltage":243.565,"reactPwr":382.788,"apprntPwr":390.483,"pwrFactor":-0.19,"whToday":22954.306,"whLastSevenDays":88648.306,"vahToday":29497.052,"varhLeadToday":0.397,"varhLagToday":10781.327}]}],"consumption":[{"type":"eim","activeCount":1,"measurementType":

"total-consumption" ,"readingTime":1498135971,"wNow":1736.44,"whLifetime":12996934.409,"varhLeadLifetime":7422102.743,"varhLagLifetime":3514138.249,"vahLifetime":18884866.53,"rmsCurrent":9.301,"rmsVoltage":243.653,"reactPwr":-430.998,"apprntPwr":2266.29,"pwrFactor":0.77,"whToday":28798.409,"whLastSevenDays":170913.409,"vahToday":41433.53,"varhLeadToday":19016.743,"varhLagToday":11006.249,"lines":[{"wNow":1736.44,"whLifetime":12996934.409,"varhLeadLifetime":7422102.743,"varhLagLifetime":3514138.249,"vahLifetime":18884866.53,"rmsCurrent":9.301,"rmsVoltage":243.653,"reactPwr":-430.998,"apprntPwr":2266.29,"pwrFactor":0.77,"whToday":28798.409,"whLastSevenDays":170913.409,"vahToday":41433.53,"varhLeadToday":19016.743,"varhLagToday":11006.249}]},{"type":"eim","activeCount":1,"measurementType":"net-consumption","readingTime":1498135971,"wNow":1804.767,"whLifetime":9268303.695,"varhLeadLifetime":7422102.346,"varhLagLifetime":144650.923,"vahLifetime":18884866.53,"rmsCurrent":7.697,"rmsVoltage":243.742,"reactPwr":-48.21,"apprntPwr":1875.342,"pwrFactor":0.95,"whToday":0,"whLastSevenDays":0,"vahToday":0,"varhLeadToday":0,"varhLagToday":0,"lines":[{"wNow":1804.767,"whLifetime":9268303.695,"varhLeadLifetime":7422102.346,"varhLagLifetime":144650.923,"vahLifetime":18884866.53,"rmsCurrent":7.697,"rmsVoltage":243.742,"reactPwr":-48.21,"apprntPwr":1875.342,"pwrFactor":0.95,"whToday":0,"whLastSevenDays":0,"vahToday":0,"varhLeadToday":0,"varhLagToday":0}]}],"storage":[{"type":"acb","activeCount":0,"readingTime":0,"wNow":0,"whNow":0,"state":"idle","percentFull":0}]}
 
You are a legend, i was just about to start googling this as I have just built my unit for install tomorrow and was going to find out how to read off the power wall to see if we could charge when exporting, rather than importing from the grid. Will test this out over the next few days.

Do you log anything to the CLI so I know if its calling the PW for its information?

Hi Icepicknz,

Great that someone the other side of the world can benefit from this too. The forum is great.

Yes - I output the main parameters like the grid export amps, current charge amps and calculated green energy as part of the debug level logging so you can see what it's calculating.

It worked great for me a couple of days ago where the home usage profile tracked the solar output pretty closely throughout the day - all energy that would have been exported for no gain before.

Let me know how you get on.

Cheers,

Pete
 
Fantastic stuff here!

I recently had my Enphase system installed, and would like to install the above, but I am a python noob and not sure how to get the output of my solar system correctly working on the TWC code. Here is the IP details and the output. I want to use the net-consumption wNow. Another way is that it could take the simple output of production and consumption and do the maths within the TWC, but that requires polling the envoy twice. Any help would be great.

http://192.168.86.151/production.json?details=1&classic=1

Hi Nick,

My changes were for a Powerwall so you are probably better off using the main TWCManager code. You'll need to change the check-green-energy code to grab details of the usage from your setup.
 
since i have two Tesla Wall Connector installed i found a bug in the code which is responsible to display the TWC on the website (index.php):

i changed three lines (342,343,345) in the code and now it displays the correct values when more than one TWC is connected.
sorry for the pictures. was not able to copy&paste as text right now
 

Attachments

  • TWCManager_old.png
    TWCManager_old.png
    114.3 KB · Views: 144
  • TWCManager_new.png
    TWCManager_new.png
    107.7 KB · Views: 146
  • TWCManager_code.png
    TWCManager_code.png
    127.2 KB · Views: 148
  • Like
Reactions: Juanmax
It worked great for me a couple of days ago where the home usage profile tracked the solar output pretty closely throughout the day - all energy that would have been exported for no gain before.

Let me know how you get on.

Cheers,

Pete

Been running it for 24 hrs now and worked perfectly yesterday. I believe there is something missing for retry; such that I changed the IP address of the RPi to one that conflicted with another device and it was offline for an hour before it got DHCP; when i went into the screen session there was something about max retries for the web url failed, then no more requests. I restarted it and it worked fine.

Today however, I went into screen and saw it wasn't polling the tesla power wall anymore so had to restart again. Perhaps my pi lost internet or the power wall did an update so was offline for a period.

What error handling can be used to continue to try poling the power wall in a fault condition?
 
I've finished decoding the 11 new commands in the new firmware. Although two of them are clearly intended to stop/start charge, they mostly just flip the main relays and fail to send a CAN message to the car telling it to start or stop. When the TWC stops charging, the ring around the car plug continues flashing green for ~30 seconds, goes blue for a couple seconds (presumably asking the TWC to resume charging), green for a bit longer, then red. After that, start charge command will not start charging again until you re-plug the car.

I'm running Firmware version: 4.4.13
Should I upgrade it, or can I even upgrade it?
 
@CDragon Thanks for your great work on this project; i wonder if you would be able to help with a couple of things if you feel like it :)

1./ @sparkypete has made a great Tesla Powerwall integration, i wonder if this could be merged into main code branch.
2./ I wonder if it would be possible to get data from the web interface in JSON format, i.e. charge rate etc so i can use it for graphing and home automation

thanks and keep up the good work!
 
Been running it for 24 hrs now and worked perfectly yesterday. I believe there is something missing for retry; such that I changed the IP address of the RPi to one that conflicted with another device and it was offline for an hour before it got DHCP; when i went into the screen session there was something about max retries for the web url failed, then no more requests. I restarted it and it worked fine.

Today however, I went into screen and saw it wasn't polling the tesla power wall anymore so had to restart again. Perhaps my pi lost internet or the power wall did an update so was offline for a period.

What error handling can be used to continue to try poling the power wall in a fault condition?

Hi Icepicknz,

Yes I am getting the same problem where it stops polling for green energy after going through the night. I don't think it's a bug I've introduced but I'm adding some extra logging so I'll track it down and report back once I have a fix. I'll also build in a try...catch so if the powerwall is not available on the IP address it will not break.
 
  • Like
Reactions: Icepicknz
Hi Icepicknz,

Yes I am getting the same problem where it stops polling for green energy after going through the night. I don't think it's a bug I've introduced but I'm adding some extra logging so I'll track it down and report back once I have a fix. I'll also build in a try...catch so if the powerwall is not available on the IP address it will not break.

its going on 10pm here and I noticed my car was charging at 1kw and there is no sun. So i just restarted TWCManager and I'm not seeing any queries to the tesla powerwall, even though i can query it manually just fine. Is there a timer so to not query in the evening or something?

Power available for all TWCs: None

TWC 7430: Charging at 4.97A.

In debug I'm just seeing
21:54:06: SHB 7430: 01 05.19/06.00A 0000 0000 M: 00 00.00/00.00A 0000 0000
21:55:07: SHB 7430: 01 05.24/06.00A 0000 0000 M: 09 00.00/00.00A 0000 0000
21:55:09: SHB 7430: 09 05.28/06.00A 0000 0000 M: 09 00.00/00.00A 0000 0000

Any ideas?
 
its going on 10pm here and I noticed my car was charging at 1kw and there is no sun. So i just restarted TWCManager and I'm not seeing any queries to the tesla powerwall, even though i can query it manually just fine. Is there a timer so to not query in the evening or something?

Power available for all TWCs: None

TWC 7430: Charging at 4.97A.

In debug I'm just seeing
21:54:06: SHB 7430: 01 05.19/06.00A 0000 0000 M: 00 00.00/00.00A 0000 0000
21:55:07: SHB 7430: 01 05.24/06.00A 0000 0000 M: 09 00.00/00.00A 0000 0000
21:55:09: SHB 7430: 09 05.28/06.00A 0000 0000 M: 09 00.00/00.00A 0000 0000

Any ideas?

Try loggin into the pi with PUTTY and type

screen -r twcmanager

That will show you the full trace of debug messages. It may be that for some reason the command to stop the car charging did not work. Also check your schedule from the web page. Remember the green energy tracking will not happen outside fo your scheduled power zone. Mine in set to 00:00 to 07:00 at 32A every day, with Track green energy selected for non-scheduled power.
 
yeah it was in the screen i was getting that debug info, there is nothing about web calls or anything, i am on debug 7 so may change that to higher and see if there is anything else; however thought i'd wait a few more hours for the sun to shine to see what it does

Try this. I was able to repat the problem. It was 7pm here. If I changed my scheduled time that was 00:00 to 07:00 so that it was 16:00 to 07:00 it immediately started the car charging which is not what we want. So it's dark here and so was going from the minimum 6A offered to the charger up to the 32A. The modified code in TWCManager that starts the charging has been modified to use a new trackingGreenEnergy flag so it will only start charging when we're in the green energy zone.

Another mod in here is that when the Powerwall is at 90% and I'm exporting 4A of power, it makes economic sense for me to use 2A of grid energy to supplement that and charge the car at 6A.

Look for maxGridUsageFor6ACharge and powerwallBatteryMinPercentageForGridShare if you want to disable that. Setting maxGridUsageFor6ACharge = 0 will do it.
 

Attachments

  • TWCManager-with-Powerwall.zip
    47.7 KB · Views: 103