Reproduce states by letting each component opt in on handling state recovery itself (#18700)
* Move group to it's own setup * Let each component to handle restore of state * Move constants for climate into const.py For now import all into __init__.py to keep backword compat * Move media plyaer constants to const.py file For now import all constants into __init__.py to keep backword compatibility * Move media player to it's own file * Move climate to it's own file * Remove ecobee service from common components BREAKING CHANGE * Add tests for climate * Add test for media_player * Make sure we clone timestamps of state * Add tests for groups * Remove old tests for media player, it's handled by other tests * Add tests for calls to component functions * Add docstring for climate const * Add docstring for media_player const * Explicitly import constants in climate * Explicitly import constants in media_player * Add period to climate const * Add period to media_player const * Fix some lint errors in climate * Fix some lint errors in media_player * Fix lint warnings on climate tests * Fix lint warnings on group tests * Fix lint warnings on media_player tests * Fix lint warnings on state tests * Adjust indent for state tests
This commit is contained in:
1 parent
c76a61ad16
commit
3bb5caabe2
13 files changed
+846
-228
No files matched your search
@@ -22,25 +22,46 @@ from homeassistant.const import (
|
||||
STATE_ON, STATE_OFF, TEMP_CELSIUS, PRECISION_WHOLE,
|
||||
PRECISION_TENTHS)
|
||||
|
||||
from .const import (
|
||||
ATTR_AUX_HEAT,
|
||||
ATTR_AWAY_MODE,
|
||||
ATTR_CURRENT_HUMIDITY,
|
||||
ATTR_CURRENT_TEMPERATURE,
|
||||
ATTR_FAN_LIST,
|
||||
ATTR_FAN_MODE,
|
||||
ATTR_HOLD_MODE,
|
||||
ATTR_HUMIDITY,
|
||||
ATTR_MAX_HUMIDITY,
|
||||
ATTR_MAX_TEMP,
|
||||
ATTR_MIN_HUMIDITY,
|
||||
ATTR_MIN_TEMP,
|
||||
ATTR_OPERATION_LIST,
|
||||
ATTR_OPERATION_MODE,
|
||||
ATTR_SWING_LIST,
|
||||
ATTR_SWING_MODE,
|
||||
ATTR_TARGET_TEMP_HIGH,
|
||||
ATTR_TARGET_TEMP_LOW,
|
||||
ATTR_TARGET_TEMP_STEP,
|
||||
DOMAIN,
|
||||
SERVICE_SET_AUX_HEAT,
|
||||
SERVICE_SET_AWAY_MODE,
|
||||
SERVICE_SET_FAN_MODE,
|
||||
SERVICE_SET_HOLD_MODE,
|
||||
SERVICE_SET_HUMIDITY,
|
||||
SERVICE_SET_OPERATION_MODE,
|
||||
SERVICE_SET_SWING_MODE,
|
||||
SERVICE_SET_TEMPERATURE,
|
||||
)
|
||||
from .reproduce_state import async_reproduce_states # noqa
|
||||
|
||||
DEFAULT_MIN_TEMP = 7
|
||||
DEFAULT_MAX_TEMP = 35
|
||||
DEFAULT_MIN_HUMITIDY = 30
|
||||
DEFAULT_MAX_HUMIDITY = 99
|
||||
|
||||
DOMAIN = 'climate'
|
||||
|
||||
ENTITY_ID_FORMAT = DOMAIN + '.{}'
|
||||
SCAN_INTERVAL = timedelta(seconds=60)
|
||||
|
||||
SERVICE_SET_AWAY_MODE = 'set_away_mode'
|
||||
SERVICE_SET_AUX_HEAT = 'set_aux_heat'
|
||||
SERVICE_SET_TEMPERATURE = 'set_temperature'
|
||||
SERVICE_SET_FAN_MODE = 'set_fan_mode'
|
||||
SERVICE_SET_HOLD_MODE = 'set_hold_mode'
|
||||
SERVICE_SET_OPERATION_MODE = 'set_operation_mode'
|
||||
SERVICE_SET_SWING_MODE = 'set_swing_mode'
|
||||
SERVICE_SET_HUMIDITY = 'set_humidity'
|
||||
|
||||
STATE_HEAT = 'heat'
|
||||
STATE_COOL = 'cool'
|
||||
STATE_IDLE = 'idle'
|
||||
@@ -64,26 +85,6 @@ SUPPORT_AWAY_MODE = 1024
|
||||
SUPPORT_AUX_HEAT = 2048
|
||||
SUPPORT_ON_OFF = 4096
|
||||
|
||||
ATTR_CURRENT_TEMPERATURE = 'current_temperature'
|
||||
ATTR_MAX_TEMP = 'max_temp'
|
||||
ATTR_MIN_TEMP = 'min_temp'
|
||||
ATTR_TARGET_TEMP_HIGH = 'target_temp_high'
|
||||
ATTR_TARGET_TEMP_LOW = 'target_temp_low'
|
||||
ATTR_TARGET_TEMP_STEP = 'target_temp_step'
|
||||
ATTR_AWAY_MODE = 'away_mode'
|
||||
ATTR_AUX_HEAT = 'aux_heat'
|
||||
ATTR_FAN_MODE = 'fan_mode'
|
||||
ATTR_FAN_LIST = 'fan_list'
|
||||
ATTR_CURRENT_HUMIDITY = 'current_humidity'
|
||||
ATTR_HUMIDITY = 'humidity'
|
||||
ATTR_MAX_HUMIDITY = 'max_humidity'
|
||||
ATTR_MIN_HUMIDITY = 'min_humidity'
|
||||
ATTR_HOLD_MODE = 'hold_mode'
|
||||
ATTR_OPERATION_MODE = 'operation_mode'
|
||||
ATTR_OPERATION_LIST = 'operation_list'
|
||||
ATTR_SWING_MODE = 'swing_mode'
|
||||
ATTR_SWING_LIST = 'swing_list'
|
||||
|
||||
CONVERTIBLE_ATTRIBUTE = [
|
||||
ATTR_TEMPERATURE,
|
||||
ATTR_TARGET_TEMP_LOW,
|
||||
|
||||
Reference in new issue
Block a user