* Climate 1.0 / part 1/2/3 * fix flake * Lint * Update Google Assistant * ambiclimate to climate 1.0 (#24911) * Fix Alexa * Lint * Migrate zhong_hong * Migrate tuya * Migrate honeywell to new climate schema (#24257) * Update one * Fix model climate v2 * Cleanup p4 * Add comfort hold mode * Fix old code * Update homeassistant/components/climate/__init__.py Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io> * Update homeassistant/components/climate/const.py Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io> * First renaming * Rename operation to hvac for paulus * Rename hold mode to preset mode * Cleanup & update comments * Remove on/off * Fix supported feature count * Update services * Update demo * Fix tests & use current_hvac * Update comment * Fix tests & add typing * Add more typing * Update modes * Fix tests * Cleanup low/high with range * Update homematic part 1 * Finish homematic * Fix lint * fix hm mapping * Support simple devices * convert lcn * migrate oem * Fix xs1 * update hive * update mil * Update toon * migrate deconz * cleanup * update tesla * Fix lint * Fix vera * Migrate zwave * Migrate velbus * Cleanup humity feature * Cleanup * Migrate wink * migrate dyson * Fix current hvac * Renaming * Fix lint * Migrate tfiac * migrate tado * Fix PRESET can be None * apply PR#23913 from dev * remove EU component, etc. * remove EU component, etc. * ready to test now * de-linted * some tweaks * de-lint * better handling of edge cases * delint * fix set_mode typos * apply PR#23913 from dev * remove EU component, etc. * ready to test now * de-linted * some tweaks * de-lint * better handling of edge cases * delint * fix set_mode typos * delint, move debug code * away preset now working * code tidy-up * code tidy-up 2 * code tidy-up 3 * address issues #18932, #15063 * address issues #18932, #15063 - 2/2 * refactor MODE_AUTO to MODE_HEAT_COOL and use F not C * add low/high to set_temp * add low/high to set_temp 2 * add low/high to set_temp - delint * run HA scripts * port changes from PR #24402 * manual rebase * manual rebase 2 * delint * minor change * remove SUPPORT_HVAC_ACTION * Migrate radiotherm * Convert touchline * Migrate flexit * Migrate nuheat * Migrate maxcube * Fix names maxcube const * Migrate proliphix * Migrate heatmiser * Migrate fritzbox * Migrate opentherm_gw * Migrate venstar * Migrate daikin * Migrate modbus * Fix elif * Migrate Homematic IP Cloud to climate-1.0 (#24913) * hmip climate fix * Update hvac_mode and preset_mode * fix lint * Fix lint * Migrate generic_thermostat * Migrate incomfort to new climate schema (#24915) * initial commit * Update climate.py * Migrate eq3btsmart * Lint * cleanup PRESET_MANUAL * Migrate ecobee * No conditional features * KNX: Migrate climate component to new climate platform (#24931) * Migrate climate component * Remove unused code * Corrected line length * Lint * Lint * fix tests * Fix value * Migrate geniushub to new climate schema (#24191) * Update one * Fix model climate v2 * Cleanup p4 * Add comfort hold mode * Fix old code * Update homeassistant/components/climate/__init__.py Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io> * Update homeassistant/components/climate/const.py Co-Authored-By: Paulus Schoutsen <paulus@home-assistant.io> * First renaming * Rename operation to hvac for paulus * Rename hold mode to preset mode * Cleanup & update comments * Remove on/off * Fix supported feature count * Update services * Update demo * Fix tests & use current_hvac * Update comment * Fix tests & add typing * Add more typing * Update modes * Fix tests * Cleanup low/high with range * Update homematic part 1 * Finish homematic * Fix lint * fix hm mapping * Support simple devices * convert lcn * migrate oem * Fix xs1 * update hive * update mil * Update toon * migrate deconz * cleanup * update tesla * Fix lint * Fix vera * Migrate zwave * Migrate velbus * Cleanup humity feature * Cleanup * Migrate wink * migrate dyson * Fix current hvac * Renaming * Fix lint * Migrate tfiac * migrate tado * delinted * delinted * use latest client * clean up mappings * clean up mappings * add duration to set_temperature * add duration to set_temperature * manual rebase * tweak * fix regression * small fix * fix rebase mixup * address comments * finish refactor * fix regression * tweak type hints * delint * manual rebase * WIP: Fixes for honeywell migration to climate-1.0 (#24938) * add type hints * code tidy-up * Fixes for incomfort migration to climate-1.0 (#24936) * delint type hints * no async unless await * revert: no async unless await * revert: no async unless await 2 * delint * fix typo * Fix homekit_controller on climate-1.0 (#24948) * Fix tests on climate-1.0 branch * As part of climate-1.0, make state return the heating-cooling.current characteristic * Fixes from review * lint * Fix imports * Migrate stibel_eltron * Fix lint * Migrate coolmaster to climate 1.0 (#24967) * Migrate coolmaster to climate 1.0 * fix lint errors * More lint fixes * Fix demo to work with UI * Migrate spider * Demo update * Updated frontend to 20190705.0 * Fix boost mode (#24980) * Prepare Netatmo for climate 1.0 (#24973) * Migration Netatmo * Address comments * Update climate.py * Migrate ephember * Migrate Sensibo * Implemented review comments (#24942) * Migrate ESPHome * Migrate MQTT * Migrate Nest * Migrate melissa * Initial/partial migration of ST * Migrate ST * Remove Away mode (#24995) * Migrate evohome, cache access tokens (#24491) * add water_heater, add storage - initial commit * add water_heater, add storage - initial commit delint add missing code desiderata update honeywell client library & CODEOWNER add auth_tokens code, refactor & delint refactor for broker delint * Add Broker, Water Heater & Refactor add missing code desiderata * update honeywell client library & CODEOWNER add auth_tokens code, refactor & delint refactor for broker * bugfix - loc_idx may not be 0 more refactor - ensure pure async more refactoring appears all r/o attributes are working tweak precsion, DHW & delint remove unused code remove unused code 2 remove unused code, refactor _save_auth_tokens() * support RoundThermostat bugfix opmode, switch to util.dt, add until=1h revert breaking change * store at_expires as naive UTC remove debug code delint tidy up exception handling delint add water_heater, add storage - initial commit delint add missing code desiderata update honeywell client library & CODEOWNER add auth_tokens code, refactor & delint refactor for broker add water_heater, add storage - initial commit delint add missing code desiderata update honeywell client library & CODEOWNER add auth_tokens code, refactor & delint refactor for broker delint bugfix - loc_idx may not be 0 more refactor - ensure pure async more refactoring appears all r/o attributes are working tweak precsion, DHW & delint remove unused code remove unused code 2 remove unused code, refactor _save_auth_tokens() support RoundThermostat bugfix opmode, switch to util.dt, add until=1h revert breaking change store at_expires as naive UTC remove debug code delint tidy up exception handling delint * update CODEOWNERS * fix regression * fix requirements * migrate to climate-1.0 * tweaking * de-lint * TCS working? & delint * tweaking * TCS code finalised * remove available() logic * refactor _switchpoints() * tidy up switchpoint code * tweak * teaking device_state_attributes * some refactoring * move PRESET_CUSTOM back to evohome * move CONF_ACCESS_TOKEN_EXPIRES CONF_REFRESH_TOKEN back to evohome * refactor SP code and dt conversion * delinted * delinted * remove water_heater * fix regression * Migrate homekit * Cleanup away mode * Fix tests * add helpers * fix tests melissa * Fix nehueat * fix zwave * add more tests * fix deconz * Fix climate test emulate_hue * fix tests * fix dyson tests * fix demo with new layout * fix honeywell * Switch homekit_controller to use HVAC_MODE_HEAT_COOL instead of HVAC_MODE_AUTO (#25009) * Lint * PyLint * Pylint * fix fritzbox tests * Fix google * Fix all tests * Fix lint * Fix auto for homekit like controler * Fix lint * fix lint
482 lines
15 KiB
Python
482 lines
15 KiB
Python
"""Provides functionality to interact with climate devices."""
|
|
from datetime import timedelta
|
|
import functools as ft
|
|
import logging
|
|
from typing import Any, Awaitable, Dict, List, Optional
|
|
|
|
import voluptuous as vol
|
|
|
|
from homeassistant.const import (
|
|
ATTR_ENTITY_ID, ATTR_TEMPERATURE, PRECISION_TENTHS, PRECISION_WHOLE,
|
|
STATE_OFF, STATE_ON, TEMP_CELSIUS)
|
|
import homeassistant.helpers.config_validation as cv
|
|
from homeassistant.helpers.config_validation import ( # noqa
|
|
PLATFORM_SCHEMA, PLATFORM_SCHEMA_BASE)
|
|
from homeassistant.helpers.entity import Entity
|
|
from homeassistant.helpers.entity_component import EntityComponent
|
|
from homeassistant.helpers.temperature import display_temp as show_temp
|
|
from homeassistant.helpers.typing import (
|
|
ConfigType, HomeAssistantType, ServiceDataType)
|
|
from homeassistant.util.temperature import convert as convert_temperature
|
|
|
|
from .const import (
|
|
ATTR_AUX_HEAT, ATTR_CURRENT_HUMIDITY, ATTR_CURRENT_TEMPERATURE,
|
|
ATTR_FAN_MODE, ATTR_FAN_MODES, ATTR_HUMIDITY, ATTR_HVAC_ACTIONS,
|
|
ATTR_HVAC_MODE, ATTR_HVAC_MODES, ATTR_MAX_HUMIDITY, ATTR_MAX_TEMP,
|
|
ATTR_MIN_HUMIDITY, ATTR_MIN_TEMP, ATTR_PRESET_MODE, ATTR_PRESET_MODES,
|
|
ATTR_SWING_MODE, ATTR_SWING_MODES, ATTR_TARGET_TEMP_HIGH,
|
|
ATTR_TARGET_TEMP_LOW, ATTR_TARGET_TEMP_STEP, DOMAIN, HVAC_MODES,
|
|
SERVICE_SET_AUX_HEAT, SERVICE_SET_FAN_MODE, SERVICE_SET_HUMIDITY,
|
|
SERVICE_SET_HVAC_MODE, SERVICE_SET_PRESET_MODE, SERVICE_SET_SWING_MODE,
|
|
SERVICE_SET_TEMPERATURE, SUPPORT_AUX_HEAT, SUPPORT_FAN_MODE,
|
|
SUPPORT_PRESET_MODE, SUPPORT_SWING_MODE, SUPPORT_TARGET_HUMIDITY,
|
|
SUPPORT_TARGET_TEMPERATURE_RANGE)
|
|
from .reproduce_state import async_reproduce_states # noqa
|
|
|
|
DEFAULT_MIN_TEMP = 7
|
|
DEFAULT_MAX_TEMP = 35
|
|
DEFAULT_MIN_HUMIDITY = 30
|
|
DEFAULT_MAX_HUMIDITY = 99
|
|
|
|
ENTITY_ID_FORMAT = DOMAIN + '.{}'
|
|
SCAN_INTERVAL = timedelta(seconds=60)
|
|
|
|
CONVERTIBLE_ATTRIBUTE = [
|
|
ATTR_TEMPERATURE,
|
|
ATTR_TARGET_TEMP_LOW,
|
|
ATTR_TARGET_TEMP_HIGH,
|
|
]
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
SET_AUX_HEAT_SCHEMA = vol.Schema({
|
|
vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids,
|
|
vol.Required(ATTR_AUX_HEAT): cv.boolean,
|
|
})
|
|
SET_TEMPERATURE_SCHEMA = vol.Schema(vol.All(
|
|
cv.has_at_least_one_key(
|
|
ATTR_TEMPERATURE, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW),
|
|
{
|
|
vol.Exclusive(ATTR_TEMPERATURE, 'temperature'): vol.Coerce(float),
|
|
vol.Inclusive(ATTR_TARGET_TEMP_HIGH, 'temperature'): vol.Coerce(float),
|
|
vol.Inclusive(ATTR_TARGET_TEMP_LOW, 'temperature'): vol.Coerce(float),
|
|
vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids,
|
|
vol.Optional(ATTR_HVAC_MODE): vol.In(HVAC_MODES),
|
|
}
|
|
))
|
|
SET_FAN_MODE_SCHEMA = vol.Schema({
|
|
vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids,
|
|
vol.Required(ATTR_FAN_MODE): cv.string,
|
|
})
|
|
SET_PRESET_MODE_SCHEMA = vol.Schema({
|
|
vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids,
|
|
vol.Required(ATTR_PRESET_MODE): vol.Maybe(cv.string),
|
|
})
|
|
SET_HVAC_MODE_SCHEMA = vol.Schema({
|
|
vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids,
|
|
vol.Required(ATTR_HVAC_MODE): vol.In(HVAC_MODES),
|
|
})
|
|
SET_HUMIDITY_SCHEMA = vol.Schema({
|
|
vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids,
|
|
vol.Required(ATTR_HUMIDITY): vol.Coerce(float),
|
|
})
|
|
SET_SWING_MODE_SCHEMA = vol.Schema({
|
|
vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids,
|
|
vol.Required(ATTR_SWING_MODE): cv.string,
|
|
})
|
|
|
|
|
|
async def async_setup(hass: HomeAssistantType, config: ConfigType) -> bool:
|
|
"""Set up climate devices."""
|
|
component = hass.data[DOMAIN] = \
|
|
EntityComponent(_LOGGER, DOMAIN, hass, SCAN_INTERVAL)
|
|
await component.async_setup(config)
|
|
|
|
component.async_register_entity_service(
|
|
SERVICE_SET_HVAC_MODE, SET_HVAC_MODE_SCHEMA,
|
|
'async_set_hvac_mode'
|
|
)
|
|
component.async_register_entity_service(
|
|
SERVICE_SET_PRESET_MODE, SET_PRESET_MODE_SCHEMA,
|
|
'async_set_preset_mode'
|
|
)
|
|
component.async_register_entity_service(
|
|
SERVICE_SET_AUX_HEAT, SET_AUX_HEAT_SCHEMA,
|
|
async_service_aux_heat
|
|
)
|
|
component.async_register_entity_service(
|
|
SERVICE_SET_TEMPERATURE, SET_TEMPERATURE_SCHEMA,
|
|
async_service_temperature_set
|
|
)
|
|
component.async_register_entity_service(
|
|
SERVICE_SET_HUMIDITY, SET_HUMIDITY_SCHEMA,
|
|
'async_set_humidity'
|
|
)
|
|
component.async_register_entity_service(
|
|
SERVICE_SET_FAN_MODE, SET_FAN_MODE_SCHEMA,
|
|
'async_set_fan_mode'
|
|
)
|
|
component.async_register_entity_service(
|
|
SERVICE_SET_SWING_MODE, SET_SWING_MODE_SCHEMA,
|
|
'async_set_swing_mode'
|
|
)
|
|
|
|
return True
|
|
|
|
|
|
async def async_setup_entry(hass: HomeAssistantType, entry):
|
|
"""Set up a config entry."""
|
|
return await hass.data[DOMAIN].async_setup_entry(entry)
|
|
|
|
|
|
async def async_unload_entry(hass: HomeAssistantType, entry):
|
|
"""Unload a config entry."""
|
|
return await hass.data[DOMAIN].async_unload_entry(entry)
|
|
|
|
|
|
class ClimateDevice(Entity):
|
|
"""Representation of a climate device."""
|
|
|
|
@property
|
|
def state(self) -> str:
|
|
"""Return the current state."""
|
|
return self.hvac_mode
|
|
|
|
@property
|
|
def precision(self) -> float:
|
|
"""Return the precision of the system."""
|
|
if self.hass.config.units.temperature_unit == TEMP_CELSIUS:
|
|
return PRECISION_TENTHS
|
|
return PRECISION_WHOLE
|
|
|
|
@property
|
|
def state_attributes(self) -> Dict[str, Any]:
|
|
"""Return the optional state attributes."""
|
|
supported_features = self.supported_features
|
|
data = {
|
|
ATTR_HVAC_MODES: self.hvac_modes,
|
|
ATTR_CURRENT_TEMPERATURE: show_temp(
|
|
self.hass, self.current_temperature, self.temperature_unit,
|
|
self.precision),
|
|
ATTR_MIN_TEMP: show_temp(
|
|
self.hass, self.min_temp, self.temperature_unit,
|
|
self.precision),
|
|
ATTR_MAX_TEMP: show_temp(
|
|
self.hass, self.max_temp, self.temperature_unit,
|
|
self.precision),
|
|
ATTR_TEMPERATURE: show_temp(
|
|
self.hass, self.target_temperature, self.temperature_unit,
|
|
self.precision),
|
|
}
|
|
|
|
if self.target_temperature_step:
|
|
data[ATTR_TARGET_TEMP_STEP] = self.target_temperature_step
|
|
|
|
if supported_features & SUPPORT_TARGET_TEMPERATURE_RANGE:
|
|
data[ATTR_TARGET_TEMP_HIGH] = show_temp(
|
|
self.hass, self.target_temperature_high, self.temperature_unit,
|
|
self.precision)
|
|
data[ATTR_TARGET_TEMP_LOW] = show_temp(
|
|
self.hass, self.target_temperature_low, self.temperature_unit,
|
|
self.precision)
|
|
|
|
if self.current_humidity is not None:
|
|
data[ATTR_CURRENT_HUMIDITY] = self.current_humidity
|
|
|
|
if supported_features & SUPPORT_TARGET_HUMIDITY:
|
|
data[ATTR_HUMIDITY] = self.target_humidity
|
|
data[ATTR_MIN_HUMIDITY] = self.min_humidity
|
|
data[ATTR_MAX_HUMIDITY] = self.max_humidity
|
|
|
|
if supported_features & SUPPORT_FAN_MODE:
|
|
data[ATTR_FAN_MODE] = self.fan_mode
|
|
data[ATTR_FAN_MODES] = self.fan_modes
|
|
|
|
if self.hvac_action:
|
|
data[ATTR_HVAC_ACTIONS] = self.hvac_action
|
|
|
|
if supported_features & SUPPORT_PRESET_MODE:
|
|
data[ATTR_PRESET_MODE] = self.preset_mode
|
|
data[ATTR_PRESET_MODES] = self.preset_modes
|
|
|
|
if supported_features & SUPPORT_SWING_MODE:
|
|
data[ATTR_SWING_MODE] = self.swing_mode
|
|
data[ATTR_SWING_MODES] = self.swing_modes
|
|
|
|
if supported_features & SUPPORT_AUX_HEAT:
|
|
data[ATTR_AUX_HEAT] = STATE_ON if self.is_aux_heat else STATE_OFF
|
|
|
|
return data
|
|
|
|
@property
|
|
def temperature_unit(self) -> str:
|
|
"""Return the unit of measurement used by the platform."""
|
|
raise NotImplementedError()
|
|
|
|
@property
|
|
def current_humidity(self) -> Optional[int]:
|
|
"""Return the current humidity."""
|
|
return None
|
|
|
|
@property
|
|
def target_humidity(self) -> Optional[int]:
|
|
"""Return the humidity we try to reach."""
|
|
return None
|
|
|
|
@property
|
|
def hvac_mode(self) -> str:
|
|
"""Return hvac operation ie. heat, cool mode.
|
|
|
|
Need to be one of HVAC_MODE_*.
|
|
"""
|
|
raise NotImplementedError()
|
|
|
|
@property
|
|
def hvac_modes(self) -> List[str]:
|
|
"""Return the list of available hvac operation modes.
|
|
|
|
Need to be a subset of HVAC_MODES.
|
|
"""
|
|
raise NotImplementedError()
|
|
|
|
@property
|
|
def hvac_action(self) -> Optional[str]:
|
|
"""Return the current running hvac operation if supported.
|
|
|
|
Need to be one of CURRENT_HVAC_*.
|
|
"""
|
|
return None
|
|
|
|
@property
|
|
def current_temperature(self) -> Optional[float]:
|
|
"""Return the current temperature."""
|
|
return None
|
|
|
|
@property
|
|
def target_temperature(self) -> Optional[float]:
|
|
"""Return the temperature we try to reach."""
|
|
return None
|
|
|
|
@property
|
|
def target_temperature_step(self) -> Optional[float]:
|
|
"""Return the supported step of target temperature."""
|
|
return None
|
|
|
|
@property
|
|
def target_temperature_high(self) -> Optional[float]:
|
|
"""Return the highbound target temperature we try to reach.
|
|
|
|
Requires SUPPORT_TARGET_TEMPERATURE_RANGE.
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
@property
|
|
def target_temperature_low(self) -> Optional[float]:
|
|
"""Return the lowbound target temperature we try to reach.
|
|
|
|
Requires SUPPORT_TARGET_TEMPERATURE_RANGE.
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
@property
|
|
def preset_mode(self) -> Optional[str]:
|
|
"""Return the current preset mode, e.g., home, away, temp.
|
|
|
|
Requires SUPPORT_PRESET_MODE.
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
@property
|
|
def preset_modes(self) -> Optional[List[str]]:
|
|
"""Return a list of available preset modes.
|
|
|
|
Requires SUPPORT_PRESET_MODE.
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
@property
|
|
def is_aux_heat(self) -> Optional[str]:
|
|
"""Return true if aux heater.
|
|
|
|
Requires SUPPORT_AUX_HEAT.
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
@property
|
|
def fan_mode(self) -> Optional[str]:
|
|
"""Return the fan setting.
|
|
|
|
Requires SUPPORT_FAN_MODE.
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
@property
|
|
def fan_modes(self) -> Optional[List[str]]:
|
|
"""Return the list of available fan modes.
|
|
|
|
Requires SUPPORT_FAN_MODE.
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
@property
|
|
def swing_mode(self) -> Optional[str]:
|
|
"""Return the swing setting.
|
|
|
|
Requires SUPPORT_SWING_MODE.
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
@property
|
|
def swing_modes(self) -> Optional[List[str]]:
|
|
"""Return the list of available swing modes.
|
|
|
|
Requires SUPPORT_SWING_MODE.
|
|
"""
|
|
raise NotImplementedError
|
|
|
|
def set_temperature(self, **kwargs) -> None:
|
|
"""Set new target temperature."""
|
|
raise NotImplementedError()
|
|
|
|
def async_set_temperature(self, **kwargs) -> Awaitable[None]:
|
|
"""Set new target temperature.
|
|
|
|
This method must be run in the event loop and returns a coroutine.
|
|
"""
|
|
return self.hass.async_add_job(
|
|
ft.partial(self.set_temperature, **kwargs))
|
|
|
|
def set_humidity(self, humidity: int) -> None:
|
|
"""Set new target humidity."""
|
|
raise NotImplementedError()
|
|
|
|
def async_set_humidity(self, humidity: int) -> Awaitable[None]:
|
|
"""Set new target humidity.
|
|
|
|
This method must be run in the event loop and returns a coroutine.
|
|
"""
|
|
return self.hass.async_add_job(self.set_humidity, humidity)
|
|
|
|
def set_fan_mode(self, fan_mode: str) -> None:
|
|
"""Set new target fan mode."""
|
|
raise NotImplementedError()
|
|
|
|
def async_set_fan_mode(self, fan_mode: str) -> Awaitable[None]:
|
|
"""Set new target fan mode.
|
|
|
|
This method must be run in the event loop and returns a coroutine.
|
|
"""
|
|
return self.hass.async_add_job(self.set_fan_mode, fan_mode)
|
|
|
|
def set_hvac_mode(self, hvac_mode: str) -> None:
|
|
"""Set new target hvac mode."""
|
|
raise NotImplementedError()
|
|
|
|
def async_set_hvac_mode(self, hvac_mode: str) -> Awaitable[None]:
|
|
"""Set new target hvac mode.
|
|
|
|
This method must be run in the event loop and returns a coroutine.
|
|
"""
|
|
return self.hass.async_add_job(self.set_hvac_mode, hvac_mode)
|
|
|
|
def set_swing_mode(self, swing_mode: str) -> None:
|
|
"""Set new target swing operation."""
|
|
raise NotImplementedError()
|
|
|
|
def async_set_swing_mode(self, swing_mode: str) -> Awaitable[None]:
|
|
"""Set new target swing operation.
|
|
|
|
This method must be run in the event loop and returns a coroutine.
|
|
"""
|
|
return self.hass.async_add_job(self.set_swing_mode, swing_mode)
|
|
|
|
def set_preset_mode(self, preset_mode: str) -> None:
|
|
"""Set new preset mode."""
|
|
raise NotImplementedError()
|
|
|
|
def async_set_preset_mode(self, preset_mode: str) -> Awaitable[None]:
|
|
"""Set new preset mode.
|
|
|
|
This method must be run in the event loop and returns a coroutine.
|
|
"""
|
|
return self.hass.async_add_job(self.set_preset_mode, preset_mode)
|
|
|
|
def turn_aux_heat_on(self) -> None:
|
|
"""Turn auxiliary heater on."""
|
|
raise NotImplementedError()
|
|
|
|
def async_turn_aux_heat_on(self) -> Awaitable[None]:
|
|
"""Turn auxiliary heater on.
|
|
|
|
This method must be run in the event loop and returns a coroutine.
|
|
"""
|
|
return self.hass.async_add_job(self.turn_aux_heat_on)
|
|
|
|
def turn_aux_heat_off(self) -> None:
|
|
"""Turn auxiliary heater off."""
|
|
raise NotImplementedError()
|
|
|
|
def async_turn_aux_heat_off(self) -> Awaitable[None]:
|
|
"""Turn auxiliary heater off.
|
|
|
|
This method must be run in the event loop and returns a coroutine.
|
|
"""
|
|
return self.hass.async_add_job(self.turn_aux_heat_off)
|
|
|
|
@property
|
|
def supported_features(self) -> int:
|
|
"""Return the list of supported features."""
|
|
raise NotImplementedError()
|
|
|
|
@property
|
|
def min_temp(self) -> float:
|
|
"""Return the minimum temperature."""
|
|
return convert_temperature(DEFAULT_MIN_TEMP, TEMP_CELSIUS,
|
|
self.temperature_unit)
|
|
|
|
@property
|
|
def max_temp(self) -> float:
|
|
"""Return the maximum temperature."""
|
|
return convert_temperature(DEFAULT_MAX_TEMP, TEMP_CELSIUS,
|
|
self.temperature_unit)
|
|
|
|
@property
|
|
def min_humidity(self) -> int:
|
|
"""Return the minimum humidity."""
|
|
return DEFAULT_MIN_HUMIDITY
|
|
|
|
@property
|
|
def max_humidity(self) -> int:
|
|
"""Return the maximum humidity."""
|
|
return DEFAULT_MAX_HUMIDITY
|
|
|
|
|
|
async def async_service_aux_heat(
|
|
entity: ClimateDevice, service: ServiceDataType
|
|
) -> None:
|
|
"""Handle aux heat service."""
|
|
if service.data[ATTR_AUX_HEAT]:
|
|
await entity.async_turn_aux_heat_on()
|
|
else:
|
|
await entity.async_turn_aux_heat_off()
|
|
|
|
|
|
async def async_service_temperature_set(
|
|
entity: ClimateDevice, service: ServiceDataType
|
|
) -> None:
|
|
"""Handle set temperature service."""
|
|
hass = entity.hass
|
|
kwargs = {}
|
|
|
|
for value, temp in service.data.items():
|
|
if value in CONVERTIBLE_ATTRIBUTE:
|
|
kwargs[value] = convert_temperature(
|
|
temp,
|
|
hass.config.units.temperature_unit,
|
|
entity.temperature_unit
|
|
)
|
|
else:
|
|
kwargs[value] = temp
|
|
|
|
await entity.async_set_temperature(**kwargs)
|