Skip to content

Commit

Permalink
Merge pull request #250 from robinostlund/v4.4.67
Browse files Browse the repository at this point in the history
v4.4.67
  • Loading branch information
robinostlund authored Feb 20, 2024
2 parents 7d739a2 + 533069f commit 15bbd06
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions volkswagencarnet/vw_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
ENGINE_TYPE_DIESEL = "diesel"
ENGINE_TYPE_GASOLINE = "gasoline"
ENGINE_TYPE_COMBUSTION = [ENGINE_TYPE_DIESEL, ENGINE_TYPE_GASOLINE]
DEFAULT_TARGET_TEMP = 24


class Vehicle:
Expand Down Expand Up @@ -341,13 +342,28 @@ async def set_window_heating(self, action="stop"):

async def set_battery_climatisation(self, mode=False):
"""Turn on/off electric climatisation from battery."""
if self.is_electric_climatisation_supported:
if self.is_climatisation_without_external_power_supported:
if mode in [True, False]:
data = {"action": {"settings": {"climatisationWithoutHVpower": mode}, "type": "setSettings"}}
temperature = (
self.climatisation_target_temperature
if self.climatisation_target_temperature is not None
else DEFAULT_TARGET_TEMP
)
data = {
"targetTemperature": temperature,
"targetTemperatureUnit": "celsius",
"climatisationWithoutExternalPower": mode,
}
self._requests["latest"] = "Climatisation"
response = await self._connection.setClimaterSettings(self.vin, data)
return await self._handle_response(
response=response,
topic="climatisation",
error_msg="Failed to set climatisation without external power",
)
else:
_LOGGER.error(f'Set climatisation without external power to "{mode}" is not supported.')
raise Exception(f'Set climatisation without external power to "{mode}" is not supported.')
return await self.set_climater(data)
else:
_LOGGER.error("No climatisation support.")
raise Exception("No climatisation support.")
Expand Down

0 comments on commit 15bbd06

Please sign in to comment.