Skip to content

Commit

Permalink
add missing cupra status
Browse files Browse the repository at this point in the history
  • Loading branch information
TA2k committed Apr 9, 2024
1 parent 85f79d2 commit b52c8ba
Show file tree
Hide file tree
Showing 4 changed files with 1,395 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [20.x, 16.x, 18.x]
node-version: [20.x, 21.x, 18.x]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
Expand Down
29 changes: 24 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1863,7 +1863,7 @@ class VwWeconnect extends utils.Adapter {
};
}
if (this.config.type === "seatcupra") {
url = "https://ola.prod.code.seat.cloud.vwgroup.com/v1/users/" + this.seatcupraUser + "/garage/vehicles";
url = "https://ola.prod.code.seat.cloud.vwgroup.com/v2/users/" + this.seatcupraUser + "/garage/vehicles";
// @ts-ignore
headers = {
accept: "application/json",
Expand Down Expand Up @@ -3100,20 +3100,19 @@ class VwWeconnect extends utils.Adapter {
}
});
}
getSeatCupraStatus(vin) {
return new Promise((resolve, reject) => {
async getSeatCupraStatus(vin) {
return new Promise(async (resolve, reject) => {
request.get(
{
url:
"https://ola.prod.code.seat.cloud.vwgroup.com/v2/users/" +
"https://ola.prod.code.seat.cloud.vwgroup.com/v5/users/" +
this.seatcupraUser +
"/vehicles/" +
vin +
"/mycar",

headers: {
accept: "*/*",

"user-agent": this.userAgent,
"accept-language": "de-de",
authorization: "Bearer " + this.config.atoken,
Expand Down Expand Up @@ -3238,6 +3237,26 @@ class VwWeconnect extends utils.Adapter {
}
},
);

await axios({
method: "get",
maxBodyLength: Infinity,
url: "https://ola.prod.code.seat.cloud.vwgroup.com/v2/vehicles/" + vin + "/status",
headers: {
accept: "*/*",
"user-agent": this.userAgent,
"accept-language": "de-de",
authorization: "Bearer " + this.config.atoken,
},
})
.then((res) => {
this.log.debug(JSON.stringify(res.data));
this.json2iob.parse(vin + ".statusv2", res.data);
})
.catch((error) => {
this.log.error(error);
error.response && this.log.error(JSON.stringify(error.response.data));
});
});
}
setSeatCupraStatus(vin, action, state) {
Expand Down
Loading

0 comments on commit b52c8ba

Please sign in to comment.