Telsa Powerwall 2 install in Australia - Accessing Data
The Goal
Access the house/battery/grid/solar data from my new Telsa Powerwall 2 install to use in my home automation and dashboards.
This was pretty straight forward to do, which makes a nice change from accessing my Envoy data which was a lot more complicated.
Install Details
I've just had this installed on 26 Jun 2019 on the Gold Coast in Australia.
- Telsa Powerwall 2
- Backup Gateway 2
- 3 phase power
The Steps
1. Accessing the local Gateway
The Gateway 2 supports a cellular, ethernet and wifi connection.
My installers had only setup the cellular connection, so I needed to setup the wifi connection.
If the Gateway 2 is using you home wifi already you should be connect directly to it on your home network.
Setting up the Wifi connection
So I needed to connect the gateway to my home wifi.
I used my mobile phone to do this.
- Connect to the Gateway's wifi point TEG-*
- I was only prompted for a password - which is displayed inside the Gateway 2 unit, at the top of the technical detail
- Check you assigned IP Address, mine was was 192.168.91.123
- Use your browser and go to the first address in this IP range, e.g. mine was 192.168.91.1
You should see a screen like the one to the right.
Setup the Wifi Network
- Click on the "Network" option on the screen.
- Click on "Wi-Fi" and follow the steps to connect to your wifi network
- Once done you should now be able to connect and login to the assigned local IP Address. You should be able to find this on your wifi router (assuming you use DHCP).
- It was a cryptic name, mine was: 1152100-04-E--TGXXXX
2. Getting Data
Ok you should now be able to access the Gateway 2 locally, and login.
The Gateway 2 has a number of API's that are available. There is some good documentation here:
- Let's check API access, with a logged in screen, change the URL to:
https://<gateway_ip_address>/api/system_status/soe
You should see something like the following:
{"percentage":5.075864226497732}
- You can try some other useful APIs:
- /api/meters/aggregates
- /api/status
- If you want to automate access you can connect using BASIC authentication and call the APIs, here's a python code snippet (untested).
TESLA_USERNAME = Customer email address TESLA_PASSWORD = The password you set
import requests import logging import json logger = logging.getLogger('tesla_data') #Login, skip SSL certificate verification (verify=False) url = TESLA_URL+'/basic' # e.g. https://192.168.1.51/basic (I have DNS setup and use https://tesla.local) session = requests.session() session.get(url, verify=False, auth=HTTPDigestAuth(TESLA_USERNAME, TESLA_PASSWORD)) #Get data url = TESLA_URL+'/api/meters/aggregates' resp = session.get(url, timeout=10, verify=False) if resp.status_code == 200: json_data = json.loads(resp.text) else: logger.error('Failed to retieve tesla data. Error code [%i]' % resp.status_code) logger.error(resp.text)
Comments
Post a Comment