Climate const.py move (#20945)

* Move constants to const.py

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

No files matched your search

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