Feature 218 add hors gel (#263)
* Implementation ok * Add attributes for UI Card actions --------- Co-authored-by: Jean-Marc Collin <jean-marc.collin-extern@renault.com>
This commit is contained in:
@@ -88,6 +88,7 @@ from .const import (
|
||||
CONF_PRESENCE_SENSOR,
|
||||
CONF_PRESET_POWER,
|
||||
SUPPORT_FLAGS,
|
||||
PRESET_FROST_PROTECTION,
|
||||
PRESET_POWER,
|
||||
PRESET_SECURITY,
|
||||
PROPORTIONAL_FUNCTION_TPI,
|
||||
@@ -148,9 +149,11 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
{
|
||||
"is_on",
|
||||
"type",
|
||||
"frost_temp",
|
||||
"eco_temp",
|
||||
"boost_temp",
|
||||
"comfort_temp",
|
||||
"frost_away_temp",
|
||||
"eco_away_temp",
|
||||
"boost_away_temp",
|
||||
"comfort_away_temp",
|
||||
@@ -272,6 +275,9 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
)
|
||||
|
||||
self._ac_mode = entry_infos.get(CONF_AC_MODE) is True
|
||||
self._attr_max_temp = entry_infos.get(CONF_TEMP_MAX)
|
||||
self._attr_min_temp = entry_infos.get(CONF_TEMP_MIN)
|
||||
|
||||
# convert entry_infos into usable attributes
|
||||
presets = {}
|
||||
items = CONF_PRESETS_WITH_AC.items() if self._ac_mode else CONF_PRESETS.items()
|
||||
@@ -281,6 +287,9 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
presets[key] = entry_infos.get(value)
|
||||
else:
|
||||
_LOGGER.debug("value %s not found in Entry", value)
|
||||
presets[key] = (
|
||||
self._attr_max_temp if self._ac_mode else self._attr_min_temp
|
||||
)
|
||||
|
||||
presets_away = {}
|
||||
items = (
|
||||
@@ -294,6 +303,9 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
presets_away[key] = entry_infos.get(value)
|
||||
else:
|
||||
_LOGGER.debug("value %s not found in Entry", value)
|
||||
presets_away[key] = (
|
||||
self._attr_max_temp if self._ac_mode else self._attr_min_temp
|
||||
)
|
||||
|
||||
if self._window_call_cancel is not None:
|
||||
self._window_call_cancel()
|
||||
@@ -310,8 +322,6 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
self._proportional_function = entry_infos.get(CONF_PROP_FUNCTION)
|
||||
self._temp_sensor_entity_id = entry_infos.get(CONF_TEMP_SENSOR)
|
||||
self._ext_temp_sensor_entity_id = entry_infos.get(CONF_EXTERNAL_TEMP_SENSOR)
|
||||
self._attr_max_temp = entry_infos.get(CONF_TEMP_MAX)
|
||||
self._attr_min_temp = entry_infos.get(CONF_TEMP_MIN)
|
||||
# Default value not configurable
|
||||
self._attr_target_temperature_step = 0.1
|
||||
self._power_sensor_entity_id = entry_infos.get(CONF_POWER_SENSOR)
|
||||
@@ -1105,9 +1115,12 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
await under.set_hvac_mode(hvac_mode) or need_control_heating
|
||||
)
|
||||
|
||||
# If AC is on maybe we have to change the temperature in force mode
|
||||
# If AC is on maybe we have to change the temperature in force mode, but not in frost mode (there is no Frost protection possible in AC mode)
|
||||
if self._ac_mode:
|
||||
await self._async_set_preset_mode_internal(self._attr_preset_mode, True)
|
||||
if self.preset_mode != PRESET_FROST_PROTECTION:
|
||||
await self._async_set_preset_mode_internal(self._attr_preset_mode, True)
|
||||
else:
|
||||
await self._async_set_preset_mode_internal(PRESET_ECO, True)
|
||||
|
||||
if need_control_heating and sub_need_control_heating:
|
||||
await self.async_control_heating(force=True)
|
||||
@@ -2165,9 +2178,13 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
"hvac_mode": self.hvac_mode,
|
||||
"preset_mode": self.preset_mode,
|
||||
"type": self._thermostat_type,
|
||||
"frost_temp": self._presets[PRESET_FROST_PROTECTION],
|
||||
"eco_temp": self._presets[PRESET_ECO],
|
||||
"boost_temp": self._presets[PRESET_BOOST],
|
||||
"comfort_temp": self._presets[PRESET_COMFORT],
|
||||
"frost_away_temp": self._presets_away.get(
|
||||
self.get_preset_away_name(PRESET_FROST_PROTECTION)
|
||||
),
|
||||
"eco_away_temp": self._presets_away.get(
|
||||
self.get_preset_away_name(PRESET_ECO)
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user