Introducing Vehicle Data Caching
Storing vehicle data for cost reduction
With the new Tesla Fleet API Pay Per Use Pricing that is coming in January,
Teslemetry needs a way to continue serving this data without incurring unsustainable costs.
At present, Home Assistant and the server-side polling service request the vehicle_data
endpoint every 20-30 seconds when a vehicle is awake, which results in approximately 1500 requests per day per vehicle.
At 0.2 cents per request, this would cost approximately $90 per month for a single vehicle.
The planned solution to reduce this cost is:
- Reduce the server-side polling rate to a sustainable level
- Turn on server-side polling for all vehicles with a subscription
- Cache the
vehicle_data
responses in Google Firestore - Only serve the cached data to client requests
Updated privacy and security policies
Since this solution requires Teslemetry to store your vehicle's data for the first time, we have updated our
privacy and security pages to reflect this change.
Using two new Google Firestores (one for each region), we will store the latest vehicle_data
response for each vehicle.
Access to this data will only be possible using the existing Tesla Fleet API /api/1/vehicle/{vin}/vehicle_data
endpoint, which requires a Teslemetry access token.
Reduced server-side polling
The exact polling rate is still being determined, but it will be significantly less frequent than the current 20-30 seconds we have grown accustomed to. Using historical data, it appears that the interval would have to be at least 15 minutes to achieve the desired 1000 requests per vehicle per month. Nothing is changing in the short term, while these requests are still free, but the change will be implemented one way or another before January 1st.
Forcing a refresh
We know that some use cases will require more frequent updates, so rather than adding multiple subscription tiers,
we will instead allow you to force a refresh of the vehicle_data
cache using 2 command credits.
A new API endpoint and button in Home Assistant will be added that will instruct the server-side polling to instantly refresh the cache for one of your vehicles.
These updates will get distributed just like a normal server-side refresh would to your webhooks, server-side event clients, and available in the API from cache.
It is our intention that the server-side service will reschedule its next automatic refresh when it receives your forced refresh request, but will grant you free forced refresh requests if they caused an automatic refresh to be missed completely.
More details about the force refresh API will be added to the documentation once it has been implemented later this month.