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.
PyTelsa problem

Hello guys,

I'm new here to TMC, and I'm relatively new to Python as well. I'm creating an application using the PyTelsa module.

The goal of the application, is basically and alert system called Teslalert (see what I did there?!). For example, the user sets specific times his/her Tesla SHOULD be charging by. If the applications notices that the car isn't charging by say, 10:00 PM, it will email the owner, alerting them that they may have forgotten to plug their vehicle in. I hope to incorporate other features in the future, but for now, that is the goal.

I'm having a little bit of a hicup, mostly with the aesthetics of my sort of demo application. See, I want to be able to just have the user log in with both his username and password, and not need to deal with inputing his/her VIN. But it seems, in order to get the VIN from the servers, you need to input the VIN, a catch-22 or sorts.

Here's the code, if it makes it any simpler:

import pytesla


from sys import exit
import time


Code:
def startup():
	email = raw_input("What's your email? > ")
	password = raw_input("What's your password? > ")
	vin = raw_input("What's your vin? > ")
	
	
	
	global car
		
	car = pytesla.Connection(email, password).vehicle(vin)
	options()
	
def options():
		
	question = raw_input("\nWould you like to know the charge state? Y/N? > ")
	
	if question == "y" or question == "Y":
		
		charge_state = car.charge_state['battery_level']
		est_range = car.charge_state['battery_range']
		
		plugged_in = ""
		
		if car.charge_state['charger_pilot_current'] > 0:
			plugged_in = "Plugged In"
		else:
			plugged_in = "Unplugged"


		
		print "Charge: %s%s \nEst. Range: %s (Mi) \nCharge Status: %s" % (charge_state, '%', est_range, plugged_in)
		
		quit()
		
	else:
		quit()
		
startup()

And here's my GitHub page if anyone wants to push a commit or two.

Thanks in advance. (Sorry for the wall of text)
 
Hmm, I wonder how I would go about accomplishing this then? The example on the PyTesla page reads:

Code:
>>> import pytesla
>>> mycar = pytesla.Connection('myemail', 'mypassword').vehicle('myvin')
>>> mycar.honk_horn()
True

But if I omit
Code:
.vehicle(vin)
from the
Code:
car
variable, it throws this error:

Code:
Traceback (most recent call last):
  File "charge_state.py", line 42, in <module>
    startup()
  File "charge_state.py", line 16, in startup
    options()
  File "charge_state.py", line 24, in options
    charge_state = car.charge_state['battery_level']
AttributeError: Connection instance has no attribute 'charge_state'
 
Others to try...
  • .vehicle()
  • .vehicle[0]
  • .vehicle(0)
  • .vehicle('*')
  • .vehicle('.*')

Just guessing, I'm not a Python or PyTesla consumer.

In case it helps, here's an example of (modified to omit my data) "vehicles" output:
[{"color":null,"display_name":null,"id":9876,"option_codes":"MS01,RENA,TM02,DRLH,PF01,BT85,PPSR,RFPO,WT21,IZMB,IDCF,TR00,SU01,SC01,TP01,AU01,CH01,HP01,PA01,PS01,AD02,X001,X003,X007,X011,X013,X024,X019","user_id":1234567890,"vehicle_id":1234567890,"vin":"5YJABCDEFGHIJ00000","tokens":["abcdabcdabcdabcd","efefefefefefefef"],"state":"online"}]
 
Hmm, I wonder how I would go about accomplishing this then? The example on the PyTesla page reads:

Code:
>>> import pytesla
>>> mycar = pytesla.Connection('myemail', 'mypassword').vehicle('myvin')
>>> mycar.honk_horn()
True

But if I omit
Code:
.vehicle(vin)
from the
Code:
car
variable, it throws this error:

Code:
Traceback (most recent call last):
  File "charge_state.py", line 42, in 
    startup()
  File "charge_state.py", line 16, in startup
    options()
  File "charge_state.py", line 24, in options
    charge_state = car.charge_state['battery_level']
AttributeError: Connection instance has no attribute 'charge_state'

