Climate const.py move (#20945)

* Move constants to const.py

* Import from const instead of climate
This commit is contained in:
Joakim Plate 2019-02-14 20:34:43 +01:00 committed by Fabian Affolter
parent 3736120c6a
commit c5de32e7b1
72 changed files with 372 additions and 295 deletions

View File

@ -11,8 +11,9 @@ import aiohttp
import async_timeout import async_timeout
from homeassistant.components import ( from homeassistant.components import (
alert, automation, binary_sensor, climate, cover, fan, group, http, alert, automation, binary_sensor, cover, fan, group, http,
input_boolean, light, lock, media_player, scene, script, sensor, switch) input_boolean, light, lock, media_player, scene, script, sensor, switch)
from homeassistant.components.climate import const as climate
from homeassistant.helpers import aiohttp_client from homeassistant.helpers import aiohttp_client
from homeassistant.helpers.event import async_track_state_change from homeassistant.helpers.event import async_track_state_change
from homeassistant.const import ( from homeassistant.const import (
@ -22,7 +23,7 @@ from homeassistant.const import (
SERVICE_MEDIA_PLAY, SERVICE_MEDIA_PREVIOUS_TRACK, SERVICE_MEDIA_STOP, SERVICE_MEDIA_PLAY, SERVICE_MEDIA_PREVIOUS_TRACK, SERVICE_MEDIA_STOP,
SERVICE_SET_COVER_POSITION, SERVICE_TURN_OFF, SERVICE_TURN_ON, SERVICE_SET_COVER_POSITION, SERVICE_TURN_OFF, SERVICE_TURN_ON,
SERVICE_UNLOCK, SERVICE_VOLUME_DOWN, SERVICE_VOLUME_UP, SERVICE_VOLUME_SET, SERVICE_UNLOCK, SERVICE_VOLUME_DOWN, SERVICE_VOLUME_UP, SERVICE_VOLUME_SET,
SERVICE_VOLUME_MUTE, STATE_LOCKED, STATE_ON, STATE_UNAVAILABLE, SERVICE_VOLUME_MUTE, STATE_LOCKED, STATE_ON, STATE_OFF, STATE_UNAVAILABLE,
STATE_UNLOCKED, TEMP_CELSIUS, TEMP_FAHRENHEIT, MATCH_ALL) STATE_UNLOCKED, TEMP_CELSIUS, TEMP_FAHRENHEIT, MATCH_ALL)
import homeassistant.core as ha import homeassistant.core as ha
import homeassistant.util.color as color_util import homeassistant.util.color as color_util
@ -58,7 +59,7 @@ API_THERMOSTAT_MODES = OrderedDict([
(climate.STATE_AUTO, 'AUTO'), (climate.STATE_AUTO, 'AUTO'),
(climate.STATE_ECO, 'ECO'), (climate.STATE_ECO, 'ECO'),
(climate.STATE_MANUAL, 'AUTO'), (climate.STATE_MANUAL, 'AUTO'),
(climate.STATE_OFF, 'OFF'), (STATE_OFF, 'OFF'),
(climate.STATE_IDLE, 'OFF'), (climate.STATE_IDLE, 'OFF'),
(climate.STATE_FAN_ONLY, 'OFF'), (climate.STATE_FAN_ONLY, 'OFF'),
(climate.STATE_DRY, 'OFF'), (climate.STATE_DRY, 'OFF'),
@ -765,7 +766,7 @@ class _AlexaThermostatController(_AlexaInterface):
unit = self.hass.config.units.temperature_unit unit = self.hass.config.units.temperature_unit
if name == 'targetSetpoint': if name == 'targetSetpoint':
temp = self.entity.attributes.get(climate.ATTR_TEMPERATURE) temp = self.entity.attributes.get(ATTR_TEMPERATURE)
elif name == 'lowerSetpoint': elif name == 'lowerSetpoint':
temp = self.entity.attributes.get(climate.ATTR_TARGET_TEMP_LOW) temp = self.entity.attributes.get(climate.ATTR_TARGET_TEMP_LOW)
elif name == 'upperSetpoint': elif name == 'upperSetpoint':

View File

@ -51,6 +51,17 @@ from .const import (
SERVICE_SET_OPERATION_MODE, SERVICE_SET_OPERATION_MODE,
SERVICE_SET_SWING_MODE, SERVICE_SET_SWING_MODE,
SERVICE_SET_TEMPERATURE, SERVICE_SET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_HIGH,
SUPPORT_TARGET_TEMPERATURE_LOW,
SUPPORT_TARGET_HUMIDITY,
SUPPORT_TARGET_HUMIDITY_HIGH,
SUPPORT_TARGET_HUMIDITY_LOW,
SUPPORT_FAN_MODE,
SUPPORT_OPERATION_MODE,
SUPPORT_HOLD_MODE,
SUPPORT_SWING_MODE,
SUPPORT_AWAY_MODE,
SUPPORT_AUX_HEAT,
) )
from .reproduce_state import async_reproduce_states # noqa from .reproduce_state import async_reproduce_states # noqa
@ -62,29 +73,6 @@ DEFAULT_MAX_HUMIDITY = 99
ENTITY_ID_FORMAT = DOMAIN + '.{}' ENTITY_ID_FORMAT = DOMAIN + '.{}'
SCAN_INTERVAL = timedelta(seconds=60) SCAN_INTERVAL = timedelta(seconds=60)
STATE_HEAT = 'heat'
STATE_COOL = 'cool'
STATE_IDLE = 'idle'
STATE_AUTO = 'auto'
STATE_MANUAL = 'manual'
STATE_DRY = 'dry'
STATE_FAN_ONLY = 'fan_only'
STATE_ECO = 'eco'
SUPPORT_TARGET_TEMPERATURE = 1
SUPPORT_TARGET_TEMPERATURE_HIGH = 2
SUPPORT_TARGET_TEMPERATURE_LOW = 4
SUPPORT_TARGET_HUMIDITY = 8
SUPPORT_TARGET_HUMIDITY_HIGH = 16
SUPPORT_TARGET_HUMIDITY_LOW = 32
SUPPORT_FAN_MODE = 64
SUPPORT_OPERATION_MODE = 128
SUPPORT_HOLD_MODE = 256
SUPPORT_SWING_MODE = 512
SUPPORT_AWAY_MODE = 1024
SUPPORT_AUX_HEAT = 2048
SUPPORT_ON_OFF = 4096
CONVERTIBLE_ATTRIBUTE = [ CONVERTIBLE_ATTRIBUTE = [
ATTR_TEMPERATURE, ATTR_TEMPERATURE,
ATTR_TARGET_TEMP_LOW, ATTR_TARGET_TEMP_LOW,

View File

@ -20,6 +20,11 @@ ATTR_TARGET_TEMP_HIGH = 'target_temp_high'
ATTR_TARGET_TEMP_LOW = 'target_temp_low' ATTR_TARGET_TEMP_LOW = 'target_temp_low'
ATTR_TARGET_TEMP_STEP = 'target_temp_step' ATTR_TARGET_TEMP_STEP = 'target_temp_step'
DEFAULT_MIN_TEMP = 7
DEFAULT_MAX_TEMP = 35
DEFAULT_MIN_HUMITIDY = 30
DEFAULT_MAX_HUMIDITY = 99
DOMAIN = 'climate' DOMAIN = 'climate'
SERVICE_SET_AUX_HEAT = 'set_aux_heat' SERVICE_SET_AUX_HEAT = 'set_aux_heat'
@ -30,3 +35,26 @@ SERVICE_SET_HUMIDITY = 'set_humidity'
SERVICE_SET_OPERATION_MODE = 'set_operation_mode' SERVICE_SET_OPERATION_MODE = 'set_operation_mode'
SERVICE_SET_SWING_MODE = 'set_swing_mode' SERVICE_SET_SWING_MODE = 'set_swing_mode'
SERVICE_SET_TEMPERATURE = 'set_temperature' SERVICE_SET_TEMPERATURE = 'set_temperature'
STATE_HEAT = 'heat'
STATE_COOL = 'cool'
STATE_IDLE = 'idle'
STATE_AUTO = 'auto'
STATE_MANUAL = 'manual'
STATE_DRY = 'dry'
STATE_FAN_ONLY = 'fan_only'
STATE_ECO = 'eco'
SUPPORT_TARGET_TEMPERATURE = 1
SUPPORT_TARGET_TEMPERATURE_HIGH = 2
SUPPORT_TARGET_TEMPERATURE_LOW = 4
SUPPORT_TARGET_HUMIDITY = 8
SUPPORT_TARGET_HUMIDITY_HIGH = 16
SUPPORT_TARGET_HUMIDITY_LOW = 32
SUPPORT_FAN_MODE = 64
SUPPORT_OPERATION_MODE = 128
SUPPORT_HOLD_MODE = 256
SUPPORT_SWING_MODE = 512
SUPPORT_AWAY_MODE = 1024
SUPPORT_AUX_HEAT = 2048
SUPPORT_ON_OFF = 4096

View File

@ -9,10 +9,11 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
PLATFORM_SCHEMA, STATE_AUTO, STATE_COOL, STATE_DRY, STATE_FAN_ONLY, from homeassistant.components.climate.const import (
STATE_AUTO, STATE_COOL, STATE_DRY, STATE_FAN_ONLY,
STATE_HEAT, SUPPORT_FAN_MODE, SUPPORT_ON_OFF, SUPPORT_OPERATION_MODE, STATE_HEAT, SUPPORT_FAN_MODE, SUPPORT_ON_OFF, SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE, ClimateDevice) SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import ( from homeassistant.const import (
ATTR_TEMPERATURE, CONF_HOST, CONF_PORT, TEMP_CELSIUS, TEMP_FAHRENHEIT) ATTR_TEMPERATURE, CONF_HOST, CONF_PORT, TEMP_CELSIUS, TEMP_FAHRENHEIT)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv

View File

@ -4,8 +4,9 @@ Demo platform that offers a fake climate device.
For more details about this platform, please refer to the documentation For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/ https://home-assistant.io/components/demo/
""" """
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
ClimateDevice, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_HUMIDITY, SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_HUMIDITY,
SUPPORT_TARGET_HUMIDITY_LOW, SUPPORT_TARGET_HUMIDITY_HIGH, SUPPORT_TARGET_HUMIDITY_LOW, SUPPORT_TARGET_HUMIDITY_HIGH,
SUPPORT_AWAY_MODE, SUPPORT_HOLD_MODE, SUPPORT_FAN_MODE, SUPPORT_AWAY_MODE, SUPPORT_HOLD_MODE, SUPPORT_FAN_MODE,

View File

@ -7,8 +7,9 @@ https://home-assistant.io/components/climate.dyson/
import logging import logging
from homeassistant.components.dyson import DYSON_DEVICES from homeassistant.components.dyson import DYSON_DEVICES
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
ClimateDevice, STATE_HEAT, STATE_COOL, STATE_IDLE, from homeassistant.components.climate.const import (
STATE_HEAT, STATE_COOL, STATE_IDLE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE, SUPPORT_OPERATION_MODE) SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE, SUPPORT_OPERATION_MODE)
from homeassistant.const import TEMP_CELSIUS, ATTR_TEMPERATURE from homeassistant.const import TEMP_CELSIUS, ATTR_TEMPERATURE

View File

@ -8,12 +8,12 @@ import logging
from datetime import timedelta from datetime import timedelta
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
ClimateDevice, PLATFORM_SCHEMA, STATE_HEAT, STATE_OFF, from homeassistant.components.climate.const import (
STATE_AUTO, SUPPORT_AUX_HEAT, SUPPORT_OPERATION_MODE, STATE_HEAT, STATE_AUTO, SUPPORT_AUX_HEAT, SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE) SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import ( from homeassistant.const import (
TEMP_CELSIUS, CONF_USERNAME, CONF_PASSWORD, ATTR_TEMPERATURE) ATTR_TEMPERATURE, TEMP_CELSIUS, CONF_USERNAME, CONF_PASSWORD, STATE_OFF)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['pyephember==0.2.0'] REQUIREMENTS = ['pyephember==0.2.0']

View File

@ -8,13 +8,14 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
STATE_ON, STATE_OFF, STATE_HEAT, STATE_MANUAL, STATE_ECO, PLATFORM_SCHEMA, from homeassistant.components.climate.const import (
ClimateDevice, STATE_HEAT, STATE_MANUAL, STATE_ECO,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_AWAY_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_AWAY_MODE,
SUPPORT_ON_OFF) SUPPORT_ON_OFF)
from homeassistant.const import ( from homeassistant.const import (
CONF_MAC, CONF_DEVICES, TEMP_CELSIUS, ATTR_TEMPERATURE, PRECISION_HALVES) ATTR_TEMPERATURE, CONF_MAC, CONF_DEVICES, STATE_ON, STATE_OFF,
TEMP_CELSIUS, PRECISION_HALVES)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['python-eq3bt==0.1.9', 'construct==2.9.45'] REQUIREMENTS = ['python-eq3bt==0.1.9', 'construct==2.9.45']

View File

@ -17,8 +17,9 @@ import voluptuous as vol
from homeassistant.const import ( from homeassistant.const import (
CONF_NAME, CONF_SLAVE, TEMP_CELSIUS, CONF_NAME, CONF_SLAVE, TEMP_CELSIUS,
ATTR_TEMPERATURE, DEVICE_DEFAULT_NAME) ATTR_TEMPERATURE, DEVICE_DEFAULT_NAME)
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
ClimateDevice, PLATFORM_SCHEMA, SUPPORT_TARGET_TEMPERATURE, from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE,
SUPPORT_FAN_MODE) SUPPORT_FAN_MODE)
from homeassistant.components.modbus import ( from homeassistant.components.modbus import (
CONF_HUB, DEFAULT_HUB, DOMAIN as MODBUS_DOMAIN) CONF_HUB, DEFAULT_HUB, DOMAIN as MODBUS_DOMAIN)

View File

@ -11,10 +11,11 @@ import voluptuous as vol
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.core import DOMAIN as HA_DOMAIN from homeassistant.core import DOMAIN as HA_DOMAIN
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
STATE_HEAT, STATE_COOL, STATE_IDLE, STATE_AUTO, ClimateDevice, from homeassistant.components.climate.const import (
STATE_HEAT, STATE_COOL, STATE_IDLE, STATE_AUTO,
ATTR_OPERATION_MODE, ATTR_AWAY_MODE, SUPPORT_OPERATION_MODE, ATTR_OPERATION_MODE, ATTR_AWAY_MODE, SUPPORT_OPERATION_MODE,
SUPPORT_AWAY_MODE, SUPPORT_TARGET_TEMPERATURE, PLATFORM_SCHEMA) SUPPORT_AWAY_MODE, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import ( from homeassistant.const import (
STATE_ON, STATE_OFF, ATTR_TEMPERATURE, CONF_NAME, ATTR_ENTITY_ID, STATE_ON, STATE_OFF, ATTR_TEMPERATURE, CONF_NAME, ATTR_ENTITY_ID,
SERVICE_TURN_ON, SERVICE_TURN_OFF, STATE_UNKNOWN, PRECISION_HALVES, SERVICE_TURN_ON, SERVICE_TURN_OFF, STATE_UNKNOWN, PRECISION_HALVES,

View File

@ -8,8 +8,9 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
ClimateDevice, PLATFORM_SCHEMA, SUPPORT_TARGET_TEMPERATURE) from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import ( from homeassistant.const import (
TEMP_CELSIUS, ATTR_TEMPERATURE, CONF_PORT, CONF_NAME, CONF_ID) TEMP_CELSIUS, ATTR_TEMPERATURE, CONF_PORT, CONF_NAME, CONF_ID)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv

View File

@ -12,8 +12,9 @@ import requests
import voluptuous as vol import voluptuous as vol
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
ClimateDevice, PLATFORM_SCHEMA, ATTR_FAN_MODE, ATTR_FAN_LIST, from homeassistant.components.climate.const import (
ATTR_FAN_MODE, ATTR_FAN_LIST,
ATTR_OPERATION_MODE, ATTR_OPERATION_LIST, SUPPORT_TARGET_TEMPERATURE, ATTR_OPERATION_MODE, ATTR_OPERATION_LIST, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_AWAY_MODE, SUPPORT_OPERATION_MODE) SUPPORT_AWAY_MODE, SUPPORT_OPERATION_MODE)
from homeassistant.const import ( from homeassistant.const import (

View File

@ -6,8 +6,9 @@ https://home-assistant.io/components/climate.melissa/
""" """
import logging import logging
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
ClimateDevice, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, from homeassistant.components.climate.const import (
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_ON_OFF, STATE_AUTO, STATE_HEAT, STATE_COOL, STATE_DRY, SUPPORT_ON_OFF, STATE_AUTO, STATE_HEAT, STATE_COOL, STATE_DRY,
STATE_FAN_ONLY, SUPPORT_FAN_MODE STATE_FAN_ONLY, SUPPORT_FAN_MODE
) )

View File

@ -9,8 +9,9 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
ClimateDevice, DOMAIN, PLATFORM_SCHEMA, STATE_HEAT, from homeassistant.components.climate.const import (
DOMAIN, STATE_HEAT,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE,
SUPPORT_ON_OFF, SUPPORT_OPERATION_MODE) SUPPORT_ON_OFF, SUPPORT_OPERATION_MODE)
from homeassistant.const import ( from homeassistant.const import (

View File

@ -9,8 +9,8 @@ from datetime import timedelta
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
ClimateDevice, from homeassistant.components.climate.const import (
DOMAIN, DOMAIN,
SUPPORT_HOLD_MODE, SUPPORT_HOLD_MODE,
SUPPORT_OPERATION_MODE, SUPPORT_OPERATION_MODE,

View File

@ -13,11 +13,12 @@ import requests
import voluptuous as vol import voluptuous as vol
# Import the device class from the component that you want to support # Import the device class from the component that you want to support
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
ClimateDevice, PLATFORM_SCHEMA, STATE_HEAT, STATE_IDLE, ATTR_TEMPERATURE, from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_AWAY_MODE) STATE_HEAT, STATE_IDLE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_AWAY_MODE)
from homeassistant.const import (CONF_HOST, CONF_USERNAME, CONF_PASSWORD, from homeassistant.const import (
CONF_PORT, TEMP_CELSIUS, CONF_NAME) ATTR_TEMPERATURE, CONF_HOST, CONF_USERNAME, CONF_PASSWORD,
CONF_PORT, TEMP_CELSIUS, CONF_NAME)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['oemthermostat==1.1'] REQUIREMENTS = ['oemthermostat==1.1']

View File

@ -6,11 +6,12 @@ https://home-assistant.io/components/climate.proliphix/
""" """
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
PRECISION_TENTHS, STATE_COOL, STATE_HEAT, STATE_IDLE, from homeassistant.components.climate.const import (
ClimateDevice, PLATFORM_SCHEMA, SUPPORT_TARGET_TEMPERATURE) STATE_COOL, STATE_HEAT, STATE_IDLE, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import ( from homeassistant.const import (
CONF_HOST, CONF_PASSWORD, CONF_USERNAME, TEMP_FAHRENHEIT, ATTR_TEMPERATURE) CONF_HOST, CONF_PASSWORD, CONF_USERNAME, PRECISION_TENTHS, TEMP_FAHRENHEIT,
ATTR_TEMPERATURE)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['proliphix==0.4.1'] REQUIREMENTS = ['proliphix==0.4.1']

View File

@ -9,12 +9,14 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
STATE_AUTO, STATE_COOL, STATE_HEAT, STATE_IDLE, STATE_ON, STATE_OFF, from homeassistant.components.climate.const import (
ClimateDevice, PLATFORM_SCHEMA, SUPPORT_TARGET_TEMPERATURE, STATE_AUTO, STATE_COOL, STATE_HEAT, STATE_IDLE,
SUPPORT_TARGET_TEMPERATURE,
SUPPORT_OPERATION_MODE, SUPPORT_FAN_MODE, SUPPORT_AWAY_MODE) SUPPORT_OPERATION_MODE, SUPPORT_FAN_MODE, SUPPORT_AWAY_MODE)
from homeassistant.const import ( from homeassistant.const import (
CONF_HOST, TEMP_FAHRENHEIT, ATTR_TEMPERATURE, PRECISION_HALVES) ATTR_TEMPERATURE, CONF_HOST, PRECISION_HALVES, TEMP_FAHRENHEIT, STATE_ON,
STATE_OFF)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['radiotherm==2.0.0'] REQUIREMENTS = ['radiotherm==2.0.0']

View File

@ -15,8 +15,9 @@ import voluptuous as vol
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_STATE, ATTR_TEMPERATURE, CONF_API_KEY, CONF_ID, ATTR_ENTITY_ID, ATTR_STATE, ATTR_TEMPERATURE, CONF_API_KEY, CONF_ID,
STATE_ON, STATE_OFF, TEMP_CELSIUS, TEMP_FAHRENHEIT) STATE_ON, STATE_OFF, TEMP_CELSIUS, TEMP_FAHRENHEIT)
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
ATTR_CURRENT_HUMIDITY, ClimateDevice, DOMAIN, PLATFORM_SCHEMA, from homeassistant.components.climate.const import (
ATTR_CURRENT_HUMIDITY, DOMAIN,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE,
SUPPORT_FAN_MODE, SUPPORT_SWING_MODE, SUPPORT_FAN_MODE, SUPPORT_SWING_MODE,
SUPPORT_ON_OFF, STATE_HEAT, STATE_COOL, STATE_FAN_ONLY, STATE_DRY, SUPPORT_ON_OFF, STATE_HEAT, STATE_COOL, STATE_FAN_ONLY, STATE_DRY,

View File

@ -8,8 +8,9 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
ClimateDevice, PLATFORM_SCHEMA, SUPPORT_TARGET_TEMPERATURE) from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import CONF_HOST, TEMP_CELSIUS, ATTR_TEMPERATURE from homeassistant.const import CONF_HOST, TEMP_CELSIUS, ATTR_TEMPERATURE
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv

