Skip to content

Commit c177a5d

Browse files
authored
Query for polestar SOC adapted (#2193)
1 parent 5426413 commit c177a5d

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • packages/modules/vehicles/polestar

packages/modules/vehicles/polestar/api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ def query_params(self, params: dict, url='https://pc-api.polestar.com/eu-north-1
4545

4646
def get_battery_data(self) -> dict or None:
4747
params = {
48-
"query": "query GetBatteryData($vin: String!) { getBatteryData(vin: $vin) { "
49-
+ "batteryChargeLevelPercentage estimatedDistanceToEmptyKm } }",
50-
"operationName": "GetBatteryData",
48+
"query": "query carTelematics($vin: String!) { carTelematics(vin: $vin) { "
49+
+ "battery { batteryChargeLevelPercentage estimatedDistanceToEmptyKm } } }",
50+
"operationName": "carTelematics",
5151
"variables": "{\"vin\":\"" + self.vin + "\"}"
5252
}
5353

5454
result = self.query_params(params)
5555

56-
return result['data']['getBatteryData']
56+
return result['data']['carTelematics']['battery']
5757

5858
def check_vin(self) -> None:
5959
# get Vehicle Data
@@ -62,7 +62,7 @@ def check_vin(self) -> None:
6262
"operationName": "GetConsumerCarsV2",
6363
"variables": "{}"
6464
}
65-
result = self.query_params(params, url='https://pc-api.polestar.com/eu-north-1/my-star/')
65+
result = self.query_params(params)
6666
if result is not None and result['data'] is not None:
6767
vins = []
6868
# get list of cars and store the ones not matching our vin

0 commit comments

Comments
 (0)