6565_LOGGER = logging .getLogger (__name__ )
6666
6767
68+ # Device is in frost guard mode
69+ PRESET_ANTI_FROST = "frost"
70+
6871PLATFORM_SCHEMA = PLATFORM_SCHEMA .extend (
6972 {
7073 vol .Required (const .CONF_HEATER ): cv .entity_ids ,
103106 vol .Optional (const .CONF_PRESET_SYNC_MODE , default = const .DEFAULT_PRESET_SYNC_MODE ): vol .In (
104107 ['sync' , 'none' ]
105108 ),
109+ vol .Optional (const .CONF_ANTI_FROST_TEMP ): vol .Coerce (float ),
106110 vol .Optional (const .CONF_AWAY_TEMP ): vol .Coerce (float ),
107111 vol .Optional (const .CONF_ECO_TEMP ): vol .Coerce (float ),
108112 vol .Optional (const .CONF_BOOST_TEMP ): vol .Coerce (float ),
@@ -169,6 +173,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
169173 'output_safety' : config .get (const .CONF_OUTPUT_SAFETY ),
170174 'initial_hvac_mode' : config .get (const .CONF_INITIAL_HVAC_MODE ),
171175 'preset_sync_mode' : config .get (const .CONF_PRESET_SYNC_MODE ),
176+ 'frost_temp' : config .get (const .CONF_ANTI_FROST_TEMP ),
172177 'away_temp' : config .get (const .CONF_AWAY_TEMP ),
173178 'eco_temp' : config .get (const .CONF_ECO_TEMP ),
174179 'boost_temp' : config .get (const .CONF_BOOST_TEMP ),
@@ -218,6 +223,8 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
218223 platform .async_register_entity_service ( # type: ignore
219224 "set_preset_temp" ,
220225 {
226+ vol .Optional ("frost_temp" ): vol .Coerce (float ),
227+ vol .Optional ("frost_temp_disable" ): vol .Coerce (bool ),
221228 vol .Optional ("away_temp" ): vol .Coerce (float ),
222229 vol .Optional ("away_temp_disable" ): vol .Coerce (bool ),
223230 vol .Optional ("eco_temp" ): vol .Coerce (float ),
@@ -244,6 +251,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
244251
245252class SmartThermostat (ClimateEntity , RestoreEntity , ABC ):
246253 """Representation of a Smart Thermostat device."""
254+ _attr_translation_key = "smart_thermostat_translation"
247255
248256 def __init__ (self , ** kwargs ):
249257 """Initialize the thermostat."""
@@ -295,6 +303,7 @@ def __init__(self, **kwargs):
295303 self ._support_flags |= ClimateEntityFeature .TURN_ON
296304 self ._enable_turn_on_off_backwards_compatibility = False # Remove after deprecation period
297305 self ._attr_preset_mode = 'none'
306+ self ._frost_temp = kwargs .get ('frost_temp' )
298307 self ._away_temp = kwargs .get ('away_temp' )
299308 self ._eco_temp = kwargs .get ('eco_temp' )
300309 self ._boost_temp = kwargs .get ('boost_temp' )
@@ -303,7 +312,8 @@ def __init__(self, **kwargs):
303312 self ._sleep_temp = kwargs .get ('sleep_temp' )
304313 self ._activity_temp = kwargs .get ('activity_temp' )
305314 self ._preset_sync_mode = kwargs .get ('preset_sync_mode' )
306- if True in [temp is not None for temp in [self ._away_temp ,
315+ if True in [temp is not None for temp in [self ._frost_temp ,
316+ self ._away_temp ,
307317 self ._eco_temp ,
308318 self ._boost_temp ,
309319 self ._comfort_temp ,
@@ -435,7 +445,7 @@ def _async_startup(*_):
435445 self .entity_id , self ._target_temp )
436446 else :
437447 self ._target_temp = float (old_state .attributes .get (ATTR_TEMPERATURE ))
438- for preset_mode in ['away_temp' , 'eco_temp' , 'boost_temp' , 'comfort_temp' , 'home_temp' ,
448+ for preset_mode in ['frost_temp' , ' away_temp' , 'eco_temp' , 'boost_temp' , 'comfort_temp' , 'home_temp' ,
439449 'sleep_temp' , 'activity_temp' ]:
440450 if old_state .attributes .get (preset_mode ) is not None :
441451 setattr (self , f"_{ preset_mode } " , float (old_state .attributes .get (preset_mode )))
@@ -490,6 +500,10 @@ def _async_startup(*_):
490500 self ._hvac_mode = HVACMode .OFF
491501 await self ._async_control_heating (calc_pid = True )
492502
503+ @property
504+ def translation_key (self ):
505+ return "smart_thermostat_translation"
506+
493507 @property
494508 def should_poll (self ):
495509 """Return the polling state."""
@@ -572,6 +586,7 @@ def preset_modes(self):
572586 def _preset_modes_temp (self ):
573587 """Return a list of preset modes and their temperatures"""
574588 return {
589+ PRESET_ANTI_FROST : self ._frost_temp ,
575590 PRESET_AWAY : self ._away_temp ,
576591 PRESET_ECO : self ._eco_temp ,
577592 PRESET_BOOST : self ._boost_temp ,
@@ -585,6 +600,7 @@ def _preset_modes_temp(self):
585600 def _preset_temp_modes (self ):
586601 """Return a list of preset temperature and their modes"""
587602 return {
603+ self ._frost_temp : PRESET_ANTI_FROST ,
588604 self ._away_temp : PRESET_AWAY ,
589605 self ._eco_temp : PRESET_ECO ,
590606 self ._boost_temp : PRESET_BOOST ,
@@ -656,6 +672,7 @@ def pid_control_output(self):
656672 def extra_state_attributes (self ):
657673 """attributes to include in entity"""
658674 device_state_attributes = {
675+ 'frost_temp' : self ._frost_temp ,
659676 'away_temp' : self ._away_temp ,
660677 'eco_temp' : self ._eco_temp ,
661678 'boost_temp' : self ._boost_temp ,
0 commit comments