diff --git a/homeassistant/components/knx/climate.py b/homeassistant/components/knx/climate.py index a3183c3b34d025..07aac11b972ff4 100644 --- a/homeassistant/components/knx/climate.py +++ b/homeassistant/components/knx/climate.py @@ -209,6 +209,7 @@ async def after_update_callback(device): await self.async_update_ha_state() self.device.register_device_updated_cb(after_update_callback) + self.device.mode.register_device_updated_cb(after_update_callback) @property def name(self) -> str: diff --git a/homeassistant/components/netatmo/climate.py b/homeassistant/components/netatmo/climate.py index 109f12a87fc40c..9656d4a37a451c 100644 --- a/homeassistant/components/netatmo/climate.py +++ b/homeassistant/components/netatmo/climate.py @@ -109,8 +109,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None): auth = hass.data[DATA_NETATMO_AUTH] + home_data = HomeData(auth) try: - home_data = HomeData(auth) + home_data.setup() except pyatmo.NoDevice: return @@ -352,7 +353,6 @@ def __init__(self, auth, home=None): def get_home_ids(self): """Get all the home ids returned by NetAtmo API.""" - self.setup() if self.homedata is None: return [] for home_id in self.homedata.homes: diff --git a/homeassistant/components/netatmo/manifest.json b/homeassistant/components/netatmo/manifest.json index 66b0efc61ff5e0..82f32c34407cab 100644 --- a/homeassistant/components/netatmo/manifest.json +++ b/homeassistant/components/netatmo/manifest.json @@ -3,7 +3,7 @@ "name": "Netatmo", "documentation": "https://www.home-assistant.io/components/netatmo", "requirements": [ - "pyatmo==2.2.0" + "pyatmo==2.2.1" ], "dependencies": [ "webhook" diff --git a/homeassistant/components/nuki/lock.py b/homeassistant/components/nuki/lock.py index 38e42fcc1b5cb3..31a655dfeddd93 100644 --- a/homeassistant/components/nuki/lock.py +++ b/homeassistant/components/nuki/lock.py @@ -144,10 +144,12 @@ def update(self): self._nuki_lock.update(aggressive=False) except requests.exceptions.RequestException: self._available = False - else: - self._name = self._nuki_lock.name - self._locked = self._nuki_lock.is_locked - self._battery_critical = self._nuki_lock.battery_critical + return + + self._available = self._nuki_lock.state != 255 + self._name = self._nuki_lock.name + self._locked = self._nuki_lock.is_locked + self._battery_critical = self._nuki_lock.battery_critical def lock(self, **kwargs): """Lock the device.""" diff --git a/homeassistant/components/smartthings/climate.py b/homeassistant/components/smartthings/climate.py index e9fefeb2995157..bb307523e97084 100644 --- a/homeassistant/components/smartthings/climate.py +++ b/homeassistant/components/smartthings/climate.py @@ -228,35 +228,34 @@ async def async_update(self): self._hvac_mode = MODE_TO_STATE.get(thermostat_mode) if self._hvac_mode is None: _LOGGER.debug( - "Device %s (%s) returned an invalid" "hvac mode: %s", + "Device %s (%s) returned an invalid hvac mode: %s", self._device.label, self._device.device_id, thermostat_mode, ) + modes = set() supported_modes = self._device.status.supported_thermostat_modes if isinstance(supported_modes, Iterable): - operations = set() for mode in supported_modes: state = MODE_TO_STATE.get(mode) if state is not None: - operations.add(state) + modes.add(state) else: _LOGGER.debug( - "Device %s (%s) returned an invalid " - "supported thermostat mode: %s", + "Device %s (%s) returned an invalid supported thermostat mode: %s", self._device.label, self._device.device_id, mode, ) - self._hvac_modes = operations else: _LOGGER.debug( - "Device %s (%s) returned invalid supported " "thermostat modes: %s", + "Device %s (%s) returned invalid supported thermostat modes: %s", self._device.label, self._device.device_id, supported_modes, ) + self._hvac_modes = list(modes) @property def current_humidity(self): diff --git a/homeassistant/components/unifi/device_tracker.py b/homeassistant/components/unifi/device_tracker.py index d9f90de7888b98..42a6f496a2ae3b 100644 --- a/homeassistant/components/unifi/device_tracker.py +++ b/homeassistant/components/unifi/device_tracker.py @@ -294,7 +294,7 @@ def is_connected(self): CONF_DETECTION_TIME, DEFAULT_DETECTION_TIME ) - if self.device.last_seen and ( + if self.device.state == 1 and ( dt_util.utcnow() - dt_util.utc_from_timestamp(float(self.device.last_seen)) < detection_time ): @@ -339,15 +339,18 @@ def device_info(self): @property def device_state_attributes(self): """Return the device state attributes.""" - if not self.device.last_seen: + if self.device.state == 0: return {} attributes = {} - attributes["upgradable"] = self.device.upgradable - attributes["overheating"] = self.device.overheating - if self.device.has_fan: attributes["fan_level"] = self.device.fan_level + if self.device.overheating: + attributes["overheating"] = self.device.overheating + + if self.device.upgradable: + attributes["upgradable"] = self.device.upgradable + return attributes diff --git a/homeassistant/components/unifi/manifest.json b/homeassistant/components/unifi/manifest.json index bcee022e1c4167..d182806c4ac7b7 100644 --- a/homeassistant/components/unifi/manifest.json +++ b/homeassistant/components/unifi/manifest.json @@ -4,7 +4,7 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/components/unifi", "requirements": [ - "aiounifi==10" + "aiounifi==11" ], "dependencies": [], "codeowners": [ diff --git a/homeassistant/components/vera/manifest.json b/homeassistant/components/vera/manifest.json index 5fddce7efe7f85..07ae7ab3d3698b 100644 --- a/homeassistant/components/vera/manifest.json +++ b/homeassistant/components/vera/manifest.json @@ -3,7 +3,7 @@ "name": "Vera", "documentation": "https://www.home-assistant.io/components/vera", "requirements": [ - "pyvera==0.3.2" + "pyvera==0.3.3" ], "dependencies": [], "codeowners": [] diff --git a/homeassistant/components/wink/climate.py b/homeassistant/components/wink/climate.py index ed2d24828025e7..38f25ef0a83912 100644 --- a/homeassistant/components/wink/climate.py +++ b/homeassistant/components/wink/climate.py @@ -27,6 +27,7 @@ SUPPORT_FAN_MODE, SUPPORT_TARGET_TEMPERATURE, SUPPORT_TARGET_TEMPERATURE_RANGE, + SUPPORT_PRESET_MODE, PRESET_NONE, ) from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, TEMP_CELSIUS @@ -62,7 +63,7 @@ SUPPORT_FAN_THERMOSTAT = [FAN_AUTO, FAN_ON] SUPPORT_PRESET_THERMOSTAT = [PRESET_AWAY, PRESET_ECO] -SUPPORT_FLAGS_AC = SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE +SUPPORT_FLAGS_AC = SUPPORT_TARGET_TEMPERATURE | SUPPORT_FAN_MODE | SUPPORT_PRESET_MODE SUPPORT_FAN_AC = [FAN_HIGH, FAN_LOW, FAN_MEDIUM] SUPPORT_PRESET_AC = [PRESET_NONE, PRESET_ECO] @@ -415,10 +416,13 @@ def current_temperature(self): @property def preset_mode(self): """Return the current preset mode, e.g., home, away, temp.""" + if not self.wink.is_on(): + return PRESET_NONE + mode = self.wink.current_mode() if mode == "auto_eco": return PRESET_ECO - return None + return PRESET_NONE @property def preset_modes(self): @@ -436,7 +440,7 @@ def hvac_mode(self) -> str: wink_mode = self.wink.current_mode() if wink_mode == "auto_eco": - return HVAC_MODE_AUTO + return HVAC_MODE_COOL return WINK_HVAC_TO_HA.get(wink_mode) @property @@ -476,6 +480,8 @@ def set_preset_mode(self, preset_mode): """Set new preset mode.""" if preset_mode == PRESET_ECO: self.wink.set_operation_mode("auto_eco") + elif self.hvac_mode == HVAC_MODE_COOL and preset_mode == PRESET_NONE: + self.set_hvac_mode(HVAC_MODE_COOL) @property def target_temperature(self): diff --git a/homeassistant/const.py b/homeassistant/const.py index 51549b8f07c918..7078ee62d07859 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -2,7 +2,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 97 -PATCH_VERSION = "1" +PATCH_VERSION = "2" __short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION) __version__ = "{}.{}".format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 6, 0) diff --git a/requirements_all.txt b/requirements_all.txt index 5404b514a58e59..423409b70544b8 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -170,7 +170,7 @@ aiopvapi==1.6.14 aioswitcher==2019.4.26 # homeassistant.components.unifi -aiounifi==10 +aiounifi==11 # homeassistant.components.wwlln aiowwlln==1.0.0 @@ -1046,7 +1046,7 @@ pyalarmdotcom==0.3.2 pyarlo==0.2.3 # homeassistant.components.netatmo -pyatmo==2.2.0 +pyatmo==2.2.1 # homeassistant.components.apple_tv pyatv==0.3.12 @@ -1566,7 +1566,7 @@ pyuptimerobot==0.0.5 # pyuserinput==0.1.11 # homeassistant.components.vera -pyvera==0.3.2 +pyvera==0.3.3 # homeassistant.components.vesync pyvesync==1.1.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index e2da65e24cd547..26630c11f677bf 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -68,7 +68,7 @@ aionotion==1.1.0 aioswitcher==2019.4.26 # homeassistant.components.unifi -aiounifi==10 +aiounifi==11 # homeassistant.components.wwlln aiowwlln==1.0.0 diff --git a/tests/components/smartthings/test_climate.py b/tests/components/smartthings/test_climate.py index 01206ded06238b..c366761ea1f1bf 100644 --- a/tests/components/smartthings/test_climate.py +++ b/tests/components/smartthings/test_climate.py @@ -214,14 +214,14 @@ async def test_legacy_thermostat_entity_state(hass, legacy_thermostat): | SUPPORT_TARGET_TEMPERATURE_RANGE | SUPPORT_TARGET_TEMPERATURE ) - assert state.attributes[ATTR_HVAC_ACTIONS] == "idle" - assert state.attributes[ATTR_HVAC_MODES] == { + assert state.attributes[ATTR_HVAC_ACTIONS] == CURRENT_HVAC_IDLE + assert sorted(state.attributes[ATTR_HVAC_MODES]) == [ HVAC_MODE_AUTO, HVAC_MODE_COOL, - HVAC_MODE_HEAT_COOL, HVAC_MODE_HEAT, + HVAC_MODE_HEAT_COOL, HVAC_MODE_OFF, - } + ] assert state.attributes[ATTR_FAN_MODE] == "auto" assert state.attributes[ATTR_FAN_MODES] == ["auto", "on"] assert state.attributes[ATTR_TARGET_TEMP_LOW] == 20 # celsius @@ -239,12 +239,12 @@ async def test_basic_thermostat_entity_state(hass, basic_thermostat): == SUPPORT_TARGET_TEMPERATURE_RANGE | SUPPORT_TARGET_TEMPERATURE ) assert ATTR_HVAC_ACTIONS not in state.attributes - assert state.attributes[ATTR_HVAC_MODES] == { - HVAC_MODE_OFF, - HVAC_MODE_HEAT_COOL, - HVAC_MODE_HEAT, + assert sorted(state.attributes[ATTR_HVAC_MODES]) == [ HVAC_MODE_COOL, - } + HVAC_MODE_HEAT, + HVAC_MODE_HEAT_COOL, + HVAC_MODE_OFF, + ] assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 21.1 # celsius @@ -260,13 +260,13 @@ async def test_thermostat_entity_state(hass, thermostat): | SUPPORT_TARGET_TEMPERATURE ) assert state.attributes[ATTR_HVAC_ACTIONS] == CURRENT_HVAC_IDLE - assert state.attributes[ATTR_HVAC_MODES] == { + assert sorted(state.attributes[ATTR_HVAC_MODES]) == [ HVAC_MODE_AUTO, HVAC_MODE_COOL, HVAC_MODE_HEAT, HVAC_MODE_HEAT_COOL, HVAC_MODE_OFF, - } + ] assert state.attributes[ATTR_FAN_MODE] == "on" assert state.attributes[ATTR_FAN_MODES] == ["auto", "on"] assert state.attributes[ATTR_TEMPERATURE] == 20 # celsius @@ -286,6 +286,7 @@ async def test_buggy_thermostat_entity_state(hass, buggy_thermostat): assert state.state is STATE_UNKNOWN assert state.attributes[ATTR_TEMPERATURE] is None assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 21.1 # celsius + assert state.attributes[ATTR_HVAC_MODES] == [] async def test_buggy_thermostat_invalid_mode(hass, buggy_thermostat): @@ -295,7 +296,7 @@ async def test_buggy_thermostat_invalid_mode(hass, buggy_thermostat): ) await setup_platform(hass, CLIMATE_DOMAIN, devices=[buggy_thermostat]) state = hass.states.get("climate.buggy_thermostat") - assert state.attributes[ATTR_HVAC_MODES] == {"heat"} + assert state.attributes[ATTR_HVAC_MODES] == [HVAC_MODE_HEAT] async def test_air_conditioner_entity_state(hass, air_conditioner): diff --git a/tests/components/unifi/test_device_tracker.py b/tests/components/unifi/test_device_tracker.py index 0d8d631d8ffa62..d5783e58818a4f 100644 --- a/tests/components/unifi/test_device_tracker.py +++ b/tests/components/unifi/test_device_tracker.py @@ -69,6 +69,7 @@ "model": "US16P150", "name": "device_1", "overheating": False, + "state": 1, "type": "usw", "upgradable": False, "version": "4.0.42.10433", @@ -81,6 +82,7 @@ "mac": "00:00:00:00:01:01", "model": "US16P150", "name": "device_1", + "state": 0, "type": "usw", "version": "4.0.42.10433", }