I guess it's possible the VIN is needed to support accounts with more than one Tesla. Sorry but I didn't think of that.

"battery_level" looks to be a valid field in the charge_state output (assuming that's how the API works).


{ charging_state: 'Stopped',
charge_limit_soc: 67,
charge_limit_soc_std: 90,
charge_limit_soc_min: 50,
charge_limit_soc_max: 100,
charge_to_max_range: false,
battery_heater_on: false,
not_enough_power_to_heat: false,
max_range_charge_counter: 0,
fast_charger_present: false,
battery_range: 114,
est_battery_range: 91.14,
ideal_battery_range: 131.54,
battery_level: 64,
battery_current: -0.7,
charge_starting_range: null,
charge_starting_soc: null,
charger_voltage: 0,
charger_pilot_current: 40,
charger_actual_current: 0,
charger_power: 0,
time_to_full_charge: 0.37,
charge_rate: -1,
charge_port_door_open: true,
scheduled_charging_start_time: 1380866400,
scheduled_charging_pending: true,
user_charge_enable_request: null,
charge_enable_request: false }
 
Last edited:
Charge scheduling based on departure time

Figure I'd add my $0.02 to this one. I've been holding off on doing this because this isn't really ready for "release", but anyone with some script kiddie skills, and a basic knowledge of bash / shell scripting can make this work.

Here's my data query and departure time based charge scheduling script and departure time set php page.

All of these things together, scheduled in cron, gets my car to start charging while I'm sleeping and always completes within 15 minutes of the time I set every day.

this script runs every minute.
Code:
#!/bin/bash
curl -b ~/cookie.txt --include "https://portal.vn.teslamotors.com/vehicles/11111/command/charge_state" 2>/dev/null | grep ^\{ | tr "," "\n" | tr -d \{ | tr -d \} > ~/tesla/11216_charge_statecurl -b ~/cookie.txt --include "https://portal.vn.teslamotors.com/vehicles/11111/command/climate_state" 2>/dev/null | grep ^\{ | tr "," "\n" | tr -d \{ | tr -d \} > ~/tesla/11111_climate_state
curl -b ~/cookie.txt --include "https://portal.vn.teslamotors.com/vehicles/xxxxx/command/drive_state" 2>/dev/null | grep ^\{ | tr "," "\n" | tr -d \{ | tr -d \} > ~/tesla/11111_drive_state
curl -b ~/cookie.txt --include "https://portal.vn.teslamotors.com/vehicles/xxxxx/command/gui_settings" 2>/dev/null | grep ^\{ | tr "," "\n" | tr -d \{ | tr -d \} > ~/tesla/11111_gui_settings
curl -b ~/cookie.txt --include "https://portal.vn.teslamotors.com/vehicles/xxxxx/command/vehicle_state" 2>/dev/null | grep ^\{ | tr "," "\n" | tr -d \{ | tr -d \} > ~/tesla/11111_vehicle_state

This script converts all the data I get from the query script into XML which I read in other scripts (see the xmlgrep section of the charge script)
Code:
cd ~/tesla/
out="~/tesla/tesla_11111_stats.xml"
#echo `date` >>debug.log
echo "<vehicle11111>" > $out
#echo 'ls ~/tesla | grep ^11111' >> debug.log
#ls ~/tesla | grep ^11111 >> debug.log
for file in `ls ~/tesla | grep ^11111`
do
#echo "$file" >> debug.log
#[ -f "$file" ] && echo "exists" >> debug.log || echo "not_exist" >> debug.log 
#echo "$(echo $file | sed 's/11111_//')" >> debug.log
echo "  <$(echo $file | sed 's/11111_//')>" >> $out


while read line
#oIFS=$IFS
#IFS=$(echo -en "\n\b")
#for category in `cat ~/tesla/$file`
do
param="$(echo $line | cut -f1 -d : | tr -d \")"
value="$(echo $line | cut -f2 -d : | tr -d \")"
#param="$(echo $category | cut -f1 -d : | tr -d \")"
#value="$(echo $category | cut -f2 -d : | tr -d \")"
#echo "param=$param,value=$value" >> debug.log
echo "    <${param}>${value}</${param}>" >> $out
done < ~/$file
echo "  </$(echo $file | sed 's/11111_//')>" >> $out
#IFS=$oIFS
done 
#done
echo "</vehicle11111>" >> $out

The charge script works, but needs a couple adjustments (time padding for charge start time, and mileage multiplier)
runs every 2 minutes via cron.
Code:
#!/bin/bash


#Tag Files
charging=/var/run/tesla/charging
charge_scheduled=/var/run/tesla/charge_scheduled
emergency_charge=/var/run/tesla/emergency_charge
dtime_file=/var/run/tesla/dtime.txt
calculating=/var/run/tesla/calculating
cookie=~/cookie.txt




#required functions for vars
xmlgrep()
{
VALUE="$(grep "\<$1\>" $2 | cut -f2 -d \> | cut -f1 -d \<)"
[ -z "$VALUE" ] && echo "$0: XML Value not found" > /dev/stderr  || echo $VALUE
VALUE=""
}




#Variables
vehid=XXXXX
debug=1
depart_time="$(cat $dtime_file | head -1 )"
stats="$(ls -t /home/matt/tesla/db/tesla_${vehid}_* | head -1)"
[ $( ls -l $stats | awk '{print $5}' -lt 2950 ) ] && \
     sleep 30 && \
     stats="$(ls -t /home/matt/tesla/db/tesla_${vehid}_* | head -1)"
#charging_state="Stopped"
charging_state="$(cat $stats | xmlgrep charging_state)"
#charging_state="$(cat $stats | /usr/local/bin/xmlgrep charging_state)"
scheduling_status="$(cat $dtime_file | grep ^status | cut -d = -f 2)"
logfile=/var/log/tesla/schedule_charge.log
latest_stats=""
requested_range="$(cat $dtime_file | grep ^range | cut -f2 -d =)"
selected_range="$(cat $stats | xmlgrep charge_limit_soc)"
timezone="$(date +%Z)"
current_epoch=$(date +%s)
[ -f $charge_scheduled ] && charge_start_epoch=$(cat $charge_scheduled | grep charge_start_epoch | cut -d = -f 2)


#Safety Checks
if [ "disabled" = "$scheduling_status" ]; then 
  [ -f $charge_scheduled ] && rm -f $charge_scheduled
  exit 0
fi
[ ! -f $dtime_file ] && echo "dtime_file not found - $dtime_file" && exit 1
[ -f $calculating ] && exit 0


#Functions
date_f()
{
echo "$(date +%F) $(date +%T)"
}


debug()
{
if [ $debug -ge 1 ]; then
  echo "$(date_f) $1"
  if [ $debug -ge 2 ]; then
    echo "$(date_f) $emergency_charge - $([ -f $emergency_charge ] && echo exists || echo not_exist)"
    echo "$(date_f) $charge_scheduled - $([ -f $charge_scheduled ] && echo exists || echo not_exist)"
    [ -f $charge_scheduled ] && CS="$(cat $charge_scheduled)" && [ ! -z "$CS" ] && echo $CS
    echo "$(date_f) $charging - $([ -f $chargeing ] && echo exists || echo not_exist)"
    echo "$(date_f) $calculating - $([ -f $calculating ] && echo exists || echo not_exist)"
    echo "$(date_f) $time_file - $([ -f $time_file ] && echo exists || echo not_exist)"
    [ -f $dtime_file ] && DTIME="$(cat $dtime_file)" && [ ! -z "$DTIME" ] && echo $DTIME
  fi
fi
}


epoch_check()
{
debug epoch_check
#write me, set var 
if [ $charge_start_epoch -le $current_epoch ]; then
charge_now=1
else 
charge_now=0
fi
debug epoch_check_charge_now=${charge_now}
debug epoch_check_complete
}


api_charge_start()
{
debug api_charge_start
touch $charging
echo -n "$(date_f) Start Charging: "
curl -b $cookie --include "https://portal.vn.teslamotors.com/vehicles/${vehid}/command/charge_start" 2> /dev/null | grep ^\{ | tr "," "\n" | tr -d "\{" | tr -d "\}" | grep result | cut -f2 -d: | sed 's/true/Done/' 
debug api_charge_start_complete
}


api_charge_stop()
{
debug api_charge_stop
echo -n "$(date_f) Stop Charging: "
curl -b $cookie --include "https://portal.vn.teslamotors.com/vehicles/${vehid}/command/charge_stop" 2> /dev/null | grep ^\{ | tr "," "\n" | tr -d "\{" | tr -d "\}" | grep result | cut -f2 -d: | sed 's/true/Done/' 
rm -f $charging
debug api_charge_stop_complete
}


api_set_range()
{
debug api_set_range
range=$requested_range
miles=$(echo "$requested_range * 2.67" | bc | cut -d . -f 1)
echo -n "Setting Charge to ${range}% / ${miles} miles: "
curl -b $cookie --include "https://portal.vn.teslamotors.com/vehicles/${vehid}/command/set_charge_limit?state=set&percent=${range}" 2> /dev/null | grep ^\{ | tr "," "\n" | tr -d "\{" | tr -d "\}" | grep result | cut -f2 -d: | sed 's/true/Done/'
debug api_set_range_complete
}


start_scheduled_charge()
{
debug start_scheduled_charge
touch $charging
#set charging tag, start charge
debug start_scheduled_charge_complete
}


stop_charging()
{
debug stop_charging
#check if we need to be charging before stoping
rm -f $charging
epoch_check
[ ! -f $charging ] && [ ! -f $emergency_charge ] && [ $charge_now -eq 0 ] && api_charge_stop
debug stop_charging_complete
}


charge()
{
debug charge
if [ ! "$charging_state" = "Charging" ]; then
debug starting_charge
#if current epoch seconds > start time epoch seconds, set tag, start charge
touch $charging
api_charge_start
fi
debug charge_complete
}


emergency_check()
{
debug emergency_check
debug emergency_check_complete
}


get_time_to_full()
{
debug get_time_to_full
touch $calculating
[ ! $requested_range -eq $selected_range ] && api_set_range
echo "$(date_f) sleeping 600"
sleep 600
latest_stats="$(ls -t ~/tesla/db/tesla_${vehid}_* | head -1)"
hours_to_full_charge="$(cat $latest_stats | xmlgrep time_to_full_charge)"
minutes_to_full_charge=$(echo "$hours_to_full_charge * 60" | bc | cut -f1 -d .)
rm -f $calculating
echo $latest_stats
echo $hours_to_full_charge
echo $minutes_to_full_charge
debug get_time_to_full_complete
}


schedule_charge()
{
debug schedule_charge
#set time in charge_scheduled tag as start=2:00
#depart time minus minutes_to_full_charge > charge_scheduled
charge_start_day="$(if [ $(date -d "$depart_time" +%s) -lt $current_epoch ]; then echo tomorrow; else echo today; fi)"
charge_start_time=$(date -d "$charge_start_day $depart_time $timezone -${minutes_to_full_charge}minutes")
charge_start_epoch=$( date -d "$charge_start_time" +%s )
epoch_check
[ $charge_now -eq 1 ] && debug new_range_starts_emergency_charge && touch $emergency_charge
cat > $charge_scheduled <<EOFCS
charge_start_day=${charge_start_day} 
charge_start_time=${charge_start_time}
charge_start_epoch=${charge_start_epoch}
EOFCS
debug schedule_charge_complete
}


recalculate_time_to_full_charge()
{
debug recalculate_time_to_full_charge
api_charge_start
get_time_to_full
schedule_charge
epoch_check
[ $charge_now -eq 0 ] && stop_charging
[ $charge_now -eq 1 ] && debug new_range_starts_emergency_charge && touch $emergency_charge
debug recalculate_time_to_full_charge_complete
}


cleanup()
{
rm -f $emergency_charge $charging $calculating $charge_scheduled
}


case $charging_state in
Stopped)
debug charge_state_stopped
#verify if charge is supposed to be scheduled, and then that is is scheduled.
[ ! -f $charge_scheduled ] && api_charge_start && get_time_to_full && schedule_charge


#if range changed, recalculate
[ ! $requested_range -eq $selected_range ] && recalculate_time_to_full_charge && schedule_charge


if [ ! -f $emergency_charge ]; then 
  epoch_check
  [ $charge_now -eq 1 ] && charge
#  [ $charge_now -eq 0 ] && stop_charging
else
  charge
fi
debug charge_state_stopped_complete
;;


Disconnected)
debug charge_state_disconnected
cleanup
debug charge_state_disconnected_complete
;;


Charging)
debug charge_state_charging
#if dtime set, enabled and no schedule then sched and stop
if [ ! -f $charging ]; then
  if [ ! -f $charge_scheduled ]; then
    debug begin_charge_scheduling
    get_time_to_full
    schedule_charge
    emergency_check
    [ $charge_now -eq 0 ] && stop_charging
    [ $charge_now -eq 1 ] && debug emergency_charge_via_charging_state
  fi
fi
debug charge_state_charging_complete
;;


Complete)
debug charge_state_complete
cleanup
[ ! $requested_range -eq $selected_range ] && recalculate_time_to_full_charge && schedule_charge && epoch_check
[ $charge_now -eq 1 ] && charge
debug charge_state_complete_complete
;;


Starting)
debug charge_state_starting
debug charge_state_starting_complete
exit 0
;;
*)
debug unknown_charge_state
exit 2
;;
esac




[ "disabled" = "$scheduling_status" ] && rm -f $charge_scheduled

Then, I use this php page, open it on the car or on my phone to set my scheduled departure time and how much charge I want at that time.

Code:
<?php
    $self="dtime.php";
    $saveTimeFile="/var/run/tesla/dtime.txt";
    $chargeScheduledFile="/var/run/tesla/charge_scheduled";


    if ( $_GET["write"] == "true" )
    {
        $hours = $_POST['hours'];
        $minutes = $_POST['minutes'];
        $period = $_POST['period'];
    $status = $_POST['status'];
        $range = $_POST['range'];


        if ($period == "pm" )
        {
            $hours = $hours + 12;
            if ($hours == "24")
            {
                $hours = "00";
            }
        }
        
        $time=$hours.":".$minutes;
        exec ('echo "'.$time.'" > '.$saveTimeFile);
        exec ('echo "status='.$status.'" >> '.$saveTimeFile);
    exec ('echo "range='.$range.'" >> '.$saveTimeFile);
    }
    
    $currentSetHour = exec ('cat '.$saveTimeFile.' | head -1 | cut -d : -f 1');
    $currentSetMinutes = exec ('cat '.$saveTimeFile.' | head -1| cut -d : -f 2');
    $currentSetPeriod = "am";
    $currentStatus = exec ('cat '.$saveTimeFile.' | grep ^status | cut -d = -f 2');
    $currentRange = exec ('cat '.$saveTimeFile.' | grep ^range | cut -d = -f 2');
    $currentChargeStart = exec ('[ -f '.$chargeScheduledFile.' ] && cat '.$chargeScheduledFile.' | grep charge_start_time | cut -f2 -d = || echo null'); 
    
    if ($currentSetHour > 13)
    {
        $currentSetHour = $currentSetHour - 12;
        $currentSetPeriod = "pm";
    }
    
    switch ($currentSetHour) {
        case "0":
            $hourZero = "selected";
            break;
        case "1":
            $hourOne = "selected";
            break;
        case "2":
            $hourTwo = "selected";
            break;
        case "3":
            $hourThree = "selected";
            break;
        case "4":
            $hourFour = "selected";
            break;
        case "5":
            $hourFive = "selected";
            break;
        case "6":
            $hourSix = "selected";
            break;
        case "7":
            $hourSeven = "selected";
            break;
        case "8":
            $hourEight = "selected";
            break;
        case "9":
            $hourNine = "selected";
            break;
        case "10":
            $hourTen = "selected";
            break;
        case "11":
            $hourEleven = "selected";
            break;
        case "12":
            $hourTwelve = "selected";
            break;
    }
    
    switch ($currentSetMinutes) {
        case "00":
            $minuteZero = "selected";
            break;
        case "15":
            $minuteFifteen = "selected";
            break;
        case "30":
            $minuteThirty = "selected";
            break;
        case "45":
            $minuteFourtyFive = "selected";
            break;
    }
    
    switch ($currentSetPeriod) {
        case "am":
            $periodAM = "selected";
            break;
        case "pm":
            $periodPM = "selected";
            break;
    }
    
    switch ($currentStatus) {
        case "enabled":
            $statusEnabled = "selected";
            break;
        case "disabled":
            $statusDisabled = "selected";
            break;
    }


    switch ($currentRange) {
    case "50":
        $range50 = "selected";
        break;
    case "60":
        $range60 = "selected";
        break;
    case "70":
        $range70 = "selected";
        break;
    case "80":
        $range80 = "selected";
        break;
    case "90":
        $range90 = "selected";
        break;
    case "100":
        $range100 = "selected";
        break;
    } 
    ?>


<html>
<head>
<meta name="viewport" content="width=260" />
<title>Departure Time</title>
</head>
<body>
<form action="<?php echo "$self"; ?>?write=true" method="post">
<select name="hours">
<option value="1" <?php echo $hourOne; ?> >1</option>
<option value="2" <?php echo $hourTwo; ?> >2</option>
<option value="3" <?php echo $hourThree; ?> >3</option>
<option value="4" <?php echo $hourFour; ?> >4</option>
<option value="5" <?php echo $hourFive; ?> >5</option>
<option value="6" <?php echo $hourSix; ?> >6</option>
<option value="7" <?php echo $hourSeven; ?> >7</option>
<option value="8" <?php echo $hourEight; ?> >8</option>
<option value="9" <?php echo $hourNine; ?> >9</option>
<option value="10" <?php echo $hourTen; ?> >10</option>
<option value="11" <?php echo $hourEleven; ?> >11</option>
<option value="12" <?php echo $hourTwelve; ?> >12</option>
</select>
:
<select name="minutes">
<option value="00" <?php echo $minuteZero; ?> >00</option>
<option value="15" <?php echo $minuteFifteen; ?> >15</option>
<option value="30" <?php echo $minuteThirty; ?> >30</option>
<option value="45" <?php echo $minuteFourtyFive; ?> >45</option>
</select>
<select name="period">
<option value="am" <?php echo $periodAM; ?> >A.M.</option>
<option value="pm" <?php echo $periodPM; ?> >P.M.</option>
</select>
<p />
Requested Range: 
<select name="range">
<option value="50" <?php echo $range50; ?> >50% - 133 miles</option>
<option value="60" <?php echo $range60; ?> >60% - 160 miles</option>
<option value="70" <?php echo $range70; ?> >70% - 185 miles</option>
<option value="80" <?php echo $range80; ?> >80% - 213 miles</option>
<option value="90" <?php echo $range90; ?> >90% - 240 miles</option>
<option value="100" <?php echo $range100; ?> >100% - 267 miles - MAX RANGE</option>
</select>
<p />
Charge Scheduling: 
<select name="status">
<option value="enabled" <?php echo $statusEnabled; ?> >Enabled</option>
<option value="disabled" <?php echo $statusDisabled; ?> >Disabled</option>
</select>
<p />
<input type="submit">
<p>
Currently scheuled charge start time: <?php echo $currentChargeStart; ?> 
</form>
</body>
</html>


Any questions, feel free to ask, though I recommend via PM.
 
Last edited:
I'm having a little bit of a hicup, mostly with the aesthetics of my sort of demo application. See, I want to be able to just have the user log in with both his username and password, and not need to deal with inputing his/her VIN. But it seems, in order to get the VIN from the servers, you need to input the VIN, a catch-22 or sorts.

If you use connection.vehicles() instead of connection.vehicle(), you will get a list of all the vehicle objects. if you have only a single vehicle,
Code:
car = connection.vehicles()[0]
would work. You could check that there is exactly one vehicle with
Code:
len(connection.vehicles()) == 1
.
 
Hi,

I searched around but did not directly found an answer to my question, so I an attempt of (not) making a fool of myself:

The 'vehicles' command returns a field called 'display_name'.
In my case this returns null.
Does anybody know HOW to set this field to a specific value ?

Living in Europe I also realize that some return values have not yet been incorporated into the different API's floating around (I use the TeslaLib C# version which has some fields strongly typed).
Is there a list with all the fields and their possible return values ?
Is it worth to setup such a list ?
 
I got blocked again today. It had ran for a couple of weeks without it happening.

When I recently took my car into service I noticed that they disabled mobile access as standard procedure. This might have caused a problem for my streaming code except for the request counting and throttling that I had recently added in 0.7.0. I expect that when a car drives out of 3G coverage that a similar problems can occur.

The lesson being that even if you are getting no HTTP errors (all HTTP 200 OK response codes), don't assume that everything is working properly and take care to count your REST requests and Streaming URL polls and not go overboard on requests.

I set the default RPM (Requests Per Minute) to 6 and have been running for several weeks without problems. However, I never have been blocked before I put the request limits in either.
 
That makes sense. Because the time I got blocked was after I had parked in a concrete parking garage where there is no signal. I had not updated yet to 0.7.0 but did now. Hopefully, as previous, they will unblock it after 24 hours and I will try the newer version.
 
That makes sense. Because the time I got blocked was after I had parked in a concrete parking garage where there is no signal. I had not updated yet to 0.7.0 but did now. Hopefully, as previous, they will unblock it after 24 hours and I will try the newer version.


Working again 24 hours later. Where is the info for changing the default from 6x/minute? I'm sure it's right in front of me I just don't see it.
 
Working again 24 hours later. Where is the info for changing the default from 6x/minute? I'm sure it's right in front of me I just don't see it.

add a --maxrpm flag and specify a max number of requests per minute (6 is default)

[examples] $ streaming -?
Usage: $0 -u <username> -p <password> [-sz] [--file <filename> || --db <MongoDB database>]
[--values <value list>] [--maxrpm <#num>]
 
Waking a sleeping Tesla

I don't have access to a Tesla with firmware 5.0 or greater so I'm having some difficulty figuring out the most reliable way to wake a car from sleep mode. From what I've heard, even Tesla's official apps sometimes can't wake a vehicle; or it can take many minutes to do so.

Has anyone found a reliable method for waking a car from sleep mode? What's the best process to use and how many retries are prudent?

Any and all advice is appreciated.
 
I don't recall seeing this posted.

Comparing 1.33.61 with 1.45.45, I see the following:

Removed from command/charge_state:
charge_starting_range=null
charge_starting_soc=null

Added to command/charge_state
charge_energy_added=7.1
charge_miles_added_rated=23.5
charge_miles_added_ideal=27.0
eu_vehicle=false
charger_phases=null

Added to command/vehicle_state:
exterior_color=SigRed

Random observation: Service Center left my front trunk open overnight. I presume she's indoors. :rolleyes:
 
Comparing 1.33.61 with 1.45.45, I see the following:
Added to command/charge_state
charge_energy_added=7.1
charge_miles_added_rated=23.5
charge_miles_added_ideal=27.0
eu_vehicle=false
charger_phases=null
So the "charger_phases" one is important for correct energy calculations (as this will read '3' if someone is charging on 3 phases). But this is made even easier by the "charge_energy_added" field.
I am in the process of adding this to the visualization tools - unfortunately I'm in the middle of a partial rewrite, so this will take a few more days.