Giter Site home page Giter Site logo

Comments (15)

yanschneider avatar yanschneider commented on June 2, 2024 1

For me as well. It seems that the teslamotors api is no longer available under the given URL.

from teslapy.

DaveTBlake avatar DaveTBlake commented on June 2, 2024 1

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.

j4mie avatar j4mie commented on June 2, 2024 1

@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.

mquilling0 avatar mquilling0 commented on June 2, 2024 1

@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.

tdorssers avatar tdorssers commented on June 2, 2024 1

I don't own a powerwall, so I cannot test it, but commit 50bdbfb should fix this, based on @DaveTBlake's code.

from teslapy.

JuhaSeppa avatar JuhaSeppa commented on June 2, 2024

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.

mquilling0 avatar mquilling0 commented on June 2, 2024

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.

JuhaSeppa avatar JuhaSeppa commented on June 2, 2024

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.

mquilling0 avatar mquilling0 commented on June 2, 2024

thank you @j4mie that worked!

from teslapy.

HeraldCoupe avatar HeraldCoupe commented on June 2, 2024

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.

yanschneider avatar yanschneider commented on June 2, 2024

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.

mquilling0 avatar mquilling0 commented on June 2, 2024

@tdorssers tested and works, thx!

from teslapy.

HeraldCoupe avatar HeraldCoupe commented on June 2, 2024

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.

jasonacox avatar jasonacox commented on June 2, 2024

@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.

DaveTBlake avatar DaveTBlake commented on June 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.