Skip to content

Commit

Permalink
fix url
Browse files Browse the repository at this point in the history
  • Loading branch information
TA2k committed Jun 9, 2024
1 parent 6d05658 commit d7902aa
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -663,20 +663,18 @@ class Fiat extends utils.Adapter {
command: command,
pinAuth: this.pinAuth,
};
let url = '/v1/accounts/' + this.UID + '/vehicles/' + vin + '/' + action;
if (command === 'CPPLUS') {
try {
data.schedule = JSON.parse(state.val);

url = '/v2/accounts/' + this.UID + '/vehicles/' + vin + '/ev/' + action;
} catch (error) {
this.log.error('Failed to parse schedule');
this.log.error(error);
}
}
this.getVehicleStatus(
vin,
'/v1/accounts/' + this.UID + '/vehicles/' + vin + '/' + action,
null,
JSON.stringify(data),
)
this.getVehicleStatus(vin, url, null, JSON.stringify(data))
.then((data) => {
if (data.responseStatus !== 'pending') {
this.log.warn(JSON.stringify(data));
Expand Down

0 comments on commit d7902aa

Please sign in to comment.