Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a sensor for the vehicle software version #71

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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