Climate const.py move (#20945)
* Move constants to const.py * Import from const instead of climate
This commit is contained in:
1 parent
3736120c6a
commit
c5de32e7b1
72 files changed
+372
-295
No files matched your search
@@ -3,8 +3,9 @@
|
||||
All containing methods are legacy helpers that should not be used by new
|
||||
components. Instead call the service directly.
|
||||
"""
|
||||
from homeassistant.components.climate import (
|
||||
_LOGGER, ATTR_AUX_HEAT, ATTR_AWAY_MODE, ATTR_FAN_MODE, ATTR_HOLD_MODE,
|
||||
from homeassistant.components.climate import _LOGGER
|
||||
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_TARGET_TEMP_LOW, DOMAIN, SERVICE_SET_AWAY_MODE, SERVICE_SET_HOLD_MODE,
|
||||
SERVICE_SET_AUX_HEAT, SERVICE_SET_TEMPERATURE, SERVICE_SET_HUMIDITY,
|
||||
|
||||
@@ -8,7 +8,9 @@ from homeassistant.util.unit_system import (
|
||||
METRIC_SYSTEM
|
||||
)
|
||||
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.components.climate import common
|
||||
@@ -26,7 +28,7 @@ class TestDemoClimate(unittest.TestCase):
|
||||
"""Set up things to be run when tests are started."""
|
||||
self.hass = get_test_home_assistant()
|
||||
self.hass.config.units = METRIC_SYSTEM
|
||||
assert setup_component(self.hass, climate.DOMAIN, {
|
||||
assert setup_component(self.hass, DOMAIN, {
|
||||
'climate': {
|
||||
'platform': 'demo',
|
||||
}})
|
||||
@@ -267,14 +269,14 @@ class TestDemoClimate(unittest.TestCase):
|
||||
state = self.hass.states.get(ENTITY_ECOBEE)
|
||||
assert 'auto' == state.state
|
||||
|
||||
self.hass.services.call(climate.DOMAIN, climate.SERVICE_TURN_OFF,
|
||||
{climate.ATTR_ENTITY_ID: ENTITY_ECOBEE})
|
||||
self.hass.services.call(DOMAIN, SERVICE_TURN_OFF,
|
||||
{ATTR_ENTITY_ID: ENTITY_ECOBEE})
|
||||
self.hass.block_till_done()
|
||||
state = self.hass.states.get(ENTITY_ECOBEE)
|
||||
assert 'off' == state.state
|
||||
|
||||
self.hass.services.call(climate.DOMAIN, climate.SERVICE_TURN_ON,
|
||||
{climate.ATTR_ENTITY_ID: ENTITY_ECOBEE})
|
||||
self.hass.services.call(DOMAIN, SERVICE_TURN_ON,
|
||||
{ATTR_ENTITY_ID: ENTITY_ECOBEE})
|
||||
self.hass.block_till_done()
|
||||
state = self.hass.states.get(ENTITY_ECOBEE)
|
||||
assert 'auto' == state.state
|
||||
@@ -20,8 +20,9 @@ from homeassistant.const import (
|
||||
)
|
||||
from homeassistant import loader
|
||||
from homeassistant.util.unit_system import METRIC_SYSTEM
|
||||
from homeassistant.components import climate, input_boolean, switch
|
||||
from homeassistant.components.climate import STATE_HEAT, STATE_COOL
|
||||
from homeassistant.components import input_boolean, switch
|
||||
from homeassistant.components.climate.const import (
|
||||
ATTR_OPERATION_MODE, STATE_HEAT, STATE_COOL, DOMAIN)
|
||||
import homeassistant.components as comps
|
||||
from tests.common import assert_setup_component, mock_restore_cache
|
||||
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, {
|
||||
'input_boolean': {'test': None}})
|
||||
|
||||
assert await async_setup_component(hass, climate.DOMAIN, {'climate': {
|
||||
assert await async_setup_component(hass, DOMAIN, {'climate': {
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test',
|
||||
'heater': heater_switch,
|
||||
@@ -105,7 +106,7 @@ async def test_heater_switch(hass, setup_comp_1):
|
||||
'platform': 'test'}})
|
||||
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',
|
||||
'name': 'test',
|
||||
'heater': heater_switch,
|
||||
@@ -134,7 +135,7 @@ def setup_comp_2(hass):
|
||||
"""Initialize components."""
|
||||
hass.config.units = METRIC_SYSTEM
|
||||
assert hass.loop.run_until_complete(async_setup_component(
|
||||
hass, climate.DOMAIN, {'climate': {
|
||||
hass, DOMAIN, {'climate': {
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test',
|
||||
'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."""
|
||||
state = hass.states.get(ENTITY)
|
||||
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):
|
||||
@@ -355,7 +356,7 @@ async def test_operating_mode_heat(hass, setup_comp_2):
|
||||
_setup_sensor(hass, 25)
|
||||
await hass.async_block_till_done()
|
||||
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()
|
||||
assert 1 == len(calls)
|
||||
call = calls[0]
|
||||
@@ -385,7 +386,7 @@ def setup_comp_3(hass):
|
||||
"""Initialize components."""
|
||||
hass.config.temperature_unit = TEMP_CELSIUS
|
||||
assert hass.loop.run_until_complete(async_setup_component(
|
||||
hass, climate.DOMAIN, {'climate': {
|
||||
hass, DOMAIN, {'climate': {
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test',
|
||||
'cold_tolerance': 2,
|
||||
@@ -433,7 +434,7 @@ async def test_operating_mode_cool(hass, setup_comp_3):
|
||||
_setup_sensor(hass, 30)
|
||||
await hass.async_block_till_done()
|
||||
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()
|
||||
assert 1 == len(calls)
|
||||
call = calls[0]
|
||||
@@ -535,7 +536,7 @@ def setup_comp_4(hass):
|
||||
"""Initialize components."""
|
||||
hass.config.temperature_unit = TEMP_CELSIUS
|
||||
assert hass.loop.run_until_complete(async_setup_component(
|
||||
hass, climate.DOMAIN, {'climate': {
|
||||
hass, DOMAIN, {'climate': {
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test',
|
||||
'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)
|
||||
await hass.async_block_till_done()
|
||||
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()
|
||||
assert 1 == len(calls)
|
||||
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)
|
||||
await hass.async_block_till_done()
|
||||
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()
|
||||
assert 1 == len(calls)
|
||||
call = calls[0]
|
||||
@@ -642,7 +643,7 @@ def setup_comp_5(hass):
|
||||
"""Initialize components."""
|
||||
hass.config.temperature_unit = TEMP_CELSIUS
|
||||
assert hass.loop.run_until_complete(async_setup_component(
|
||||
hass, climate.DOMAIN, {'climate': {
|
||||
hass, DOMAIN, {'climate': {
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test',
|
||||
'cold_tolerance': 0.3,
|
||||
@@ -720,7 +721,7 @@ async def test_mode_change_ac_trigger_off_not_long_enough_2(
|
||||
_setup_sensor(hass, 25)
|
||||
await hass.async_block_till_done()
|
||||
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()
|
||||
assert 1 == len(calls)
|
||||
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)
|
||||
await hass.async_block_till_done()
|
||||
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()
|
||||
assert 1 == len(calls)
|
||||
call = calls[0]
|
||||
@@ -751,7 +752,7 @@ def setup_comp_6(hass):
|
||||
"""Initialize components."""
|
||||
hass.config.temperature_unit = TEMP_CELSIUS
|
||||
assert hass.loop.run_until_complete(async_setup_component(
|
||||
hass, climate.DOMAIN, {'climate': {
|
||||
hass, DOMAIN, {'climate': {
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test',
|
||||
'cold_tolerance': 0.3,
|
||||
@@ -829,7 +830,7 @@ async def test_mode_change_heater_trigger_off_not_long_enough(
|
||||
_setup_sensor(hass, 30)
|
||||
await hass.async_block_till_done()
|
||||
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()
|
||||
assert 1 == len(calls)
|
||||
call = calls[0]
|
||||
@@ -847,7 +848,7 @@ async def test_mode_change_heater_trigger_on_not_long_enough(
|
||||
_setup_sensor(hass, 25)
|
||||
await hass.async_block_till_done()
|
||||
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()
|
||||
assert 1 == len(calls)
|
||||
call = calls[0]
|
||||
@@ -861,7 +862,7 @@ def setup_comp_7(hass):
|
||||
"""Initialize components."""
|
||||
hass.config.temperature_unit = TEMP_CELSIUS
|
||||
assert hass.loop.run_until_complete(async_setup_component(
|
||||
hass, climate.DOMAIN, {'climate': {
|
||||
hass, DOMAIN, {'climate': {
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test',
|
||||
'cold_tolerance': 0.3,
|
||||
@@ -933,7 +934,7 @@ def setup_comp_8(hass):
|
||||
"""Initialize components."""
|
||||
hass.config.temperature_unit = TEMP_CELSIUS
|
||||
assert hass.loop.run_until_complete(async_setup_component(
|
||||
hass, climate.DOMAIN, {'climate': {
|
||||
hass, DOMAIN, {'climate': {
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test',
|
||||
'cold_tolerance': 0.3,
|
||||
@@ -1000,7 +1001,7 @@ def setup_comp_9(hass):
|
||||
"""Initialize components."""
|
||||
hass.config.temperature_unit = TEMP_CELSIUS
|
||||
assert hass.loop.run_until_complete(async_setup_component(
|
||||
hass, climate.DOMAIN, {'climate': [
|
||||
hass, DOMAIN, {'climate': [
|
||||
{
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test_heat',
|
||||
@@ -1080,7 +1081,7 @@ def setup_comp_10(hass):
|
||||
"""Initialize components."""
|
||||
hass.config.temperature_unit = TEMP_FAHRENHEIT
|
||||
assert hass.loop.run_until_complete(async_setup_component(
|
||||
hass, climate.DOMAIN, {'climate': {
|
||||
hass, DOMAIN, {'climate': {
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test',
|
||||
'cold_tolerance': 0.3,
|
||||
@@ -1109,7 +1110,7 @@ async def test_precision(hass, setup_comp_10):
|
||||
async def test_custom_setup_params(hass):
|
||||
"""Test the setup with custom parameters."""
|
||||
result = await async_setup_component(
|
||||
hass, climate.DOMAIN, {'climate': {
|
||||
hass, DOMAIN, {'climate': {
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test',
|
||||
'heater': ENT_SWITCH,
|
||||
@@ -1129,13 +1130,14 @@ async def test_restore_state(hass):
|
||||
"""Ensure states are restored on startup."""
|
||||
mock_restore_cache(hass, (
|
||||
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
|
||||
|
||||
await async_setup_component(
|
||||
hass, climate.DOMAIN, {'climate': {
|
||||
hass, DOMAIN, {'climate': {
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test_thermostat',
|
||||
'heater': ENT_SWITCH,
|
||||
@@ -1144,7 +1146,7 @@ async def test_restore_state(hass):
|
||||
|
||||
state = hass.states.get('climate.test_thermostat')
|
||||
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)
|
||||
|
||||
|
||||
@@ -1155,13 +1157,14 @@ async def test_no_restore_state(hass):
|
||||
"""
|
||||
mock_restore_cache(hass, (
|
||||
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
|
||||
|
||||
await async_setup_component(
|
||||
hass, climate.DOMAIN, {'climate': {
|
||||
hass, DOMAIN, {'climate': {
|
||||
'platform': 'generic_thermostat',
|
||||
'name': 'test_thermostat',
|
||||
'heater': ENT_SWITCH,
|
||||
@@ -1191,7 +1194,7 @@ async def test_restore_state_uncoherence_case(hass):
|
||||
state = hass.states.get(ENTITY)
|
||||
assert 20 == state.attributes[ATTR_TEMPERATURE]
|
||||
assert STATE_OFF == \
|
||||
state.attributes[climate.ATTR_OPERATION_MODE]
|
||||
state.attributes[ATTR_OPERATION_MODE]
|
||||
assert STATE_OFF == state.state
|
||||
assert 0 == len(calls)
|
||||
|
||||
@@ -1199,12 +1202,12 @@ async def test_restore_state_uncoherence_case(hass):
|
||||
await hass.async_block_till_done()
|
||||
state = hass.states.get(ENTITY)
|
||||
assert STATE_OFF == \
|
||||
state.attributes[climate.ATTR_OPERATION_MODE]
|
||||
state.attributes[ATTR_OPERATION_MODE]
|
||||
assert STATE_OFF == state.state
|
||||
|
||||
|
||||
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',
|
||||
'name': 'test',
|
||||
'cold_tolerance': 2,
|
||||
@@ -1220,6 +1223,6 @@ def _mock_restore_cache(hass, temperature=20, operation_mode=STATE_OFF):
|
||||
mock_restore_cache(hass, (
|
||||
State(ENTITY, '0', {
|
||||
ATTR_TEMPERATURE: str(temperature),
|
||||
climate.ATTR_OPERATION_MODE: operation_mode,
|
||||
ATTR_OPERATION_MODE: operation_mode,
|
||||
ATTR_AWAY_MODE: "on"}),
|
||||
))
|
||||
@@ -8,7 +8,7 @@ import somecomfort
|
||||
|
||||
from homeassistant.const import (
|
||||
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)
|
||||
|
||||
import homeassistant.components.climate.honeywell as honeywell
|
||||
|
||||
@@ -4,8 +4,9 @@ import json
|
||||
|
||||
from homeassistant.components.climate.melissa import MelissaClimate
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
melissa, SUPPORT_TARGET_TEMPERATURE, SUPPORT_OPERATION_MODE,
|
||||
from homeassistant.components.climate import melissa
|
||||
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,
|
||||
STATE_COOL, STATE_AUTO
|
||||
)
|
||||
|
||||
@@ -3,7 +3,7 @@ import unittest
|
||||
from unittest.mock import Mock, patch
|
||||
from tests.common import get_test_home_assistant
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
from homeassistant.components.climate.const import (
|
||||
SUPPORT_HOLD_MODE,
|
||||
SUPPORT_OPERATION_MODE,
|
||||
SUPPORT_TARGET_TEMPERATURE,
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
|
||||
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 (
|
||||
ATTR_AUX_HEAT, ATTR_AWAY_MODE, ATTR_HOLD_MODE, ATTR_HUMIDITY,
|
||||
ATTR_OPERATION_MODE, ATTR_SWING_MODE, ATTR_TARGET_TEMP_HIGH,
|
||||
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_SWING_MODE, SERVICE_SET_TEMPERATURE)
|
||||
SERVICE_SET_SWING_MODE, SERVICE_SET_TEMPERATURE, STATE_HEAT)
|
||||
from homeassistant.const import (
|
||||
ATTR_TEMPERATURE, SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_OFF, STATE_ON)
|
||||
from homeassistant.core import Context, State
|
||||
|
||||
@@ -3,7 +3,7 @@ import unittest
|
||||
from unittest import mock
|
||||
import homeassistant.const as const
|
||||
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):
|
||||
|
||||
@@ -8,7 +8,8 @@ import pytest
|
||||
|
||||
from homeassistant import core, const, setup
|
||||
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.components import google_assistant as ga
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@ from homeassistant.core import State
|
||||
from homeassistant.const import (
|
||||
ATTR_SUPPORTED_FEATURES, ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS)
|
||||
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 (
|
||||
const, trait, helpers, smart_home as sh)
|
||||
from homeassistant.components.light.demo import DemoLight
|
||||
@@ -210,10 +212,10 @@ async def test_execute(hass):
|
||||
|
||||
async def test_raising_error_trait(hass):
|
||||
"""Test raising an error while executing a trait command."""
|
||||
hass.states.async_set('climate.bla', climate.STATE_HEAT, {
|
||||
climate.ATTR_MIN_TEMP: 15,
|
||||
climate.ATTR_MAX_TEMP: 30,
|
||||
ATTR_SUPPORTED_FEATURES: climate.SUPPORT_OPERATION_MODE,
|
||||
hass.states.async_set('climate.bla', STATE_HEAT, {
|
||||
ATTR_MIN_TEMP: 15,
|
||||
ATTR_MAX_TEMP: 30,
|
||||
ATTR_SUPPORTED_FEATURES: SUPPORT_OPERATION_MODE,
|
||||
ATTR_UNIT_OF_MEASUREMENT: TEMP_CELSIUS,
|
||||
})
|
||||
result = await sh.async_handle_message(hass, BASIC_CONFIG, {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import (
|
||||
climate,
|
||||
cover,
|
||||
fan,
|
||||
input_boolean,
|
||||
@@ -15,10 +14,11 @@ from homeassistant.components import (
|
||||
vacuum,
|
||||
group,
|
||||
)
|
||||
from homeassistant.components.climate import const as climate
|
||||
from homeassistant.components.google_assistant import trait, helpers, const
|
||||
from homeassistant.const import (
|
||||
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.util import color
|
||||
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_OPERATION_MODE: climate.STATE_AUTO,
|
||||
climate.ATTR_OPERATION_LIST: [
|
||||
climate.STATE_OFF,
|
||||
STATE_OFF,
|
||||
climate.STATE_COOL,
|
||||
climate.STATE_HEAT,
|
||||
climate.STATE_AUTO,
|
||||
@@ -737,12 +737,12 @@ async def test_temperature_setting_climate_setpoint(hass):
|
||||
'climate.bla', climate.STATE_AUTO, {
|
||||
climate.ATTR_OPERATION_MODE: climate.STATE_COOL,
|
||||
climate.ATTR_OPERATION_LIST: [
|
||||
climate.STATE_OFF,
|
||||
STATE_OFF,
|
||||
climate.STATE_COOL,
|
||||
],
|
||||
climate.ATTR_MIN_TEMP: 10,
|
||||
climate.ATTR_MAX_TEMP: 30,
|
||||
climate.ATTR_TEMPERATURE: 18,
|
||||
ATTR_TEMPERATURE: 18,
|
||||
climate.ATTR_CURRENT_TEMPERATURE: 20
|
||||
}), BASIC_CONFIG)
|
||||
assert trt.sync_attributes() == {
|
||||
@@ -772,7 +772,7 @@ async def test_temperature_setting_climate_setpoint(hass):
|
||||
assert len(calls) == 1
|
||||
assert calls[0].data == {
|
||||
ATTR_ENTITY_ID: 'climate.bla',
|
||||
climate.ATTR_TEMPERATURE: 19
|
||||
ATTR_TEMPERATURE: 19
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
from homeassistant.components.climate.const import (
|
||||
ATTR_CURRENT_TEMPERATURE, ATTR_MAX_TEMP, ATTR_MIN_TEMP,
|
||||
ATTR_TARGET_TEMP_LOW, ATTR_TARGET_TEMP_HIGH, ATTR_OPERATION_MODE,
|
||||
ATTR_OPERATION_LIST, DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
"""Basic checks for HomeKitclimate."""
|
||||
from homeassistant.components.climate import (
|
||||
from homeassistant.components.climate.const import (
|
||||
DOMAIN, SERVICE_SET_OPERATION_MODE, SERVICE_SET_TEMPERATURE)
|
||||
from tests.components.homekit_controller.common import (
|
||||
setup_test_component)
|
||||
|
||||
@@ -7,11 +7,15 @@ from unittest.mock import ANY
|
||||
import pytest
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components import climate, mqtt
|
||||
from homeassistant.components import mqtt
|
||||
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_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.const import STATE_OFF, STATE_UNAVAILABLE
|
||||
from homeassistant.setup import setup_component
|
||||
@@ -54,7 +58,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
|
||||
def test_setup_params(self):
|
||||
"""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)
|
||||
assert 21 == state.attributes.get('temperature')
|
||||
@@ -66,7 +70,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
|
||||
def test_supported_features(self):
|
||||
"""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)
|
||||
support = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_OPERATION_MODE |
|
||||
@@ -77,13 +81,13 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
|
||||
def test_get_operation_modes(self):
|
||||
"""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)
|
||||
modes = state.attributes.get('operation_list')
|
||||
assert [
|
||||
climate.STATE_AUTO, STATE_OFF, climate.STATE_COOL,
|
||||
climate.STATE_HEAT, climate.STATE_DRY, climate.STATE_FAN_ONLY
|
||||
STATE_AUTO, STATE_OFF, STATE_COOL,
|
||||
STATE_HEAT, STATE_DRY, STATE_FAN_ONLY
|
||||
] == modes
|
||||
|
||||
def test_set_operation_bad_attr_and_state(self):
|
||||
@@ -91,7 +95,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
|
||||
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)
|
||||
assert "off" == state.attributes.get('operation_mode')
|
||||
@@ -105,7 +109,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
|
||||
def test_set_operation(self):
|
||||
"""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)
|
||||
assert "off" == state.attributes.get('operation_mode')
|
||||
@@ -122,7 +126,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
"""Test setting operation mode in pessimistic mode."""
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
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)
|
||||
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."""
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
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)
|
||||
assert "off" == state.attributes.get('operation_mode')
|
||||
@@ -179,7 +183,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
|
||||
def test_set_fan_mode_bad_attr(self):
|
||||
"""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)
|
||||
assert "low" == state.attributes.get('fan_mode')
|
||||
@@ -193,7 +197,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
"""Test setting of new fan mode in pessimistic mode."""
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
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)
|
||||
assert state.attributes.get('fan_mode') is None
|
||||
@@ -215,7 +219,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
|
||||
def test_set_fan_mode(self):
|
||||
"""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)
|
||||
assert "low" == state.attributes.get('fan_mode')
|
||||
@@ -228,7 +232,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
|
||||
def test_set_swing_mode_bad_attr(self):
|
||||
"""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)
|
||||
assert "off" == state.attributes.get('swing_mode')
|
||||
@@ -242,7 +246,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
"""Test setting swing mode in pessimistic mode."""
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
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)
|
||||
assert state.attributes.get('swing_mode') is None
|
||||
@@ -264,7 +268,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
|
||||
def test_set_swing(self):
|
||||
"""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)
|
||||
assert "off" == state.attributes.get('swing_mode')
|
||||
@@ -277,7 +281,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
|
||||
def test_set_target_temperature(self):
|
||||
"""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)
|
||||
assert 21 == state.attributes.get('temperature')
|
||||
@@ -315,7 +319,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
"""Test setting the target temperature."""
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
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)
|
||||
assert state.attributes.get('temperature') is None
|
||||
@@ -342,7 +346,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
config['climate']['current_temperature_topic'] = 'current_temperature'
|
||||
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')
|
||||
self.hass.block_till_done()
|
||||
@@ -353,7 +357,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
"""Test setting of the away mode."""
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
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)
|
||||
assert 'off' == state.attributes.get('away_mode')
|
||||
@@ -384,7 +388,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
config['climate']['payload_on'] = 'AN'
|
||||
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)
|
||||
assert 'off' == state.attributes.get('away_mode')
|
||||
@@ -407,7 +411,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
"""Test setting the hold mode in pessimistic mode."""
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
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)
|
||||
assert state.attributes.get('hold_mode') is None
|
||||
@@ -429,7 +433,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
|
||||
def test_set_hold(self):
|
||||
"""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)
|
||||
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."""
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
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)
|
||||
assert 'off' == state.attributes.get('aux_heat')
|
||||
@@ -479,7 +483,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
|
||||
def test_set_aux(self):
|
||||
"""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)
|
||||
assert 'off' == state.attributes.get('aux_heat')
|
||||
@@ -505,7 +509,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
config['climate']['payload_available'] = 'good'
|
||||
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')
|
||||
assert STATE_UNAVAILABLE == state.state
|
||||
@@ -543,7 +547,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
config['climate']['aux_state_topic'] = 'aux-state'
|
||||
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
|
||||
state = self.hass.states.get(ENTITY_CLIMATE)
|
||||
@@ -638,7 +642,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
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)
|
||||
min_temp = state.attributes.get('min_temp')
|
||||
@@ -651,7 +655,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
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)
|
||||
max_temp = state.attributes.get('max_temp')
|
||||
@@ -664,7 +668,7 @@ class TestMQTTClimate(unittest.TestCase):
|
||||
config = copy.deepcopy(DEFAULT_CONFIG)
|
||||
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)
|
||||
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):
|
||||
"""Test the setting of attribute via MQTT with JSON payload."""
|
||||
assert await async_setup_component(hass, climate.DOMAIN, {
|
||||
climate.DOMAIN: {
|
||||
assert await async_setup_component(hass, CLIMATE_DOMAIN, {
|
||||
CLIMATE_DOMAIN: {
|
||||
'platform': 'mqtt',
|
||||
'name': 'test',
|
||||
'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):
|
||||
"""Test attributes get extracted from a JSON result."""
|
||||
assert await async_setup_component(hass, climate.DOMAIN, {
|
||||
climate.DOMAIN: {
|
||||
assert await async_setup_component(hass, CLIMATE_DOMAIN, {
|
||||
CLIMATE_DOMAIN: {
|
||||
'platform': 'mqtt',
|
||||
'name': 'test',
|
||||
'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):
|
||||
"""Test attributes get extracted from a JSON result."""
|
||||
assert await async_setup_component(hass, climate.DOMAIN, {
|
||||
climate.DOMAIN: {
|
||||
assert await async_setup_component(hass, CLIMATE_DOMAIN, {
|
||||
CLIMATE_DOMAIN: {
|
||||
'platform': 'mqtt',
|
||||
'name': 'test',
|
||||
'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):
|
||||
"""Test unique id option only creates one climate per unique_id."""
|
||||
await async_mock_mqtt_component(hass)
|
||||
assert await async_setup_component(hass, climate.DOMAIN, {
|
||||
climate.DOMAIN: [{
|
||||
assert await async_setup_component(hass, CLIMATE_DOMAIN, {
|
||||
CLIMATE_DOMAIN: [{
|
||||
'platform': 'mqtt',
|
||||
'name': 'Test 1',
|
||||
'power_state_topic': 'test-topic',
|
||||
@@ -798,7 +802,7 @@ async def test_unique_id(hass):
|
||||
})
|
||||
async_fire_mqtt_message(hass, 'test-topic', 'payload')
|
||||
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):
|
||||
@@ -974,8 +978,8 @@ async def test_entity_id_update(hass, mqtt_mock):
|
||||
"""Test MQTT subscriptions are managed when entity_id is updated."""
|
||||
registry = mock_registry(hass, {})
|
||||
mock_mqtt = await async_mock_mqtt_component(hass)
|
||||
assert await async_setup_component(hass, climate.DOMAIN, {
|
||||
climate.DOMAIN: [{
|
||||
assert await async_setup_component(hass, CLIMATE_DOMAIN, {
|
||||
CLIMATE_DOMAIN: [{
|
||||
'platform': 'mqtt',
|
||||
'name': 'beer',
|
||||
'mode_state_topic': 'test-topic',
|
||||
|
||||
@@ -8,18 +8,18 @@ from pysmartthings import Attribute, Capability
|
||||
from pysmartthings.device import Status
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.climate import (
|
||||
from homeassistant.components.climate.const import (
|
||||
ATTR_CURRENT_HUMIDITY, ATTR_CURRENT_TEMPERATURE, ATTR_FAN_LIST,
|
||||
ATTR_FAN_MODE, ATTR_OPERATION_LIST, ATTR_OPERATION_MODE,
|
||||
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, DOMAIN as CLIMATE_DOMAIN,
|
||||
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_TARGET_TEMPERATURE_HIGH, SUPPORT_TARGET_TEMPERATURE_LOW)
|
||||
from homeassistant.components.smartthings import climate
|
||||
from homeassistant.components.smartthings.const import DOMAIN
|
||||
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
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Test Z-Wave climate devices."""
|
||||
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.const import (
|
||||
STATE_OFF, TEMP_CELSIUS, TEMP_FAHRENHEIT, ATTR_TEMPERATURE)
|
||||
|
||||
Reference in new issue
Block a user