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

Model S REST API

This site may earn commission on affiliate links.
Has anyone ever seen battery_heater_on = true in the charge state response?

I am querying through many days worth of data including times I know I saw a battery heater notification on the dashboard and I see nothing.

Is there a verified way of knowing that the battery heater is actually on? I am trying to see if some of my vampire drain is from battery heating and/or 12V battery charging.

This was leaving my GF's house Sunday morning at 10:48am.

cat *.xml | | grep battery_heater_on | grep -v false | grep -v null

tesla_112xx_stats-20131215104807.xml: <battery_heater_on>true</battery_heater_on>

<vehicle112xx>
<charge_state>
<charging_state>Disconnected</charging_state>
<charge_limit_soc>90</charge_limit_soc>
<charge_limit_soc_std>90</charge_limit_soc_std>
<charge_limit_soc_min>50</charge_limit_soc_min>
<charge_limit_soc_max>100</charge_limit_soc_max>
<charge_to_max_range>false</charge_to_max_range>
<battery_heater_on>true</battery_heater_on>
<not_enough_power_to_heat>false</not_enough_power_to_heat>
<max_range_charge_counter>0</max_range_charge_counter>
<fast_charger_present>false</fast_charger_present>
<battery_range>43.73</battery_range>
<est_battery_range>17.79</est_battery_range>
<ideal_battery_range>49.62</ideal_battery_range>
<battery_level>29</battery_level>
<battery_current>-29.1</battery_current>
<charge_energy_added>38.5</charge_energy_added>
<charge_miles_added_rated>130.5</charge_miles_added_rated>
<charge_miles_added_ideal>148.0</charge_miles_added_ideal>
<charger_voltage>0</charger_voltage>
<charger_pilot_current>0</charger_pilot_current>
<charger_actual_current>0</charger_actual_current>
<charger_power>0</charger_power>
<time_to_full_charge>null</time_to_full_charge>
<charge_rate>0.0</charge_rate>
<charge_port_door_open>false</charge_port_door_open>
<scheduled_charging_start_time>null</scheduled_charging_start_time>
<scheduled_charging_pending>false</scheduled_charging_pending>
<user_charge_enable_request>null</user_charge_enable_request>
<charge_enable_request>false</charge_enable_request>
<eu_vehicle>false</eu_vehicle>
<charger_phases>null</charger_phases>
</charge_state>
<climate_state>
<inside_temp>9.0</inside_temp>
<outside_temp>-11.0</outside_temp>
<driver_temp_setting>19.8</driver_temp_setting>
<passenger_temp_setting>19.8</passenger_temp_setting>
<is_auto_conditioning_on>false</is_auto_conditioning_on>
<is_front_defroster_on>0</is_front_defroster_on>
<is_rear_defroster_on>false</is_rear_defroster_on>
<fan_status>10</fan_status>
</climate_state>
<drive_state>
<shift_state>D</shift_state>
<speed>9</speed>
<latitude>XX</latitude>
<longitude>-YY</longitude>
<heading>179</heading>
<gps_as_of>1387126082</gps_as_of>
</drive_state>
<gui_settings>
<gui_distance_units>mi/hr</gui_distance_units>
<gui_temperature_units>F</gui_temperature_units>
<gui_charge_rate_units>mi/hr</gui_charge_rate_units>
<gui_24_hour_time>false</gui_24_hour_time>
<gui_range_display>Rated</gui_range_display>
</gui_settings>
<vehicle_state>
<df>0</df>
<dr>0</dr>
<pf>0</pf>
<pr>0</pr>
<ft>0</ft>
<rt>0</rt>
<car_version>1.49.22</car_version>
<locked>true</locked>
<sun_roof_installed>true</sun_roof_installed>
<sun_roof_state>closed</sun_roof_state>
<sun_roof_percent_open>0</sun_roof_percent_open>
<dark_rims>false</dark_rims>
<wheel_type>Base19</wheel_type>
<has_spoiler>true</has_spoiler>
<roof_color>None</roof_color>
<perf_config>Sport</perf_config>
<exterior_color>Red</exterior_color>
</vehicle_state>
</vehicle112xx>
 
