Migrate from deprecated /history to /calendar_history API#101
Closed
gbassaragh wants to merge 1 commit intoMikeBishop:masterfrom
Closed
Migrate from deprecated /history to /calendar_history API#101gbassaragh wants to merge 1 commit intoMikeBishop:masterfrom
gbassaragh wants to merge 1 commit intoMikeBishop:masterfrom
Conversation
Tesla has deprecated the /history endpoint (returns HTTP 410) and now requires the /calendar_history endpoint with explicit date parameters. Changes: - Add getCalendarHistoryDates() helper function for UTC date generation - Update doTeslaApiGetEnergy to use /calendar_history - Update doTeslaApiGetPowerHistory to use /calendar_history - Update doTeslaApiGetBackupHistory to use /calendar_history - Update doTeslaApiGetSelfConsumption to use /calendar_history All endpoints now include required start_date, end_date, and time_zone parameters in ISO 8601 format. Fixes energy history charts not displaying due to API deprecation.
Owner
|
As you presumably found after this (leading to #102), there's a good bit of data handling fixes to be done on top of the obvious changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tesla has deprecated the
/historyendpoint (returns HTTP 410) and now requires the/calendar_historyendpoint with explicit date parameters.The old
/historyendpoint was returning:Changes
getCalendarHistoryDates()helper function for generating UTC date parametersdoTeslaApiGetEnergyto use/calendar_historydoTeslaApiGetPowerHistoryto use/calendar_historydoTeslaApiGetBackupHistoryto use/calendar_historydoTeslaApiGetSelfConsumptionto use/calendar_historyAll endpoints now include the required
start_date,end_date, andtime_zoneparameters in ISO 8601 format.Testing
Tested with Tesla Owner API - all endpoints now return
time_seriesdata successfully:kind=energy- returns energy consumption datakind=power- returns power flow datakind=self_consumption- returns self-consumption metricskind=backup- returns backup event historyEnergy history charts now display correctly in the MagicMirror module.
Related
This addresses the Tesla API deprecation that occurred in late 2024, where the legacy
/historyendpoint was retired in favor of the Fleet API's/calendar_historyendpoint.