View File

@ -8,14 +8,14 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
from homeassistant.components.climate.const import (
ATTR_OPERATION_MODE, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, ATTR_OPERATION_MODE, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW,
PLATFORM_SCHEMA, STATE_AUTO, STATE_COOL, STATE_HEAT, SUPPORT_FAN_MODE, STATE_AUTO, STATE_COOL, STATE_HEAT, SUPPORT_FAN_MODE,
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_HUMIDITY, SUPPORT_AWAY_MODE, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_HUMIDITY, SUPPORT_AWAY_MODE,
SUPPORT_TARGET_HUMIDITY_HIGH, SUPPORT_TARGET_HUMIDITY_LOW, SUPPORT_TARGET_HUMIDITY_HIGH, SUPPORT_TARGET_HUMIDITY_LOW,
SUPPORT_HOLD_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_HOLD_MODE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW, SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW)
ClimateDevice)
from homeassistant.const import ( from homeassistant.const import (
ATTR_TEMPERATURE, CONF_HOST, CONF_PASSWORD, CONF_SSL, CONF_TIMEOUT, ATTR_TEMPERATURE, CONF_HOST, CONF_PASSWORD, CONF_SSL, CONF_TIMEOUT,
CONF_USERNAME, PRECISION_WHOLE, STATE_OFF, STATE_ON, TEMP_CELSIUS, CONF_USERNAME, PRECISION_WHOLE, STATE_OFF, STATE_ON, TEMP_CELSIUS,

View File

@ -8,10 +8,11 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
ATTR_OPERATION_MODE, PLATFORM_SCHEMA, STATE_COOL, STATE_DRY, from homeassistant.components.climate.const import (
ATTR_OPERATION_MODE, STATE_COOL, STATE_DRY,
STATE_FAN_ONLY, STATE_HEAT, SUPPORT_FAN_MODE, SUPPORT_ON_OFF, STATE_FAN_ONLY, STATE_HEAT, SUPPORT_FAN_MODE, SUPPORT_ON_OFF,
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, ClimateDevice) SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import (ATTR_TEMPERATURE, CONF_HOST, CONF_PORT, from homeassistant.const import (ATTR_TEMPERATURE, CONF_HOST, CONF_PORT,
EVENT_HOMEASSISTANT_STOP, TEMP_CELSIUS) EVENT_HOMEASSISTANT_STOP, TEMP_CELSIUS)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv

View File

@ -4,17 +4,17 @@ import re
import voluptuous as vol import voluptuous as vol
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
from homeassistant.components.climate.const import (
ATTR_CURRENT_TEMPERATURE, ATTR_FAN_MODE, ATTR_OPERATION_MODE, ATTR_CURRENT_TEMPERATURE, ATTR_FAN_MODE, ATTR_OPERATION_MODE,
ATTR_SWING_MODE, PLATFORM_SCHEMA, STATE_AUTO, STATE_COOL, STATE_DRY, ATTR_SWING_MODE, STATE_AUTO, STATE_COOL, STATE_DRY,
STATE_FAN_ONLY, STATE_HEAT, STATE_OFF, SUPPORT_FAN_MODE, STATE_FAN_ONLY, STATE_HEAT, SUPPORT_FAN_MODE,
SUPPORT_OPERATION_MODE, SUPPORT_SWING_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_SWING_MODE, SUPPORT_TARGET_TEMPERATURE)
ClimateDevice)
from homeassistant.components.daikin import DOMAIN as DAIKIN_DOMAIN from homeassistant.components.daikin import DOMAIN as DAIKIN_DOMAIN
from homeassistant.components.daikin.const import ( from homeassistant.components.daikin.const import (
ATTR_INSIDE_TEMPERATURE, ATTR_OUTSIDE_TEMPERATURE, ATTR_TARGET_TEMPERATURE) ATTR_INSIDE_TEMPERATURE, ATTR_OUTSIDE_TEMPERATURE, ATTR_TARGET_TEMPERATURE)
from homeassistant.const import ( from homeassistant.const import (
ATTR_TEMPERATURE, CONF_HOST, CONF_NAME, TEMP_CELSIUS) ATTR_TEMPERATURE, CONF_HOST, CONF_NAME, STATE_OFF, TEMP_CELSIUS)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -4,15 +4,16 @@ import logging
import voluptuous as vol import voluptuous as vol
from homeassistant.components import ecobee from homeassistant.components import ecobee
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
DOMAIN, STATE_COOL, STATE_HEAT, STATE_AUTO, STATE_IDLE, ClimateDevice, from homeassistant.components.climate.const import (
DOMAIN, STATE_COOL, STATE_HEAT, STATE_AUTO, STATE_IDLE,
ATTR_TARGET_TEMP_LOW, ATTR_TARGET_TEMP_HIGH, SUPPORT_TARGET_TEMPERATURE, ATTR_TARGET_TEMP_LOW, ATTR_TARGET_TEMP_HIGH, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_AWAY_MODE, SUPPORT_HOLD_MODE, SUPPORT_OPERATION_MODE, SUPPORT_AWAY_MODE, SUPPORT_HOLD_MODE, SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_HUMIDITY_LOW, SUPPORT_TARGET_HUMIDITY_HIGH, SUPPORT_TARGET_HUMIDITY_LOW, SUPPORT_TARGET_HUMIDITY_HIGH,
SUPPORT_AUX_HEAT, SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_FAN_MODE, SUPPORT_AUX_HEAT, SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_FAN_MODE,
SUPPORT_TARGET_TEMPERATURE_LOW, STATE_OFF) SUPPORT_TARGET_TEMPERATURE_LOW)
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, STATE_ON, ATTR_TEMPERATURE, TEMP_FAHRENHEIT) ATTR_ENTITY_ID, STATE_ON, STATE_OFF, ATTR_TEMPERATURE, TEMP_FAHRENHEIT)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
_CONFIGURING = {} _CONFIGURING = {}