It seems to me like the HTTP Long Poll interval in the streaming API is now ~5 minutes, where before it was ~2 minutes. Can anyone else confirm that?

This might turn out to be a good thing because I can start a poll and use it to monitor if the car is in motion, or parked for up to 5 minutes, without generating any additional requests that would keep the car awake.
 
Hey Hans. I don't know if this is helpful but my car had never slept until I stopped the service running the streaming app. I know it's supposed to let it sleep but it has never worked on mine and I'm using the most recent 0.8.5. Have you noticed this with anyone else?
 
Hey Hans. I don't know if this is helpful but my car had never slept until I stopped the service running the streaming app. I know it's supposed to let it sleep but it has never worked on mine and I'm using the most recent 0.8.5. Have you noticed this with anyone else?

Where you running with the --zzz flag to enable sleep mode? If not, it will keep the car awake all the time as you saw.
 
Great to hear - I am actually working on a scheduler that I will incorporate into TeslaMS. It will support up to 10 scheduled commands in the GUI.

The commands that will be available are:
Start/stop charging
Set charging to Max/Standard or given percentage
Start/stop HVAC - and set temp to x (In celsius)
Alert if unplugged at time of check.

Also considering whether i should implement a feature to enable an alert if vehicle is unplugged/charging stops if charge state less than X

GUI will be similar to the one found in VisibleTesla.

If one should need further schedules these can be manually entered in the MongoDB behind teslams - and thus unlimited.

It will be possible to schedule a command each 5 minutes.

Hope that others than me will like the feature.
 
Great to hear - I am actually working on a scheduler that I will incorporate into TeslaMS. It will support up to 10 scheduled commands in the GUI.

The commands that will be available are:
Start/stop charging
Set charging to Max/Standard or given percentage
Start/stop HVAC - and set temp to x (In celsius)
Alert if unplugged at time of check.

Also considering whether i should implement a feature to enable an alert if vehicle is unplugged/charging stops if charge state less than X

GUI will be similar to the one found in VisibleTesla.

If one should need further schedules these can be manually entered in the MongoDB behind teslams - and thus unlimited.

It will be possible to schedule a command each 5 minutes.

Hope that others than me will like the feature.

Sounds interesting. Looking forward to it.
 
Getting data out of mongo

I have been using vb.net to get data out of mongo. However, I notice that it doesn't always get the most recent data especially when the car had been sleeping. After I drive for a while I am able to retrieve my location at a 3 sec. interval from the database. I guess my question is, how is the data put in to the database because I know all the data is there when I check tesla tracker? Is there a difference in how the data is dumped into the database soon after sleeping? Thanks.
 
I have been using vb.net to get data out of mongo. However, I notice that it doesn't always get the most recent data especially when the car had been sleeping. After I drive for a while I am able to retrieve my location at a 3 sec. interval from the database. I guess my question is, how is the data put in to the database because I know all the data is there when I check tesla tracker? Is there a difference in how the data is dumped into the database soon after sleeping? Thanks.

This is likely just like VisibleTesla. When the car is sleeping the app queries less frequently. When you start on a trip it is still waiting for the next query time. When it finally queries next time you have already driven for some distance.
 
I have had success with the REST interfaces. However, when calling the streaming interface I am receiving a 401 Unauthorized error return. Here is an example code snippet:

Code:
var options =
            {
                url: "[URL]https://streaming.vn.teslamotors.com/stream/[/URL]" + vehicleId + "/?values=speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state,range,est_range",
                responseType: "json",
                type: "GET",
                user: username,
                password: token
            };
       // the error function is always called with 401 result
       WinJS.xhr(options).done();

Any insights appreciated. I pass in the first token received as token. Probably something simple but I am not seeing it.