Add minimal_deactivation_delay (#905)
* Add minimal_deactivation_delay In some cases users may want to keep the equipment on if it will deactivate for a short time. This could help reduce wear on gas boilers. * fix(prop_algorithm): correct the log message for minimal_deactivation_delay * fix(translations): correct the translations for minimal_deactivation_delay
This commit is contained in:
@@ -104,6 +104,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
|
||||
"last_temperature_datetime",
|
||||
"last_ext_temperature_datetime",
|
||||
"minimal_activation_delay_sec",
|
||||
"minimal_deactivation_delay_sec",
|
||||
"last_update_datetime",
|
||||
"timezone",
|
||||
"temperature_unit",
|
||||
@@ -370,6 +371,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
|
||||
self._tpi_coef_ext = 0
|
||||
|
||||
self._minimal_activation_delay = entry_infos.get(CONF_MINIMAL_ACTIVATION_DELAY)
|
||||
self._minimal_deactivation_delay = entry_infos.get(CONF_MINIMAL_DEACTIVATION_DELAY)
|
||||
self._last_temperature_measure = self.now
|
||||
self._last_ext_temperature_measure = self.now
|
||||
|
||||
@@ -1684,6 +1686,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity, Generic[T]):
|
||||
self._current_tz
|
||||
).isoformat(),
|
||||
"minimal_activation_delay_sec": self._minimal_activation_delay,
|
||||
"minimal_deactivation_delay_sec": self._minimal_deactivation_delay,
|
||||
ATTR_TOTAL_ENERGY: self.total_energy,
|
||||
"last_update_datetime": self.now.isoformat(),
|
||||
"timezone": str(self._current_tz),
|
||||
|
||||
@@ -371,6 +371,12 @@ class VersatileThermostatBaseConfigFlow(FlowHandler):
|
||||
):
|
||||
return False
|
||||
|
||||
if (
|
||||
infos.get(CONF_USE_ADVANCED_CENTRAL_CONFIG, False) is False
|
||||
and infos.get(CONF_MINIMAL_DEACTIVATION_DELAY, -1) == -1
|
||||
):
|
||||
return False
|
||||
|
||||
if (
|
||||
infos.get(CONF_PROP_FUNCTION, None) == PROPORTIONAL_FUNCTION_TPI
|
||||
and infos.get(CONF_USE_TPI_CENTRAL_CONFIG, False) is False
|
||||
|
||||
@@ -374,6 +374,7 @@ STEP_PRESENCE_DATA_SCHEMA = vol.Schema( # pylint: disable=invalid-name
|
||||
STEP_CENTRAL_ADVANCED_DATA_SCHEMA = vol.Schema( # pylint: disable=invalid-name
|
||||
{
|
||||
vol.Required(CONF_MINIMAL_ACTIVATION_DELAY, default=10): cv.positive_int,
|
||||
vol.Required(CONF_MINIMAL_DEACTIVATION_DELAY, default=0): cv.positive_int,
|
||||
vol.Required(CONF_SAFETY_DELAY_MIN, default=60): cv.positive_int,
|
||||
vol.Required(
|
||||
CONF_SAFETY_MIN_ON_PERCENT,
|
||||
|
||||
@@ -83,6 +83,7 @@ CONF_TPI_COEF_EXT = "tpi_coef_ext"
|
||||
CONF_PRESENCE_SENSOR = "presence_sensor_entity_id"
|
||||
CONF_PRESET_POWER = "power_temp"
|
||||
CONF_MINIMAL_ACTIVATION_DELAY = "minimal_activation_delay"
|
||||
CONF_MINIMAL_DEACTIVATION_DELAY = "minimal_deactivation_delay"
|
||||
CONF_TEMP_MIN = "temp_min"
|
||||
CONF_TEMP_MAX = "temp_max"
|
||||
CONF_SAFETY_DELAY_MIN = "safety_delay_min"
|
||||
@@ -289,6 +290,7 @@ ALL_CONF = (
|
||||
CONF_TPI_COEF_EXT,
|
||||
CONF_PRESENCE_SENSOR,
|
||||
CONF_MINIMAL_ACTIVATION_DELAY,
|
||||
CONF_MINIMAL_DEACTIVATION_DELAY,
|
||||
CONF_TEMP_MIN,
|
||||
CONF_TEMP_MAX,
|
||||
CONF_SAFETY_DELAY_MIN,
|
||||
|
||||
@@ -30,18 +30,20 @@ class PropAlgorithm:
|
||||
tpi_coef_ext,
|
||||
cycle_min: int,
|
||||
minimal_activation_delay: int,
|
||||
minimal_deactivation_delay: int,
|
||||
vtherm_entity_id: str = None,
|
||||
max_on_percent: float = None,
|
||||
) -> None:
|
||||
"""Initialisation of the Proportional Algorithm"""
|
||||
_LOGGER.debug(
|
||||
"%s - Creation new PropAlgorithm function_type: %s, tpi_coef_int: %s, tpi_coef_ext: %s, cycle_min:%d, minimal_activation_delay:%d", # pylint: disable=line-too-long
|
||||
"%s - Creation new PropAlgorithm function_type: %s, tpi_coef_int: %s, tpi_coef_ext: %s, cycle_min:%d, minimal_activation_delay:%d, minimal_deactivation_delay:%d", # pylint: disable=line-too-long
|
||||
vtherm_entity_id,
|
||||
function_type,
|
||||
tpi_coef_int,
|
||||
tpi_coef_ext,
|
||||
cycle_min,
|
||||
minimal_activation_delay,
|
||||
minimal_deactivation_delay,
|
||||
)
|
||||
|
||||
# Issue 506 - check parameters
|
||||
@@ -51,10 +53,11 @@ class PropAlgorithm:
|
||||
or not is_number(tpi_coef_ext)
|
||||
or not is_number(cycle_min)
|
||||
or not is_number(minimal_activation_delay)
|
||||
or not is_number(minimal_deactivation_delay)
|
||||
or function_type != PROPORTIONAL_FUNCTION_TPI
|
||||
):
|
||||
_LOGGER.error(
|
||||
"%s - configuration is wrong. function_type=%s, entity_id is %s, tpi_coef_int is %s, tpi_coef_ext is %s, cycle_min is %s, minimal_activation_delay is %s",
|
||||
"%s - configuration is wrong. function_type=%s, entity_id is %s, tpi_coef_int is %s, tpi_coef_ext is %s, cycle_min is %s, minimal_activation_delay is %s, minimal_deactivation_delay is %s",
|
||||
vtherm_entity_id,
|
||||
function_type,
|
||||
vtherm_entity_id,
|
||||
@@ -62,6 +65,7 @@ class PropAlgorithm:
|
||||
tpi_coef_ext,
|
||||
cycle_min,
|
||||
minimal_activation_delay,
|
||||
minimal_deactivation_delay,
|
||||
)
|
||||
raise TypeError(
|
||||
"TPI parameters are not set correctly. VTherm will not work as expected. Please reconfigure it correctly. See previous log for values"
|
||||
@@ -73,6 +77,7 @@ class PropAlgorithm:
|
||||
self._tpi_coef_ext = tpi_coef_ext
|
||||
self._cycle_min = cycle_min
|
||||
self._minimal_activation_delay = minimal_activation_delay
|
||||
self._minimal_deactivation_delay = minimal_deactivation_delay
|
||||
self._on_percent = 0
|
||||
self._calculated_on_percent = 0
|
||||
self._on_time_sec = 0
|
||||
@@ -187,6 +192,18 @@ class PropAlgorithm:
|
||||
|
||||
self._off_time_sec = self._cycle_min * 60 - self._on_time_sec
|
||||
|
||||
# Do not stop heating when off time less than xx sec
|
||||
if self._off_time_sec < self._minimal_deactivation_delay:
|
||||
if self._off_time_sec > 0:
|
||||
_LOGGER.info(
|
||||
"%s - Force 100% heating cycle since the off duration (%f) is shorter than minimal_deactivation_delay (%f)",
|
||||
self._vtherm_entity_id,
|
||||
self._off_time_sec,
|
||||
self._minimal_deactivation_delay,
|
||||
)
|
||||
self._on_time_sec = self._cycle_min * 60
|
||||
self._off_time_sec = 0
|
||||
|
||||
def set_safety(self, default_on_percent: float):
|
||||
"""Set a default value for on_percent (used for safety mode)"""
|
||||
_LOGGER.info(
|
||||
|
||||
@@ -199,6 +199,7 @@
|
||||
"description": "Configuration of advanced parameters. Leave the default values if you don't know what you are doing.\nThese parameters can lead to very poor temperature control or bad power regulation [](https://github.com/jmcollin78/versatile_thermostat/blob/main/documentation/en/feature-advanced.md)",
|
||||
"data": {
|
||||
"minimal_activation_delay": "Minimum activation delay",
|
||||
"minimal_deactivation_delay": "Minimum deactivation delay",
|
||||
"safety_delay_min": "Safety delay (in minutes)",
|
||||
"safety_min_on_percent": "Minimum power percent to enable safety mode",
|
||||
"safety_default_on_percent": "Power percent to use in safety mode",
|
||||
@@ -206,6 +207,7 @@
|
||||
},
|
||||
"data_description": {
|
||||
"minimal_activation_delay": "Delay in seconds under which the equipment will not be activated",
|
||||
"minimal_deactivation_delay": "Delay in seconds under which the equipment will be kept active",
|
||||
"safety_delay_min": "Maximum allowed delay in minutes between two temperature measurements. Above this delay the thermostat will turn to a safety off state",
|
||||
"safety_min_on_percent": "Minimum heating percent value for safety preset activation. Below this amount of power percent the thermostat won't go into safety preset",
|
||||
"safety_default_on_percent": "The default heating power percent value in safety preset. Set to 0 to switch off heater in safety preset",
|
||||
@@ -451,6 +453,7 @@
|
||||
"description": "Configuration of advanced parameters. Leave the default values if you don't know what you are doing.\nThese parameters can lead to very poor temperature control or bad power regulation [](https://github.com/jmcollin78/versatile_thermostat/blob/main/documentation/en/feature-advanced.md)",
|
||||
"data": {
|
||||
"minimal_activation_delay": "Minimum activation delay",
|
||||
"minimal_deactivation_delay": "Minimum deactivation delay",
|
||||
"safety_delay_min": "Safety delay (in minutes)",
|
||||
"safety_min_on_percent": "Minimum power percent to enable safety mode",
|
||||
"safety_default_on_percent": "Power percent to use in safety mode",
|
||||
@@ -458,6 +461,7 @@
|
||||
},
|
||||
"data_description": {
|
||||
"minimal_activation_delay": "Delay in seconds under which the equipment will not be activated",
|
||||
"minimal_deactivation_delay": "Delay in seconds under which the equipment will be kept active",
|
||||
"safety_delay_min": "Maximum allowed delay in minutes between two temperature measurements. Above this delay the thermostat will turn to a safety off state",
|
||||
"safety_min_on_percent": "Minimum heating percent value for safety preset activation. Below this amount of power percent the thermostat won't go into safety preset",
|
||||
"safety_default_on_percent": "The default heating power percent value in safety preset. Set to 0 to switch off heater in safety preset",
|
||||
|
||||
@@ -82,6 +82,7 @@ class ThermostatOverClimateValve(ThermostatOverClimate):
|
||||
self._tpi_coef_ext,
|
||||
self._cycle_min,
|
||||
self._minimal_activation_delay,
|
||||
self._minimal_deactivation_delay,
|
||||
self.name,
|
||||
)
|
||||
|
||||
|
||||
@@ -77,6 +77,7 @@ class ThermostatOverSwitch(BaseThermostat[UnderlyingSwitch]):
|
||||
self._tpi_coef_ext,
|
||||
self._cycle_min,
|
||||
self._minimal_activation_delay,
|
||||
self._minimal_deactivation_delay,
|
||||
self.name,
|
||||
max_on_percent=self._max_on_percent,
|
||||
)
|
||||
|
||||
@@ -96,6 +96,7 @@ class ThermostatOverValve(BaseThermostat[UnderlyingValve]): # pylint: disable=a
|
||||
self._tpi_coef_ext,
|
||||
self._cycle_min,
|
||||
self._minimal_activation_delay,
|
||||
self._minimal_deactivation_delay,
|
||||
self.name,
|
||||
max_on_percent=self._max_on_percent,
|
||||
)
|
||||
|
||||
@@ -199,6 +199,7 @@
|
||||
"description": "Configuration of advanced parameters. Leave the default values if you don't know what you are doing.\nThese parameters can lead to very poor temperature control or bad power regulation [](https://github.com/jmcollin78/versatile_thermostat/blob/main/documentation/en/feature-advanced.md)",
|
||||
"data": {
|
||||
"minimal_activation_delay": "Minimum activation delay",
|
||||
"minimal_deactivation_delay": "Minimal deactivation delay",
|
||||
"safety_delay_min": "Safety delay (in minutes)",
|
||||
"safety_min_on_percent": "Minimum power percent to enable safety mode",
|
||||
"safety_default_on_percent": "Power percent to use in safety mode",
|
||||
@@ -206,6 +207,7 @@
|
||||
},
|
||||
"data_description": {
|
||||
"minimal_activation_delay": "Delay in seconds under which the equipment will not be activated",
|
||||
"minimal_deactivation_delay": "Delay in seconds under which the equipment will be kept active",
|
||||
"safety_delay_min": "Maximum allowed delay in minutes between two temperature measurements. Above this delay the thermostat will turn to a safety off state",
|
||||
"safety_min_on_percent": "Minimum heating percent value for safety preset activation. Below this amount of power percent the thermostat won't go into safety preset",
|
||||
"safety_default_on_percent": "The default heating power percent value in safety preset. Set to 0 to switch off heater in safety preset",
|
||||
|
||||
@@ -200,6 +200,7 @@
|
||||
"description": "Configuration des paramètres avancés. Laissez les valeurs par défaut si vous ne savez pas ce que vous faites.\nCes paramètres peuvent induire des mauvais comportements du thermostat [](https://github.com/jmcollin78/versatile_thermostat/blob/main/documentation/fr/feature-advanced.md)",
|
||||
"data": {
|
||||
"minimal_activation_delay": "Délai minimal d'activation",
|
||||
"minimal_deactivation_delay": "Minimal deactivation delay",
|
||||
"safety_delay_min": "Délai maximal entre 2 mesures de températures",
|
||||
"safety_min_on_percent": "Pourcentage minimal de puissance",
|
||||
"safety_default_on_percent": "Pourcentage de puissance a utiliser en mode securité",
|
||||
@@ -207,6 +208,7 @@
|
||||
},
|
||||
"data_description": {
|
||||
"minimal_activation_delay": "Délai en secondes en-dessous duquel l'équipement ne sera pas activé",
|
||||
"minimal_deactivation_delay": "Delay in seconds under which the equipment will be kept active",
|
||||
"safety_delay_min": "Délai maximal autorisé en minutes entre 2 mesures de températures. Au-dessus de ce délai, le thermostat se mettra en position de sécurité",
|
||||
"safety_min_on_percent": "Seuil minimal de pourcentage de chauffage en-dessous duquel le préréglage sécurité ne sera jamais activé",
|
||||
"safety_default_on_percent": "Valeur par défaut pour le pourcentage de chauffage en mode sécurité. Mettre 0 pour éteindre le radiateur en mode sécurité",
|
||||
@@ -448,6 +450,7 @@
|
||||
"description": "Configuration des paramètres avancés. Laissez les valeurs par défaut si vous ne savez pas ce que vous faites.\nCes paramètres peuvent induire des mauvais comportements du thermostat [](https://github.com/jmcollin78/versatile_thermostat/blob/main/documentation/fr/feature-advanced.md)",
|
||||
"data": {
|
||||
"minimal_activation_delay": "Délai minimal d'activation",
|
||||
"minimal_deactivation_delay": "Minimal deactivation delay",
|
||||
"safety_delay_min": "Délai maximal entre 2 mesures de températures",
|
||||
"safety_min_on_percent": "Pourcentage minimal de puissance",
|
||||
"safety_default_on_percent": "Pourcentage de puissance a utiliser en mode securité",
|
||||
@@ -455,6 +458,7 @@
|
||||
},
|
||||
"data_description": {
|
||||
"minimal_activation_delay": "Délai en seondes en-dessous duquel l'équipement ne sera pas activé",
|
||||
"minimal_deactivation_delay": "Delay in seconds under which the equipment will be kept active",
|
||||
"safety_delay_min": "Délai maximal autorisé en minutes entre 2 mesures de températures. Au-dessus de ce délai, le thermostat se mettra en position de sécurité",
|
||||
"safety_min_on_percent": "Seuil minimal de pourcentage de chauffage en-dessous duquel le préréglage sécurité ne sera jamais activé",
|
||||
"safety_default_on_percent": "Valeur par défaut pour le pourcentage de chauffage en mode sécurité. Mettre 0 pour éteindre le radiateur en mode sécurité",
|
||||
|
||||
Reference in New Issue
Block a user