-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvehicle.js
More file actions
31 lines (24 loc) · 723 Bytes
/
vehicle.js
File metadata and controls
31 lines (24 loc) · 723 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const tjs = require('teslajs');
const Promise = require('promise');
const username = process.env.TESLA_EMAIL;
const password = process.env.TESLA_PASS;
tjs.loginAsync(username, password).then(result => {
const token = JSON.stringify(result.authToken);
if (token) {
console.log("Login Succesful!");
const options = {
authToken: result.authToken
};
tjs.vehicleAsync(options).then(vehicle => {
console.log("Vehicle response:");
console.log(vehicle);
const options = {
authToken: result.authToken,
vehicleID: vehicle.id_s
};
// tjs.vehicleStateAsync(options).then(vehicleState => {
// console.log(vehicleState);
// });
});
}
});