View File

@ -1,12 +1,14 @@
"""Support for control of Elk-M1 connected thermostats.""" """Support for control of Elk-M1 connected thermostats."""
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, PRECISION_WHOLE, STATE_AUTO, from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, STATE_AUTO,
STATE_COOL, STATE_FAN_ONLY, STATE_HEAT, STATE_IDLE, SUPPORT_AUX_HEAT, STATE_COOL, STATE_FAN_ONLY, STATE_HEAT, STATE_IDLE, SUPPORT_AUX_HEAT,
SUPPORT_FAN_MODE, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_FAN_MODE, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE_HIGH,
SUPPORT_TARGET_TEMPERATURE_LOW, ClimateDevice) SUPPORT_TARGET_TEMPERATURE_LOW)
from homeassistant.components.elkm1 import ( from homeassistant.components.elkm1 import (
DOMAIN as ELK_DOMAIN, ElkEntity, create_elk_entities) DOMAIN as ELK_DOMAIN, ElkEntity, create_elk_entities)
from homeassistant.const import STATE_ON from homeassistant.const import (
STATE_ON, PRECISION_WHOLE)
DEPENDENCIES = [ELK_DOMAIN] DEPENDENCIES = [ELK_DOMAIN]

View File

@ -4,13 +4,13 @@ import logging
from requests.exceptions import HTTPError from requests.exceptions import HTTPError
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
STATE_AUTO, STATE_ECO, STATE_MANUAL, STATE_OFF, from homeassistant.components.climate.const import (
STATE_AUTO, STATE_ECO, STATE_MANUAL,
SUPPORT_AWAY_MODE, SUPPORT_AWAY_MODE,
SUPPORT_ON_OFF, SUPPORT_ON_OFF,
SUPPORT_OPERATION_MODE, SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,
ClimateDevice
) )
from homeassistant.components.evohome import ( from homeassistant.components.evohome import (
DATA_EVOHOME, DISPATCHER_EVOHOME, DATA_EVOHOME, DISPATCHER_EVOHOME,
@ -22,6 +22,7 @@ from homeassistant.const import (
CONF_SCAN_INTERVAL, CONF_SCAN_INTERVAL,
HTTP_TOO_MANY_REQUESTS, HTTP_TOO_MANY_REQUESTS,
PRECISION_HALVES, PRECISION_HALVES,
STATE_OFF,
TEMP_CELSIUS TEMP_CELSIUS
) )
from homeassistant.core import callback from homeassistant.core import callback

View File

@ -8,13 +8,14 @@ from homeassistant.components.fritzbox import (
ATTR_STATE_DEVICE_LOCKED, ATTR_STATE_BATTERY_LOW, ATTR_STATE_HOLIDAY_MODE, ATTR_STATE_DEVICE_LOCKED, ATTR_STATE_BATTERY_LOW, ATTR_STATE_HOLIDAY_MODE,
ATTR_STATE_LOCKED, ATTR_STATE_SUMMER_MODE, ATTR_STATE_LOCKED, ATTR_STATE_SUMMER_MODE,
ATTR_STATE_WINDOW_OPEN) ATTR_STATE_WINDOW_OPEN)
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
ATTR_OPERATION_MODE, ClimateDevice, STATE_ECO, STATE_HEAT, STATE_MANUAL, from homeassistant.components.climate.const import (
STATE_OFF, STATE_ON, SUPPORT_OPERATION_MODE, ATTR_OPERATION_MODE, STATE_ECO, STATE_HEAT, STATE_MANUAL,
SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE) SUPPORT_TARGET_TEMPERATURE)
from homeassistant.const import ( from homeassistant.const import (
ATTR_BATTERY_LEVEL, ATTR_TEMPERATURE, PRECISION_HALVES, TEMP_CELSIUS) ATTR_BATTERY_LEVEL, ATTR_TEMPERATURE, PRECISION_HALVES, TEMP_CELSIUS,
STATE_OFF, STATE_ON)
DEPENDENCIES = ['fritzbox'] DEPENDENCIES = ['fritzbox']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -2,7 +2,6 @@
import logging import logging
from homeassistant.components import ( from homeassistant.components import (
climate,
cover, cover,
group, group,
fan, fan,
@ -15,6 +14,7 @@ from homeassistant.components import (
switch, switch,
vacuum, vacuum,
) )
from homeassistant.components.climate import const as climate
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_ENTITY_ID,
SERVICE_TURN_OFF, SERVICE_TURN_OFF,
@ -24,6 +24,7 @@ from homeassistant.const import (
TEMP_CELSIUS, TEMP_CELSIUS,
TEMP_FAHRENHEIT, TEMP_FAHRENHEIT,
ATTR_SUPPORTED_FEATURES, ATTR_SUPPORTED_FEATURES,
ATTR_TEMPERATURE,
) )
from homeassistant.core import DOMAIN as HA_DOMAIN from homeassistant.core import DOMAIN as HA_DOMAIN
from homeassistant.util import color as color_util, temperature as temp_util from homeassistant.util import color as color_util, temperature as temp_util
@ -516,7 +517,7 @@ class TemperatureSettingTrait(_Trait):
hass_to_google = { hass_to_google = {
climate.STATE_HEAT: 'heat', climate.STATE_HEAT: 'heat',
climate.STATE_COOL: 'cool', climate.STATE_COOL: 'cool',
climate.STATE_OFF: 'off', STATE_OFF: 'off',
climate.STATE_AUTO: 'heatcool', climate.STATE_AUTO: 'heatcool',
climate.STATE_FAN_ONLY: 'fan-only', climate.STATE_FAN_ONLY: 'fan-only',
climate.STATE_DRY: 'dry', climate.STATE_DRY: 'dry',
@ -576,7 +577,7 @@ class TemperatureSettingTrait(_Trait):
round(temp_util.convert(attrs[climate.ATTR_TARGET_TEMP_LOW], round(temp_util.convert(attrs[climate.ATTR_TARGET_TEMP_LOW],
unit, TEMP_CELSIUS), 1) unit, TEMP_CELSIUS), 1)
else: else:
target_temp = attrs.get(climate.ATTR_TEMPERATURE) target_temp = attrs.get(ATTR_TEMPERATURE)
if target_temp is not None: if target_temp is not None:
response['thermostatTemperatureSetpoint'] = round( response['thermostatTemperatureSetpoint'] = round(
temp_util.convert(target_temp, unit, TEMP_CELSIUS), 1) temp_util.convert(target_temp, unit, TEMP_CELSIUS), 1)
@ -606,7 +607,7 @@ class TemperatureSettingTrait(_Trait):
await self.hass.services.async_call( await self.hass.services.async_call(
climate.DOMAIN, climate.SERVICE_SET_TEMPERATURE, { climate.DOMAIN, climate.SERVICE_SET_TEMPERATURE, {
ATTR_ENTITY_ID: self.state.entity_id, ATTR_ENTITY_ID: self.state.entity_id,
climate.ATTR_TEMPERATURE: temp ATTR_TEMPERATURE: temp
}, blocking=True) }, blocking=True)
elif command == COMMAND_THERMOSTAT_TEMPERATURE_SET_RANGE: elif command == COMMAND_THERMOSTAT_TEMPERATURE_SET_RANGE:

View File

@ -1,9 +1,11 @@
"""Support for the Hive climate devices.""" """Support for the Hive climate devices."""
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
STATE_AUTO, STATE_HEAT, STATE_OFF, STATE_ON, SUPPORT_AUX_HEAT, from homeassistant.components.climate.const import (
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, ClimateDevice) STATE_AUTO, STATE_HEAT,
SUPPORT_AUX_HEAT, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE)
from homeassistant.components.hive import DATA_HIVE, DOMAIN from homeassistant.components.hive import DATA_HIVE, DOMAIN
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import (
ATTR_TEMPERATURE, STATE_OFF, STATE_ON, TEMP_CELSIUS)
DEPENDENCIES = ['hive'] DEPENDENCIES = ['hive']

View File

@ -3,7 +3,7 @@ import logging
from pyhap.const import CATEGORY_THERMOSTAT from pyhap.const import CATEGORY_THERMOSTAT
from homeassistant.components.climate import ( from homeassistant.components.climate.const import (
ATTR_CURRENT_TEMPERATURE, ATTR_MAX_TEMP, ATTR_MIN_TEMP, ATTR_CURRENT_TEMPERATURE, ATTR_MAX_TEMP, ATTR_MIN_TEMP,
ATTR_OPERATION_LIST, ATTR_OPERATION_MODE, ATTR_TARGET_TEMP_HIGH, ATTR_OPERATION_LIST, ATTR_OPERATION_MODE, ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW, DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP, ATTR_TARGET_TEMP_LOW, DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP,

View File

@ -1,12 +1,13 @@
"""Support for Homekit climate devices.""" """Support for Homekit climate devices."""
import logging import logging
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
STATE_COOL, STATE_HEAT, STATE_IDLE, SUPPORT_OPERATION_MODE, from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, ClimateDevice) STATE_HEAT, STATE_COOL, STATE_IDLE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE)
from homeassistant.components.homekit_controller import ( from homeassistant.components.homekit_controller import (
KNOWN_ACCESSORIES, HomeKitEntity) HomeKitEntity, KNOWN_ACCESSORIES)
from homeassistant.const import ATTR_TEMPERATURE, STATE_OFF, TEMP_CELSIUS from homeassistant.const import TEMP_CELSIUS, STATE_OFF, ATTR_TEMPERATURE
DEPENDENCIES = ['homekit_controller'] DEPENDENCIES = ['homekit_controller']

View File

@ -1,9 +1,10 @@
"""Support for Homematic thermostats.""" """Support for Homematic thermostats."""
import logging import logging
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
STATE_AUTO, STATE_MANUAL, SUPPORT_OPERATION_MODE, STATE_AUTO, STATE_MANUAL, SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE, ClimateDevice) SUPPORT_TARGET_TEMPERATURE)
from homeassistant.components.homematic import ( from homeassistant.components.homematic import (
ATTR_DISCOVER_DEVICES, HM_ATTRIBUTE_SUPPORT, HMDevice) ATTR_DISCOVER_DEVICES, HM_ATTRIBUTE_SUPPORT, HMDevice)
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS

View File

@ -1,12 +1,12 @@
"""Support for HomematicIP Cloud climate devices.""" """Support for HomematicIP Cloud climate devices."""
import logging import logging
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
ATTR_TEMPERATURE, STATE_AUTO, STATE_MANUAL, SUPPORT_TARGET_TEMPERATURE, from homeassistant.components.climate.const import (
ClimateDevice) STATE_AUTO, STATE_MANUAL, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.components.homematicip_cloud import ( from homeassistant.components.homematicip_cloud import (
DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice) DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice)
from homeassistant.const import TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -1,11 +1,12 @@
"""Support for KNX/IP climate devices.""" """Support for KNX/IP climate devices."""
import voluptuous as vol import voluptuous as vol
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
PLATFORM_SCHEMA, SUPPORT_ON_OFF, SUPPORT_OPERATION_MODE, from homeassistant.components.climate.const import (
SUPPORT_ON_OFF, SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE, STATE_HEAT, SUPPORT_TARGET_TEMPERATURE, STATE_HEAT,
STATE_IDLE, STATE_MANUAL, STATE_DRY, STATE_IDLE, STATE_MANUAL, STATE_DRY,
STATE_FAN_ONLY, STATE_ECO, ClimateDevice) STATE_FAN_ONLY, STATE_ECO)
from homeassistant.const import ( from homeassistant.const import (
ATTR_TEMPERATURE, CONF_NAME, TEMP_CELSIUS) ATTR_TEMPERATURE, CONF_NAME, TEMP_CELSIUS)
from homeassistant.core import callback from homeassistant.core import callback

View File

@ -2,8 +2,9 @@
import socket import socket
import logging import logging
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
ClimateDevice, STATE_AUTO, SUPPORT_TARGET_TEMPERATURE, from homeassistant.components.climate.const import (
STATE_AUTO, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_OPERATION_MODE) SUPPORT_OPERATION_MODE)
from homeassistant.components.maxcube import DATA_KEY from homeassistant.components.maxcube import DATA_KEY
from homeassistant.const import TEMP_CELSIUS, ATTR_TEMPERATURE from homeassistant.const import TEMP_CELSIUS, ATTR_TEMPERATURE

View File

