Skip to content

Commit

Permalink
Fixed query of climater, preheater, fixed last_update_time, oil and h…
Browse files Browse the repository at this point in the history
…ybrid range
  • Loading branch information
t0bias-r committed Mar 4, 2024
1 parent ab3266e commit 358f7dd
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
8 changes: 4 additions & 4 deletions custom_components/audiconnect/audi_connect_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,12 @@ async def update(self):
await self.call_update(self.update_vehicle_longterm, 3)
info = "position"
await self.call_update(self.update_vehicle_position, 3)
#info = "climater"
#await self.call_update(self.update_vehicle_climater, 3)
info = "climater"
await self.call_update(self.update_vehicle_climater, 3)
#info = "charger"
#await self.call_update(self.update_vehicle_charger, 3)
#info = "preheater"
#await self.call_update(self.update_vehicle_preheater, 3)
info = "preheater"
await self.call_update(self.update_vehicle_preheater, 3)
# Return True on success, False on error
return self._no_error
except Exception as exception:
Expand Down
9 changes: 6 additions & 3 deletions custom_components/audiconnect/audi_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,15 @@ def __init__(self, data):

self._tryAppendFieldWithTs(data, "LIGHT_STATUS", ["vehicleLights", "lightsStatus", "value", "lights"])


self.appendWindowState(data)
self.appendSunRoofState(data)
self.appendDoorState(data)
self.appendHoodState(data)

self._tryAppendStateWithTs(data, "last_update_time", -1, ["measurements", "odometerStatus", "value", "carCapturedTimestamp"])
self._tryAppendStateWithTs(data, "carType", -1, ["fuelStatus", "rangeStatus", "value", "carType"])

self._tryAppendStateWithTs(data, "engineTypeFirstEngine", -2, ["fuelStatus", "rangeStatus", "value", "primaryEngine", "type"])
self._tryAppendStateWithTs(data, "primaryEngineRange", -2, ["fuelStatus", "rangeStatus", "value", "primaryEngine", "remainingRange_km"])
self._tryAppendStateWithTs(data, "primaryEngineRangePercent", -2, ["fuelStatus", "rangeStatus", "value", "primaryEngine", "currentSOC_pct"])
Expand All @@ -78,7 +79,9 @@ def __init__(self, data):
self._tryAppendStateWithTs(data, "chargingState", -1, ["charging", "chargingStatus", "value", "chargingState"])
self._tryAppendStateWithTs(data, "plugState", -1, ["charging", "plugStatus", "value", "plugConnectionState"])
self._tryAppendStateWithTs(data, "remainingChargingTime", -1, ["charging", "plugStatus", "value", "remainingChargingTimeToComplete_min"])


self._tryAppendStateWithTs(data, "climatisationState", -1, ["climatisation", "auxiliaryHeatingStatus", "value", "climatisationState"])


def _tryAppendStateWithTs(self, json, name, tsoff, loc):
ts = None
Expand Down
4 changes: 2 additions & 2 deletions custom_components/audiconnect/audi_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ async def get_stored_vehicle_data(self, vin: str):
"lvBattery",
"measurements",
"oilLevel",
"readiness"
"readiness",
#"userCapabilities",
"vehicleHealthInspection",
"vehicleHealthWarnings",
"vehicleLights",
}
}
self._api.use_token(self._bearer_token_json)
data = await self._api.get(
"https://emea.bff.cariad.digital/vehicle/v1/vehicles/{vin}/selectivestatus?jobs={jobs}".format(
Expand Down
6 changes: 6 additions & 0 deletions custom_components/audiconnect/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,12 @@ def create_instruments():
Sensor(attr="mileage", name="Mileage", icon="mdi:speedometer", unit="km"),
Sensor(attr="service_adblue_distance", name="AdBlue range", icon="mdi:gas-station", unit="km"),
Sensor(attr="range", name="Range", icon="mdi:gas-station", unit="km"),
Sensor(
attr="hybrid_range",
name="hybrid Range",
icon="mdi:gas-station-outline",
unit="km",
),
Sensor(
attr="service_inspection_time",
name="Service inspection time",
Expand Down

0 comments on commit 358f7dd

Please sign in to comment.