Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

TOU api

This site may earn commission on affiliate links.
thread is a little old, but I was having the same issue, and thought I would drop the solution in case someone else needs it.

Setting mode:

curl -s -k --header "Authorization: Bearer $TOKEN" -X POST -H "Content-Type: application/json" -d '{"default_real_mode":"'$1'"}' "https://owner-api.teslamotors.com/api/1/energy_sites/NNNN/operation"


Setting reserve:

curl -s -k --header "Authorization: Bearer $TOKEN" -X POST -H "Content-Type: application/json" -d '{"backup_reserve_percent":'$2'}' "https://owner-api.teslamotors.com/api/1/energy_sites/NNNN/backup"

When using the public API you need to add the content type to the header, this is not required when taking to the gateway on the local address. You also can't set the backup reserve in the same post like you can with the local gateway.

Shaun
 
  • Informative
Reactions: gern
Also at least for me, I switched to the public api vs the internal one for changes (I still us it to pull data) because obtaining a new token restarts the powerwalls which during an outage causes the power to go out and sometimes not come back till grid power becomes available again.
 
  • Informative
Reactions: aesculus