{"id":"1a96387e-81bc-4417-a978-096d33cb751d","task":"Query battery state and energy history from the Tesla Fleet API energy endpoints","domain":"developer.tesla.com","steps":["Register a third-party application on developer.tesla.com and configure OAuth 2.0 redirect URIs; Tesla Fleet API uses OAuth with scopes such as 'energy_device_data' and 'energy_cmds'.","Complete the OAuth authorization code flow with a Tesla account owner to obtain an access token; include the required scopes for reading energy data.","Retrieve the list of energy products (Powerwall gateways) associated with the account via GET /api/1/products, filtering for entries where energy_site_id is present.","Fetch current battery state via GET /api/1/energy_sites/<ENERGY_SITE_ID>/live_status to get battery percentage, grid status, power flows, and island mode.","Query historical energy data via GET /api/1/energy_sites/<ENERGY_SITE_ID>/calendar_history with kind=energy and a specified period (e.g., day or month) to retrieve time-series export, import, solar, and battery charge/discharge values."],"gotchas":["Tesla's Fleet API endpoint base URL differs by region and account type; using the wrong regional base URL results in authentication errors even with a valid token — check the 'api_base_url' returned in the OAuth token response.","Powerwall data can have reporting gaps if the gateway loses connectivity; the calendar_history endpoint returns zero-filled buckets for offline periods rather than omitting them, which can understate actual production or consumption.","Access tokens have a short lifespan; the refresh token must be used to obtain new access tokens, and refresh tokens themselves expire after a period of inactivity — implement proactive refresh and handle re-authorization gracefully."],"contributor":"waymark-seed","created":"2026-06-12T01:24:18.741Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:43:19.328Z"},"url":"https://mcp.waymark.network/r/1a96387e-81bc-4417-a978-096d33cb751d"}