Compare commits

..

27 Commits

Author SHA1 Message Date
Paulus Schoutsen
a652a4d9e9 Merge pull request #25376 from home-assistant/rc
0.96.3
2019-07-21 12:02:38 -07:00
cgtobi
2189cb0ee7 Add Netatmo climate battery level (#25143)
* Add battery level sensor

* Only update battery level if lower or nonexistent
2019-07-21 12:00:56 -07:00
Paulus Schoutsen
15064e83b4 Bumped version to 0.96.3 2019-07-21 11:10:36 -07:00
David F. Mulcahey
8538e69e28 change and condition to or condition (#25374) 2019-07-21 11:10:26 -07:00
David F. Mulcahey
35c719628d fix remove and re-add scenario (#25370) 2019-07-21 11:10:25 -07:00
Otto Winter
0eab89c8f4 Fix ESPHome climate migration (#25366) 2019-07-21 11:10:25 -07:00
David F. Mulcahey
a3043b9a90 bump quirks version (#25362) 2019-07-21 11:10:24 -07:00
Paulus Schoutsen
c795c93034 Introduce PRESET_NONE for climate (#25360)
* Introduce PRESET_NONE for climate

* Require preset mode to be a string

* Lint

* Fix tests
2019-07-21 11:10:24 -07:00
David Bonnes
2228a0dcac Improve geniushub logging and bump client (#25359)
* add debug logging

* bump geniushub client library

* delint

* bump again

* bump again, again
2019-07-21 11:10:23 -07:00
cgtobi
68e7f4ca5a Fix preset service call (#25358) 2019-07-21 11:09:59 -07:00
David F. Mulcahey
e052bcb03b add available to device info (#25349) 2019-07-21 11:08:21 -07:00
Michael Scherer
a56b604936 Fix for hvac_modes list being null (#25347)
* Fix for empty hvac_modes list

* Empty list instead of default value for hvac_modes
2019-07-21 11:08:21 -07:00
Fredrik Erlandsson
f6b6818fb0 Restore Daikin A/C on/off services (#25332) 2019-07-21 11:08:20 -07:00
eyager1
93a65bf507 Update zwave climate mappings (#25327)
hvac_action should be idle when thermostat is in Pending Heat or Pending Cool.
2019-07-21 11:08:19 -07:00
Paulus Schoutsen
ec302912a3 Restore sensiobo turn on/off methods (#25321) 2019-07-21 11:08:19 -07:00
Paulus Schoutsen
615af773e5 Updated frontend to 20190721.0 2019-07-21 09:56:12 -07:00
Paulus Schoutsen
9c51650ea3 Updated frontend to 20190720.0 2019-07-20 18:01:47 -07:00
Matthias Alphart
01430262cd temporary patch to fix KNX climate devices (#25356)
This is a temporary patch for knx climate devices. It should be reverted when #24738 is merged to release. 
It should fix https://github.com/home-assistant/home-assistant/issues/25247 for 0.96
2019-07-20 17:57:38 -07:00
Paulus Schoutsen
a6e3cc6617 Merge pull request #25313 from home-assistant/rc
0.96.2
2019-07-19 11:42:01 -07:00
Andrew Sayre
b4481269ec Turn on device before setting mode (#25314) 2019-07-19 10:19:51 -07:00
Paulus Schoutsen
662c33af85 Bumped version to 0.96.2 2019-07-19 09:44:53 -07:00
cgtobi
fc384ca6d5 Fix plant error when adding new value (#25302)
* Only add value if int or floar

* Simplify check

* Simplify check
2019-07-19 09:44:44 -07:00
Pascal Vizeli
49e2583b08 Fix HM with use wrong datapoint for off (#25298) 2019-07-19 09:44:43 -07:00
David Bonnes
8629b86186 [climate] Correct honeywell supported_features (#25292)
* Initial commit

* delint
2019-07-19 09:44:43 -07:00
William Scanlon
68c4e5c0c9 Fixed python-wink method names (#25285)
* Fixed python-wink method names

* Fixed aux heat
2019-07-19 09:44:42 -07:00
cgtobi
c4d1cd0e03 Fix fritzbox climate HVAC mode / temperature (#25275)
* Set the target temperature

* Update tests

* Update tests

* Fix linter complaints
2019-07-19 09:44:41 -07:00
Paulus Schoutsen
8b020ea5e6 Updated frontend to 20190719.0 2019-07-19 09:43:24 -07:00
43 changed files with 248 additions and 108 deletions

View File

@@ -74,7 +74,7 @@ SET_FAN_MODE_SCHEMA = vol.Schema({
})
SET_PRESET_MODE_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids,
vol.Required(ATTR_PRESET_MODE): vol.Maybe(cv.string),
vol.Required(ATTR_PRESET_MODE): cv.string,
})
SET_HVAC_MODE_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.comp_entity_ids,

View File

@@ -32,6 +32,8 @@ HVAC_MODES = [
HVAC_MODE_FAN_ONLY,
]
# No preset is active
PRESET_NONE = 'none'
# Device is running an energy-saving mode
PRESET_ECO = 'eco'

View File

@@ -289,6 +289,17 @@ class DaikinClimate(ClimateDevice):
"""Retrieve latest state."""
await self._api.async_update()
async def async_turn_on(self):
"""Turn device on."""
await self._api.device.set({})
async def async_turn_off(self):
"""Turn device off."""
await self._api.device.set({
HA_ATTR_TO_DAIKIN[ATTR_HVAC_MODE]:
HA_STATE_TO_DAIKIN[HVAC_MODE_OFF]
})
@property
def device_info(self):
"""Return a device description for device registry."""

View File

@@ -12,7 +12,7 @@ from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_LOW, ATTR_TARGET_TEMP_HIGH, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_AUX_HEAT, SUPPORT_TARGET_TEMPERATURE_RANGE, SUPPORT_FAN_MODE,
PRESET_AWAY, FAN_AUTO, FAN_ON, CURRENT_HVAC_OFF, CURRENT_HVAC_HEAT,
CURRENT_HVAC_COOL, SUPPORT_PRESET_MODE
CURRENT_HVAC_COOL, SUPPORT_PRESET_MODE, PRESET_NONE
)
from homeassistant.const import (
ATTR_ENTITY_ID, STATE_ON, ATTR_TEMPERATURE, TEMP_FAHRENHEIT)
@@ -49,6 +49,7 @@ PRESET_TO_ECOBEE_HOLD = {
}
PRESET_MODES = [
PRESET_NONE,
PRESET_AWAY,
PRESET_HOME,
PRESET_SLEEP
@@ -331,7 +332,7 @@ class Thermostat(ClimateDevice):
self.thermostat_index, PRESET_TO_ECOBEE_HOLD[preset_mode],
self.hold_preference())
elif preset_mode is None:
elif preset_mode is PRESET_NONE:
self.data.ecobee.resume_program(self.thermostat_index)
else:

View File

@@ -7,7 +7,7 @@ import voluptuous as vol
from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF, PRESET_AWAY, PRESET_BOOST,
SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE)
SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE, PRESET_NONE)
from homeassistant.const import (
ATTR_TEMPERATURE, CONF_DEVICES, CONF_MAC, PRECISION_HALVES, TEMP_CELSIUS)
import homeassistant.helpers.config_validation as cv
@@ -181,7 +181,7 @@ class EQ3BTSmartThermostat(ClimateDevice):
def set_preset_mode(self, preset_mode):
"""Set new preset mode."""
if not preset_mode:
if preset_mode == PRESET_NONE:
self.set_hvac_mode(HVAC_MODE_HEAT)
self._thermostat.mode = HA_TO_EQ_PRESET[preset_mode]

View File

@@ -76,6 +76,11 @@ class EsphomeClimateDevice(EsphomeEntity, ClimateDevice):
for mode in self._static_info.supported_modes
]
@property
def preset_modes(self):
"""Return preset modes."""
return [PRESET_AWAY] if self._static_info.supports_away else []
@property
def target_temperature_step(self) -> float:
"""Return the supported step of target temperature."""
@@ -97,7 +102,7 @@ class EsphomeClimateDevice(EsphomeEntity, ClimateDevice):
"""Return the list of supported features."""
features = 0
if self._static_info.supports_two_point_target_temperature:
features |= (SUPPORT_TARGET_TEMPERATURE_RANGE)
features |= SUPPORT_TARGET_TEMPERATURE_RANGE
else:
features |= SUPPORT_TARGET_TEMPERATURE
if self._static_info.supports_away:
@@ -109,6 +114,11 @@ class EsphomeClimateDevice(EsphomeEntity, ClimateDevice):
"""Return current operation ie. heat, cool, idle."""
return _climate_modes.from_esphome(self._state.mode)
@esphome_state_property
def preset_mode(self):
"""Return current preset mode."""
return PRESET_AWAY if self._state.away else None
@esphome_state_property
def current_temperature(self) -> Optional[float]:
"""Return the current temperature."""
@@ -143,29 +153,13 @@ class EsphomeClimateDevice(EsphomeEntity, ClimateDevice):
data['target_temperature_high'] = kwargs[ATTR_TARGET_TEMP_HIGH]
await self._client.climate_command(**data)
async def async_set_operation_mode(self, operation_mode) -> None:
async def async_set_hvac_mode(self, hvac_mode: str) -> None:
"""Set new target operation mode."""
await self._client.climate_command(
key=self._static_info.key,
mode=_climate_modes.from_hass(operation_mode),
mode=_climate_modes.from_hass(hvac_mode),
)
@property
def preset_mode(self):
"""Return current preset mode."""
if self._state and self._state.away:
return PRESET_AWAY
return None
@property
def preset_modes(self):
"""Return preset modes."""
if self._static_info.supports_away:
return [PRESET_AWAY]
return []
async def async_set_preset_mode(self, preset_mode):
"""Set preset mode."""
away = preset_mode == PRESET_AWAY

View File

@@ -10,7 +10,7 @@ from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
HVAC_MODE_HEAT, HVAC_MODE_AUTO, HVAC_MODE_OFF,
CURRENT_HVAC_HEAT, CURRENT_HVAC_IDLE, CURRENT_HVAC_OFF,
PRESET_AWAY, PRESET_ECO, PRESET_HOME,
PRESET_AWAY, PRESET_ECO, PRESET_HOME, PRESET_NONE,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_PRESET_MODE)
from homeassistant.const import PRECISION_TENTHS
from homeassistant.util.dt import parse_datetime
@@ -40,12 +40,11 @@ HA_PRESET_TO_TCS = {
TCS_PRESET_TO_HA = {v: k for k, v in HA_PRESET_TO_TCS.items()}
EVO_PRESET_TO_HA = {
EVO_FOLLOW: None,
EVO_FOLLOW: PRESET_NONE,
EVO_TEMPOVER: 'temporary',
EVO_PERMOVER: 'permanent',
}
HA_PRESET_TO_EVO = {v: k for k, v in EVO_PRESET_TO_HA.items()
if v is not None}
HA_PRESET_TO_EVO = {v: k for k, v in EVO_PRESET_TO_HA.items()}
def setup_platform(hass, hass_config, add_entities,

View File

@@ -93,9 +93,10 @@ class FritzboxThermostat(ClimateDevice):
@property
def target_temperature(self):
"""Return the temperature we try to reach."""
if self._target_temperature in (ON_API_TEMPERATURE,
OFF_API_TEMPERATURE):
return None
if self._target_temperature == ON_API_TEMPERATURE:
return ON_REPORT_SET_TEMPERATURE
if self._target_temperature == OFF_API_TEMPERATURE:
return OFF_REPORT_SET_TEMPERATURE
return self._target_temperature
def set_temperature(self, **kwargs):
@@ -110,7 +111,10 @@ class FritzboxThermostat(ClimateDevice):
@property
def hvac_mode(self):
"""Return the current operation mode."""
if self._target_temperature == OFF_REPORT_SET_TEMPERATURE:
if (
self._target_temperature == OFF_REPORT_SET_TEMPERATURE or
self._target_temperature == OFF_API_TEMPERATURE
):
return HVAC_MODE_OFF
return HVAC_MODE_HEAT

View File

@@ -3,7 +3,7 @@
"name": "Home Assistant Frontend",
"documentation": "https://www.home-assistant.io/components/frontend",
"requirements": [
"home-assistant-frontend==20190718.0"
"home-assistant-frontend==20190721.0"
],
"dependencies": [
"api",

View File

@@ -8,7 +8,7 @@ from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateDevice
from homeassistant.components.climate.const import (
ATTR_PRESET_MODE, CURRENT_HVAC_COOL, CURRENT_HVAC_HEAT, CURRENT_HVAC_IDLE,
CURRENT_HVAC_OFF, HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_OFF,
PRESET_AWAY, SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE)
PRESET_AWAY, SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE, PRESET_NONE)
from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_TEMPERATURE, CONF_NAME, EVENT_HOMEASSISTANT_START,
PRECISION_HALVES, PRECISION_TENTHS, PRECISION_WHOLE, SERVICE_TURN_OFF,
@@ -251,7 +251,7 @@ class GenericThermostat(ClimateDevice, RestoreEntity):
def preset_modes(self):
"""Return a list of available preset modes."""
if self._away_temp:
return [PRESET_AWAY]
return [PRESET_NONE, PRESET_AWAY]
return None
async def async_set_hvac_mode(self, hvac_mode):
@@ -404,7 +404,7 @@ class GenericThermostat(ClimateDevice, RestoreEntity):
self._saved_target_temp = self._target_temp
self._target_temp = self._away_temp
await self._async_control_heating(force=True)
elif not preset_mode and self._is_away:
elif preset_mode == PRESET_NONE and self._is_away:
self._is_away = False
self._target_temp = self._saved_target_temp
await self._async_control_heating(force=True)

View File

@@ -54,6 +54,9 @@ async def async_setup(hass, hass_config):
exc_info=True)
return False
_LOGGER.debug("zones_raw = %s", data._client.hub._zones_raw) # noqa; pylint: disable=protected-access
_LOGGER.debug("devices_raw = %s", data._client.hub._devices_raw) # noqa; pylint: disable=protected-access
async_track_time_interval(hass, data.async_update, SCAN_INTERVAL)
for platform in ['climate', 'water_heater']:
@@ -84,4 +87,8 @@ class GeniusData:
except AssertionError: # assert response.status == HTTP_OK
_LOGGER.warning("Update failed.", exc_info=True)
return
_LOGGER.debug("zones_raw = %s", self._client.hub._zones_raw) # noqa; pylint: disable=protected-access
_LOGGER.debug("devices_raw = %s", self._client.hub._devices_raw) # noqa; pylint: disable=protected-access
async_dispatcher_send(self._hass, DOMAIN)

View File

@@ -3,7 +3,7 @@
"name": "Genius Hub",
"documentation": "https://www.home-assistant.io/components/geniushub",
"requirements": [
"geniushub-client==0.4.12"
"geniushub-client==0.4.15"
],
"dependencies": [],
"codeowners": ["@zxdavb"]

View File

@@ -2,7 +2,7 @@
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF, PRESET_BOOST,
SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE)
SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE, PRESET_NONE)
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from . import DATA_HIVE, DOMAIN
@@ -21,7 +21,7 @@ HASS_TO_HIVE_STATE = {
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
SUPPORT_HVAC = [HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF]
SUPPORT_PRESET = [PRESET_BOOST]
SUPPORT_PRESET = [PRESET_NONE, PRESET_BOOST]
def setup_platform(hass, config, add_entities, discovery_info=None):
@@ -168,7 +168,7 @@ class HiveClimateEntity(ClimateDevice):
def set_preset_mode(self, preset_mode) -> None:
"""Set new preset mode."""
if preset_mode is None and self.preset_mode == PRESET_BOOST:
if preset_mode == PRESET_NONE and self.preset_mode == PRESET_BOOST:
self.session.heating.turn_boost_off(self.node_id)
elif preset_mode == PRESET_BOOST:

View File

@@ -66,7 +66,7 @@ class HMThermostat(HMDevice, ClimateDevice):
Need to be one of HVAC_MODE_*.
"""
if self.current_temperature <= self._hmdevice.OFF_VALUE + 0.5:
if self.target_temperature <= self._hmdevice.OFF_VALUE + 0.5:
return HVAC_MODE_OFF
if "MANU_MODE" in self._hmdevice.ACTIONNODE:
if self._hm_controll_mode == self._hmdevice.MANU_MODE:

View File

@@ -10,7 +10,7 @@ from homematicip.aio.home import AsyncHome
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO, HVAC_MODE_HEAT, PRESET_BOOST, PRESET_ECO,
SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE)
SUPPORT_PRESET_MODE, SUPPORT_TARGET_TEMPERATURE, PRESET_NONE)
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from homeassistant.core import HomeAssistant
@@ -121,7 +121,7 @@ class HomematicipHeatingGroup(HomematicipGenericDevice, ClimateDevice):
Requires SUPPORT_PRESET_MODE.
"""
return [PRESET_BOOST]
return [PRESET_NONE, PRESET_BOOST]
@property
def min_temp(self) -> float:

View File

@@ -11,12 +11,11 @@ from homeassistant.components.climate import ClimateDevice, PLATFORM_SCHEMA
from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW,
FAN_AUTO, FAN_DIFFUSE, FAN_ON,
SUPPORT_AUX_HEAT, SUPPORT_FAN_MODE,
SUPPORT_PRESET_MODE, SUPPORT_TARGET_HUMIDITY, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE,
SUPPORT_AUX_HEAT, SUPPORT_FAN_MODE, SUPPORT_PRESET_MODE,
SUPPORT_TARGET_HUMIDITY, SUPPORT_TARGET_TEMPERATURE_RANGE,
CURRENT_HVAC_COOL, CURRENT_HVAC_HEAT, CURRENT_HVAC_IDLE, CURRENT_HVAC_OFF,
HVAC_MODE_OFF, HVAC_MODE_HEAT, HVAC_MODE_COOL, HVAC_MODE_HEAT_COOL,
PRESET_AWAY,
PRESET_AWAY, PRESET_NONE,
)
from homeassistant.const import (
CONF_PASSWORD, CONF_USERNAME, TEMP_CELSIUS, TEMP_FAHRENHEIT,
@@ -128,7 +127,6 @@ class HoneywellUSThermostat(ClimateDevice):
self._password = password
self._supported_features = (SUPPORT_PRESET_MODE |
SUPPORT_TARGET_TEMPERATURE |
SUPPORT_TARGET_TEMPERATURE_RANGE)
# pylint: disable=protected-access
@@ -231,7 +229,7 @@ class HoneywellUSThermostat(ClimateDevice):
@property
def preset_modes(self) -> Optional[List[str]]:
"""Return a list of available preset modes."""
return [PRESET_AWAY]
return [PRESET_NONE, PRESET_AWAY]
@property
def is_aux_heat(self) -> Optional[str]:

View File

@@ -219,7 +219,7 @@ class KNXClimate(ClimateDevice):
@property
def target_temperature_step(self):
"""Return the supported step of target temperature."""
return self.device.temperature_step
return self.device.setpoint_shift_step
@property
def target_temperature(self):

View File

@@ -12,7 +12,7 @@ from homeassistant.components.climate.const import (
HVAC_MODE_DRY, HVAC_MODE_FAN_ONLY, HVAC_MODE_HEAT, HVAC_MODE_OFF,
SUPPORT_AUX_HEAT, SUPPORT_FAN_MODE, SUPPORT_PRESET_MODE,
SUPPORT_SWING_MODE, SUPPORT_TARGET_TEMPERATURE, PRESET_AWAY,
SUPPORT_TARGET_TEMPERATURE_RANGE)
SUPPORT_TARGET_TEMPERATURE_RANGE, PRESET_NONE)
from homeassistant.components.fan import SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM
from homeassistant.const import (
ATTR_TEMPERATURE, CONF_DEVICE, CONF_NAME, CONF_VALUE_TEMPLATE, STATE_ON)
@@ -538,6 +538,9 @@ class MqttClimate(MqttAttributes, MqttAvailability, MqttDiscoveryUpdate,
presets.extend(self._config[CONF_HOLD_LIST])
if presets:
presets.insert(0, PRESET_NONE)
return presets
@property

View File

@@ -8,7 +8,7 @@ from homeassistant.components.climate.const import (
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW, FAN_AUTO, FAN_ON,
HVAC_MODE_AUTO, HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_OFF,
SUPPORT_PRESET_MODE, SUPPORT_FAN_MODE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE, PRESET_AWAY, PRESET_ECO)
SUPPORT_TARGET_TEMPERATURE_RANGE, PRESET_AWAY, PRESET_ECO, PRESET_NONE)
from homeassistant.const import (
ATTR_TEMPERATURE, CONF_SCAN_INTERVAL, TEMP_CELSIUS, TEMP_FAHRENHEIT)
from homeassistant.helpers.dispatcher import async_dispatcher_connect
@@ -28,7 +28,7 @@ NEST_MODE_HEAT = 'heat'
NEST_MODE_COOL = 'cool'
NEST_MODE_OFF = 'off'
PRESET_MODES = [PRESET_AWAY, PRESET_ECO]
PRESET_MODES = [PRESET_NONE, PRESET_AWAY, PRESET_ECO]
def setup_platform(hass, config, add_entities, discovery_info=None):

View File

@@ -16,7 +16,9 @@ from homeassistant.components.climate.const import (
DEFAULT_MIN_TEMP
)
from homeassistant.const import (
TEMP_CELSIUS, ATTR_TEMPERATURE, CONF_NAME, PRECISION_HALVES, STATE_OFF)
TEMP_CELSIUS, ATTR_TEMPERATURE, CONF_NAME, PRECISION_HALVES, STATE_OFF,
ATTR_BATTERY_LEVEL
)
from homeassistant.util import Throttle
from .const import DATA_NETATMO_AUTH
@@ -25,6 +27,7 @@ _LOGGER = logging.getLogger(__name__)
PRESET_FROST_GUARD = 'Frost Guard'
PRESET_SCHEDULE = 'Schedule'
PRESET_MANUAL = 'Manual'
SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE)
SUPPORT_HVAC = [HVAC_MODE_HEAT, HVAC_MODE_AUTO, HVAC_MODE_OFF]
@@ -32,7 +35,7 @@ SUPPORT_PRESET = [
PRESET_AWAY, PRESET_BOOST, PRESET_FROST_GUARD, PRESET_SCHEDULE,
]
STATE_NETATMO_SCHEDULE = PRESET_SCHEDULE
STATE_NETATMO_SCHEDULE = 'schedule'
STATE_NETATMO_HG = 'hg'
STATE_NETATMO_MAX = 'max'
STATE_NETATMO_AWAY = PRESET_AWAY
@@ -42,7 +45,6 @@ STATE_NETATMO_MANUAL = 'manual'
PRESET_MAP_NETATMO = {
PRESET_FROST_GUARD: STATE_NETATMO_HG,
PRESET_BOOST: STATE_NETATMO_MAX,
STATE_NETATMO_MAX: STATE_NETATMO_MAX,
PRESET_SCHEDULE: STATE_NETATMO_SCHEDULE,
PRESET_AWAY: STATE_NETATMO_AWAY,
STATE_NETATMO_OFF: STATE_NETATMO_OFF
@@ -54,16 +56,17 @@ NETATMO_MAP_PRESET = {
STATE_NETATMO_SCHEDULE: PRESET_SCHEDULE,
STATE_NETATMO_AWAY: PRESET_AWAY,
STATE_NETATMO_OFF: STATE_NETATMO_OFF,
STATE_NETATMO_MANUAL: 'Manual',
STATE_NETATMO_MANUAL: STATE_NETATMO_MANUAL,
}
HVAC_MAP_NETATMO = {
STATE_NETATMO_SCHEDULE: HVAC_MODE_AUTO,
PRESET_SCHEDULE: HVAC_MODE_AUTO,
STATE_NETATMO_HG: HVAC_MODE_AUTO,
PRESET_FROST_GUARD: HVAC_MODE_AUTO,
STATE_NETATMO_MAX: HVAC_MODE_HEAT,
PRESET_BOOST: HVAC_MODE_HEAT,
STATE_NETATMO_OFF: HVAC_MODE_OFF,
STATE_NETATMO_MANUAL: HVAC_MODE_AUTO,
PRESET_MANUAL: HVAC_MODE_AUTO,
STATE_NETATMO_AWAY: HVAC_MODE_AUTO
}
@@ -152,6 +155,7 @@ class NetatmoThermostat(ClimateDevice):
self._operation_list = [HVAC_MODE_AUTO, HVAC_MODE_HEAT]
self._support_flags = SUPPORT_FLAGS
self._hvac_mode = None
self._battery_level = None
self.update_without_throttle = False
self._module_type = \
self._data.room_status.get(room_id, {}).get('module_type')
@@ -218,9 +222,9 @@ class NetatmoThermostat(ClimateDevice):
if hvac_mode == HVAC_MODE_OFF:
mode = STATE_NETATMO_OFF
elif hvac_mode == HVAC_MODE_AUTO:
mode = STATE_NETATMO_SCHEDULE
mode = PRESET_SCHEDULE
elif hvac_mode == HVAC_MODE_HEAT:
mode = STATE_NETATMO_MAX
mode = PRESET_BOOST
self.set_preset_mode(mode)
@@ -259,6 +263,8 @@ class NetatmoThermostat(ClimateDevice):
self._data.homestatus.setThermmode(
self._data.home_id, PRESET_MAP_NETATMO[preset_mode]
)
else:
_LOGGER.error("Preset mode '%s' not available", preset_mode)
self.update_without_throttle = True
self.schedule_update_ha_state()
@@ -284,6 +290,16 @@ class NetatmoThermostat(ClimateDevice):
self.update_without_throttle = True
self.schedule_update_ha_state()
@property
def device_state_attributes(self):
"""Return the state attributes of the thermostat."""
attr = {}
if self._battery_level is not None:
attr[ATTR_BATTERY_LEVEL] = self._battery_level
return attr
def update(self):
"""Get the latest data from NetAtmo API and updates the states."""
try:
@@ -308,10 +324,12 @@ class NetatmoThermostat(ClimateDevice):
self._data.room_status[self._room_id]["setpoint_mode"]
]
self._hvac_mode = HVAC_MAP_NETATMO[self._preset]
except KeyError:
self._battery_level = \
self._data.room_status[self._room_id].get('battery_level')
except KeyError as err:
_LOGGER.error(
"The thermostat in room %s seems to be out of reach.",
self._room_id
"The thermostat in room %s seems to be out of reach. (%s)",
self._room_id, err
)
self._away = self._hvac_mode == HVAC_MAP_NETATMO[STATE_NETATMO_AWAY]
@@ -434,6 +452,7 @@ class ThermostatData:
roomstatus["module_id"] = None
roomstatus["heating_status"] = None
roomstatus["heating_power_request"] = None
batterylevel = None
for module_id in homedata_room["module_ids"]:
if (self.homedata.modules[self.home][module_id]["type"]
== NA_THERM
@@ -444,6 +463,10 @@ class ThermostatData:
rid=roomstatus["module_id"]
)
roomstatus["heating_status"] = self.boilerstatus
batterylevel = (
self.homestatus
.thermostats[roomstatus["module_id"]]
.get("battery_level"))
elif roomstatus["module_type"] == NA_VALVE:
roomstatus["heating_power_request"] = homestatus_room[
"heating_power_request"
@@ -456,6 +479,15 @@ class ThermostatData:
self.boilerstatus
and roomstatus["heating_status"]
)
batterylevel = (
self.homestatus.valves[roomstatus["module_id"]]
.get("battery_level"))
if batterylevel:
if roomstatus.get("battery_level") is None:
roomstatus["battery_level"] = batterylevel
elif batterylevel < roomstatus["battery_level"]:
roomstatus["battery_level"] = batterylevel
self.room_status[room] = roomstatus
except KeyError as err:
_LOGGER.error("Update of room %s failed. Error: %s", room, err)

View File

@@ -7,7 +7,7 @@ import voluptuous as vol
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO, HVAC_MODE_HEAT, HVAC_MODE_OFF, SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE)
SUPPORT_TARGET_TEMPERATURE, PRESET_NONE)
from homeassistant.const import (
ATTR_ENTITY_ID, ATTR_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT)
import homeassistant.helpers.config_validation as cv
@@ -157,6 +157,7 @@ class NuHeatThermostat(ClimateDevice):
def preset_modes(self):
"""Return available preset modes."""
return [
PRESET_NONE,
MODE_HOLD_TEMPERATURE,
MODE_TEMPORARY_HOLD
]
@@ -173,7 +174,7 @@ class NuHeatThermostat(ClimateDevice):
def set_preset_mode(self, preset_mode):
"""Update the hold mode of the thermostat."""
if preset_mode is None:
if preset_mode == PRESET_NONE:
schedule_mode = SCHEDULE_RUN
elif preset_mode == MODE_HOLD_TEMPERATURE:

View File

@@ -170,7 +170,7 @@ class OpenThermClimate(ClimateDevice):
@property
def preset_modes(self):
"""Available preset modes to set."""
return [PRESET_AWAY]
return []
def set_preset_mode(self, preset_mode):
"""Set the preset mode."""

View File

@@ -363,7 +363,7 @@ class DailyHistory:
def add_measurement(self, value, timestamp=None):
"""Add a new measurement for a certain day."""
day = (timestamp or datetime.now()).date()
if value is None:
if not isinstance(value, (int, float)):
return
if self._days is None:
self._days = deque()
@@ -388,4 +388,6 @@ class DailyHistory:
oldest = self._days.popleft()
del self._max_dict[oldest]
self._days.append(day)
if not isinstance(value, (int, float)):
return
self._max_dict[day] = value

View File

@@ -318,6 +318,18 @@ class SensiboClimate(ClimateDevice):
await self._client.async_set_ac_state_property(
self._id, 'swing', swing_mode, self._ac_states)
async def async_turn_on(self):
"""Turn Sensibo unit on."""
with async_timeout.timeout(TIMEOUT):
await self._client.async_set_ac_state_property(
self._id, 'on', True, self._ac_states)
async def async_turn_off(self):
"""Turn Sensibo unit on."""
with async_timeout.timeout(TIMEOUT):
await self._client.async_set_ac_state_property(
self._id, 'on', False, self._ac_states)
async def async_assume_state(self, state):
"""Set external state."""
change_needed = \

View File

@@ -326,8 +326,13 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateDevice):
if hvac_mode == HVAC_MODE_OFF:
await self.async_turn_off()
return
await self._device.set_air_conditioner_mode(
STATE_TO_AC_MODE[hvac_mode], set_status=True)
tasks = []
# Turn on the device if it's off before setting mode.
if not self._device.status.switch:
tasks.append(self._device.switch_on(set_status=True))
tasks.append(self._device.set_air_conditioner_mode(
STATE_TO_AC_MODE[hvac_mode], set_status=True))
await asyncio.gather(*tasks)
# State is set optimistically in the command above, therefore update
# the entity state ahead of receiving the confirming push updates
self.async_schedule_update_ha_state()
@@ -338,7 +343,12 @@ class SmartThingsAirConditioner(SmartThingsEntity, ClimateDevice):
# operation mode
operation_mode = kwargs.get(ATTR_HVAC_MODE)
if operation_mode:
tasks.append(self.async_set_hvac_mode(operation_mode))
if operation_mode == HVAC_MODE_OFF:
tasks.append(self._device.switch_off(set_status=True))
else:
if not self._device.status.switch:
tasks.append(self._device.switch_on(set_status=True))
tasks.append(self.async_set_hvac_mode(operation_mode))
# temperature
tasks.append(self._device.set_cooling_setpoint(
kwargs[ATTR_TEMPERATURE], set_status=True))

View File

@@ -130,9 +130,8 @@ class ToonThermostatDevice(ToonDisplayDeviceEntity, ClimateDevice):
def set_preset_mode(self, preset_mode: str) -> None:
"""Set new preset mode."""
if preset_mode is not None:
self._client.thermostat_state = self._preset = preset_mode
self.schedule_update_ha_state()
self._client.thermostat_state = self._preset = preset_mode
self.schedule_update_ha_state()
def set_hvac_mode(self, hvac_mode: str) -> None:
"""Set new target hvac mode."""

View File

@@ -8,7 +8,7 @@ from homeassistant.components.climate.const import (
ATTR_HVAC_MODE, ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_LOW,
HVAC_MODE_AUTO, HVAC_MODE_COOL, HVAC_MODE_HEAT, SUPPORT_FAN_MODE,
SUPPORT_TARGET_HUMIDITY, SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE, PRESET_AWAY,
SUPPORT_TARGET_TEMPERATURE, PRESET_AWAY, PRESET_NONE,
SUPPORT_TARGET_TEMPERATURE_RANGE,
HVAC_MODE_OFF)
from homeassistant.const import (
@@ -213,6 +213,7 @@ class VenstarThermostat(ClimateDevice):
def preset_modes(self):
"""Return valid preset modes."""
return [
PRESET_NONE,
PRESET_AWAY,
HOLD_MODE_TEMPERATURE,
]
@@ -286,7 +287,7 @@ class VenstarThermostat(ClimateDevice):
success = self._client.set_away(self._client.AWAY_AWAY)
elif preset_mode == HOLD_MODE_TEMPERATURE:
success = self._client.set_schedule(0)
elif preset_mode is None:
elif preset_mode == PRESET_NONE:
success = False
if self._client.away:
success = self._client.set_away(self._client.AWAY_HOME)

View File

@@ -10,7 +10,7 @@ from homeassistant.components.climate.const import (
FAN_LOW, FAN_MEDIUM, FAN_ON, HVAC_MODE_AUTO, HVAC_MODE_COOL,
HVAC_MODE_FAN_ONLY, HVAC_MODE_HEAT, HVAC_MODE_OFF, PRESET_AWAY, PRESET_ECO,
SUPPORT_AUX_HEAT, SUPPORT_FAN_MODE, SUPPORT_TARGET_TEMPERATURE,
SUPPORT_TARGET_TEMPERATURE_RANGE)
SUPPORT_TARGET_TEMPERATURE_RANGE, PRESET_NONE)
from homeassistant.const import (
ATTR_TEMPERATURE, PRECISION_TENTHS, TEMP_CELSIUS)
from homeassistant.helpers.temperature import display_temp as show_temp
@@ -44,7 +44,7 @@ SUPPORT_PRESET_THERMOSTAT = [PRESET_AWAY, PRESET_ECO]
SUPPORT_FLAGS_AC = SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE
SUPPORT_FAN_AC = [FAN_HIGH, FAN_LOW, FAN_MEDIUM]
SUPPORT_PRESET_AC = [PRESET_ECO]
SUPPORT_PRESET_AC = [PRESET_NONE, PRESET_ECO]
def setup_platform(hass, config, add_entities, discovery_info=None):
@@ -137,7 +137,7 @@ class WinkThermostat(WinkDevice, ClimateDevice):
@property
def preset_mode(self):
"""Return the current preset mode, e.g., home, away, temp."""
mode = self.wink.current_mode()
mode = self.wink.current_hvac_mode()
if mode == "eco":
return PRESET_ECO
if self.wink.away():
@@ -192,7 +192,7 @@ class WinkThermostat(WinkDevice, ClimateDevice):
"""Return true if aux heater."""
if 'aux' not in self.wink.hvac_modes():
return None
if self.wink.hvac_action_mode() == 'aux':
if self.wink.current_hvac_mode() == 'aux':
return True
return False
@@ -205,7 +205,7 @@ class WinkThermostat(WinkDevice, ClimateDevice):
if not self.wink.is_on():
return HVAC_MODE_OFF
wink_mode = self.wink.current_mode()
wink_mode = self.wink.current_hvac_mode()
if wink_mode == "aux":
return HVAC_MODE_HEAT
if wink_mode == "eco":
@@ -220,7 +220,7 @@ class WinkThermostat(WinkDevice, ClimateDevice):
"""
hvac_list = [HVAC_MODE_OFF]
modes = self.wink.modes()
modes = self.wink.hvac_modes()
for mode in modes:
if mode in ("eco", "aux"):
continue
@@ -409,7 +409,7 @@ class WinkAC(WinkDevice, ClimateDevice):
if not self.wink.is_on():
return HVAC_MODE_OFF
wink_mode = self.wink.current_mode()
wink_mode = self.wink.current_hvac_mode()
if wink_mode == "auto_eco":
return HVAC_MODE_AUTO
return WINK_HVAC_TO_HA.get(wink_mode)
@@ -422,7 +422,7 @@ class WinkAC(WinkDevice, ClimateDevice):
"""
hvac_list = [HVAC_MODE_OFF]
modes = self.wink.modes()
modes = self.wink.hvac_modes()
for mode in modes:
if mode == "auto_eco":
continue

View File

@@ -59,6 +59,7 @@ ATTR_COMMAND = 'command'
ATTR_COMMAND_TYPE = 'command_type'
ATTR_ARGS = 'args'
ATTR_ENDPOINT_ID = 'endpoint_id'
ATTR_AVAILABLE = 'available'
IN = 'in'
OUT = 'out'

View File

@@ -23,7 +23,7 @@ from .const import (
MANUFACTURER_CODE, MODEL, NAME, NWK, OUT, POWER_CONFIGURATION_CHANNEL,
POWER_SOURCE, QUIRK_APPLIED, QUIRK_CLASS, SERVER, SERVER_COMMANDS,
SIGNAL_AVAILABLE, UNKNOWN_MANUFACTURER, UNKNOWN_MODEL, ZDO_CHANNEL,
LQI, RSSI, LAST_SEEN)
LQI, RSSI, LAST_SEEN, ATTR_AVAILABLE)
_LOGGER = logging.getLogger(__name__)
_KEEP_ALIVE_INTERVAL = 7200
@@ -213,7 +213,8 @@ class ZHADevice:
POWER_SOURCE: self.power_source,
LQI: self.lqi,
RSSI: self.rssi,
LAST_SEEN: update_time
LAST_SEEN: update_time,
ATTR_AVAILABLE: self.available
}
def add_cluster_channel(self, cluster_channel):

View File

@@ -190,6 +190,13 @@ class ZHAGateway:
if entity_id == entity_reference.reference_id:
return entity_reference
def remove_entity_reference(self, entity):
"""Remove entity reference for given entity_id if found."""
if entity.zha_device.ieee in self.device_registry:
entity_refs = self.device_registry.get(entity.zha_device.ieee)
self.device_registry[entity.zha_device.ieee] = [
e for e in entity_refs if e.reference_id != entity.entity_id]
@property
def devices(self):
"""Return devices."""

View File

@@ -50,7 +50,7 @@ class ZhaEntity(RestoreEntity, entity.Entity):
self._available = False
self._component = kwargs['component']
self._unsubs = []
self.remove_future = asyncio.Future()
self.remove_future = None
for channel in channels:
self.cluster_channels[channel.name] = channel
@@ -123,6 +123,7 @@ class ZhaEntity(RestoreEntity, entity.Entity):
async def async_added_to_hass(self):
"""Run when about to be added to hass."""
await super().async_added_to_hass()
self.remove_future = asyncio.Future()
await self.async_check_recently_seen()
await self.async_accept_signal(
None, "{}_{}".format(self.zha_device.available_signal, 'entity'),
@@ -151,8 +152,10 @@ class ZhaEntity(RestoreEntity, entity.Entity):
async def async_will_remove_from_hass(self) -> None:
"""Disconnect entity object when removed."""
for unsub in self._unsubs:
for unsub in self._unsubs[:]:
unsub()
self._unsubs.remove(unsub)
self.zha_device.gateway.remove_entity_reference(self)
self.remove_future.set_result(True)
@callback

View File

@@ -5,7 +5,7 @@
"documentation": "https://www.home-assistant.io/components/zha",
"requirements": [
"bellows-homeassistant==0.8.2",
"zha-quirks==0.0.18",
"zha-quirks==0.0.19",
"zigpy-deconz==0.2.1",
"zigpy-homeassistant==0.7.0",
"zigpy-xbee-homeassistant==0.4.0"

View File

@@ -49,10 +49,10 @@ HVAC_STATE_MAPPINGS = {
HVAC_CURRENT_MAPPINGS = {
"Idle": CURRENT_HVAC_IDLE,
"Heat": CURRENT_HVAC_HEAT,
"Pending Heat": CURRENT_HVAC_HEAT,
"Pending Heat": CURRENT_HVAC_IDLE,
"Heating": CURRENT_HVAC_HEAT,
"Cool": CURRENT_HVAC_COOL,
"Pending Cool": CURRENT_HVAC_COOL,
"Pending Cool": CURRENT_HVAC_IDLE,
"Cooling": CURRENT_HVAC_COOL,
"Fan Only": CURRENT_HVAC_FAN,
"Vent / Economiser": CURRENT_HVAC_FAN,
@@ -244,7 +244,9 @@ class ZWaveClimate(ZWaveDeviceEntity, ClimateDevice):
Need to be a subset of HVAC_MODES.
"""
return self._hvac_list
if self.values.mode:
return self._hvac_list
return []
@property
def hvac_action(self):

View File

@@ -2,7 +2,7 @@
"""Constants used by Home Assistant components."""
MAJOR_VERSION = 0
MINOR_VERSION = 96
PATCH_VERSION = '1'
PATCH_VERSION = '3'
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
REQUIRED_PYTHON_VER = (3, 5, 3)

View File

@@ -433,7 +433,7 @@ class Entity:
async def _async_registry_updated(self, event):
"""Handle entity registry update."""
data = event.data
if data['action'] != 'update' and data.get(
if data['action'] != 'update' or data.get(
'old_entity_id', data['entity_id']) != self.entity_id:
return

View File

@@ -10,7 +10,7 @@ certifi>=2019.6.16
cryptography==2.7
distro==1.4.0
hass-nabucasa==0.15
home-assistant-frontend==20190718.0
home-assistant-frontend==20190721.0
importlib-metadata==0.18
jinja2>=2.10.1
netdisco==2.6.0

View File

@@ -505,7 +505,7 @@ gearbest_parser==1.0.7
geizhals==0.0.9
# homeassistant.components.geniushub
geniushub-client==0.4.12
geniushub-client==0.4.15
# homeassistant.components.geo_json_events
# homeassistant.components.nsw_rural_fire_service_feed
@@ -610,7 +610,7 @@ hole==0.3.0
holidays==0.9.10
# homeassistant.components.frontend
home-assistant-frontend==20190718.0
home-assistant-frontend==20190721.0
# homeassistant.components.zwave
homeassistant-pyozw==0.1.4
@@ -1939,7 +1939,7 @@ zengge==0.2
zeroconf==0.23.0
# homeassistant.components.zha
zha-quirks==0.0.18
zha-quirks==0.0.19
# homeassistant.components.zhong_hong
zhong_hong_hvac==1.0.9

View File

@@ -165,7 +165,7 @@ hdate==0.8.8
holidays==0.9.10
# homeassistant.components.frontend
home-assistant-frontend==20190718.0
home-assistant-frontend==20190721.0
# homeassistant.components.homekit_controller
homekit[IP]==0.14.0

View File

@@ -66,10 +66,10 @@ class TestFritzboxClimate(unittest.TestCase):
assert 19.5 == self.thermostat.target_temperature
self.thermostat._target_temperature = 126.5
assert self.thermostat.target_temperature is None
assert self.thermostat.target_temperature == 0.0
self.thermostat._target_temperature = 127.0
assert self.thermostat.target_temperature is None
assert self.thermostat.target_temperature == 30.0
@patch.object(FritzboxThermostat, 'set_hvac_mode')
def test_set_temperature_operation_mode(self, mock_set_op):
@@ -103,7 +103,7 @@ class TestFritzboxClimate(unittest.TestCase):
self.thermostat._target_temperature = 127.0
assert 'heat' == self.thermostat.hvac_mode
self.thermostat._target_temperature = 126.5
assert 'heat' == self.thermostat.hvac_mode
assert 'off' == self.thermostat.hvac_mode
self.thermostat._target_temperature = 22.0
assert 'heat' == self.thermostat.hvac_mode
self.thermostat._target_temperature = 16.0

View File

@@ -9,7 +9,7 @@ import voluptuous as vol
from homeassistant.components import input_boolean, switch
from homeassistant.components.climate.const import (
ATTR_PRESET_MODE, DOMAIN, HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_OFF,
PRESET_AWAY)
PRESET_AWAY, PRESET_NONE)
from homeassistant.const import (
ATTR_TEMPERATURE, SERVICE_TURN_OFF, SERVICE_TURN_ON, STATE_OFF, STATE_ON,
TEMP_CELSIUS, TEMP_FAHRENHEIT)
@@ -202,7 +202,7 @@ async def test_set_away_mode_and_restore_prev_temp(hass, setup_comp_2):
await common.async_set_preset_mode(hass, PRESET_AWAY)
state = hass.states.get(ENTITY)
assert 16 == state.attributes.get('temperature')
await common.async_set_preset_mode(hass, None)
await common.async_set_preset_mode(hass, PRESET_NONE)
state = hass.states.get(ENTITY)
assert 23 == state.attributes.get('temperature')
@@ -217,7 +217,7 @@ async def test_set_away_mode_twice_and_restore_prev_temp(hass, setup_comp_2):
await common.async_set_preset_mode(hass, PRESET_AWAY)
state = hass.states.get(ENTITY)
assert 16 == state.attributes.get('temperature')
await common.async_set_preset_mode(hass, None)
await common.async_set_preset_mode(hass, PRESET_NONE)
state = hass.states.get(ENTITY)
assert 23 == state.attributes.get('temperature')

View File

@@ -16,7 +16,7 @@ from homeassistant.components.climate.const import (
SUPPORT_FAN_MODE,
SUPPORT_SWING_MODE, SUPPORT_TARGET_TEMPERATURE, HVAC_MODE_AUTO,
HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_DRY, HVAC_MODE_FAN_ONLY,
SUPPORT_TARGET_TEMPERATURE_RANGE)
SUPPORT_TARGET_TEMPERATURE_RANGE, PRESET_NONE)
from homeassistant.components.mqtt.discovery import async_start
from homeassistant.const import STATE_OFF, STATE_UNAVAILABLE
@@ -425,7 +425,7 @@ async def test_set_away_mode(hass, mqtt_mock):
state = hass.states.get(ENTITY_CLIMATE)
assert state.attributes.get('preset_mode') == 'away'
await common.async_set_preset_mode(hass, None, ENTITY_CLIMATE)
await common.async_set_preset_mode(hass, PRESET_NONE, ENTITY_CLIMATE)
mqtt_mock.async_publish.assert_called_once_with(
'away-mode-topic', 'AUS', 0, False)
state = hass.states.get(ENTITY_CLIMATE)
@@ -467,7 +467,7 @@ async def test_set_hold(hass, mqtt_mock):
state = hass.states.get(ENTITY_CLIMATE)
assert state.attributes.get('preset_mode') == 'hold-on'
await common.async_set_preset_mode(hass, None, ENTITY_CLIMATE)
await common.async_set_preset_mode(hass, PRESET_NONE, ENTITY_CLIMATE)
mqtt_mock.async_publish.assert_called_once_with(
'hold-topic', 'off', 0, False)
state = hass.states.get(ENTITY_CLIMATE)

View File

@@ -293,6 +293,23 @@ async def test_set_hvac_mode(hass, thermostat, air_conditioner):
assert state.state == HVAC_MODE_COOL, entity_id
async def test_ac_set_hvac_mode_from_off(hass, air_conditioner):
"""Test setting HVAC mode when the unit is off."""
air_conditioner.status.update_attribute_value(
Attribute.air_conditioner_mode, 'heat')
air_conditioner.status.update_attribute_value(Attribute.switch, 'off')
await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner])
state = hass.states.get('climate.air_conditioner')
assert state.state == HVAC_MODE_OFF
await hass.services.async_call(
CLIMATE_DOMAIN, SERVICE_SET_HVAC_MODE, {
ATTR_ENTITY_ID: 'climate.air_conditioner',
ATTR_HVAC_MODE: HVAC_MODE_HEAT_COOL},
blocking=True)
state = hass.states.get('climate.air_conditioner')
assert state.state == HVAC_MODE_HEAT_COOL
async def test_ac_set_hvac_mode_off(hass, air_conditioner):
"""Test the AC HVAC mode can be turned off set successfully."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner])
@@ -376,6 +393,39 @@ async def test_set_temperature_ac_with_mode(hass, air_conditioner):
assert state.state == HVAC_MODE_COOL
async def test_set_temperature_ac_with_mode_from_off(hass, air_conditioner):
"""Test the temp and mode is set successfully when the unit is off."""
air_conditioner.status.update_attribute_value(
Attribute.air_conditioner_mode, 'heat')
air_conditioner.status.update_attribute_value(Attribute.switch, 'off')
await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner])
assert hass.states.get('climate.air_conditioner').state == HVAC_MODE_OFF
await hass.services.async_call(
CLIMATE_DOMAIN, SERVICE_SET_TEMPERATURE, {
ATTR_ENTITY_ID: 'climate.air_conditioner',
ATTR_TEMPERATURE: 27,
ATTR_HVAC_MODE: HVAC_MODE_COOL},
blocking=True)
state = hass.states.get('climate.air_conditioner')
assert state.attributes[ATTR_TEMPERATURE] == 27
assert state.state == HVAC_MODE_COOL
async def test_set_temperature_ac_with_mode_to_off(hass, air_conditioner):
"""Test the temp and mode is set successfully to turn off the unit."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[air_conditioner])
assert hass.states.get('climate.air_conditioner').state != HVAC_MODE_OFF
await hass.services.async_call(
CLIMATE_DOMAIN, SERVICE_SET_TEMPERATURE, {
ATTR_ENTITY_ID: 'climate.air_conditioner',
ATTR_TEMPERATURE: 27,
ATTR_HVAC_MODE: HVAC_MODE_OFF},
blocking=True)
state = hass.states.get('climate.air_conditioner')
assert state.attributes[ATTR_TEMPERATURE] == 27
assert state.state == HVAC_MODE_OFF
async def test_set_temperature_with_mode(hass, thermostat):
"""Test the temperature and mode is set successfully."""
await setup_platform(hass, CLIMATE_DOMAIN, devices=[thermostat])