jasonacox / pypowerwall

Python API for Tesla Powerwall and Solar Power Data
MIT License
139 stars 26 forks source link

Tool script set_mode.py error #41

Open jasonacox opened 1 year ago

jasonacox commented 1 year ago

Raised by user:

The script set_mode.py has been working but in the past few days it has failed. Here is the me what I see.

Traceback (most recent call last): File "C:\Users\dgpet\Documents\Projects\Python\Powerwall\set-mode.py", line 299, in mode = data["operation"] KeyError: 'operation'

I have dumped the ‘data’ though I don’t have a copy of successful one to compare too.. Anything I can do to help?

Confirmed that the data payload no longer contains 'operation' key.

jasonacox commented 1 year ago

The API or the way the teslapy mapps the Tesla API response has changed. The operational mode for the Powerwall used to be visible in the get_battery_data() which this script used but is no longer visible there. It does show up at the site configuration payload at api('SITE_CONFIG'). I adjusted the script to use that as the source for the operational mode (see commit change).

You can pull the latest changes from set-mode.py.