Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TA2k committed May 29, 2024
1 parent 7c123f9 commit 7ea9d4b
Showing 1 changed file with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ class Ford extends utils.Adapter {
{ command: 'engine/start', name: 'True = Start, False = Stop' },
{ command: 'charge/start', name: 'True = Start, False = Stop' },

{ command: 'cancelCharge', name: 'True = Cancel'}
{ command: 'cancelCharge', name: 'True = Cancel' },
{ command: 'location', name: 'True = Refresh Location' },
{ command: 'doors/lock', name: 'True = Lock, False = Unlock' },
{ command: 'status', name: 'True = Request Status Update' },
Expand Down Expand Up @@ -589,28 +589,27 @@ class Ford extends utils.Adapter {
this.log.error(JSON.stringify(error.response.data));
}
});
await this.requestClient({
method: 'get',
url: `https://api.mps.ford.com/api/fordconnect/v3/vehicles/${vin}/location`,
headers: {
Accept: '*/*',
'Content-Type': 'application/json',
'Application-Id': 'AFDC085B-377A-4351-B23E-5E1D35FB3700',
Authorization: 'Bearer ' + this.session.access_token,
},
await this.requestClient({
method: 'get',
url: `https://api.mps.ford.com/api/fordconnect/v3/vehicles/${vin}/location`,
headers: {
Accept: '*/*',
'Content-Type': 'application/json',
'Application-Id': 'AFDC085B-377A-4351-B23E-5E1D35FB3700',
Authorization: 'Bearer ' + this.session.access_token,
},
})
.then((res) => {
this.log.debug(JSON.stringify(res.data));
this.json2iob.parse(vin + '.location', res.data);
})
.then((res) => {
this.log.debug(JSON.stringify(res.data));
this.json2iob.parse(vin + '.location', res.data);
})
.catch((error) => {
this.log.error('Failed to update vehicle location');
this.log.error(error);
if (error.response) {
this.log.error(JSON.stringify(error.response.data));
}
});

.catch((error) => {
this.log.error('Failed to update vehicle location');
this.log.error(error);
if (error.response) {
this.log.error(JSON.stringify(error.response.data));
}
});
}
}
async getVehicles() {
Expand Down

0 comments on commit 7ea9d4b

Please sign in to comment.