Skip to content

Commit

Permalink
Merge branch 'main' into introduce-brands
Browse files Browse the repository at this point in the history
  • Loading branch information
WebSpider authored Feb 27, 2025
2 parents aa81273 + b8c80bb commit c9ee60e
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions myskoda/myskoda.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,11 @@ async def list_vehicle_vins(self) -> list[str]:
return []
return [vehicle.vin for vehicle in garage.vehicles]

async def get_vehicle(self, vin: str) -> Vehicle:
async def get_vehicle(
self, vin: str, excluded_capabilities: list[CapabilityId] | None = None
) -> Vehicle:
"""Load a full vehicle based on its capabilities."""
all_capabilities = [
capabilities = [
CapabilityId.AIR_CONDITIONING,
CapabilityId.AUXILIARY_HEATING,
CapabilityId.CHARGING,
Expand All @@ -410,7 +412,10 @@ async def get_vehicle(self, vin: str) -> Vehicle:
CapabilityId.DEPARTURE_TIMERS,
]

return await self.get_partial_vehicle(vin, all_capabilities)
if excluded_capabilities:
capabilities = [c for c in capabilities if c not in excluded_capabilities]

return await self.get_partial_vehicle(vin, capabilities)

async def get_partial_vehicle(self, vin: str, capabilities: list[CapabilityId]) -> Vehicle:
"""Load a partial vehicle, based on list of capabilities."""
Expand All @@ -420,17 +425,7 @@ async def get_partial_vehicle(self, vin: str, capabilities: list[CapabilityId])
vehicle = Vehicle(info, maintenance)

for capa in capabilities:
# Only request vehicle health data if we do not need to wakeup the car
# This avoids triggering battery protection, such as in Skoda Karoq
# https://github.com/skodaconnect/homeassistant-myskoda/issues/468
if info.is_capability_available(capa):
if (
capa == CapabilityId.VEHICLE_HEALTH_INSPECTION
and CapabilityId.VEHICLE_HEALTH_WARNINGS_WITH_WAKE_UP
in vehicle.info.capabilities.capabilities
):
_LOGGER.debug("Skipping request for capability %s.", capa)
continue
await self._request_capability_data(vehicle, vin, capa)

return vehicle
Expand Down

0 comments on commit c9ee60e

Please sign in to comment.