This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Help with Tesla Powerwall API V3
#12
I've implemented the above and can report back that it's working!

The IP address in the URL above should be replaced with  'https://owner-api.teslamotors.com'


I'm still having a little trouble capturing the energy_site_id .. how does one traverse the returned table with a numeric (1) table name.


https://owner-api.teslamotors.com/api/1/products  returns data in the form 

Code:
* table:
[response]
  * table:
  [1]
    * table:
    [site_name]
      * string: Home Energy Gateway
    [energy_site_id]
      * string: xxxxxxx
    [id]
      * string: xxxx-xxx-xxxx-xxxx


which I'd normally process as follows

Code:
mydata = json.pdecode(table.concat(resp))

assetSiteD = mydata.response.1.energy_site_id


however the table name '1' in the above errors when I try to save the script

Code:
Lua syntax error at line 200: malformed number near '.1.energy_site_id'


How do I reference the value with a table name of 1?


Kind Regards
James
Reply


Messages In This Thread
Help with Tesla Powerwall API V3 - by jamesng - 21.04.2021, 14:18
RE: Help with Tesla Powerwall API V3 - by jamesng - 29.04.2021, 12:29

Forum Jump: