You can install our site as a web app on your iOS device by utilizing the Add to Home Screen feature in Safari. Please see this thread for more details on this.
Note: This feature may not be available in some browsers.
@Pramithas , where did you get this information regarding the Fleet API?
There has always been some overlapping of served data between the streaming API and the other data request endpoints, the key difference is the streaming API provides these values in real-time. So if you're trying to track the location of your vehicle in real-time, you could use the drive_state data request endpoint or the streaming API to get the vehicle's current location, the latter being the preferred method.
Method:
GET
URL:
https://streaming.vn.teslamotors.com/stream/{VEHICLE_ID}/?values={VALUES}
Required Headers:
Authorization: Basic {STREAMING_TOKEN}
1502820003896,0,10152.7,97,605,348,47.686585,-117.233318,1,R,196
1502820007396,0,10152.7,97,605,348,47.686584,-117.233318,1,R,196
1502820008896,1,10152.7,97,605,347,47.686582,-117.233317,1,R,196
1502820009396,1,10152.7,97,605,355,47.686580,-117.233317,1,R,196
1502820010896,1,10152.7,97,605,355,47.686570,-117.233316,1,P,196
1502820011396,0,10152.7,97,605,355,47.686569,-117.233316,1,P,196
1502820012896,0,10152.7,97,605,355,47.686569,-117.233317,0,P,196
1502820243159,,10152.7,97,605,355,47.686569,-117.233317,0,,196
@Pramithas , I can't seem to find any samples out there so here's a summary I wrote up real quick. The streaming API isn't anything fancy like summon and its web sockets, instead it's just a long-running GET request.
Code:Method: GET URL: https://streaming.vn.teslamotors.com/stream/{VEHICLE_ID}/?values={VALUES} Required Headers: Authorization: Basic {STREAMING_TOKEN}
Where...
Sample response data served over time as the request remains open:
- {VEHICLE_ID} - the value of the vehicle_id field found in the vehicle summary data - note this is not to be confused with the id (or id_s) field also found in the vehicle summary data
- {VALUES} - a comma-separated value string of the telemetry data you want to retrieve in real-time. The full list, that we know of, is this:
speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state,est_range
- {STREAMING_TOKEN} - base-64 encoded string of the 1st of the 2 streaming tokens provided to you in the vehicle summary data in the tokens field
Code:1502820003896,0,10152.7,97,605,348,47.686585,-117.233318,1,R,196 1502820007396,0,10152.7,97,605,348,47.686584,-117.233318,1,R,196 1502820008896,1,10152.7,97,605,347,47.686582,-117.233317,1,R,196 1502820009396,1,10152.7,97,605,355,47.686580,-117.233317,1,R,196 1502820010896,1,10152.7,97,605,355,47.686570,-117.233316,1,P,196 1502820011396,0,10152.7,97,605,355,47.686569,-117.233316,1,P,196 1502820012896,0,10152.7,97,605,355,47.686569,-117.233317,0,P,196 1502820243159,,10152.7,97,605,355,47.686569,-117.233317,0,,196
Where each row has comma-separated-values corresponding to the values you requested in the query parameter, values.
One thing to note, streaming tokens expire every 15 minutes on a universal timer I believe (or something extremely, noticeably short compared to the 45+ day expiration on the bearer token), so if you start receiving 401 unauthorized responses you should query the vehicle summary data to acquire the latest streaming token then try again.
Olorin-2:Shell ulmo$ curl -s -H "`cat header`" -X GET 'dhttps://owner-api.dteslamotors.dcom/api/1/products' |json_pp -f json -t dumper
$VAR1 = {
'count' => 2,
'response' => [
{
'notifications_enabled' => bless( do{\(my $o = 1)}, 'JSON::PP::Boolean' ),
'vin' => '5YJSA1E25GF1nunya',
'state' => 'online',
'option_codes' => 'MDLS,RENA,AF02,APF0,APH2,APPA,AU01,BC0B,BP00,BR03,BS00,BX60,CDM0,CH05,PBCW,CW00,DCF0,DRLH,DSH7,DV4W,FG02,FR03,HP00,IDBA,IX01,LP01,ME02,MI01,PF00,PI01,PK00,PS01,PX00,QPBT,RFBC,SC01,SP00,SR01,SU00,TM00,TP03,TR00,UTAW,WTAS,X001,X003,X007,X011,X014,X021,X025,X027,X028,X031,X037,X040,X044,YFFC,BTX5,COUS',
'color' => undef,
'backseat_token_updated_at' => undef,
'id_s' => 'numnunya',
'in_service' => bless( do{\(my $o = 0)}, 'JSON::PP::Boolean' ),
'remote_start_enabled' => $VAR1->{'response'}[0]{'notifications_enabled'},
'id' => 'numnunya',
'tokens' => [
'hexnunya',
'hexnunya'
],
'display_name' => 'serialnunya',
'calendar_enabled' => $VAR1->{'response'}[0]{'notifications_enabled'},
'vehicle_id' => numnunya,
'user_id' => numnunya,
'backseat_token' => undef
},
{
'energy_left' => 12312,
'total_pack_energy' => 28116,
'id' => 'nunya',
'site_name' => 'Home Energy Gateway',
'key' => 'nunya',
'battery_power' => 1270
}
]
};
Olorin-2:Shell ulmo$
Via the streaming API.
Try this:
Code:curl --user USERNAME:TOKEN https://streaming.vn.teslamotors.com/stream/VEHICLE_ID/?values=speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state
where USERNAME is your MyTesla username, TOKEN is the first token returned in your vehicle's JSON returned from the REST API, VEHICLE_ID is the "vehicle_id" returned in vehicle's JSON. The TOKEN value rotates every few minutes, so you will need to query your vehicle's JSON description before opening a new stream.
Fields are returned as a comma separated list of values matching the field references in the URL query string. The first field is a timestamp.
Now run that curl command, then hop in your vehicle and drive around for a while, and watch it stream.
For those that use Ruby, I've already developed a ruby gem that supports both the rest and streaming APIs as well as a high-level Vehicle Object API. I'll release a public version by the end of the month, just need some time to clean it up a little (and I'm traveling quite a bit this month). Here's some sample code (from my twitter client) using the API:
Code:portal = Teslamatic::API::Portal.new(config[:username], config[:password]) vehicles = Teslamatic::Vehicle.vehicles(portal) vehicle = vehicles.first current_gear = vehicle.gear_selector current_odometer = vehicle.odometer
I somehow missed your post. (12 hour workdays ...) Currently, there is no interaction between PowerWalls and vehicles (although many of us wish that would change). These are the parameters I see so far:@Ulmo , it's not that easy due to the certificate pinning the official app uses. I am able to sniff the traffic of the official app on an older rooted Android device with the Xposed framework installed.using a custom module I wrote to remove the certificate pinning at runtime allowing me to sniff the network traffic via Fiddler.
I could sniff the APIs, however I don't have a Powerwall and am unsure what exactly these new APIs enable us to do remotely? Is the Powerwall somehow connected to the vehicle enabling the Powerwall to share its charge state with the vehicle and by extension with the mobile app?
function m(e) {
var t = e.mode,
n = e.backupReserve,
r = e.generationLimit,
o = e.solarLimit,
a = e.batteryLimit;
return "string" == typeof r && (r = parseFloat(r)),
"string" == typeof o && (o = parseFloat(o)), "string" == typeof a && (a = parseFloat(a)),
function(e) {
e(j()), e((0, S.clearError)(R.RECEIVE_SAVE_OPERATION_SETTINGS_ERROR));
var i = {
backup_reserve_percent: n,
max_pv_export_power_kW: o
};
return t && (i.mode = t), fetch(k.default.api.uri + "/operation", {
method: "POST",
credentials: "same-origin",
headers: {
"Content-Type": "application/json"
},
body: (0, T.default)(i)
}).then(D.parseText).then(D.parseResponseText).then(D.checkResponseStatus).then(function(i) {
e(s({
mode: t,
backupReserve: n,
generationLimit: r,
solarLimit: o,
batteryLimit: a
}))
}).catch(function(t) {
e((0, S.showError)(R.RECEIVE_SAVE_OPERATION_SETTINGS_ERROR, t.toString(), t.response)), e(H())
})
}
}
Your best bet is to just parse out those fields when you get the response blob from the APINow, any clues as to how I drill down deeper into that so I don't get a clutter of cars, roofs, solar panels, and other products in my output? I'd like to just know more about my PowerWall installation.
That's exactly what I did with the above; I found the id or key (I forget which) which was the unique identifier, and discarded the rest of the entries. Then, I used those variables. I got everything working great grabbing the correct piece of data when there are multiple live products. A few days later, my prior car disappeared, and yet everything continued working great.Your best bet is to just parse out those fields when you get the response blob from the API
here (EU, Netherlands) you get API access after deliveryAt this point, I suspect that I simply cannot get a token yet because the car is in production (due end of September / Early October).
Does anyone know if that's a correct conclusion? Namely, that you cannot get a token before the car reaches a certain stage of production (or even delivery)?