Hello:
I'm using the Tesla API to access data about my Model S and I'm trying to get a reading on the current battery level measured in kWh. I know that I could get a direct battery reading, but I'd like to do this measurement via software and I'd like to do it every night.
I've seen that the charge_energy_added field seems to frequent start tracking quite late after the charging has started. So I'm trying to figure out how to determine how much energy is added to the battery using the battery_range field. I've read on multiple threads that the battery_range is -actually- determined by Tesla by multiplying the actual kWh currently in the battery times the "hardcoded" Wh/mile that the car is rated at. Of course, the rated Wh/mile will be different for each model/year, etc so I can't hard code the value in my software. If I "watch" a charging session by pinging the API every 60 seconds, I can calculate the miles of range that are added during the period of time when the charge_energy_added field is working correctly. From there, I can impute that my car is rated at ~311 Wh/mile. Once I have this number, then any time I want to know my battery level in kWh, I can simply multiply the battery_level times 311.
But, is there ANY way to just get the rated Wh/mile for my car directly rather than having to impute it from a charging session? Maybe it's in the existing Tesla API, or maybe its on an EPA web site?? Anyone have any ideas?
I'm using the Tesla API to access data about my Model S and I'm trying to get a reading on the current battery level measured in kWh. I know that I could get a direct battery reading, but I'd like to do this measurement via software and I'd like to do it every night.
I've seen that the charge_energy_added field seems to frequent start tracking quite late after the charging has started. So I'm trying to figure out how to determine how much energy is added to the battery using the battery_range field. I've read on multiple threads that the battery_range is -actually- determined by Tesla by multiplying the actual kWh currently in the battery times the "hardcoded" Wh/mile that the car is rated at. Of course, the rated Wh/mile will be different for each model/year, etc so I can't hard code the value in my software. If I "watch" a charging session by pinging the API every 60 seconds, I can calculate the miles of range that are added during the period of time when the charge_energy_added field is working correctly. From there, I can impute that my car is rated at ~311 Wh/mile. Once I have this number, then any time I want to know my battery level in kWh, I can simply multiply the battery_level times 311.
But, is there ANY way to just get the rated Wh/mile for my car directly rather than having to impute it from a charging session? Maybe it's in the existing Tesla API, or maybe its on an EPA web site?? Anyone have any ideas?