mlowijs / tesla_api

Lightweight Python API client for the Tesla API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Endpoint for Meter Aggregates

scienceintheshed opened this issue · comments

Would like to access the same endpoint through this API as is available via "Powerwall_ip_address/API/metres/aggregates"...cant' find it in energy.py nor have I been able to re-create.

I don't personally own a Powerwall but will see what I can do, thanks!

Just solved it about an hour ago but need to wait until tomorrow to verify readings...

Cool, is it something you can create a PR for?

New to github so I will have to work out how to do that...there are quite a few more endpoints that I have now found so I will look at including all of them.

scienceintheshed: I wrote the energy API based on mlowjs code to access Tesla cars via the cloud. So the energy API goes via the cloud rather than access the powerwall directly since I was unable to change settings by accessing the powerwall directly. I have, however, been able to get access to aggregate meter data directly from a Powerwall 2 - see: https://github.com/swm11/homeautomationegs/blob/master/powerwall/dumpPowerwallDaemon.py

Thanks for that...I can see your fork now...

I have been able to access the meter aggregates directly from the Powerwall wlan address for some time using he endpoints at https://github.com/vloschiavo/powerwall2. Problem was it tended to lose connection on a regular basis and needs to be manually reconnected, that's why I'm wanting to do it from the cloud.

Modifying your energy.py code with;

Helper function added by scienceintheshed.

def get_solar_power(self):
    return int(self.get_energy_site_live_status()["solar_power"])

gives me exactly what I want. I have a few more endpoints that I've added to my local copy of the energy.py code. Happy to share once I understand github a bit better.

That's interesting - I occasionally see my Powerwall 2 disconnect, but my logging script retries a few times and it always appears to succeed.

@scienceintheshed I added your helper method and will release 2.0.1 to PyPI soon! Be aware we migrated the package to be async, so you'll have to await that method.