Comments (15)
For me as well. It seems that the teslamotors api is no longer available under the given URL.
from teslapy.
Same here, my script using get_battery_data failed last night. Looks like the endpoints starting api/1/powerwalls/
no longer work :(
However I have had success getting the Powerwall data I want by swapping to use api/1/energy_sites/{site_id}/site_info
, followed by api/1/energy_sites/{site_id}/live_status
, calling the first is necessary for the second API call to return fully populated data. These endpoints are in endpoints.json as "SITE_CONFIG" and "SITE_DATA" respectively, and to access them I have added routines to the battery class in _init_.py
as follows
def get_site_info(self):
""" Retrieve current site/battery information """
self.update(self.api('SITE_CONFIG')['response'])
return self
def get_site_data(self):
""" Retrieve current site/battery live status """
self.update(self.api('SITE_DATA')['response'])
return self
from teslapy.
@mquilling0 it looks like this works:
battery.api("OPERATION_MODE", default_real_mode="self_consumption")
There seem to be two endpoints for changing operation mode. set_operation
uses the one named BATTERY_OPERATION_MODE
in the endpoints.json
file, which points at api/1/powerwalls/{battery_id}/operation
. This is the one that no longer works. OPERATION_MODE
, on the other hand, uses api/1/energy_sites/{site_id}/operation
, which does still work. Presumably set_operation
needs to be changed to use this endpoint.
from teslapy.
@JuhaSeppa i have a very specific need that neither mode can achieve alone
export from sun up to 9am
charge from 9am to 4pm
export from 4pm to 8pm but dont drop below 65% (we rarely use the grid but this is the only time we might - which gives us the ability to be awake and limit usage during an outage)
use battery overnight (but turn off any appliance if % drops below 10% - rarely happens)
i can achieve this exact profile and rarely use any grid energy + maximize my energy export credit. our yearly bill is negative.
using time based control it does all kinds of dumb stuff and pulls a few kW/day from the grid.
from teslapy.
I don't own a powerwall, so I cannot test it, but commit 50bdbfb should fix this, based on @DaveTBlake's code.
from teslapy.
I've been fetching Tesla Powerwall power timeseries data, which stopped working via the api/1/powerwalls/
path. I was able to retrieve the same data from the 'CALENDAR_HISTORY_DATA' api endpoint with kind='power'
and date_end='time in isoformat'
arguments to get the data I wanted.
from teslapy.
I am having the same issue but for setting operation mode - any workaround for this?
battery.set_operation("self_consumption")
410 Client Error: https://powergate.prd.sn.tesla.services:443/api/powerwalls/{xxxx}/operation => Gone for url: https://owner-api.teslamotors.com/api/1/powerwalls/{yyyy}/operation
from teslapy.
I am having the same issue but for setting operation mode - any workaround for this?
battery.set_operation("self_consumption") 410 Client Error: https://powergate.prd.sn.tesla.services:443/api/powerwalls/{xxxx}/operation => Gone for url: https://owner-api.teslamotors.com/api/1/powerwalls/{yyyy}/operation
Depending on what you want to achieve, you might be able to realise the desired functionality by keeping the operation mode unchanged and just manipulating the backup reserve percentage.
I’ve implemented charge (backup = 100%), standby (backup = current charge level from the local API) and self consumption (backup = whatever percentage you want to keep in reserve for a power cut) this way while keeping mode as autonomous. Overnight cheap electricity is configured to the Powerwall and I use these operations only when I want to achieve something else.
from teslapy.
thank you @j4mie that worked!
from teslapy.
I presume at some point TeslaPy will be updated to reflect the change that Tesla have implemented.
Any ideas as to when?
Thanks to the developers, TeslaPy is a life-saver!
from teslapy.
battery.api("OPERATION_MODE", default_real_mode="self_consumption")
still gives me the 410 error unfortunately.
tesla = teslapy.Tesla(email_address)
battery_list = tesla.battery_list()
battery = battery_list[0]
battery.api("OPERATION_MODE", default_real_mode="self_consumption")
#battery.set_operation('self_consumption')
battery.set_backup_reserve_percent(10)
from teslapy.
@tdorssers tested and works, thx!
from teslapy.
I don't own a powerwall, so I cannot test it, but commit 50bdbfb should fix this, based on @DaveTBlake's code.
Thank you so much, I've also tested it and got it working.
from teslapy.
@tdorssers Thank you! This does indeed fix the issue. The schema changed a bit for battery
so anyone using this to read battery data will need to a adjust (example).
Test:
# Pull latest TeslaPy - use latest until TeslaPy releases a new PyPI package
pip install -e git+https://github.com/tdorssers/TeslaPy.git#egg=teslapy
# Pull latest set-reserve.py
wget https://raw.githubusercontent.com/jasonacox/pypowerwall/main/tools/set-reserve.py
# Test
python3 set-reserve.py --read
READ: Current Battery Reserve Setting: 20% for 2 Powerwalls
from teslapy.
using time based control it does all kinds of dumb stuff and pulls a few kW/day from the grid.
@mquilling0 doesn't it just!!!
I don't own a powerwall, so I cannot test it, but commit 50bdbfb should fix this, based on @DaveTBlake's code.
Thanks @tdorssers , sorry I didn't get my act together and raise a PR just left code suggestions. I'm very grateful for everything you have done making the API avialable, my Powerwall would be unmanageable without it.
from teslapy.
Related Issues (20)
- last_seen() raises "Timestamp is in the future" error HOT 3
- No longer able to set Powerwall to self_consumption mode HOT 6
- Percentage Charged not updating on get_battery_data()
- Preconditioning Battery
- Authorization broken -> Always getting "Access Denied" HOT 1
- Solar panel power only updates sporadically HOT 2
- Fails to work when run in a daemon process. HOT 2
- 400 Client Error: time_of_use_settings
- latitude and longitude are not in drive_state HOT 3
- Selenium blocked by Tesla HOT 2
- Move to Fleet API and Tesla Vehicle Command SDK HOT 5
- I get an InvalidSchema("No connection adapters were found for 'https://owner-api.teslamotors.com/api/1/vehicles/) Exception when using vehicle.get_vehicle_data() HOT 1
- Powerwall function get_battery_data not working HOT 1
- Not able to login HOT 6
- It seems get_charge_history() API URI is no longer working? Returns 400 HOT 2
- Seems like the teslapy is no longer working with the new Tesla APIs HOT 58
- drive_state does not have latitude and longitude
- shift_state and speed stay None even during driving
- looks like tesla have changed battery data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from teslapy.