Replies: 25 comments 178 replies
-
I'm working on a protobuf decode and encode tool to help with the investigation. I have the decode.py tool started here: https://github.com/jasonacox/pypowerwall/tree/main/tools/tedapi # Download code
git clone https://github.com/jasonacox/pypowerwall.git
cd pypowerwall/tools/tedapi
# Build python bindings for protobuf schema - tedapi_pb2.py
protoc --python_out=. tedapi.proto
# Decode payload
python decode.py <filename> I'm not a protobuf expert, so I'm pretty sure my work could be improved. I welcome any gurus who want to contribute... 😁 |
Beta Was this translation helpful? Give feedback.
-
How was the existing tesla.proto file generated? The messages here seem to be an extension of those proto definitions, e.g.:
|
Beta Was this translation helpful? Give feedback.
-
Tools for tedapi API TestingI created test.py and decode.py scripts to help research tedapi. Both require that you are connected to your Powerwall Gateway WiFi. See here. test.pyThis script (test.py) will prompt you for your Gateway password (on the QR sticker) and will proceed to:
decode.pyThis script (decode.py) is a simple decoder for tedapi probotbuf binary payloads. It will decode the file you specify. This is useful when using curl to download the payloads. Install# Download
git clone https://github.com/jasonacox/pypowerwall.git
cd pypowerwall/tools/tedapi
# Test Script
python test.py
# Decode Script
python decode.py response.bin |
Beta Was this translation helpful? Give feedback.
-
Thanks for the work so far. I noticed something interesting in the "config" output "strategy": {
"control": "lps",
"forecast_method": "exm1dmc",
"forecast_range": 2,
"forecast_output": { "to_cloud": true },
"pv_forecast_method": "exmMaax",
"TOU_mode": "economic"
}, Since I'm on Time-Based Control (technically the Tesla Energy VPP in Australia), I think this is the first instance I've seen where the "forecasting" aspect is exposed anywhere. I'm not sure |
Beta Was this translation helpful? Give feedback.
-
Do I need to configure my raspberry pi to log into my gateway access point or do the scripts do that for me? I’m guessing |
Beta Was this translation helpful? Give feedback.
-
finally got test.py to run, don't really know what i did... python test.py``` eric@raspberrypi:~/Downloads/pypowerwall/tools/tedapi $ python test.py Tesla Powerwall Gateway API DecoderConnect to your Powerwall Gateway WiFi. Fetching Configuration from Powerwall... Fetching Current Status from Powerwall...
|
Beta Was this translation helpful? Give feedback.
-
i see my neurio data at bottom: Tesla Powerwall Gateway API Decoder
|
Beta Was this translation helpful? Give feedback.
-
can we add a switch in the config file for local "192.168.91.1" and start mining neurio data from the TEG locally? :) |
Beta Was this translation helpful? Give feedback.
-
On RPi, doesn’t seem it matters how you set up the two networks, either wired and wireless; or both wireless. |
Beta Was this translation helpful? Give feedback.
-
Very early, but I have string data again! Still working on the rest. Pulled a bunch of stuff from the android tesla one app, as well as definitely lots of great insight here. Does require some way to access that internal wireless from the proxy. https://github.com/ygelfand/go-powerwall and similarly named docker hub image. Listens on :8080 and attempts to emulate the /strings endpoint at /api/v1/strings, so in theory should only need to add
to your telegraf config to test. |
Beta Was this translation helpful? Give feedback.
-
Potential addition to pypowerwall library to help support this investigation: jasonacox/pypowerwall#73 It would be interesting if this works for Powerwall 3 owners and could be a path to get local data access as well as the extended vitals data lost by the recent firmware upgrade for Powerwall 2/+ owners. This would be a "high degree of difficulty / effort" add-on for the project as it would require someone setting up a multi-homed server (RPi, etc.) that connects to Gateway WiFi as well as your LAN. Thanks to @ygelfand's great work, there is good indication that this API is stable. |
Beta Was this translation helpful? Give feedback.
-
Can the fleet api code run ont the same RPi as powerwall dashboard? |
Beta Was this translation helpful? Give feedback.
-
I tried
on my Raspberry Pi 4, but received "Error: Nexthop has invalid gateway". It appears this is because my PWD host is on 192.168.0.x and my TEG is on my IOT network at 192.168.2.x. I'm running OpenWRT, so I'm going to try the router-based option that was suggested above, but I wanted to post this in case anyone has a Linux-based solution or failing that, to make sure the others are aware the host-based solution may not work with the TEG on a different subnet. EDIT: I had to add a route on the PI using "sudo ip route add 192.168.91.0/24 via 192.168.0.1" and add static routing on my router to get it to connect from the PI. EDIT 2: I just realized why I needed the extra route on the device. For whatever reason, my PWD stack's "powerwall-dashboard-default" network was using IP subnet 192.168.80.0/20, which includes 192.168.91.x. I shut down the stack, deleted the network, then recreated the stack. The new network was created on 172.18.0.0/16 which doesn't conflict with the gateway IP. All of my other docker networks are in 172.x. I'm not sure what accident of history had PWD using 192.168.80.0/20 In OpenWRT: As with the example @BJReplay posted, I didn't need to enter a gateway in the last field, but I had to select my IOT network as the interface in the first field. |
Beta Was this translation helpful? Give feedback.
-
v4.4.0 Released - Local Vitals and FleetAPII have pushed v4.4.0. Here are the steps to onboard the new version:
Please report any issues (open issue if you can). |
Beta Was this translation helpful? Give feedback.
-
@jasonacox - this is awesome. Forgive me if I missed it but do I have to access 192.168.91.1 through the gateways Wi-Fi connection or can I set my pfSense router to use the Ethernet connection to route this IP through? |
Beta Was this translation helpful? Give feedback.
-
Just wanted to chime in - this is working like a champ!!(PW2 with non-Tesla solar) Thank you so much to Jason and everyone else who has put so much time into this project! |
Beta Was this translation helpful? Give feedback.
-
I'm attempting to add Powerwall 3 local API support for pypowerwall. I'm looking for Powerwall 3 owners who want to test: You can also test the docker container (should be compatible with all systems) standalone or in the Dashboard. As mentioned, to see
|
Beta Was this translation helpful? Give feedback.
-
New user here. Just had a system installed with 3 PW3’s. All running OK in cloud API mode (running on a Ubuntu VM under Proxmox) but I’d like to get the detailed data and I’m willing to help test out PW3 support. One question, with 3 PW3s will I just connect to the primary unit (which I believe acts as the master) or do I have to connect to all of them separately? I have the IPs and passwords for all of them. |
Beta Was this translation helpful? Give feedback.
-
Success - I think. Set up a new VM so it was a clean install. Added a static route to 192.168.9.1 and installed selecting option 4 in setup. System connected and asked for the password, so that all seems good. I now see the Frequency and Voltages graphs populated as well as some extra 'Alerts'. However, 'No data' in Powerwall Capacity, String Voltage, String Current, String Power, or Inverter Power sections. Is this as expected? Or is it just because it's night time and dark! :-) Is there any raw data I can provide to assist? The /help page is as follows: ` pyPowerwall [0.10.6] Proxy [t63]
|
Beta Was this translation helpful? Give feedback.
-
Did some packet sniffing while using the Tesla One app and it looks like it makes individual POST calls to endpoints on each PW3 with this format:
The JSON data sent back from these calls contains individual string voltages and currents. For example. One packet I captured contained: |
Beta Was this translation helpful? Give feedback.
-
Just as an FYI, I got this working in the first place by adding a route to 192.168.91.1 in the Linux VM where I was running the Docker. Today, instead, I added a static route in my router running OPNSense so all machines on the network can see the PW3, and it seems to works fine. Also don’t have to worry about the route getting lost. |
Beta Was this translation helpful? Give feedback.
-
Small update. I've noticed that the backend has lost contact to the tedapi 192.168.91.1 address a couple of times. The route is apparently still there but the dashboard can't connect and a manual ping also fails. I have to ping the route gateway (the DHCP address of the host PW3) to wake it up again. Once I've pinged the gateway, then the direct ping to 192.168.91.1 works again. Strange... This happens both with direct routes in the Linux host, and with a static route set up on the router. Coud be something in my system, or could be something in the PW3 - not sure which. |
Beta Was this translation helpful? Give feedback.
-
What's the status of getting PW3 String Data and displaying it on the dashboard? Is there anything I can do to help get this working? |
Beta Was this translation helpful? Give feedback.
-
The specific individual string voltage and current data for all 6 inverters is retrievable through the "ComponentsQuery" call. This is a one PW3 at a time call with the din in the POST request. It isn’t in the call above as that has a max of 4 sets of data. PW3 has 6 inverters so uses a new call. Unfortunately you can’t get it all at once, you have to query each PW3 separately. |
Beta Was this translation helpful? Give feedback.
-
Question: In An other question: |
Beta Was this translation helpful? Give feedback.
-
With recent Firmware Upgrades (e.g. 23.28.1) the Tesla Gateway portal now instructs the user to install and use the Tesla Pros app to manage the system. As discussed in 367 there are ways to bypass these screens to get to the classic portal interface. The new Powerwall 3's do not appear to have a user web portal and instead use only the Tesla Pros app (see PW3 support issue #387).
So far, I have discovered the following:
GET /api/status
This works with Powerwall2/+ systems but may not work for Powerwall 3.
Cookies - not sure if these are needed but they show up:
Curl Simulation
GET /tedapi/din
This is similar to the above but did not show up in the packet captures I conducted. It uses basic auth that appears to be: Tesla_Energy_Device:GW_PWD where the GW_PWD is the password near the QR code on the Powerwall that you scan with the Tesla Pros app.
curl -v -k -u "Tesla_Energy_Device:GW_PWD"" https://192.168.91.1/tedapi/din
It only returns a simple string that contains the DIN:
POST /tedapi/v1
This appears to be the workhorse function. It uses basic auth that appears to be:
Tesla_Energy_Device:GW_PWD
where the GW_PWD is the password near the QR code on the Powerwall that you scan with the Tesla Pros app.Payloads are binary Protocol Buffers (protobufs) but we don't yet have a schema definition file. You can use
protoc --decode_raw < v1_request
to decode the raw response.Sample transaction
There are different types of request sent. One is for
config
which gets a payload that contains the configuration of the Powerwall. Another is forquery
that gets current data (e.g. systemStatus, realPowerW, voltages, frequencies, etc.).CONFIG Example
Raw File
v1_request
used for the POST that appears to be asking for config details. This is theprotoc --decode_raw < v1_request
output:Curl Simulation
An example response (
v1.json
) payload from the one above (protoc --decode_raw < v1.json
) - Showing system config data which comes through in JSON blob (removed to protect the innocent):QUERY Example
Raw File
v1_request.large
used for the POST that appears to be asking for query details. This is theprotoc --decode_raw < v1_request.large
output:An example response (
v1.json
) payload from the one above (protoc --decode_raw < v1.json
):Researchers and Credit
Beta Was this translation helpful? Give feedback.
All reactions