-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tesla Gen 3 Wall Connector (WiFi) #20
Comments
Looking at the TeslaMotorsClub forum, the author of this repo (WinterDragoness) has a Gen 3 unit and is investigating. However, there's no obvious solution so far...
Copied from the TMC forum. |
Please add V3 Support. You can access the data via the API: http://"ipaddress"/api/1/vitals
http://"ipaddress"/api/1/wifi_status
http://"ipaddress"/api/1/lifetime
http://"ipaddress"/api/1/version
Sure will be your first beta tester. |
I'm not convinced there's a big value add to support logging data without being able to control the charging. Since you already have a nice REST interface, I'd just push that directly into OpenEnergyMonitor/HomeAssistant/whatever and call it job done, at least until we have some way to control the charging. |
At least a new firmware upgrade to 21.29.1 has power sharing api calls. So maybe twc manager could use that to control gene live. But first api should be traced for handshakes and messages and then twc gen3 emulator could be build. |
Just got an gen3. Also i would like to mange the gen3 you must connect to the "private" tesla network. In your own network you see an /public page (and can access the api). |
@Darosnl Can you give more details on what is accesible on each chanel ? |
Could you explain what you need or what i can do? |
Hi, |
I'm happy to help but if you can point me to some tooling i can use. |
Hi, |
Would the TWC access point stay up, if you connected and kept the connection alive forever? I.e. connect to TWC SSID, and send a get request for the config page once per minute or so. |
Hi, Good discussion you have going on here. I recently bought gen3 as well. My initial idea was to use an openwrt wifi router with 2 bands that would forward the requests to the dedicated wifi network, that way the public part of API would be always accessible. Of course, one needs to first reverse engineer the load balancing protocol to control the charger ;). |
This is really interesting. I have a gen3 and we’re looking to have an enphase solar system installed. Ideally I’d monitor the enphase via API calls and enable 6A charging to the car if the correct amount of excess solar is detected. @bgrigoriu did you have any luck or success with anything? My initial train of thought is a device which is connected to the wall charger Wi-Fi hotspot and just posts charging rate updates as the solar capacity becomes available. I guess there is also the issue of telling the car to stop/start charging too but 1 hurdle at a time! |
@petekelly |
@petekelly, if you have a tesla only, you can set the amperage via the vehicle api. I installed a twc3 in my cabin yesterday and made a really ugly python test script in home assistant in order to set the charging rate based on whats available on each phase. Tends to work fairly well, but don't know the rate limits on the api. Would be better to do it to the twc directly though since it would work with all vehicles and less things that could break along the way. https://gist.github.com/mattiasottosson/7deb5db74d561dcaee7ec331679922e7 |
Hi, |
I use a cheap wifi router with custom OpenWrt firmware. |
Yes Tesla only (albeit it's not arriving until Saturday...). This was my plan actually, to
|
I tried this a few years ago. I found that the car stopped responding to on-off commands after only a handful per day. It might be different now, and I don't know if the same limit is applied to the new API for setting Tesla charge current. If I were to do it over again I would use the car's schedule to enable charging during typical solar hours and modulate the charge current with the TWC signal (I still have Gen2). |
I forget exactly what my setup was. I think it was OpenHab using the Tesla API to control the car's on-off, and TWCManager on a Pi Zero controlling the Gen2 TWC amps setting, and OpenHab using HTTP calls to TWCManager. I have a Brultech GEM power monitor feeding OpenHab with the solar and house consumption data, which is why OpenHab needed to be the center of the system. |
I ran it for one night now and it seemed to be working just fine. You can actually set the amps to lower than 6 through the api. It even seems to accept 0 as a value and pauses the charging (but the actual charging session is still active). |
@petekelly It looks like you would use homeassistant. Nevertheless I would like on "offline" version with limit imposed by the TWC better: we could have a higher rate of control and easier support of multiple cars or other brands. However, the minimal charge rate will probably be limited to 6A. |
@KastB Based on your work I hacked together a version without MQTT / HomeAssistant support (neither of which I have in my setup) here: https://github.com/realdadfish/addon-tesla-pv-charging - it's not final yet and not tested, just work-in-progress. The plan is to have this running standalone on my home server. The problematic part will probably be that the vehicle is woken up each time I need to query the state of charge to determine whether or not to charge it and if so at what amperage. At night the whole process can be stopped (when plugged in) because solar_power is zero, but at day time this means the car never really gets to sleep, especially when it's not charging, and this will likely draw power. I don't know how Teslamate gathers the current data, but I'd guess it uses the Tesla API internally as well to query it, so I don't actually know how big of a problem this becomes. |
@realdafish Probably there is a difference. There is some logic which decides when to stop polling/use the streaming api so that as little data as possible is lost while sleep mode is not prevented. Simply polling is probably not the best solution (probably ~300W higher consumption during the times sleep is prevented) https://docs.teslamate.org/docs/faq/ |
Btw gen3 also supports rs485 power sharing . Maybe this could be adapted for that bus? |
@jonasman are you sure there is full rs485 support for v3? I only read about V2 - do you have a link to detailed information? My solution to control the charge current on the vehicle side broke due to restrictions on the API for Tesla cars. Does anybody have any experience with this API and it's capabilities/limitations? |
@KastB that’s how neurio is connected to the wc3: |
Nice, if someone can track down the meter model, that should lead to the protocol specs (probably Modbus), and then the meter can be faked. Looks like this is the unit: |
I would appreciate it if someone else could take a look at the data. |
Exellent job @frizzby :) Serial number and such are probably read by WC3 when provisioned. So we should record the data from the installaion phase. I assume that the WC3 will not just blindly ask the data - it first reads the model and serial to verify it really is Neurio. Not really done decoding yet, but the first hunch is that it could be RTU Framing. Three ones at the begining looks like 3.5 character start, the rest would be missing from capture.. Some documentation here: |
I didn't have time to dig into it today. |
@frizzby Great work, thank you! I had a second look into it and wondered if we really can expect so little data: |
Thanks everyone for taking time to look at it! @KastB, aaah, yes, I think you're right – I'm not using the right baud rate. For some reason I assumed (incorrectly) that since I'm getting any data it means the baud rate is right. Now that I think about it that assumption makes no sense. I don't have an oscilloscope, but I do have a logic analyzer. Can it be used to determine the baud rate? In my understanding it should be possible if used with rs485-TTL converter, not directly from rs485 line. Can someone confirm? Meanwhile, I'm going to just try different baudrates to see what results it will give. |
Disconnected and reconnected the meter. 115200 baud rate.
|
This is how it looks with 115200 with low vs high load https://docs.google.com/spreadsheets/d/1KzO4i0zNmd9PlaaSO53OKI9kKUAVvXDLb3r9rOAyFCA/edit?usp=sharing |
looks like modbus RTU, but all the responses have an extra 107 bytes after the frame convert to hex and use a tool like https://npulse.net/en/online-modbus (enter hex into Hexadecimal Translate, hit enter etc) request as hex 01030088000A45E7 CRCs seem to check out , not sure what the extra 107 bytes are, not timestamps that I can see First few bytes of each extra data portion: |
here is some python that reads your binary and decodes it. seems they are 32bit floats, and match your readings ? https://gist.github.com/frankenbubble/33d14a01c65c80f42e0f92a09127a888 using the raw data in your sheet, putting it data.txt for the script I get this output Line 1: CRC (received): E745 Response: your sheet indicates its for reading 86W and 380W, which looks like a close match to the first 2 32-bit floats in the response for the page indicating 2000KW , script says 32-bit Floats: [1985.830322265625, 2206.439697265625, -0.03160013630986214, -0.1267232745885849, -52.32987594604492] |
Nice script. The current guess is: the 32-bit floats are Power/Current with clamp 1,2,3,4. |
This script give as csv to show the Power/Current values: |
@frizzby I guess your goal should already be achieved. For us/me there are still 2 or 3 open points:
|
re 1. The doc for the meter say it has measurements for Real Power, Reactive Power, Energy, Imported/Exported, RMS Current, |
@frizzby It would be great if you could 3 more tests:
|
Thanks everyone for the help! Nicely done decoding it!
Btw, my wall connector is Tesla Universal Wall Connector, not TWC3. But I think they are the same software-wise. |
Thank you very much for your efforts doing those recordings! |
Is it clear whats needed on the network side towards the WC3 to enable and configure the load balancing without an actual Neurio meter? |
Unfortunately I didn't have time today to do the recommission, and tomorrow I leave for vacation for a few weeks. I have some vested interest myself in figuring out the rest of the modbus communication, so I will recommission and record the comms when I'm back home. |
Protobuf mentioned above is an excerpt from the communication between TWC and Tesla One app with the phone connected to the AP the TWC is broadcasting. Once we're able to emulate the meter TWC should automatically detect the meter and you would use Tesla One app to configure CTs as Conductor and set the current limit. You can see how that looks in the video and in the pdf. I didn't see any changes in |
Here they have a reactive power for each clamp |
afaik, the wall chargers don't expose any data like this via the 'normal' internet wifi, although you can get some different data via the built in 'setup' wifi, but that still goes asleep after some minutes. I suspect the 5th float is indeed (total) reactive power, as it make sense with the AC turning on it becomes a high positive value, otherwise a small negative value. I also suspect if we queried the meter at other addresses we would get more data, and we might see that happening in the setup communications. it would be interesting to see what serial requests come from the TWC3 during setup as it looks for a meter (what address it queries and with what codes etc), |
I hooked up my twc for serial, and notice it regularly outputs a modbus request, adding here as information, i assume a probe for a meter. Binary: 00000001 00000011 10011100 01000010 00000000 00000110 01001011 10001100 |
I can confirm that I get exactly the same data. So getting a trace from power on from someone with a Neurio connected would help us get one step further hopefully. |
Hi, any news on this? |
Need @frizzby or someone with the hardware to post more serial data |
Attached are two files:
|
@frizzby: welcome back, I hope you had nice holidays. For the provisioning/resetting: Those seem to be ASCII Strings: To register this seems to be the register: Raw:3078303030303034373134423035363836310000312E362E312D5465736C6100FFFFFFFFFFFFFFFF3031322E3030303230412E480000FFFF3930393534005641483438313041423032333100FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF30343A37313A34423A30353A36383A363100 Maybe/Probably 9c420006 is just a magic string. 00010037 holds different Blocks.
|
The two files seem identical, but i think it's ok as it's probably the commissioning one. I put a simple html page together that makes parsing the binary easier. https://frankenbubble.github.io/modbus_decoder/index.html , it looks like ~20 gets of data at 2 addresses, is probably the metrics. and 2 at 2 other addresses is the setup (I'm guessing). My TWC sends out the requests to address 0x9C42, and it looks like the response is the manufacturers name. the requests to 0x0001 seem to have the firmware and other information like @KastB says. some of it looks different to your screenshots earlier such as VAH4810AB0231 looks like it previously in you data was VAH4770AB5642 . @KastB maybe the meter number 52506 is now 90954 |
Is there anyone interested in adding support for the Tesla Gen 3 Wall Connector (WiFi), released in Jan 2020? I see two steps:
First, the API would have to be reversed -- possibly some kind of web endpoint accessible via simple GET/POST requests, given the browser based breaker/amp selection. Or perhaps there is telnet/ssh access. Currently, there is no power sharing logic enabled, so there is no device to device traffic to watch over the network with Wireshark.
Second, the core logic for green charging from this repo should be ported over to use the new API.
Currently I don't have access to the Gen3, otherwise I'd give this a shot.
The text was updated successfully, but these errors were encountered: