Skip to content

Commit

Permalink
better start with correct temperature
Browse files Browse the repository at this point in the history
  • Loading branch information
tillsteinbach committed Jan 19, 2025
1 parent bd52f8c commit 53e18b8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/carconnectivity_connectors/skoda/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -1430,6 +1430,20 @@ def __on_air_conditioning_start_stop(self, start_stop_command: ClimatizationStar
raise SetterError(f'Unknown temperature unit {command_arguments['target_temperature_unit']}')
else:
command_dict['targetTemperature']['unitInCar'] = 'CELSIUS'
elif start_stop_command.parent is not None and (climatization := start_stop_command.parent.parent) is not None \
and isinstance(climatization, Climatization) and climatization.settings is not None \
and climatization.settings.target_temperature is not None and climatization.settings.target_temperature.enabled \
and climatization.settings.target_temperature.value is not None: # pylint: disable=too-many-boolean-expressions
# Round target temperature to nearest 0.5
command_dict['targetTemperature']['temperatureValue'] = round(climatization.settings.target_temperature.value * 2) / 2
if climatization.settings.target_temperature.unit == Temperature.C:
command_dict['targetTemperature']['unitInCar'] = 'CELSIUS'
elif climatization.settings.target_temperature.unit == Temperature.F:
command_dict['targetTemperature']['unitInCar'] = 'FAHRENHEIT'
elif climatization.settings.target_temperature.unit == Temperature.K:
command_dict['targetTemperature']['unitInCar'] = 'KELVIN'
else:
raise SetterError(f'Unknown temperature unit {climatization.settings.target_temperature.unit}')
else:
command_dict['targetTemperature']['temperatureValue'] = 25.0
command_dict['targetTemperature']['unitInCar'] = 'CELSIUS'
Expand Down
2 changes: 1 addition & 1 deletion src/carconnectivity_connectors/skoda/mqtt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ def _on_message_callback(self, client: Client, obj: Any, msg: MQTTMessage) -> No
try:
self._skoda_connector.fetch_air_conditioning(vehicle, no_cache=True)
except CarConnectivityError as e:
LOG.error('Error while fetching charging: %s', e)
LOG.error('Error while fetching air conditioning: %s', e)
elif 'name' in data and data['name'] == 'climatisation-completed':
if 'data' in data and data['data'] is not None:
vehicle: Optional[GenericVehicle] = self._skoda_connector.car_connectivity.garage.get_vehicle(vin)
Expand Down

0 comments on commit 53e18b8

Please sign in to comment.