The day has arrived..
The veil will be lifted...
The secrets of the RS485 TWC (aka HPWC II) load-sharing protocol can now be found at
TWCManager.
About 30 mins before the sun got too low, I got it scaling the car charger power to solar panel output. Here's a graph from my
TED monitor:
View attachment 259639
Each dot is a minute of averaged power use and solar is negative because it's generating power instead of using power. I started car charging at the red line. The car is not taking quite as much power as the panels are producing because the TWC or the car are being overly conservative, drawing only 2.7A when told they can draw 3.51A (for example). The car itself stops charging when the limit drops below 1A but TED stopped reporting power use somewhere around 1.3A. That's just a limitation of the TED "Spyder" sensors.
I did find one issue that may have no great solution:
If TWCManager is stopped or crashes for more than maybe 30 seconds (haven't timed it exactly), the slave wall charger starts blinking red 4 times and stops charging the car. The car will soon say "Charge cable fault" on the smaller display.
When TWCManager is re-started, the TWC light turns green and the car stops showing any error, yet the car will refuse to charge until you re-plug the charging cable. In this condition, the TWC reports protocol state 08 when TWCManager reconnects, then reports state 03 after the manager gives it a new charger power limit. State 03 seems to mean the car refuses to charge (ie it enters state 03 if you hit "Stop charging" on the car's UI). Yet if you press "Start charging" on the UI, nothing happens. No error, no feedback, and the button still shows "Start charging". Car shows 0/10A available for charging (or whatever the max charge set by TWCManager is) but won't charge until you unplug and replug.
I plan to try some things like just waiting a long time, but I'm not sure there's a solution other than to have TWCManager email or text a warning telling you to re-plug. Of course depending how it's crashed, that may not be possible either. Usually what crashes in a raspberry pi are the USB devices rather than the CPU, though since wifi is USB it may crash and not be able to email. I think they may have worked those problems out by now but I'm still using older USB-crashy firmware on original a Pi 1B.
Other than problems with USB wifi locking up, I've run home automation on a Pi with an ethernet connection for a few years and I don't remember it ever locking up. It runs a USB Insteon controller that has also been trouble free (other than I had to replace its crappy capacitors once which is a common problem).
Wow, I just noticed they've come out with
Pi Zero W with built in wifi and a small enough form factor it has some hope of fitting in the TWC in an insulated case. And only $10 frickin dollars? Holy cow... That's cheaper than an FTDI RS485 cable!
The problem is powering the pi. I don't know if it's safe to steal 1 to 2A of power from a 5V power supply in the TWC, or if it even supplies 5V power. If not, the Pi plus a "wall wart" power supply could be housed in the "spacer" adapter that comes with the TWC and fits behind it. 120V power for the wall wart could even be taken from the TWC's main power. That probably breaks electrical codes, though possibly not as long as all wiring remains in the fire-resistant enclosure.
Anyway, as long as TWCManager doesn't stop running, I've left it telling the charger there's a 0.01A limit for up to 2 hours so far and when I change it to 10A the car starts charging within ~30s even if its screens have turned off. I'm doing a test now leaving it running all night to make sure it starts charging in the morning once sun hits the solar panels.