Skip to content

Commit

Permalink
Request vehicle software version in query
Browse files Browse the repository at this point in the history
Add a sensor for the vehicle software version
  • Loading branch information
nsheridan committed Jan 6, 2024
1 parent b57f303 commit 79765c6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/polestar_api/pypolestar/polestar.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async def _get_vehicle_data(self):
"""" Get the latest vehicle data from the Polestar API."""
# get Vehicle Data
params = {
"query": "query getCars { getConsumerCarsV2 { vin internalVehicleIdentifier modelYear content { model { code name __typename } images { studio { url angles __typename } __typename } __typename } hasPerformancePackage registrationNo deliveryDate currentPlannedDeliveryDate __typename }}",
"query": "query getCars { getConsumerCarsV2 { vin internalVehicleIdentifier modelYear content { model { code name __typename } images { studio { url angles __typename } __typename } __typename } hasPerformancePackage registrationNo deliveryDate currentPlannedDeliveryDate software { version __typename } __typename }}",
"operationName": "getCars",
"variables": "{}"
}
Expand Down
11 changes: 11 additions & 0 deletions custom_components/polestar_api/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,17 @@ class PolestarSensorDescription(
max_value=None,
dict_data=None
),
PolestarSensorDescription(
key="software_version",
name="Software Version",
icon="mdi:information-outline",
query="getConsumerCarsV2",
field_name="software/version",
unit=None,
round_digits=None,
max_value=None,
dict_data=None
),
PolestarSensorDescription(
key="registration_number",
name="Registration Number",
Expand Down
3 changes: 3 additions & 0 deletions custom_components/polestar_api/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
"polestar_registration_number": {
"name": "Registration Number"
},
"polestar_software_version": {
"name": "Software Version"
},
"polestar_estimated_fully_charged_time": {
"name": "Estimated Fully Charged Time"
},
Expand Down

0 comments on commit 79765c6

Please sign in to comment.