Compare commits
1 Commits
2.0.0.beta
...
2.0.0.beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7e63c9aa79 |
@@ -820,9 +820,12 @@ class VersatileThermostat(ClimateEntity, RestoreEntity):
|
|||||||
@property
|
@property
|
||||||
def _is_device_active(self):
|
def _is_device_active(self):
|
||||||
"""If the toggleable device is currently active."""
|
"""If the toggleable device is currently active."""
|
||||||
if self._is_over_climate or not self.hass.states.get(self._heater_entity_id):
|
if self._is_over_climate and self._underlying_climate:
|
||||||
return None
|
return self._underlying_climate.hvac_action not in [
|
||||||
|
CURRENT_HVAC_IDLE,
|
||||||
|
CURRENT_HVAC_OFF,
|
||||||
|
]
|
||||||
|
else:
|
||||||
return self.hass.states.is_state(self._heater_entity_id, STATE_ON)
|
return self.hass.states.is_state(self._heater_entity_id, STATE_ON)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -1377,11 +1380,17 @@ class VersatileThermostat(ClimateEntity, RestoreEntity):
|
|||||||
async def _async_underlying_entity_turn_off(self):
|
async def _async_underlying_entity_turn_off(self):
|
||||||
"""Turn heater toggleable device off."""
|
"""Turn heater toggleable device off."""
|
||||||
if not self._is_over_climate:
|
if not self._is_over_climate:
|
||||||
|
_LOGGER.debug(
|
||||||
|
"%s - Stopping underlying switch %s", self, self._heater_entity_id
|
||||||
|
)
|
||||||
data = {ATTR_ENTITY_ID: self._heater_entity_id}
|
data = {ATTR_ENTITY_ID: self._heater_entity_id}
|
||||||
await self.hass.services.async_call(
|
await self.hass.services.async_call(
|
||||||
HA_DOMAIN, SERVICE_TURN_OFF, data, context=self._context
|
HA_DOMAIN, SERVICE_TURN_OFF, data, context=self._context
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
_LOGGER.debug(
|
||||||
|
"%s - Stopping underlying switch %s", self, self._climate_entity_id
|
||||||
|
)
|
||||||
data = {ATTR_ENTITY_ID: self._climate_entity_id}
|
data = {ATTR_ENTITY_ID: self._climate_entity_id}
|
||||||
await self.hass.services.async_call(
|
await self.hass.services.async_call(
|
||||||
HA_DOMAIN, SERVICE_TURN_OFF, data, context=self._context
|
HA_DOMAIN, SERVICE_TURN_OFF, data, context=self._context
|
||||||
@@ -1567,16 +1576,19 @@ class VersatileThermostat(ClimateEntity, RestoreEntity):
|
|||||||
# Check overpowering condition
|
# Check overpowering condition
|
||||||
overpowering: bool = await self.check_overpowering()
|
overpowering: bool = await self.check_overpowering()
|
||||||
if overpowering:
|
if overpowering:
|
||||||
_LOGGER.debug("%s - End of cycle (0)", self)
|
_LOGGER.debug("%s - End of cycle (overpowering)", self)
|
||||||
return
|
return
|
||||||
|
|
||||||
security: bool = await self.check_security()
|
security: bool = await self.check_security()
|
||||||
if security:
|
if security:
|
||||||
_LOGGER.debug("%s - End of cycle (1)", self)
|
_LOGGER.debug("%s - End of cycle (security)", self)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Stop here if we are off
|
# Stop here if we are off
|
||||||
if self._hvac_mode == HVAC_MODE_OFF:
|
if self._hvac_mode == HVAC_MODE_OFF:
|
||||||
|
_LOGGER.debug("%s - End of cycle (HVAC_MODE_OFF)", self)
|
||||||
|
if self._is_device_active:
|
||||||
|
await self._async_underlying_entity_turn_off()
|
||||||
return
|
return
|
||||||
|
|
||||||
if not self._is_over_climate:
|
if not self._is_over_climate:
|
||||||
@@ -1616,6 +1628,12 @@ class VersatileThermostat(ClimateEntity, RestoreEntity):
|
|||||||
self._async_cancel_cycle = None
|
self._async_cancel_cycle = None
|
||||||
_LOGGER.debug("%s - Stopping cycle during calculation", self)
|
_LOGGER.debug("%s - Stopping cycle during calculation", self)
|
||||||
|
|
||||||
|
if self._hvac_mode == HVAC_MODE_OFF:
|
||||||
|
_LOGGER.debug("%s - End of cycle (HVAC_MODE_OFF - 2)", self)
|
||||||
|
if self._is_device_active:
|
||||||
|
await self._async_underlying_entity_turn_off()
|
||||||
|
return
|
||||||
|
|
||||||
if on:
|
if on:
|
||||||
security = (
|
security = (
|
||||||
await self.check_security()
|
await self.check_security()
|
||||||
|
|||||||
@@ -211,11 +211,11 @@ class VersatileThermostatBaseConfigFlow(FlowHandler):
|
|||||||
elif is_power_sensor(v):
|
elif is_power_sensor(v):
|
||||||
_LOGGER.debug("Power sensor !")
|
_LOGGER.debug("Power sensor !")
|
||||||
power_sensors.append(k)
|
power_sensors.append(k)
|
||||||
elif k.startswith(PERSON_DOMAIN) or k.startswith(BINARY_SENSOR_DOMAIN):
|
elif k.startswith(PERSON_DOMAIN):
|
||||||
_LOGGER.debug("Presence sensor !")
|
_LOGGER.debug("Presence sensor !")
|
||||||
presence_sensors.append(k)
|
presence_sensors.append(k)
|
||||||
|
|
||||||
# window sensor
|
# window sensor and presence
|
||||||
if k.startswith(INPUT_BOOLEAN_DOMAIN) or k.startswith(BINARY_SENSOR_DOMAIN):
|
if k.startswith(INPUT_BOOLEAN_DOMAIN) or k.startswith(BINARY_SENSOR_DOMAIN):
|
||||||
_LOGGER.debug("Window or presence sensor !")
|
_LOGGER.debug("Window or presence sensor !")
|
||||||
window_sensors.append(k)
|
window_sensors.append(k)
|
||||||
|
|||||||
Reference in New Issue
Block a user