Issue #343 - disable safety mode for outdoor thermometer
This commit is contained in:
@@ -24,6 +24,7 @@ from .const import (
|
||||
CONF_AUTO_REGULATION_SLOW,
|
||||
CONF_AUTO_REGULATION_EXPERT,
|
||||
CONF_SHORT_EMA_PARAMS,
|
||||
CONF_SAFETY_MODE,
|
||||
CONF_THERMOSTAT_CENTRAL_CONFIG,
|
||||
CONF_THERMOSTAT_TYPE,
|
||||
)
|
||||
@@ -47,12 +48,17 @@ EMA_PARAM_SCHEMA = {
|
||||
vol.Required("precision"): cv.positive_int,
|
||||
}
|
||||
|
||||
SAFETY_MODE_PARAM_SCHEMA = {
|
||||
vol.Required("check_outdoor_sensor"): bool,
|
||||
}
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema(
|
||||
{
|
||||
DOMAIN: vol.Schema(
|
||||
{
|
||||
CONF_AUTO_REGULATION_EXPERT: vol.Schema(SELF_REGULATION_PARAM_SCHEMA),
|
||||
CONF_SHORT_EMA_PARAMS: vol.Schema(EMA_PARAM_SCHEMA),
|
||||
CONF_SAFETY_MODE: vol.Schema(SAFETY_MODE_PARAM_SCHEMA),
|
||||
}
|
||||
),
|
||||
},
|
||||
|
||||
@@ -1657,7 +1657,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
|
||||
# try to restart if we were in safety mode
|
||||
if self._security_state:
|
||||
await self.check_security()
|
||||
await self.check_safety()
|
||||
|
||||
# check window_auto
|
||||
return await self._async_manage_window_auto()
|
||||
@@ -1684,7 +1684,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
|
||||
# try to restart if we were in safety mode
|
||||
if self._security_state:
|
||||
await self.check_security()
|
||||
await self.check_safety()
|
||||
except ValueError as ex:
|
||||
_LOGGER.error("Unable to update external temperature from sensor: %s", ex)
|
||||
|
||||
@@ -2122,7 +2122,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
"""Get now. The local datetime or the overloaded _set_now date"""
|
||||
return self._now if self._now is not None else datetime.now(self._current_tz)
|
||||
|
||||
async def check_security(self) -> bool:
|
||||
async def check_safety(self) -> bool:
|
||||
"""Check if last temperature date is too long"""
|
||||
now = self.now
|
||||
delta_temp = (
|
||||
@@ -2134,9 +2134,12 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
|
||||
mode_cond = self._hvac_mode != HVACMode.OFF
|
||||
|
||||
api:VersatileThermostatAPI = VersatileThermostatAPI.get_vtherm_api()
|
||||
is_outdoor_checked = not api.safety_mode or api.safety_mode.get('check_outdoor_sensor') != False
|
||||
|
||||
temp_cond: bool = (
|
||||
delta_temp > self._security_delay_min
|
||||
or delta_ext_temp > self._security_delay_min
|
||||
or (is_outdoor_checked and delta_ext_temp > self._security_delay_min)
|
||||
)
|
||||
climate_cond: bool = self.is_over_climate and self.hvac_action not in [
|
||||
HVACAction.COOLING,
|
||||
@@ -2307,7 +2310,7 @@ class BaseThermostat(ClimateEntity, RestoreEntity):
|
||||
_LOGGER.debug("%s - End of cycle (overpowering)", self)
|
||||
return True
|
||||
|
||||
security: bool = await self.check_security()
|
||||
security: bool = await self.check_safety()
|
||||
if security and self.is_over_climate:
|
||||
_LOGGER.debug("%s - End of cycle (security and over climate)", self)
|
||||
return True
|
||||
|
||||
@@ -105,7 +105,6 @@ CONF_AUTO_REGULATION_EXPERT = "auto_regulation_expert"
|
||||
CONF_AUTO_REGULATION_DTEMP = "auto_regulation_dtemp"
|
||||
CONF_AUTO_REGULATION_PERIOD_MIN = "auto_regulation_periode_min"
|
||||
CONF_INVERSE_SWITCH = "inverse_switch_command"
|
||||
CONF_SHORT_EMA_PARAMS = "short_ema_params"
|
||||
CONF_AUTO_FAN_MODE = "auto_fan_mode"
|
||||
CONF_AUTO_FAN_NONE = "auto_fan_none"
|
||||
CONF_AUTO_FAN_LOW = "auto_fan_low"
|
||||
@@ -113,6 +112,10 @@ CONF_AUTO_FAN_MEDIUM = "auto_fan_medium"
|
||||
CONF_AUTO_FAN_HIGH = "auto_fan_high"
|
||||
CONF_AUTO_FAN_TURBO = "auto_fan_turbo"
|
||||
|
||||
# Global params into configuration.yaml
|
||||
CONF_SHORT_EMA_PARAMS = "short_ema_params"
|
||||
CONF_SAFETY_MODE = "safety_mode"
|
||||
|
||||
CONF_USE_MAIN_CENTRAL_CONFIG = "use_main_central_config"
|
||||
CONF_USE_TPI_CENTRAL_CONFIG = "use_tpi_central_config"
|
||||
CONF_USE_WINDOW_CENTRAL_CONFIG = "use_window_central_config"
|
||||
|
||||
@@ -356,7 +356,7 @@ class UnderlyingSwitch(UnderlyingEntity):
|
||||
_LOGGER.debug("%s - End of cycle (3)", self)
|
||||
return
|
||||
# safety mode could have change the on_time percent
|
||||
await self._thermostat.check_security()
|
||||
await self._thermostat.check_safety()
|
||||
time = self._on_time_sec
|
||||
|
||||
action_label = "start"
|
||||
|
||||
@@ -7,6 +7,7 @@ from .const import (
|
||||
DOMAIN,
|
||||
CONF_AUTO_REGULATION_EXPERT,
|
||||
CONF_SHORT_EMA_PARAMS,
|
||||
CONF_SAFETY_MODE,
|
||||
CONF_THERMOSTAT_TYPE,
|
||||
CONF_THERMOSTAT_CENTRAL_CONFIG,
|
||||
)
|
||||
@@ -46,6 +47,7 @@ class VersatileThermostatAPI(dict):
|
||||
super().__init__()
|
||||
self._expert_params = None
|
||||
self._short_ema_params = None
|
||||
self._safety_mode = None
|
||||
self._central_boiler_entity = None
|
||||
|
||||
def find_central_configuration(self):
|
||||
@@ -88,6 +90,10 @@ class VersatileThermostatAPI(dict):
|
||||
if self._short_ema_params:
|
||||
_LOGGER.debug("We have found short ema params %s", self._short_ema_params)
|
||||
|
||||
self._safety_mode = config.get(CONF_SAFETY_MODE)
|
||||
if self._safety_mode:
|
||||
_LOGGER.debug("We have found safet_mode params %s", self._safety_mode)
|
||||
|
||||
def register_central_boiler(self, central_boiler_entity):
|
||||
"""Register the central boiler entity. This is used by the CentralBoilerBinarySensor
|
||||
class to register itself at creation"""
|
||||
@@ -105,9 +111,14 @@ class VersatileThermostatAPI(dict):
|
||||
|
||||
@property
|
||||
def short_ema_params(self):
|
||||
"""Get the self regulation params"""
|
||||
"""Get the short EMA params in expert mode"""
|
||||
return self._short_ema_params
|
||||
|
||||
@property
|
||||
def safety_mode(self):
|
||||
"""Get the safety_mode params"""
|
||||
return self._safety_mode
|
||||
|
||||
@property
|
||||
def hass(self):
|
||||
"""Get the HomeAssistant object"""
|
||||
|
||||
Reference in New Issue
Block a user