@ -6,8 +6,9 @@ import voluptuous as vol
from homeassistant.const import ( from homeassistant.const import (
CONF_NAME, CONF_SLAVE, ATTR_TEMPERATURE) CONF_NAME, CONF_SLAVE, ATTR_TEMPERATURE)
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
ClimateDevice, PLATFORM_SCHEMA, SUPPORT_TARGET_TEMPERATURE) from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE)
from homeassistant.components.modbus import ( from homeassistant.components.modbus import (
CONF_HUB, DEFAULT_HUB, DOMAIN as MODBUS_DOMAIN) CONF_HUB, DEFAULT_HUB, DOMAIN as MODBUS_DOMAIN)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv

View File

@ -10,11 +10,13 @@ import voluptuous as vol
from homeassistant.components import climate, mqtt from homeassistant.components import climate, mqtt
from homeassistant.components.climate import ( from homeassistant.components.climate import (
ClimateDevice, PLATFORM_SCHEMA as CLIMATE_PLATFORM_SCHEMA)
from homeassistant.components.climate.const import (
ATTR_OPERATION_MODE, DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP, ATTR_OPERATION_MODE, DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP,
PLATFORM_SCHEMA as CLIMATE_PLATFORM_SCHEMA, STATE_AUTO, STATE_COOL, STATE_AUTO, STATE_COOL,
STATE_DRY, STATE_FAN_ONLY, STATE_HEAT, SUPPORT_AUX_HEAT, SUPPORT_AWAY_MODE, STATE_DRY, STATE_FAN_ONLY, STATE_HEAT, SUPPORT_AUX_HEAT, SUPPORT_AWAY_MODE,
SUPPORT_FAN_MODE, SUPPORT_HOLD_MODE, SUPPORT_OPERATION_MODE, SUPPORT_FAN_MODE, SUPPORT_HOLD_MODE, SUPPORT_OPERATION_MODE,
SUPPORT_SWING_MODE, SUPPORT_TARGET_TEMPERATURE, ClimateDevice) SUPPORT_SWING_MODE, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.components.fan import SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM from homeassistant.components.fan import SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM
from homeassistant.components.mqtt import ( from homeassistant.components.mqtt import (
ATTR_DISCOVERY_HASH, CONF_QOS, CONF_RETAIN, CONF_STATE_TOPIC, ATTR_DISCOVERY_HASH, CONF_QOS, CONF_RETAIN, CONF_STATE_TOPIC,

View File

@ -1,12 +1,13 @@
"""MySensors platform that offers a Climate (MySensors-HVAC) component.""" """MySensors platform that offers a Climate (MySensors-HVAC) component."""
from homeassistant.components import mysensors from homeassistant.components import mysensors
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, DOMAIN, STATE_AUTO, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, DOMAIN, STATE_AUTO,
STATE_COOL, STATE_HEAT, STATE_OFF, SUPPORT_FAN_MODE, STATE_COOL, STATE_HEAT, SUPPORT_FAN_MODE,
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW, SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW)
ClimateDevice) from homeassistant.const import (
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT ATTR_TEMPERATURE, STATE_OFF, TEMP_CELSIUS, TEMP_FAHRENHEIT)
DICT_HA_TO_MYS = { DICT_HA_TO_MYS = {
STATE_AUTO: 'AutoChangeOver', STATE_AUTO: 'AutoChangeOver',

View File

@ -7,7 +7,7 @@ import threading
import voluptuous as vol import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
from homeassistant.components.climate import ( from homeassistant.components.climate.const import (
ATTR_AWAY_MODE, SERVICE_SET_AWAY_MODE) ATTR_AWAY_MODE, SERVICE_SET_AWAY_MODE)
from homeassistant.const import ( from homeassistant.const import (
CONF_BINARY_SENSORS, CONF_FILENAME, CONF_MONITORED_CONDITIONS, CONF_BINARY_SENSORS, CONF_FILENAME, CONF_MONITORED_CONDITIONS,

View File

@ -5,14 +5,15 @@ import voluptuous as vol
from homeassistant.components.nest import ( from homeassistant.components.nest import (
DATA_NEST, SIGNAL_NEST_UPDATE, DOMAIN as NEST_DOMAIN) DATA_NEST, SIGNAL_NEST_UPDATE, DOMAIN as NEST_DOMAIN)
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
STATE_AUTO, STATE_COOL, STATE_HEAT, STATE_ECO, ClimateDevice, from homeassistant.components.climate.const import (
PLATFORM_SCHEMA, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, STATE_AUTO, STATE_COOL, STATE_HEAT, STATE_ECO,
ATTR_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW,
SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW, SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW,
SUPPORT_OPERATION_MODE, SUPPORT_AWAY_MODE, SUPPORT_FAN_MODE) SUPPORT_OPERATION_MODE, SUPPORT_AWAY_MODE, SUPPORT_FAN_MODE)
from homeassistant.const import ( from homeassistant.const import (
TEMP_CELSIUS, TEMP_FAHRENHEIT, ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT,
CONF_SCAN_INTERVAL, STATE_ON, STATE_OFF) CONF_SCAN_INTERVAL, STATE_ON, STATE_OFF)
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect

View File

@ -1,7 +1,7 @@
"""Support for Nest Thermostat sensors.""" """Support for Nest Thermostat sensors."""
import logging import logging
from homeassistant.components.climate import ( from homeassistant.components.climate.const import (
STATE_COOL, STATE_HEAT) STATE_COOL, STATE_HEAT)
from homeassistant.components.nest import ( from homeassistant.components.nest import (
DATA_NEST, DATA_NEST_CONFIG, CONF_SENSORS, NestSensorDevice) DATA_NEST, DATA_NEST_CONFIG, CONF_SENSORS, NestSensorDevice)

View File

@ -4,8 +4,9 @@ from datetime import timedelta
import voluptuous as vol import voluptuous as vol
from homeassistant.const import TEMP_CELSIUS, ATTR_TEMPERATURE from homeassistant.const import TEMP_CELSIUS, ATTR_TEMPERATURE
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
STATE_HEAT, STATE_IDLE, ClimateDevice, PLATFORM_SCHEMA, from homeassistant.components.climate.const import (
STATE_HEAT, STATE_IDLE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_AWAY_MODE) SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_AWAY_MODE)
from homeassistant.util import Throttle from homeassistant.util import Throttle
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv

View File

@ -1,9 +1,9 @@
"""Support for OpenTherm Gateway climate devices.""" """Support for OpenTherm Gateway climate devices."""
import logging import logging
from homeassistant.components.climate import (ClimateDevice, STATE_IDLE, from homeassistant.components.climate import ClimateDevice
STATE_HEAT, STATE_COOL, from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE) STATE_IDLE, STATE_HEAT, STATE_COOL, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.components.opentherm_gw import ( from homeassistant.components.opentherm_gw import (
CONF_FLOOR_TEMP, CONF_PRECISION, DATA_DEVICE, DATA_GW_VARS, CONF_FLOOR_TEMP, CONF_PRECISION, DATA_DEVICE, DATA_GW_VARS,
DATA_OPENTHERM_GW, SIGNAL_OPENTHERM_GW_UPDATE) DATA_OPENTHERM_GW, SIGNAL_OPENTHERM_GW_UPDATE)

View File

@ -5,7 +5,7 @@ from aiohttp import web
import voluptuous as vol import voluptuous as vol
from homeassistant import core as hacore from homeassistant import core as hacore
from homeassistant.components.climate import ATTR_CURRENT_TEMPERATURE from homeassistant.components.climate.const import ATTR_CURRENT_TEMPERATURE
from homeassistant.components.http import HomeAssistantView from homeassistant.components.http import HomeAssistantView
from homeassistant.const import ( from homeassistant.const import (
ATTR_TEMPERATURE, ATTR_UNIT_OF_MEASUREMENT, CONTENT_TYPE_TEXT_PLAIN, ATTR_TEMPERATURE, ATTR_UNIT_OF_MEASUREMENT, CONTENT_TYPE_TEXT_PLAIN,

View File

@ -1,13 +1,14 @@
"""Support for climate devices through the SmartThings cloud API.""" """Support for climate devices through the SmartThings cloud API."""
import asyncio import asyncio
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
ATTR_OPERATION_MODE, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, ATTR_OPERATION_MODE, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW,
ATTR_TEMPERATURE, STATE_AUTO, STATE_COOL, STATE_ECO, STATE_HEAT, STATE_OFF, STATE_AUTO, STATE_COOL, STATE_ECO, STATE_HEAT,
SUPPORT_FAN_MODE, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW, SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW)
ClimateDevice) from homeassistant.const import (
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT ATTR_TEMPERATURE, STATE_OFF, TEMP_CELSIUS, TEMP_FAHRENHEIT)
from . import SmartThingsEntity from . import SmartThingsEntity
from .const import DATA_BROKERS, DOMAIN from .const import DATA_BROKERS, DOMAIN

View File

@ -2,12 +2,13 @@
import logging import logging
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
ATTR_TEMPERATURE, STATE_COOL, STATE_HEAT, STATE_IDLE, from homeassistant.components.climate.const import (
STATE_COOL, STATE_HEAT, STATE_IDLE,
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_FAN_MODE, ClimateDevice) SUPPORT_FAN_MODE)
from homeassistant.components.spider import DOMAIN as SPIDER_DOMAIN from homeassistant.components.spider import DOMAIN as SPIDER_DOMAIN
from homeassistant.const import TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
DEPENDENCIES = ['spider'] DEPENDENCIES = ['spider']

View File

@ -2,8 +2,9 @@
import logging import logging
from homeassistant.const import (PRECISION_TENTHS, TEMP_CELSIUS) from homeassistant.const import (PRECISION_TENTHS, TEMP_CELSIUS)
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
ClimateDevice, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE) from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE)
from homeassistant.util.temperature import convert as convert_temperature from homeassistant.util.temperature import convert as convert_temperature
from homeassistant.const import ATTR_TEMPERATURE from homeassistant.const import ATTR_TEMPERATURE
from homeassistant.components.tado import DATA_TADO from homeassistant.components.tado import DATA_TADO

View File

@ -1,9 +1,9 @@
"""Support for Tesla HVAC system.""" """Support for Tesla HVAC system."""
import logging import logging
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, ENTITY_ID_FORMAT
ENTITY_ID_FORMAT, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, from homeassistant.components.climate.const import (
ClimateDevice) SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.components.tesla import DOMAIN as TESLA_DOMAIN from homeassistant.components.tesla import DOMAIN as TESLA_DOMAIN
from homeassistant.components.tesla import TeslaDevice from homeassistant.components.tesla import TeslaDevice
from homeassistant.const import ( from homeassistant.const import (

View File

@ -1,9 +1,10 @@
"""Support for Toon van Eneco Thermostats.""" """Support for Toon van Eneco Thermostats."""
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
ATTR_TEMPERATURE, STATE_COOL, STATE_ECO, STATE_HEAT, STATE_AUTO, from homeassistant.components.climate.const import (
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, ClimateDevice) STATE_COOL, STATE_ECO, STATE_HEAT, STATE_AUTO,
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE)
import homeassistant.components.toon as toon_main import homeassistant.components.toon as toon_main
from homeassistant.const import TEMP_CELSIUS from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE

View File

@ -1,13 +1,14 @@
"""Support for the Tuya climate devices.""" """Support for the Tuya climate devices."""
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, ENTITY_ID_FORMAT
ATTR_TEMPERATURE, ENTITY_ID_FORMAT, STATE_AUTO, STATE_COOL, STATE_ECO, from homeassistant.components.climate.const import (
STATE_AUTO, STATE_COOL, STATE_ECO,
STATE_FAN_ONLY, STATE_HEAT, SUPPORT_FAN_MODE, SUPPORT_ON_OFF, STATE_FAN_ONLY, STATE_HEAT, SUPPORT_FAN_MODE, SUPPORT_ON_OFF,
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, ClimateDevice) SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.components.fan import SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH from homeassistant.components.fan import SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH
from homeassistant.components.tuya import DATA_TUYA, TuyaDevice from homeassistant.components.tuya import DATA_TUYA, TuyaDevice
from homeassistant.const import ( from homeassistant.const import (
PRECISION_WHOLE, TEMP_CELSIUS, TEMP_FAHRENHEIT) ATTR_TEMPERATURE, PRECISION_WHOLE, TEMP_CELSIUS, TEMP_FAHRENHEIT)
DEPENDENCIES = ['tuya'] DEPENDENCIES = ['tuya']
DEVICE_TYPE = 'climate' DEVICE_TYPE = 'climate'

View File

@ -1,8 +1,9 @@
"""Support for Velbus thermostat.""" """Support for Velbus thermostat."""
import logging import logging
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
STATE_HEAT, SUPPORT_TARGET_TEMPERATURE, ClimateDevice) from homeassistant.components.climate.const import (
STATE_HEAT, SUPPORT_TARGET_TEMPERATURE)
from homeassistant.components.velbus import ( from homeassistant.components.velbus import (
DOMAIN as VELBUS_DOMAIN, VelbusEntity) DOMAIN as VELBUS_DOMAIN, VelbusEntity)
from homeassistant.const import ( from homeassistant.const import (

View File

@ -2,9 +2,10 @@
import logging import logging
from homeassistant.util import convert from homeassistant.util import convert
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice, ENTITY_ID_FORMAT
ClimateDevice, STATE_AUTO, STATE_COOL, from homeassistant.components.climate.const import (
STATE_HEAT, ENTITY_ID_FORMAT, SUPPORT_TARGET_TEMPERATURE, STATE_AUTO, STATE_COOL,
STATE_HEAT, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_OPERATION_MODE, SUPPORT_FAN_MODE) SUPPORT_OPERATION_MODE, SUPPORT_FAN_MODE)
from homeassistant.const import ( from homeassistant.const import (
STATE_ON, STATE_ON,

View File

@ -1,17 +1,18 @@
"""Support for Wink thermostats and Air Conditioners.""" """Support for Wink thermostats and Air Conditioners."""
import logging import logging
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
ATTR_CURRENT_HUMIDITY, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, ATTR_CURRENT_HUMIDITY, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW,
ATTR_TEMPERATURE, STATE_AUTO, STATE_COOL, STATE_ECO, STATE_AUTO, STATE_COOL, STATE_ECO,
STATE_FAN_ONLY, STATE_HEAT, SUPPORT_AUX_HEAT, STATE_FAN_ONLY, STATE_HEAT, SUPPORT_AUX_HEAT,
SUPPORT_AWAY_MODE, SUPPORT_FAN_MODE, SUPPORT_AWAY_MODE, SUPPORT_FAN_MODE,
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW, SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW)
ClimateDevice)
from homeassistant.components.wink import DOMAIN, WinkDevice from homeassistant.components.wink import DOMAIN, WinkDevice
from homeassistant.const import ( from homeassistant.const import (
PRECISION_TENTHS, STATE_OFF, STATE_ON, STATE_UNKNOWN, TEMP_CELSIUS) ATTR_TEMPERATURE, PRECISION_TENTHS, STATE_OFF, STATE_ON, STATE_UNKNOWN,
TEMP_CELSIUS)
from homeassistant.helpers.temperature import display_temp as show_temp from homeassistant.helpers.temperature import display_temp as show_temp
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -2,10 +2,12 @@
from functools import partial from functools import partial
import logging import logging
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
ATTR_TEMPERATURE, ClimateDevice, SUPPORT_TARGET_TEMPERATURE) from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE)
from homeassistant.components.xs1 import ( from homeassistant.components.xs1 import (
ACTUATORS, DOMAIN as COMPONENT_DOMAIN, SENSORS, XS1DeviceEntity) ACTUATORS, DOMAIN as COMPONENT_DOMAIN, SENSORS, XS1DeviceEntity)
from homeassistant.const import ATTR_TEMPERATURE
DEPENDENCIES = ['xs1'] DEPENDENCIES = ['xs1']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -2,8 +2,9 @@
# Because we do not compile openzwave on CI # Because we do not compile openzwave on CI
import logging import logging
from homeassistant.core import callback from homeassistant.core import callback
from homeassistant.components.climate import ( from homeassistant.components.climate import ClimateDevice
DOMAIN, ClimateDevice, STATE_AUTO, STATE_COOL, STATE_HEAT, from homeassistant.components.climate.const import (
DOMAIN, STATE_AUTO, STATE_COOL, STATE_HEAT,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_FAN_MODE,
SUPPORT_OPERATION_MODE, SUPPORT_SWING_MODE) SUPPORT_OPERATION_MODE, SUPPORT_SWING_MODE)
from homeassistant.components.zwave import ZWaveDeviceEntity from homeassistant.components.zwave import ZWaveDeviceEntity

