@@ -123,7 +123,7 @@ def __init__(
123123 def _load_climate_settings_from_coordinator (self ) -> None :
124124 """Load climate settings from coordinator data if available."""
125125 try :
126- if not self .vehicle or not hasattr (self .vehicle , "climate_settings" ):
126+ if not self .vehicle or not getattr (self .vehicle , "climate_settings" , None ):
127127 _LOGGER .debug ("Vehicle climate_settings not yet available" )
128128 return
129129
@@ -147,18 +147,24 @@ def _load_temperature_settings(self) -> None:
147147 """Load temperature settings from climate_settings."""
148148 climate_settings = self .vehicle .climate_settings
149149 target_temperature = climate_settings .temperature
150- if target_temperature is not None :
150+ if target_temperature is not None and target_temperature . value is not None :
151151 self ._attr_target_temperature = target_temperature .value
152- self ._attr_min_temp = getattr (climate_settings , "min_temp" , 18 )
153- self ._attr_max_temp = getattr (climate_settings , "max_temp" , 29 )
154- self ._attr_target_temperature_step = getattr (
155- climate_settings , "temp_interval" , 1
152+ # `or <default>` guards against the attribute existing but being None
153+ # (climate-settings HTTP 500). A None min/max_temp makes HA core's
154+ # set_temperature validation do `float < None` -> TypeError; keep the
155+ # __init__ defaults (18/29/1) instead.
156+ self ._attr_min_temp = getattr (climate_settings , "min_temp" , None ) or 18
157+ self ._attr_max_temp = getattr (climate_settings , "max_temp" , None ) or 29
158+ self ._attr_target_temperature_step = (
159+ getattr (climate_settings , "temp_interval" , None ) or 1
156160 )
157161
158162 def _load_defrost_settings (self ) -> None :
159163 """Load defrost settings from climate_settings operations."""
160164 climate_settings = self .vehicle .climate_settings
161- operations = getattr (climate_settings , "operations" , [])
165+ # API can return operations=None (e.g. climate-settings HTTP 500);
166+ # `or []` guards against the attribute existing but being None.
167+ operations = getattr (climate_settings , "operations" , None ) or []
162168 for operation in filter (lambda o : o .category_name == "defrost" , operations ):
163169 for param in operation .parameters :
164170 if param .name == "frontDefrost" :
@@ -224,8 +230,11 @@ def _create_climate_settings(self) -> ClimateSettingsModel:
224230 Returns:
225231 ClimateSettingsModel configured with the specified settings
226232 """
227- # Start with existing operations
228- ac_operations = self .vehicle .climate_settings .operations .copy ()
233+ # Start with existing operations. climate_settings itself (not just
234+ # .operations) can be None when the climate-settings endpoint 500'd, so
235+ # getattr through both to avoid an AttributeError on the control path.
236+ climate_settings = getattr (self .vehicle , "climate_settings" , None )
237+ ac_operations = (getattr (climate_settings , "operations" , None ) or []).copy ()
229238
230239 # Find and replace the defrost operation
231240 for i , operation in enumerate (ac_operations ):
0 commit comments