Comments (6)
Thank you Rob0101. From my limited testing it seems that in addition, the backup reserve also needs to be different to that currently set otherwise it doesn't change modes.
from teslapy.
Interesting experiences guys, I've not been setting mode since last winter (switching to autonomous to get the faster charge rate over the cheap electricity supply period that I am tricking the Powerwall into charging from the grid by changing the reserve percentage). I always set both reserve percentage and mode so maybe I would not notice this issue.
I wonder if this is another aspect of the Tesla API randomly deprecating the powerwalls
endpoints in favour of energy_sites
. The endpoints I use are:
"OPERATION_MODE": {
"TYPE": "POST",
"URI": "api/1/energy_sites/{site_id}/operation",
"AUTH": true
},
"BACKUP_RESERVE": {
"TYPE": "POST",
"URI": "api/1/energy_sites/{site_id}/backup",
"AUTH": true
},
Note I'm using energy_sites
for both, and first I get api/1/energy_sites/{site_id}/site_info
("SITE_CONFIG" in endpoints.json) using a routine I added to the battery class (which maybe populates the {site_id} ?) .
@rob0101 in your example you use a mix of energy_sites
and powerwalls
since
"BATTERY_BACKUP_RESERVE": {
"TYPE": "POST",
"URI": "api/1/powerwalls/{battery_id}/backup",
"AUTH": true
},
Maybe that is significant? Of course it could all change tomorrow. Hope this could be of use to either of you.
from teslapy.
Commit 50bdbfb removed the depricated powerwall API. Please use the energy site API.
from teslapy.
I'm new to teslaPy and not fluent in python.
I've had no luck getting a simple script to toggle between the two states. I was able to change the minimum reserve, so it may be I'm hitting a similar issue to HeraldCoupe.
Can someone share a simple code sample that changes the state as a starting point.
Thanks
from teslapy.
Got this working:
`
import sys
new_mode = sys.argv[1]
new_MRL = int(sys.argv[2])
import teslapy
from teslapy import Tesla, Battery
with teslapy.Tesla('[email protected]') as tesla:
batteries = tesla.battery_list()
batteries[0].command('BACKUP_RESERVE',backup_reserve_percent=new_MRL)
batteries[0].command('BATTERY_OPERATION_MODE',default_real_mode=new_mode)
`
but bizarrely it'll only set the mode if I also set the backup reserve. Remove that line and stop working.
from teslapy.
I've updated to the new teslapy code and my revised script (below) is working.
import sys
new_mode = ""
new_MRL = ""
if len(sys.argv)>1 : new_mode = sys.argv[1]
if len(sys.argv)>2 : new_MRL = int(sys.argv[2])
import teslapy
from teslapy import Tesla, Battery
with teslapy.Tesla('[email protected]') as tesla:
batteries = tesla.battery_list()
battery = batteries[0]
if new_MRL != '':
battery.set_backup_reserve_percent(new_MRL)
if new_mode != '':
battery.set_operation(new_mode)
battery.get_site_info()
print("Mode:" + battery["default_real_mode"])
print("Reserve:" + str(battery["backup_reserve_percent"]))
from teslapy.
Related Issues (20)
- 429 on every sync_wake_up() call HOT 3
- last_seen() raises "Timestamp is in the future" error HOT 3
- 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
- 410 error on get_battery_data HOT 15
- 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 HOT 1
- shift_state and speed stay None even during driving
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.