View File

@ -218,7 +218,7 @@ def state_as_number(state: State) -> float:
Raises ValueError if this is not possible. Raises ValueError if this is not possible.
""" """
from homeassistant.components.climate import ( from homeassistant.components.climate.const import (
STATE_HEAT, STATE_COOL, STATE_IDLE) STATE_HEAT, STATE_COOL, STATE_IDLE)
if state.state in (STATE_ON, STATE_LOCKED, STATE_ABOVE_HORIZON, if state.state in (STATE_ON, STATE_LOCKED, STATE_ABOVE_HORIZON,

View File

@ -3,8 +3,9 @@
All containing methods are legacy helpers that should not be used by new All containing methods are legacy helpers that should not be used by new
components. Instead call the service directly. components. Instead call the service directly.
""" """
from homeassistant.components.climate import ( from homeassistant.components.climate import _LOGGER
_LOGGER, ATTR_AUX_HEAT, ATTR_AWAY_MODE, ATTR_FAN_MODE, ATTR_HOLD_MODE, from homeassistant.components.climate.const import (
ATTR_AUX_HEAT, ATTR_AWAY_MODE, ATTR_FAN_MODE, ATTR_HOLD_MODE,
ATTR_HUMIDITY, ATTR_OPERATION_MODE, ATTR_SWING_MODE, ATTR_TARGET_TEMP_HIGH, ATTR_HUMIDITY, ATTR_OPERATION_MODE, ATTR_SWING_MODE, ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW, DOMAIN, SERVICE_SET_AWAY_MODE, SERVICE_SET_HOLD_MODE, ATTR_TARGET_TEMP_LOW, DOMAIN, SERVICE_SET_AWAY_MODE, SERVICE_SET_HOLD_MODE,
SERVICE_SET_AUX_HEAT, SERVICE_SET_TEMPERATURE, SERVICE_SET_HUMIDITY, SERVICE_SET_AUX_HEAT, SERVICE_SET_TEMPERATURE, SERVICE_SET_HUMIDITY,

View File

@ -8,7 +8,9 @@ from homeassistant.util.unit_system import (
METRIC_SYSTEM METRIC_SYSTEM
) )
from homeassistant.setup import setup_component from homeassistant.setup import setup_component
from homeassistant.components import climate from homeassistant.components.climate import (
DOMAIN, SERVICE_TURN_OFF, SERVICE_TURN_ON)
from homeassistant.const import (ATTR_ENTITY_ID)
from tests.common import get_test_home_assistant from tests.common import get_test_home_assistant
from tests.components.climate import common from tests.components.climate import common
@ -26,7 +28,7 @@ class TestDemoClimate(unittest.TestCase):
"""Set up things to be run when tests are started.""" """Set up things to be run when tests are started."""
self.hass = get_test_home_assistant() self.hass = get_test_home_assistant()
self.hass.config.units = METRIC_SYSTEM self.hass.config.units = METRIC_SYSTEM
assert setup_component(self.hass, climate.DOMAIN, { assert setup_component(self.hass, DOMAIN, {
'climate': { 'climate': {
'platform': 'demo', 'platform': 'demo',
}}) }})
@ -267,14 +269,14 @@ class TestDemoClimate(unittest.TestCase):
state = self.hass.states.get(ENTITY_ECOBEE) state = self.hass.states.get(ENTITY_ECOBEE)
assert 'auto' == state.state assert 'auto' == state.state
self.hass.services.call(climate.DOMAIN, climate.SERVICE_TURN_OFF, self.hass.services.call(DOMAIN, SERVICE_TURN_OFF,
{climate.ATTR_ENTITY_ID: ENTITY_ECOBEE}) {ATTR_ENTITY_ID: ENTITY_ECOBEE})
self.hass.block_till_done() self.hass.block_till_done()
state = self.hass.states.get(ENTITY_ECOBEE) state = self.hass.states.get(ENTITY_ECOBEE)
assert 'off' == state.state assert 'off' == state.state
self.hass.services.call(climate.DOMAIN, climate.SERVICE_TURN_ON, self.hass.services.call(DOMAIN, SERVICE_TURN_ON,
{climate.ATTR_ENTITY_ID: ENTITY_ECOBEE}) {ATTR_ENTITY_ID: ENTITY_ECOBEE})
self.hass.block_till_done() self.hass.block_till_done()
state = self.hass.states.get(ENTITY_ECOBEE) state = self.hass.states.get(ENTITY_ECOBEE)
assert 'auto' == state.state assert 'auto' == state.state

View File

@ -20,8 +20,9 @@ from homeassistant.const import (
) )
from homeassistant import loader from homeassistant import loader
from homeassistant.util.unit_system import METRIC_SYSTEM from homeassistant.util.unit_system import METRIC_SYSTEM
from homeassistant.components import climate, input_boolean, switch from homeassistant.components import input_boolean, switch
from homeassistant.components.climate import STATE_HEAT, STATE_COOL from homeassistant.components.climate.const import (
ATTR_OPERATION_MODE, STATE_HEAT, STATE_COOL, DOMAIN)
import homeassistant.components as comps import homeassistant.components as comps
from tests.common import assert_setup_component, mock_restore_cache from tests.common import assert_setup_component, mock_restore_cache
from tests.components.climate import common from tests.components.climate import common
@ -77,7 +78,7 @@ async def test_heater_input_boolean(hass, setup_comp_1):
assert await async_setup_component(hass, input_boolean.DOMAIN, { assert await async_setup_component(hass, input_boolean.DOMAIN, {
'input_boolean': {'test': None}}) 'input_boolean': {'test': None}})
assert await async_setup_component(hass, climate.DOMAIN, {'climate': { assert await async_setup_component(hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test', 'name': 'test',
'heater': heater_switch, 'heater': heater_switch,
@ -105,7 +106,7 @@ async def test_heater_switch(hass, setup_comp_1):
'platform': 'test'}}) 'platform': 'test'}})
heater_switch = switch_1.entity_id heater_switch = switch_1.entity_id
assert await async_setup_component(hass, climate.DOMAIN, {'climate': { assert await async_setup_component(hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test', 'name': 'test',
'heater': heater_switch, 'heater': heater_switch,
@ -134,7 +135,7 @@ def setup_comp_2(hass):
"""Initialize components.""" """Initialize components."""
hass.config.units = METRIC_SYSTEM hass.config.units = METRIC_SYSTEM
assert hass.loop.run_until_complete(async_setup_component( assert hass.loop.run_until_complete(async_setup_component(
hass, climate.DOMAIN, {'climate': { hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test', 'name': 'test',
'cold_tolerance': 2, 'cold_tolerance': 2,
@ -162,7 +163,7 @@ async def test_get_operation_modes(hass, setup_comp_2):
"""Test that the operation list returns the correct modes.""" """Test that the operation list returns the correct modes."""
state = hass.states.get(ENTITY) state = hass.states.get(ENTITY)
modes = state.attributes.get('operation_list') modes = state.attributes.get('operation_list')
assert [climate.STATE_HEAT, STATE_OFF] == modes assert [STATE_HEAT, STATE_OFF] == modes
async def test_set_target_temp(hass, setup_comp_2): async def test_set_target_temp(hass, setup_comp_2):
@ -355,7 +356,7 @@ async def test_operating_mode_heat(hass, setup_comp_2):
_setup_sensor(hass, 25) _setup_sensor(hass, 25)
await hass.async_block_till_done() await hass.async_block_till_done()
calls = _setup_switch(hass, False) calls = _setup_switch(hass, False)
common.async_set_operation_mode(hass, climate.STATE_HEAT) common.async_set_operation_mode(hass, STATE_HEAT)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 1 == len(calls) assert 1 == len(calls)
call = calls[0] call = calls[0]
@ -385,7 +386,7 @@ def setup_comp_3(hass):
"""Initialize components.""" """Initialize components."""
hass.config.temperature_unit = TEMP_CELSIUS hass.config.temperature_unit = TEMP_CELSIUS
assert hass.loop.run_until_complete(async_setup_component( assert hass.loop.run_until_complete(async_setup_component(
hass, climate.DOMAIN, {'climate': { hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test', 'name': 'test',
'cold_tolerance': 2, 'cold_tolerance': 2,
@ -433,7 +434,7 @@ async def test_operating_mode_cool(hass, setup_comp_3):
_setup_sensor(hass, 30) _setup_sensor(hass, 30)
await hass.async_block_till_done() await hass.async_block_till_done()
calls = _setup_switch(hass, False) calls = _setup_switch(hass, False)
common.async_set_operation_mode(hass, climate.STATE_COOL) common.async_set_operation_mode(hass, STATE_COOL)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 1 == len(calls) assert 1 == len(calls)
call = calls[0] call = calls[0]
@ -535,7 +536,7 @@ def setup_comp_4(hass):
"""Initialize components.""" """Initialize components."""
hass.config.temperature_unit = TEMP_CELSIUS hass.config.temperature_unit = TEMP_CELSIUS
assert hass.loop.run_until_complete(async_setup_component( assert hass.loop.run_until_complete(async_setup_component(
hass, climate.DOMAIN, {'climate': { hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test', 'name': 'test',
'cold_tolerance': 0.3, 'cold_tolerance': 0.3,
@ -611,7 +612,7 @@ async def test_mode_change_ac_trigger_off_not_long_enough(hass, setup_comp_4):
_setup_sensor(hass, 25) _setup_sensor(hass, 25)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 0 == len(calls) assert 0 == len(calls)
common.async_set_operation_mode(hass, climate.STATE_OFF) common.async_set_operation_mode(hass, STATE_OFF)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 1 == len(calls) assert 1 == len(calls)
call = calls[0] call = calls[0]
@ -628,7 +629,7 @@ async def test_mode_change_ac_trigger_on_not_long_enough(hass, setup_comp_4):
_setup_sensor(hass, 30) _setup_sensor(hass, 30)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 0 == len(calls) assert 0 == len(calls)
common.async_set_operation_mode(hass, climate.STATE_HEAT) common.async_set_operation_mode(hass, STATE_HEAT)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 1 == len(calls) assert 1 == len(calls)
call = calls[0] call = calls[0]
@ -642,7 +643,7 @@ def setup_comp_5(hass):
"""Initialize components.""" """Initialize components."""
hass.config.temperature_unit = TEMP_CELSIUS hass.config.temperature_unit = TEMP_CELSIUS
assert hass.loop.run_until_complete(async_setup_component( assert hass.loop.run_until_complete(async_setup_component(
hass, climate.DOMAIN, {'climate': { hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test', 'name': 'test',
'cold_tolerance': 0.3, 'cold_tolerance': 0.3,
@ -720,7 +721,7 @@ async def test_mode_change_ac_trigger_off_not_long_enough_2(
_setup_sensor(hass, 25) _setup_sensor(hass, 25)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 0 == len(calls) assert 0 == len(calls)
common.async_set_operation_mode(hass, climate.STATE_OFF) common.async_set_operation_mode(hass, STATE_OFF)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 1 == len(calls) assert 1 == len(calls)
call = calls[0] call = calls[0]
@ -737,7 +738,7 @@ async def test_mode_change_ac_trigger_on_not_long_enough_2(hass, setup_comp_5):
_setup_sensor(hass, 30) _setup_sensor(hass, 30)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 0 == len(calls) assert 0 == len(calls)
common.async_set_operation_mode(hass, climate.STATE_HEAT) common.async_set_operation_mode(hass, STATE_HEAT)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 1 == len(calls) assert 1 == len(calls)
call = calls[0] call = calls[0]
@ -751,7 +752,7 @@ def setup_comp_6(hass):
"""Initialize components.""" """Initialize components."""
hass.config.temperature_unit = TEMP_CELSIUS hass.config.temperature_unit = TEMP_CELSIUS
assert hass.loop.run_until_complete(async_setup_component( assert hass.loop.run_until_complete(async_setup_component(
hass, climate.DOMAIN, {'climate': { hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test', 'name': 'test',
'cold_tolerance': 0.3, 'cold_tolerance': 0.3,
@ -829,7 +830,7 @@ async def test_mode_change_heater_trigger_off_not_long_enough(
_setup_sensor(hass, 30) _setup_sensor(hass, 30)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 0 == len(calls) assert 0 == len(calls)
common.async_set_operation_mode(hass, climate.STATE_OFF) common.async_set_operation_mode(hass, STATE_OFF)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 1 == len(calls) assert 1 == len(calls)
call = calls[0] call = calls[0]
@ -847,7 +848,7 @@ async def test_mode_change_heater_trigger_on_not_long_enough(
_setup_sensor(hass, 25) _setup_sensor(hass, 25)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 0 == len(calls) assert 0 == len(calls)
common.async_set_operation_mode(hass, climate.STATE_HEAT) common.async_set_operation_mode(hass, STATE_HEAT)
await hass.async_block_till_done() await hass.async_block_till_done()
assert 1 == len(calls) assert 1 == len(calls)
call = calls[0] call = calls[0]
@ -861,7 +862,7 @@ def setup_comp_7(hass):
"""Initialize components.""" """Initialize components."""
hass.config.temperature_unit = TEMP_CELSIUS hass.config.temperature_unit = TEMP_CELSIUS
assert hass.loop.run_until_complete(async_setup_component( assert hass.loop.run_until_complete(async_setup_component(
hass, climate.DOMAIN, {'climate': { hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test', 'name': 'test',
'cold_tolerance': 0.3, 'cold_tolerance': 0.3,
@ -933,7 +934,7 @@ def setup_comp_8(hass):
"""Initialize components.""" """Initialize components."""
hass.config.temperature_unit = TEMP_CELSIUS hass.config.temperature_unit = TEMP_CELSIUS
assert hass.loop.run_until_complete(async_setup_component( assert hass.loop.run_until_complete(async_setup_component(
hass, climate.DOMAIN, {'climate': { hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test', 'name': 'test',
'cold_tolerance': 0.3, 'cold_tolerance': 0.3,
@ -1000,7 +1001,7 @@ def setup_comp_9(hass):
"""Initialize components.""" """Initialize components."""
hass.config.temperature_unit = TEMP_CELSIUS hass.config.temperature_unit = TEMP_CELSIUS
assert hass.loop.run_until_complete(async_setup_component( assert hass.loop.run_until_complete(async_setup_component(
hass, climate.DOMAIN, {'climate': [ hass, DOMAIN, {'climate': [
{ {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test_heat', 'name': 'test_heat',
@ -1080,7 +1081,7 @@ def setup_comp_10(hass):
"""Initialize components.""" """Initialize components."""
hass.config.temperature_unit = TEMP_FAHRENHEIT hass.config.temperature_unit = TEMP_FAHRENHEIT
assert hass.loop.run_until_complete(async_setup_component( assert hass.loop.run_until_complete(async_setup_component(
hass, climate.DOMAIN, {'climate': { hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test', 'name': 'test',
'cold_tolerance': 0.3, 'cold_tolerance': 0.3,
@ -1109,7 +1110,7 @@ async def test_precision(hass, setup_comp_10):
async def test_custom_setup_params(hass): async def test_custom_setup_params(hass):
"""Test the setup with custom parameters.""" """Test the setup with custom parameters."""
result = await async_setup_component( result = await async_setup_component(
hass, climate.DOMAIN, {'climate': { hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test', 'name': 'test',
'heater': ENT_SWITCH, 'heater': ENT_SWITCH,
@ -1129,13 +1130,14 @@ async def test_restore_state(hass):
"""Ensure states are restored on startup.""" """Ensure states are restored on startup."""
mock_restore_cache(hass, ( mock_restore_cache(hass, (
State('climate.test_thermostat', '0', {ATTR_TEMPERATURE: "20", State('climate.test_thermostat', '0', {ATTR_TEMPERATURE: "20",
climate.ATTR_OPERATION_MODE: "off", ATTR_AWAY_MODE: "on"}), ATTR_OPERATION_MODE: "off",
ATTR_AWAY_MODE: "on"}),
)) ))
hass.state = CoreState.starting hass.state = CoreState.starting
await async_setup_component( await async_setup_component(
hass, climate.DOMAIN, {'climate': { hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test_thermostat', 'name': 'test_thermostat',
'heater': ENT_SWITCH, 'heater': ENT_SWITCH,
@ -1144,7 +1146,7 @@ async def test_restore_state(hass):
state = hass.states.get('climate.test_thermostat') state = hass.states.get('climate.test_thermostat')
assert(state.attributes[ATTR_TEMPERATURE] == 20) assert(state.attributes[ATTR_TEMPERATURE] == 20)
assert(state.attributes[climate.ATTR_OPERATION_MODE] == "off") assert(state.attributes[ATTR_OPERATION_MODE] == "off")
assert(state.state == STATE_OFF) assert(state.state == STATE_OFF)
@ -1155,13 +1157,14 @@ async def test_no_restore_state(hass):
""" """
mock_restore_cache(hass, ( mock_restore_cache(hass, (
State('climate.test_thermostat', '0', {ATTR_TEMPERATURE: "20", State('climate.test_thermostat', '0', {ATTR_TEMPERATURE: "20",
climate.ATTR_OPERATION_MODE: "off", ATTR_AWAY_MODE: "on"}), ATTR_OPERATION_MODE: "off",
ATTR_AWAY_MODE: "on"}),
)) ))
hass.state = CoreState.starting hass.state = CoreState.starting
await async_setup_component( await async_setup_component(
hass, climate.DOMAIN, {'climate': { hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test_thermostat', 'name': 'test_thermostat',
'heater': ENT_SWITCH, 'heater': ENT_SWITCH,
@ -1191,7 +1194,7 @@ async def test_restore_state_uncoherence_case(hass):
state = hass.states.get(ENTITY) state = hass.states.get(ENTITY)
assert 20 == state.attributes[ATTR_TEMPERATURE] assert 20 == state.attributes[ATTR_TEMPERATURE]
assert STATE_OFF == \ assert STATE_OFF == \
state.attributes[climate.ATTR_OPERATION_MODE] state.attributes[ATTR_OPERATION_MODE]
assert STATE_OFF == state.state assert STATE_OFF == state.state
assert 0 == len(calls) assert 0 == len(calls)
@ -1199,12 +1202,12 @@ async def test_restore_state_uncoherence_case(hass):
await hass.async_block_till_done() await hass.async_block_till_done()
state = hass.states.get(ENTITY) state = hass.states.get(ENTITY)
assert STATE_OFF == \ assert STATE_OFF == \
state.attributes[climate.ATTR_OPERATION_MODE] state.attributes[ATTR_OPERATION_MODE]
assert STATE_OFF == state.state assert STATE_OFF == state.state
async def _setup_climate(hass): async def _setup_climate(hass):
assert await async_setup_component(hass, climate.DOMAIN, {'climate': { assert await async_setup_component(hass, DOMAIN, {'climate': {
'platform': 'generic_thermostat', 'platform': 'generic_thermostat',
'name': 'test', 'name': 'test',
'cold_tolerance': 2, 'cold_tolerance': 2,
@ -1220,6 +1223,6 @@ def _mock_restore_cache(hass, temperature=20, operation_mode=STATE_OFF):
mock_restore_cache(hass, ( mock_restore_cache(hass, (
State(ENTITY, '0', { State(ENTITY, '0', {
ATTR_TEMPERATURE: str(temperature), ATTR_TEMPERATURE: str(temperature),
climate.ATTR_OPERATION_MODE: operation_mode, ATTR_OPERATION_MODE: operation_mode,
ATTR_AWAY_MODE: "on"}), ATTR_AWAY_MODE: "on"}),
)) ))

View File

@ -8,7 +8,7 @@ import somecomfort
from homeassistant.const import ( from homeassistant.const import (
CONF_USERNAME, CONF_PASSWORD, TEMP_CELSIUS, TEMP_FAHRENHEIT) CONF_USERNAME, CONF_PASSWORD, TEMP_CELSIUS, TEMP_FAHRENHEIT)
from homeassistant.components.climate import ( from homeassistant.components.climate.const import (
ATTR_FAN_MODE, ATTR_OPERATION_MODE, ATTR_FAN_LIST, ATTR_OPERATION_LIST) ATTR_FAN_MODE, ATTR_OPERATION_MODE, ATTR_FAN_LIST, ATTR_OPERATION_LIST)
import homeassistant.components.climate.honeywell as honeywell import homeassistant.components.climate.honeywell as honeywell

View File

@ -4,8 +4,9 @@ import json
from homeassistant.components.climate.melissa import MelissaClimate from homeassistant.components.climate.melissa import MelissaClimate
from homeassistant.components.climate import ( from homeassistant.components.climate import melissa
melissa, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, from homeassistant.components.climate.const import (
SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE,
SUPPORT_ON_OFF, SUPPORT_FAN_MODE, STATE_HEAT, STATE_FAN_ONLY, STATE_DRY, SUPPORT_ON_OFF, SUPPORT_FAN_MODE, STATE_HEAT, STATE_FAN_ONLY, STATE_DRY,
STATE_COOL, STATE_AUTO STATE_COOL, STATE_AUTO
) )

View File

@ -3,7 +3,7 @@ import unittest
from unittest.mock import Mock, patch from unittest.mock import Mock, patch
from tests.common import get_test_home_assistant from tests.common import get_test_home_assistant
from homeassistant.components.climate import ( from homeassistant.components.climate.const import (
SUPPORT_HOLD_MODE, SUPPORT_HOLD_MODE,
SUPPORT_OPERATION_MODE, SUPPORT_OPERATION_MODE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE,

View File

@ -2,13 +2,13 @@
import pytest import pytest
from homeassistant.components.climate import STATE_HEAT, async_reproduce_states from homeassistant.components.climate import async_reproduce_states
from homeassistant.components.climate.const import ( from homeassistant.components.climate.const import (
ATTR_AUX_HEAT, ATTR_AWAY_MODE, ATTR_HOLD_MODE, ATTR_HUMIDITY, ATTR_AUX_HEAT, ATTR_AWAY_MODE, ATTR_HOLD_MODE, ATTR_HUMIDITY,
ATTR_OPERATION_MODE, ATTR_SWING_MODE, ATTR_TARGET_TEMP_HIGH, ATTR_OPERATION_MODE, ATTR_SWING_MODE, ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW, DOMAIN, SERVICE_SET_AUX_HEAT, SERVICE_SET_AWAY_MODE, ATTR_TARGET_TEMP_LOW, DOMAIN, SERVICE_SET_AUX_HEAT, SERVICE_SET_AWAY_MODE,
SERVICE_SET_HOLD_MODE, SERVICE_SET_HUMIDITY, SERVICE_SET_OPERATION_MODE, SERVICE_SET_HOLD_MODE, SERVICE_SET_HUMIDITY, SERVICE_SET_OPERATION_MODE,
SERVICE_SET_SWING_MODE, SERVICE_SET_TEMPERATURE) SERVICE_SET_SWING_MODE, SERVICE_SET_TEMPERATURE, STATE_HEAT)
from homeassistant.const import ( from homeassistant.const import (
ATTR_TEMPERATURE, SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_OFF, STATE_ON) ATTR_TEMPERATURE, SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_OFF, STATE_ON)
from homeassistant.core import Context, State from homeassistant.core import Context, State

View File

@ -3,7 +3,7 @@ import unittest
from unittest import mock from unittest import mock
import homeassistant.const as const import homeassistant.const as const
from homeassistant.components.ecobee import climate as ecobee from homeassistant.components.ecobee import climate as ecobee
from homeassistant.components.climate import STATE_OFF from homeassistant.const import STATE_OFF
class TestEcobee(unittest.TestCase): class TestEcobee(unittest.TestCase):

View File

@ -8,7 +8,8 @@ import pytest
from homeassistant import core, const, setup from homeassistant import core, const, setup
from homeassistant.components import ( from homeassistant.components import (
fan, cover, light, switch, climate, lock, async_setup, media_player) fan, cover, light, switch, lock, async_setup, media_player)
from homeassistant.components.climate import const as climate
from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES
from homeassistant.components import google_assistant as ga from homeassistant.components import google_assistant as ga

View File

@ -3,7 +3,9 @@ from homeassistant.core import State
from homeassistant.const import ( from homeassistant.const import (
ATTR_SUPPORTED_FEATURES, ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS) ATTR_SUPPORTED_FEATURES, ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS)
from homeassistant.setup import async_setup_component from homeassistant.setup import async_setup_component
from homeassistant.components import climate from homeassistant.components.climate.const import (
ATTR_MIN_TEMP, ATTR_MAX_TEMP, STATE_HEAT, SUPPORT_OPERATION_MODE
)
from homeassistant.components.google_assistant import ( from homeassistant.components.google_assistant import (
const, trait, helpers, smart_home as sh) const, trait, helpers, smart_home as sh)
from homeassistant.components.light.demo import DemoLight from homeassistant.components.light.demo import DemoLight
@ -210,10 +212,10 @@ async def test_execute(hass):
async def test_raising_error_trait(hass): async def test_raising_error_trait(hass):
"""Test raising an error while executing a trait command.""" """Test raising an error while executing a trait command."""
hass.states.async_set('climate.bla', climate.STATE_HEAT, { hass.states.async_set('climate.bla', STATE_HEAT, {
climate.ATTR_MIN_TEMP: 15, ATTR_MIN_TEMP: 15,
climate.ATTR_MAX_TEMP: 30, ATTR_MAX_TEMP: 30,
ATTR_SUPPORTED_FEATURES: climate.SUPPORT_OPERATION_MODE, ATTR_SUPPORTED_FEATURES: SUPPORT_OPERATION_MODE,
ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS, ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS,
}) })
result = await sh.async_handle_message(hass, BASIC_CONFIG, { result = await sh.async_handle_message(hass, BASIC_CONFIG, {

View File

@ -2,7 +2,6 @@
import pytest import pytest
from homeassistant.components import ( from homeassistant.components import (
climate,
cover, cover,
fan, fan,
input_boolean, input_boolean,
@ -15,10 +14,11 @@ from homeassistant.components import (
vacuum, vacuum,
group, group,
) )
from homeassistant.components.climate import const as climate
from homeassistant.components.google_assistant import trait, helpers, const from homeassistant.components.google_assistant import trait, helpers, const
from homeassistant.const import ( from homeassistant.const import (
STATE_ON, STATE_OFF, ATTR_ENTITY_ID, SERVICE_TURN_ON, SERVICE_TURN_OFF, STATE_ON, STATE_OFF, ATTR_ENTITY_ID, SERVICE_TURN_ON, SERVICE_TURN_OFF,
TEMP_CELSIUS, TEMP_FAHRENHEIT, ATTR_SUPPORTED_FEATURES) TEMP_CELSIUS, TEMP_FAHRENHEIT, ATTR_SUPPORTED_FEATURES, ATTR_TEMPERATURE)
from homeassistant.core import State, DOMAIN as HA_DOMAIN from homeassistant.core import State, DOMAIN as HA_DOMAIN
from homeassistant.util import color from homeassistant.util import color
from tests.common import async_mock_service from tests.common import async_mock_service
@ -668,7 +668,7 @@ async def test_temperature_setting_climate_range(hass):
climate.ATTR_CURRENT_HUMIDITY: 25, climate.ATTR_CURRENT_HUMIDITY: 25,
climate.ATTR_OPERATION_MODE: climate.STATE_AUTO, climate.ATTR_OPERATION_MODE: climate.STATE_AUTO,
climate.ATTR_OPERATION_LIST: [ climate.ATTR_OPERATION_LIST: [
climate.STATE_OFF, STATE_OFF,
climate.STATE_COOL, climate.STATE_COOL,
climate.STATE_HEAT, climate.STATE_HEAT,
climate.STATE_AUTO, climate.STATE_AUTO,
@ -737,12 +737,12 @@ async def test_temperature_setting_climate_setpoint(hass):
'climate.bla', climate.STATE_AUTO, { 'climate.bla', climate.STATE_AUTO, {
climate.ATTR_OPERATION_MODE: climate.STATE_COOL, climate.ATTR_OPERATION_MODE: climate.STATE_COOL,
climate.ATTR_OPERATION_LIST: [ climate.ATTR_OPERATION_LIST: [
climate.STATE_OFF, STATE_OFF,
climate.STATE_COOL, climate.STATE_COOL,
], ],
climate.ATTR_MIN_TEMP: 10, climate.ATTR_MIN_TEMP: 10,
climate.ATTR_MAX_TEMP: 30, climate.ATTR_MAX_TEMP: 30,
climate.ATTR_TEMPERATURE: 18, ATTR_TEMPERATURE: 18,
climate.ATTR_CURRENT_TEMPERATURE: 20 climate.ATTR_CURRENT_TEMPERATURE: 20
}), BASIC_CONFIG) }), BASIC_CONFIG)
assert trt.sync_attributes() == { assert trt.sync_attributes() == {
@ -772,7 +772,7 @@ async def test_temperature_setting_climate_setpoint(hass):
assert len(calls) == 1 assert len(calls) == 1
assert calls[0].data == { assert calls[0].data == {
ATTR_ENTITY_ID: 'climate.bla', ATTR_ENTITY_ID: 'climate.bla',
climate.ATTR_TEMPERATURE: 19 ATTR_TEMPERATURE: 19
} }

View File

@ -4,7 +4,7 @@ from unittest.mock import patch
import pytest import pytest
from homeassistant.components.climate import ( from homeassistant.components.climate.const import (
ATTR_CURRENT_TEMPERATURE, ATTR_MAX_TEMP, ATTR_MIN_TEMP, ATTR_CURRENT_TEMPERATURE, ATTR_MAX_TEMP, ATTR_MIN_TEMP,
ATTR_TARGET_TEMP_LOW, ATTR_TARGET_TEMP_HIGH, ATTR_OPERATION_MODE, ATTR_TARGET_TEMP_LOW, ATTR_TARGET_TEMP_HIGH, ATTR_OPERATION_MODE,
ATTR_OPERATION_LIST, DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP, ATTR_OPERATION_LIST, DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP,

View File

@ -1,5 +1,5 @@
"""Basic checks for HomeKitclimate.""" """Basic checks for HomeKitclimate."""
from homeassistant.components.climate import ( from homeassistant.components.climate.const import (
DOMAIN, SERVICE_SET_OPERATION_MODE, SERVICE_SET_TEMPERATURE) DOMAIN, SERVICE_SET_OPERATION_MODE, SERVICE_SET_TEMPERATURE)
from tests.components.homekit_controller.common import ( from tests.components.homekit_controller.common import (
setup_test_component) setup_test_component)

View File

@ -7,11 +7,15 @@ from unittest.mock import ANY
import pytest import pytest
import voluptuous as vol import voluptuous as vol
from homeassistant.components import climate, mqtt from homeassistant.components import mqtt
from homeassistant.components.climate import ( from homeassistant.components.climate import (
DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP, SUPPORT_AUX_HEAT, SUPPORT_AWAY_MODE, DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP)
from homeassistant.components.climate.const import (
DOMAIN as CLIMATE_DOMAIN,
SUPPORT_AUX_HEAT, SUPPORT_AWAY_MODE,
SUPPORT_FAN_MODE, SUPPORT_HOLD_MODE, SUPPORT_OPERATION_MODE, SUPPORT_FAN_MODE, SUPPORT_HOLD_MODE, SUPPORT_OPERATION_MODE,
SUPPORT_SWING_MODE, SUPPORT_TARGET_TEMPERATURE) SUPPORT_SWING_MODE, SUPPORT_TARGET_TEMPERATURE, STATE_AUTO,
STATE_COOL, STATE_HEAT, STATE_DRY, STATE_FAN_ONLY)
from homeassistant.components.mqtt.discovery import async_start from homeassistant.components.mqtt.discovery import async_start
from homeassistant.const import STATE_OFF, STATE_UNAVAILABLE from homeassistant.const import STATE_OFF, STATE_UNAVAILABLE
from homeassistant.setup import setup_component from homeassistant.setup import setup_component
@ -54,7 +58,7 @@ class TestMQTTClimate(unittest.TestCase):
def test_setup_params(self): def test_setup_params(self):
"""Test the initial parameters.""" """Test the initial parameters."""
assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG) assert setup_component(self.hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert 21 == state.attributes.get('temperature') assert 21 == state.attributes.get('temperature')
@ -66,7 +70,7 @@ class TestMQTTClimate(unittest.TestCase):
def test_supported_features(self): def test_supported_features(self):
"""Test the supported_features.""" """Test the supported_features."""
assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG) assert setup_component(self.hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
support = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE | support = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE |
@ -77,13 +81,13 @@ class TestMQTTClimate(unittest.TestCase):
def test_get_operation_modes(self): def test_get_operation_modes(self):
"""Test that the operation list returns the correct modes.""" """Test that the operation list returns the correct modes."""
assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG) assert setup_component(self.hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
modes = state.attributes.get('operation_list') modes = state.attributes.get('operation_list')
assert [ assert [
climate.STATE_AUTO, STATE_OFF, climate.STATE_COOL, STATE_AUTO, STATE_OFF, STATE_COOL,
climate.STATE_HEAT, climate.STATE_DRY, climate.STATE_FAN_ONLY STATE_HEAT, STATE_DRY, STATE_FAN_ONLY
] == modes ] == modes
def test_set_operation_bad_attr_and_state(self): def test_set_operation_bad_attr_and_state(self):
@ -91,7 +95,7 @@ class TestMQTTClimate(unittest.TestCase):
Also check the state. Also check the state.
""" """
assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG) assert setup_component(self.hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert "off" == state.attributes.get('operation_mode') assert "off" == state.attributes.get('operation_mode')
@ -105,7 +109,7 @@ class TestMQTTClimate(unittest.TestCase):
def test_set_operation(self): def test_set_operation(self):
"""Test setting of new operation mode.""" """Test setting of new operation mode."""
assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG) assert setup_component(self.hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert "off" == state.attributes.get('operation_mode') assert "off" == state.attributes.get('operation_mode')
@ -122,7 +126,7 @@ class TestMQTTClimate(unittest.TestCase):
"""Test setting operation mode in pessimistic mode.""" """Test setting operation mode in pessimistic mode."""
config = copy.deepcopy(DEFAULT_CONFIG) config = copy.deepcopy(DEFAULT_CONFIG)
config['climate']['mode_state_topic'] = 'mode-state' config['climate']['mode_state_topic'] = 'mode-state'
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert state.attributes.get('operation_mode') is None assert state.attributes.get('operation_mode') is None
@ -150,7 +154,7 @@ class TestMQTTClimate(unittest.TestCase):
"""Test setting of new operation mode with power command enabled.""" """Test setting of new operation mode with power command enabled."""
config = copy.deepcopy(DEFAULT_CONFIG) config = copy.deepcopy(DEFAULT_CONFIG)
config['climate']['power_command_topic'] = 'power-command' config['climate']['power_command_topic'] = 'power-command'
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert "off" == state.attributes.get('operation_mode') assert "off" == state.attributes.get('operation_mode')
@ -179,7 +183,7 @@ class TestMQTTClimate(unittest.TestCase):
def test_set_fan_mode_bad_attr(self): def test_set_fan_mode_bad_attr(self):
"""Test setting fan mode without required attribute.""" """Test setting fan mode without required attribute."""
assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG) assert setup_component(self.hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert "low" == state.attributes.get('fan_mode') assert "low" == state.attributes.get('fan_mode')
@ -193,7 +197,7 @@ class TestMQTTClimate(unittest.TestCase):
"""Test setting of new fan mode in pessimistic mode.""" """Test setting of new fan mode in pessimistic mode."""
config = copy.deepcopy(DEFAULT_CONFIG) config = copy.deepcopy(DEFAULT_CONFIG)
config['climate']['fan_mode_state_topic'] = 'fan-state' config['climate']['fan_mode_state_topic'] = 'fan-state'
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert state.attributes.get('fan_mode') is None assert state.attributes.get('fan_mode') is None
@ -215,7 +219,7 @@ class TestMQTTClimate(unittest.TestCase):
def test_set_fan_mode(self): def test_set_fan_mode(self):
"""Test setting of new fan mode.""" """Test setting of new fan mode."""
assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG) assert setup_component(self.hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert "low" == state.attributes.get('fan_mode') assert "low" == state.attributes.get('fan_mode')
@ -228,7 +232,7 @@ class TestMQTTClimate(unittest.TestCase):
def test_set_swing_mode_bad_attr(self): def test_set_swing_mode_bad_attr(self):
"""Test setting swing mode without required attribute.""" """Test setting swing mode without required attribute."""
assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG) assert setup_component(self.hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert "off" == state.attributes.get('swing_mode') assert "off" == state.attributes.get('swing_mode')
@ -242,7 +246,7 @@ class TestMQTTClimate(unittest.TestCase):
"""Test setting swing mode in pessimistic mode.""" """Test setting swing mode in pessimistic mode."""
config = copy.deepcopy(DEFAULT_CONFIG) config = copy.deepcopy(DEFAULT_CONFIG)
config['climate']['swing_mode_state_topic'] = 'swing-state' config['climate']['swing_mode_state_topic'] = 'swing-state'
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert state.attributes.get('swing_mode') is None assert state.attributes.get('swing_mode') is None
@ -264,7 +268,7 @@ class TestMQTTClimate(unittest.TestCase):
def test_set_swing(self): def test_set_swing(self):
"""Test setting of new swing mode.""" """Test setting of new swing mode."""
assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG) assert setup_component(self.hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert "off" == state.attributes.get('swing_mode') assert "off" == state.attributes.get('swing_mode')
@ -277,7 +281,7 @@ class TestMQTTClimate(unittest.TestCase):
def test_set_target_temperature(self): def test_set_target_temperature(self):
"""Test setting the target temperature.""" """Test setting the target temperature."""
assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG) assert setup_component(self.hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert 21 == state.attributes.get('temperature') assert 21 == state.attributes.get('temperature')
@ -315,7 +319,7 @@ class TestMQTTClimate(unittest.TestCase):
"""Test setting the target temperature.""" """Test setting the target temperature."""
config = copy.deepcopy(DEFAULT_CONFIG) config = copy.deepcopy(DEFAULT_CONFIG)
config['climate']['temperature_state_topic'] = 'temperature-state' config['climate']['temperature_state_topic'] = 'temperature-state'
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert state.attributes.get('temperature') is None assert state.attributes.get('temperature') is None
@ -342,7 +346,7 @@ class TestMQTTClimate(unittest.TestCase):
config = copy.deepcopy(DEFAULT_CONFIG) config = copy.deepcopy(DEFAULT_CONFIG)
config['climate']['current_temperature_topic'] = 'current_temperature' config['climate']['current_temperature_topic'] = 'current_temperature'
mock_component(self.hass, 'mqtt') mock_component(self.hass, 'mqtt')
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
fire_mqtt_message(self.hass, 'current_temperature', '47') fire_mqtt_message(self.hass, 'current_temperature', '47')
self.hass.block_till_done() self.hass.block_till_done()
@ -353,7 +357,7 @@ class TestMQTTClimate(unittest.TestCase):
"""Test setting of the away mode.""" """Test setting of the away mode."""
config = copy.deepcopy(DEFAULT_CONFIG) config = copy.deepcopy(DEFAULT_CONFIG)
config['climate']['away_mode_state_topic'] = 'away-state' config['climate']['away_mode_state_topic'] = 'away-state'
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert 'off' == state.attributes.get('away_mode') assert 'off' == state.attributes.get('away_mode')
@ -384,7 +388,7 @@ class TestMQTTClimate(unittest.TestCase):
config['climate']['payload_on'] = 'AN' config['climate']['payload_on'] = 'AN'
config['climate']['payload_off'] = 'AUS' config['climate']['payload_off'] = 'AUS'
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert 'off' == state.attributes.get('away_mode') assert 'off' == state.attributes.get('away_mode')
@ -407,7 +411,7 @@ class TestMQTTClimate(unittest.TestCase):
"""Test setting the hold mode in pessimistic mode.""" """Test setting the hold mode in pessimistic mode."""
config = copy.deepcopy(DEFAULT_CONFIG) config = copy.deepcopy(DEFAULT_CONFIG)
config['climate']['hold_state_topic'] = 'hold-state' config['climate']['hold_state_topic'] = 'hold-state'
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert state.attributes.get('hold_mode') is None assert state.attributes.get('hold_mode') is None
@ -429,7 +433,7 @@ class TestMQTTClimate(unittest.TestCase):
def test_set_hold(self): def test_set_hold(self):
"""Test setting the hold mode.""" """Test setting the hold mode."""
assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG) assert setup_component(self.hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert state.attributes.get('hold_mode') is None assert state.attributes.get('hold_mode') is None
@ -452,7 +456,7 @@ class TestMQTTClimate(unittest.TestCase):
"""Test setting of the aux heating in pessimistic mode.""" """Test setting of the aux heating in pessimistic mode."""
config = copy.deepcopy(DEFAULT_CONFIG) config = copy.deepcopy(DEFAULT_CONFIG)
config['climate']['aux_state_topic'] = 'aux-state' config['climate']['aux_state_topic'] = 'aux-state'
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert 'off' == state.attributes.get('aux_heat') assert 'off' == state.attributes.get('aux_heat')
@ -479,7 +483,7 @@ class TestMQTTClimate(unittest.TestCase):
def test_set_aux(self): def test_set_aux(self):
"""Test setting of the aux heating.""" """Test setting of the aux heating."""
assert setup_component(self.hass, climate.DOMAIN, DEFAULT_CONFIG) assert setup_component(self.hass, CLIMATE_DOMAIN, DEFAULT_CONFIG)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
assert 'off' == state.attributes.get('aux_heat') assert 'off' == state.attributes.get('aux_heat')
@ -505,7 +509,7 @@ class TestMQTTClimate(unittest.TestCase):
config['climate']['payload_available'] = 'good' config['climate']['payload_available'] = 'good'
config['climate']['payload_not_available'] = 'nogood' config['climate']['payload_not_available'] = 'nogood'
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get('climate.test') state = self.hass.states.get('climate.test')
assert STATE_UNAVAILABLE == state.state assert STATE_UNAVAILABLE == state.state
@ -543,7 +547,7 @@ class TestMQTTClimate(unittest.TestCase):
config['climate']['aux_state_topic'] = 'aux-state' config['climate']['aux_state_topic'] = 'aux-state'
config['climate']['current_temperature_topic'] = 'current-temperature' config['climate']['current_temperature_topic'] = 'current-temperature'
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
# Operation Mode # Operation Mode
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
@ -638,7 +642,7 @@ class TestMQTTClimate(unittest.TestCase):
config = copy.deepcopy(DEFAULT_CONFIG) config = copy.deepcopy(DEFAULT_CONFIG)
config['climate']['min_temp'] = 26 config['climate']['min_temp'] = 26
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
min_temp = state.attributes.get('min_temp') min_temp = state.attributes.get('min_temp')
@ -651,7 +655,7 @@ class TestMQTTClimate(unittest.TestCase):
config = copy.deepcopy(DEFAULT_CONFIG) config = copy.deepcopy(DEFAULT_CONFIG)
config['climate']['max_temp'] = 60 config['climate']['max_temp'] = 60
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
max_temp = state.attributes.get('max_temp') max_temp = state.attributes.get('max_temp')
@ -664,7 +668,7 @@ class TestMQTTClimate(unittest.TestCase):
config = copy.deepcopy(DEFAULT_CONFIG) config = copy.deepcopy(DEFAULT_CONFIG)
config['climate']['temp_step'] = 0.01 config['climate']['temp_step'] = 0.01
assert setup_component(self.hass, climate.DOMAIN, config) assert setup_component(self.hass, CLIMATE_DOMAIN, config)
state = self.hass.states.get(ENTITY_CLIMATE) state = self.hass.states.get(ENTITY_CLIMATE)
temp_step = state.attributes.get('target_temp_step') temp_step = state.attributes.get('target_temp_step')
@ -675,8 +679,8 @@ class TestMQTTClimate(unittest.TestCase):
async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock): async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock):
"""Test the setting of attribute via MQTT with JSON payload.""" """Test the setting of attribute via MQTT with JSON payload."""
assert await async_setup_component(hass, climate.DOMAIN, { assert await async_setup_component(hass, CLIMATE_DOMAIN, {
climate.DOMAIN: { CLIMATE_DOMAIN: {
'platform': 'mqtt', 'platform': 'mqtt',
'name': 'test', 'name': 'test',
'power_state_topic': 'test-topic', 'power_state_topic': 'test-topic',
@ -694,8 +698,8 @@ async def test_setting_attribute_via_mqtt_json_message(hass, mqtt_mock):
async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog): async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result.""" """Test attributes get extracted from a JSON result."""
assert await async_setup_component(hass, climate.DOMAIN, { assert await async_setup_component(hass, CLIMATE_DOMAIN, {
climate.DOMAIN: { CLIMATE_DOMAIN: {
'platform': 'mqtt', 'platform': 'mqtt',
'name': 'test', 'name': 'test',
'power_state_topic': 'test-topic', 'power_state_topic': 'test-topic',
@ -714,8 +718,8 @@ async def test_update_with_json_attrs_not_dict(hass, mqtt_mock, caplog):
async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog): async def test_update_with_json_attrs_bad_JSON(hass, mqtt_mock, caplog):
"""Test attributes get extracted from a JSON result.""" """Test attributes get extracted from a JSON result."""
assert await async_setup_component(hass, climate.DOMAIN, { assert await async_setup_component(hass, CLIMATE_DOMAIN, {
climate.DOMAIN: { CLIMATE_DOMAIN: {
'platform': 'mqtt', 'platform': 'mqtt',
'name': 'test', 'name': 'test',
'power_state_topic': 'test-topic', 'power_state_topic': 'test-topic',
@ -781,8 +785,8 @@ async def test_discovery_update_attr(hass, mqtt_mock, caplog):
async def test_unique_id(hass): async def test_unique_id(hass):
"""Test unique id option only creates one climate per unique_id.""" """Test unique id option only creates one climate per unique_id."""
await async_mock_mqtt_component(hass) await async_mock_mqtt_component(hass)
assert await async_setup_component(hass, climate.DOMAIN, { assert await async_setup_component(hass, CLIMATE_DOMAIN, {
climate.DOMAIN: [{ CLIMATE_DOMAIN: [{
'platform': 'mqtt', 'platform': 'mqtt',
'name': 'Test 1', 'name': 'Test 1',
'power_state_topic': 'test-topic', 'power_state_topic': 'test-topic',
@ -798,7 +802,7 @@ async def test_unique_id(hass):
}) })
async_fire_mqtt_message(hass, 'test-topic', 'payload') async_fire_mqtt_message(hass, 'test-topic', 'payload')
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(hass.states.async_entity_ids(climate.DOMAIN)) == 1 assert len(hass.states.async_entity_ids(CLIMATE_DOMAIN)) == 1
async def test_discovery_removal_climate(hass, mqtt_mock, caplog): async def test_discovery_removal_climate(hass, mqtt_mock, caplog):
@ -974,8 +978,8 @@ async def test_entity_id_update(hass, mqtt_mock):
"""Test MQTT subscriptions are managed when entity_id is updated.""" """Test MQTT subscriptions are managed when entity_id is updated."""
registry = mock_registry(hass, {}) registry = mock_registry(hass, {})
mock_mqtt = await async_mock_mqtt_component(hass) mock_mqtt = await async_mock_mqtt_component(hass)
assert await async_setup_component(hass, climate.DOMAIN, { assert await async_setup_component(hass, CLIMATE_DOMAIN, {
climate.DOMAIN: [{ CLIMATE_DOMAIN: [{
'platform': 'mqtt', 'platform': 'mqtt',
'name': 'beer', 'name': 'beer',
'mode_state_topic': 'test-topic', 'mode_state_topic': 'test-topic',

View File

@ -8,18 +8,18 @@ from pysmartthings import Attribute, Capability
from pysmartthings.device import Status from pysmartthings.device import Status
import pytest import pytest
from homeassistant.components.climate import ( from homeassistant.components.climate.const import (
ATTR_CURRENT_HUMIDITY, ATTR_CURRENT_TEMPERATURE, ATTR_FAN_LIST, ATTR_CURRENT_HUMIDITY, ATTR_CURRENT_TEMPERATURE, ATTR_FAN_LIST,
ATTR_FAN_MODE, ATTR_OPERATION_LIST, ATTR_OPERATION_MODE, ATTR_FAN_MODE, ATTR_OPERATION_LIST, ATTR_OPERATION_MODE,
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, DOMAIN as CLIMATE_DOMAIN, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, DOMAIN as CLIMATE_DOMAIN,
SERVICE_SET_FAN_MODE, SERVICE_SET_OPERATION_MODE, SERVICE_SET_TEMPERATURE, SERVICE_SET_FAN_MODE, SERVICE_SET_OPERATION_MODE, SERVICE_SET_TEMPERATURE,
STATE_AUTO, STATE_COOL, STATE_ECO, STATE_HEAT, STATE_OFF, SUPPORT_FAN_MODE, STATE_AUTO, STATE_COOL, STATE_ECO, STATE_HEAT, SUPPORT_FAN_MODE,
SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW) SUPPORT_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW)
from homeassistant.components.smartthings import climate from homeassistant.components.smartthings import climate
from homeassistant.components.smartthings.const import DOMAIN from homeassistant.components.smartthings.const import DOMAIN
from homeassistant.const import ( from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES, ATTR_TEMPERATURE) ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES, ATTR_TEMPERATURE, STATE_OFF)
from .conftest import setup_platform from .conftest import setup_platform

View File

@ -1,7 +1,7 @@
"""Test Z-Wave climate devices.""" """Test Z-Wave climate devices."""
import pytest import pytest
from homeassistant.components.climate import STATE_COOL, STATE_HEAT from homeassistant.components.climate.const import STATE_COOL, STATE_HEAT
from homeassistant.components.zwave import climate from homeassistant.components.zwave import climate
from homeassistant.const import ( from homeassistant.const import (
STATE_OFF, TEMP_CELSIUS, TEMP_FAHRENHEIT, ATTR_TEMPERATURE) STATE_OFF, TEMP_CELSIUS, TEMP_FAHRENHEIT, ATTR_TEMPERATURE)