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.
  1. Connect to the Gateway's wifi point TEG-*
  2. I was only prompted for a password - which is displayed inside the Gateway 2 unit, at the top of the technical detail
  3. Check you assigned IP Address, mine was was 192.168.91.123
  4. 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.

  1. Click on login, and you'll see the screen to the right.
  2. Choose "Customer" as the "Login Type".
  3. I entered my email and chose "Change or Forgot Password"
  4. I selected "Forgot Password" and you can follow the steps to set your password
  5. Having done this you should be logged in to the Gateway

Setup the Wifi Network

  1. Click on the "Network" option on the screen.
  2. Click on "Wi-Fi" and follow the steps to connect to your wifi network
  3. 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).
  4. 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:

  1. 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}

  2. You can try some other useful APIs:
    • /api/meters/aggregates
    • /api/status
  3. If you want to automate access you can connect using BASIC authentication and call the APIs, here's a python code snippet (untested).
  4. 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

Popular posts from this blog

Experience with Optus 4G wireless broadband

Port Forwarding on Optus 4G B525 router

Huawei B525 Python API