jsgoecke / tesla

Provides a wrapper around the API to easily query and command a Telsa car. As of now this has been used with a Model S, a Model X, and a Model 3.
MIT License
325 stars 72 forks source link

Support the summons capability #2

Closed jsgoecke closed 8 years ago

jsgoecke commented 8 years ago

https://www.teslamotors.com/blog/summon-your-tesla-your-phone

jsgoecke commented 8 years ago

With this it will also need to support /command/trigger_homelink.

jsgoecke commented 8 years ago
 def summon_reverse(self): 
    print self.car_id action = "start_reverse" 
    params = { 'vehicle_id': self.car_id, 'lat': self.lat, 'lon': self.lon, 'action': action } 
    self.post('/api/1/vehicles/%d/command/autopark_request' 
        % self.car_id, params) 

 def summon_forward(self): 
    print self.car_id action = "start_forward" 
    params = { 'vehicle_id': self.car_id, 'lat': self.lat, 'lon': self.lon, 'action': action } 
    self.post('/api/1/vehicles/%d/command/autopark_request' 
        % self.car_id, params) Note that you get the exact lat and lon from the drive_state request. "action" is either "start_forward" or "start_reverse"