From 11d62a16aac8a1cb7c39fb1f58176b646fb96354 Mon Sep 17 00:00:00 2001 From: PK Date: Tue, 4 Feb 2025 18:43:31 +0100 Subject: [PATCH] Query for polestar SOC adapted --- packages/modules/vehicles/polestar/api.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/modules/vehicles/polestar/api.py b/packages/modules/vehicles/polestar/api.py index 464c701e03..ca9e2a48d4 100755 --- a/packages/modules/vehicles/polestar/api.py +++ b/packages/modules/vehicles/polestar/api.py @@ -45,15 +45,15 @@ def query_params(self, params: dict, url='https://pc-api.polestar.com/eu-north-1 def get_battery_data(self) -> dict or None: params = { - "query": "query GetBatteryData($vin: String!) { getBatteryData(vin: $vin) { " - + "batteryChargeLevelPercentage estimatedDistanceToEmptyKm } }", - "operationName": "GetBatteryData", + "query": "query carTelematics($vin: String!) { carTelematics(vin: $vin) { " + + "battery { batteryChargeLevelPercentage estimatedDistanceToEmptyKm } } }", + "operationName": "carTelematics", "variables": "{\"vin\":\"" + self.vin + "\"}" } result = self.query_params(params) - return result['data']['getBatteryData'] + return result['data']['carTelematics']['battery'] def check_vin(self) -> None: # get Vehicle Data @@ -62,7 +62,7 @@ def check_vin(self) -> None: "operationName": "GetConsumerCarsV2", "variables": "{}" } - result = self.query_params(params, url='https://pc-api.polestar.com/eu-north-1/my-star/') + result = self.query_params(params) if result is not None and result['data'] is not None: vins = [] # get list of cars and store the ones not matching our vin