mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
commit
c58f3a4b4a
@ -209,6 +209,7 @@ class KNXClimate(ClimateDevice):
|
|||||||
await self.async_update_ha_state()
|
await self.async_update_ha_state()
|
||||||
|
|
||||||
self.device.register_device_updated_cb(after_update_callback)
|
self.device.register_device_updated_cb(after_update_callback)
|
||||||
|
self.device.mode.register_device_updated_cb(after_update_callback)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> str:
|
def name(self) -> str:
|
||||||
|
@ -109,8 +109,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
|
|
||||||
auth = hass.data[DATA_NETATMO_AUTH]
|
auth = hass.data[DATA_NETATMO_AUTH]
|
||||||
|
|
||||||
|
home_data = HomeData(auth)
|
||||||
try:
|
try:
|
||||||
home_data = HomeData(auth)
|
home_data.setup()
|
||||||
except pyatmo.NoDevice:
|
except pyatmo.NoDevice:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -352,7 +353,6 @@ class HomeData:
|
|||||||
|
|
||||||
def get_home_ids(self):
|
def get_home_ids(self):
|
||||||
"""Get all the home ids returned by NetAtmo API."""
|
"""Get all the home ids returned by NetAtmo API."""
|
||||||
self.setup()
|
|
||||||
if self.homedata is None:
|
if self.homedata is None:
|
||||||
return []
|
return []
|
||||||
for home_id in self.homedata.homes:
|
for home_id in self.homedata.homes:
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Netatmo",
|
"name": "Netatmo",
|
||||||
"documentation": "https://www.home-assistant.io/components/netatmo",
|
"documentation": "https://www.home-assistant.io/components/netatmo",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"pyatmo==2.2.0"
|
"pyatmo==2.2.1"
|
||||||
],
|
],
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"webhook"
|
"webhook"
|
||||||
|
@ -144,10 +144,12 @@ class NukiLock(LockDevice):
|
|||||||
self._nuki_lock.update(aggressive=False)
|
self._nuki_lock.update(aggressive=False)
|
||||||
except requests.exceptions.RequestException:
|
except requests.exceptions.RequestException:
|
||||||
self._available = False
|
self._available = False
|
||||||
else:
|
return
|
||||||
self._name = self._nuki_lock.name
|
|
||||||
self._locked = self._nuki_lock.is_locked
|
self._available = self._nuki_lock.state != 255
|
||||||
self._battery_critical = self._nuki_lock.battery_critical
|
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):
|
def lock(self, **kwargs):
|
||||||
"""Lock the device."""
|
"""Lock the device."""
|
||||||
|
@ -228,35 +228,34 @@ class SmartThingsThermostat(SmartThingsEntity, ClimateDevice):
|
|||||||
self._hvac_mode = MODE_TO_STATE.get(thermostat_mode)
|
self._hvac_mode = MODE_TO_STATE.get(thermostat_mode)
|
||||||
if self._hvac_mode is None:
|
if self._hvac_mode is None:
|
||||||
_LOGGER.debug(
|
_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.label,
|
||||||
self._device.device_id,
|
self._device.device_id,
|
||||||
thermostat_mode,
|
thermostat_mode,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
modes = set()
|
||||||
supported_modes = self._device.status.supported_thermostat_modes
|
supported_modes = self._device.status.supported_thermostat_modes
|
||||||
if isinstance(supported_modes, Iterable):
|
if isinstance(supported_modes, Iterable):
|
||||||
operations = set()
|
|
||||||
for mode in supported_modes:
|
for mode in supported_modes:
|
||||||
state = MODE_TO_STATE.get(mode)
|
state = MODE_TO_STATE.get(mode)
|
||||||
if state is not None:
|
if state is not None:
|
||||||
operations.add(state)
|
modes.add(state)
|
||||||
else:
|
else:
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"Device %s (%s) returned an invalid "
|
"Device %s (%s) returned an invalid supported thermostat mode: %s",
|
||||||
"supported thermostat mode: %s",
|
|
||||||
self._device.label,
|
self._device.label,
|
||||||
self._device.device_id,
|
self._device.device_id,
|
||||||
mode,
|
mode,
|
||||||
)
|
)
|
||||||
self._hvac_modes = operations
|
|
||||||
else:
|
else:
|
||||||
_LOGGER.debug(
|
_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.label,
|
||||||
self._device.device_id,
|
self._device.device_id,
|
||||||
supported_modes,
|
supported_modes,
|
||||||
)
|
)
|
||||||
|
self._hvac_modes = list(modes)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def current_humidity(self):
|
def current_humidity(self):
|
||||||
|
@ -294,7 +294,7 @@ class UniFiDeviceTracker(ScannerEntity):
|
|||||||
CONF_DETECTION_TIME, DEFAULT_DETECTION_TIME
|
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))
|
dt_util.utcnow() - dt_util.utc_from_timestamp(float(self.device.last_seen))
|
||||||
< detection_time
|
< detection_time
|
||||||
):
|
):
|
||||||
@ -339,15 +339,18 @@ class UniFiDeviceTracker(ScannerEntity):
|
|||||||
@property
|
@property
|
||||||
def device_state_attributes(self):
|
def device_state_attributes(self):
|
||||||
"""Return the device state attributes."""
|
"""Return the device state attributes."""
|
||||||
if not self.device.last_seen:
|
if self.device.state == 0:
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
attributes = {}
|
attributes = {}
|
||||||
|
|
||||||
attributes["upgradable"] = self.device.upgradable
|
|
||||||
attributes["overheating"] = self.device.overheating
|
|
||||||
|
|
||||||
if self.device.has_fan:
|
if self.device.has_fan:
|
||||||
attributes["fan_level"] = self.device.fan_level
|
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
|
return attributes
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/components/unifi",
|
"documentation": "https://www.home-assistant.io/components/unifi",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"aiounifi==10"
|
"aiounifi==11"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": [
|
"codeowners": [
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Vera",
|
"name": "Vera",
|
||||||
"documentation": "https://www.home-assistant.io/components/vera",
|
"documentation": "https://www.home-assistant.io/components/vera",
|
||||||
"requirements": [
|
"requirements": [
|
||||||
"pyvera==0.3.2"
|
"pyvera==0.3.3"
|
||||||
],
|
],
|
||||||
"dependencies": [],
|
"dependencies": [],
|
||||||
"codeowners": []
|
"codeowners": []
|
||||||
|
@ -27,6 +27,7 @@ from homeassistant.components.climate.const import (
|
|||||||
SUPPORT_FAN_MODE,
|
SUPPORT_FAN_MODE,
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
SUPPORT_TARGET_TEMPERATURE,
|
||||||
SUPPORT_TARGET_TEMPERATURE_RANGE,
|
SUPPORT_TARGET_TEMPERATURE_RANGE,
|
||||||
|
SUPPORT_PRESET_MODE,
|
||||||
PRESET_NONE,
|
PRESET_NONE,
|
||||||
)
|
)
|
||||||
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, TEMP_CELSIUS
|
from homeassistant.const import ATTR_TEMPERATURE, PRECISION_TENTHS, TEMP_CELSIUS
|
||||||
@ -62,7 +63,7 @@ SUPPORT_FLAGS_THERMOSTAT = (
|
|||||||
SUPPORT_FAN_THERMOSTAT = [FAN_AUTO, FAN_ON]
|
SUPPORT_FAN_THERMOSTAT = [FAN_AUTO, FAN_ON]
|
||||||
SUPPORT_PRESET_THERMOSTAT = [PRESET_AWAY, PRESET_ECO]
|
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_FAN_AC = [FAN_HIGH, FAN_LOW, FAN_MEDIUM]
|
||||||
SUPPORT_PRESET_AC = [PRESET_NONE, PRESET_ECO]
|
SUPPORT_PRESET_AC = [PRESET_NONE, PRESET_ECO]
|
||||||
|
|
||||||
@ -415,10 +416,13 @@ class WinkAC(WinkDevice, ClimateDevice):
|
|||||||
@property
|
@property
|
||||||
def preset_mode(self):
|
def preset_mode(self):
|
||||||
"""Return the current preset mode, e.g., home, away, temp."""
|
"""Return the current preset mode, e.g., home, away, temp."""
|
||||||
|
if not self.wink.is_on():
|
||||||
|
return PRESET_NONE
|
||||||
|
|
||||||
mode = self.wink.current_mode()
|
mode = self.wink.current_mode()
|
||||||
if mode == "auto_eco":
|
if mode == "auto_eco":
|
||||||
return PRESET_ECO
|
return PRESET_ECO
|
||||||
return None
|
return PRESET_NONE
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def preset_modes(self):
|
def preset_modes(self):
|
||||||
@ -436,7 +440,7 @@ class WinkAC(WinkDevice, ClimateDevice):
|
|||||||
|
|
||||||
wink_mode = self.wink.current_mode()
|
wink_mode = self.wink.current_mode()
|
||||||
if wink_mode == "auto_eco":
|
if wink_mode == "auto_eco":
|
||||||
return HVAC_MODE_AUTO
|
return HVAC_MODE_COOL
|
||||||
return WINK_HVAC_TO_HA.get(wink_mode)
|
return WINK_HVAC_TO_HA.get(wink_mode)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -476,6 +480,8 @@ class WinkAC(WinkDevice, ClimateDevice):
|
|||||||
"""Set new preset mode."""
|
"""Set new preset mode."""
|
||||||
if preset_mode == PRESET_ECO:
|
if preset_mode == PRESET_ECO:
|
||||||
self.wink.set_operation_mode("auto_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
|
@property
|
||||||
def target_temperature(self):
|
def target_temperature(self):
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 97
|
MINOR_VERSION = 97
|
||||||
PATCH_VERSION = "1"
|
PATCH_VERSION = "2"
|
||||||
__short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION)
|
__short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION)
|
||||||
__version__ = "{}.{}".format(__short_version__, PATCH_VERSION)
|
__version__ = "{}.{}".format(__short_version__, PATCH_VERSION)
|
||||||
REQUIRED_PYTHON_VER = (3, 6, 0)
|
REQUIRED_PYTHON_VER = (3, 6, 0)
|
||||||
|
@ -170,7 +170,7 @@ aiopvapi==1.6.14
|
|||||||
aioswitcher==2019.4.26
|
aioswitcher==2019.4.26
|
||||||
|
|
||||||
# homeassistant.components.unifi
|
# homeassistant.components.unifi
|
||||||
aiounifi==10
|
aiounifi==11
|
||||||
|
|
||||||
# homeassistant.components.wwlln
|
# homeassistant.components.wwlln
|
||||||
aiowwlln==1.0.0
|
aiowwlln==1.0.0
|
||||||
@ -1046,7 +1046,7 @@ pyalarmdotcom==0.3.2
|
|||||||
pyarlo==0.2.3
|
pyarlo==0.2.3
|
||||||
|
|
||||||
# homeassistant.components.netatmo
|
# homeassistant.components.netatmo
|
||||||
pyatmo==2.2.0
|
pyatmo==2.2.1
|
||||||
|
|
||||||
# homeassistant.components.apple_tv
|
# homeassistant.components.apple_tv
|
||||||
pyatv==0.3.12
|
pyatv==0.3.12
|
||||||
@ -1566,7 +1566,7 @@ pyuptimerobot==0.0.5
|
|||||||
# pyuserinput==0.1.11
|
# pyuserinput==0.1.11
|
||||||
|
|
||||||
# homeassistant.components.vera
|
# homeassistant.components.vera
|
||||||
pyvera==0.3.2
|
pyvera==0.3.3
|
||||||
|
|
||||||
# homeassistant.components.vesync
|
# homeassistant.components.vesync
|
||||||
pyvesync==1.1.0
|
pyvesync==1.1.0
|
||||||
|
@ -68,7 +68,7 @@ aionotion==1.1.0
|
|||||||
aioswitcher==2019.4.26
|
aioswitcher==2019.4.26
|
||||||
|
|
||||||
# homeassistant.components.unifi
|
# homeassistant.components.unifi
|
||||||
aiounifi==10
|
aiounifi==11
|
||||||
|
|
||||||
# homeassistant.components.wwlln
|
# homeassistant.components.wwlln
|
||||||
aiowwlln==1.0.0
|
aiowwlln==1.0.0
|
||||||
|
@ -214,14 +214,14 @@ async def test_legacy_thermostat_entity_state(hass, legacy_thermostat):
|
|||||||
| SUPPORT_TARGET_TEMPERATURE_RANGE
|
| SUPPORT_TARGET_TEMPERATURE_RANGE
|
||||||
| SUPPORT_TARGET_TEMPERATURE
|
| SUPPORT_TARGET_TEMPERATURE
|
||||||
)
|
)
|
||||||
assert state.attributes[ATTR_HVAC_ACTIONS] == "idle"
|
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_AUTO,
|
||||||
HVAC_MODE_COOL,
|
HVAC_MODE_COOL,
|
||||||
HVAC_MODE_HEAT_COOL,
|
|
||||||
HVAC_MODE_HEAT,
|
HVAC_MODE_HEAT,
|
||||||
|
HVAC_MODE_HEAT_COOL,
|
||||||
HVAC_MODE_OFF,
|
HVAC_MODE_OFF,
|
||||||
}
|
]
|
||||||
assert state.attributes[ATTR_FAN_MODE] == "auto"
|
assert state.attributes[ATTR_FAN_MODE] == "auto"
|
||||||
assert state.attributes[ATTR_FAN_MODES] == ["auto", "on"]
|
assert state.attributes[ATTR_FAN_MODES] == ["auto", "on"]
|
||||||
assert state.attributes[ATTR_TARGET_TEMP_LOW] == 20 # celsius
|
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
|
== SUPPORT_TARGET_TEMPERATURE_RANGE | SUPPORT_TARGET_TEMPERATURE
|
||||||
)
|
)
|
||||||
assert ATTR_HVAC_ACTIONS not in state.attributes
|
assert ATTR_HVAC_ACTIONS not in state.attributes
|
||||||
assert state.attributes[ATTR_HVAC_MODES] == {
|
assert sorted(state.attributes[ATTR_HVAC_MODES]) == [
|
||||||
HVAC_MODE_OFF,
|
|
||||||
HVAC_MODE_HEAT_COOL,
|
|
||||||
HVAC_MODE_HEAT,
|
|
||||||
HVAC_MODE_COOL,
|
HVAC_MODE_COOL,
|
||||||
}
|
HVAC_MODE_HEAT,
|
||||||
|
HVAC_MODE_HEAT_COOL,
|
||||||
|
HVAC_MODE_OFF,
|
||||||
|
]
|
||||||
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 21.1 # celsius
|
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 21.1 # celsius
|
||||||
|
|
||||||
|
|
||||||
@ -260,13 +260,13 @@ async def test_thermostat_entity_state(hass, thermostat):
|
|||||||
| SUPPORT_TARGET_TEMPERATURE
|
| SUPPORT_TARGET_TEMPERATURE
|
||||||
)
|
)
|
||||||
assert state.attributes[ATTR_HVAC_ACTIONS] == CURRENT_HVAC_IDLE
|
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_AUTO,
|
||||||
HVAC_MODE_COOL,
|
HVAC_MODE_COOL,
|
||||||
HVAC_MODE_HEAT,
|
HVAC_MODE_HEAT,
|
||||||
HVAC_MODE_HEAT_COOL,
|
HVAC_MODE_HEAT_COOL,
|
||||||
HVAC_MODE_OFF,
|
HVAC_MODE_OFF,
|
||||||
}
|
]
|
||||||
assert state.attributes[ATTR_FAN_MODE] == "on"
|
assert state.attributes[ATTR_FAN_MODE] == "on"
|
||||||
assert state.attributes[ATTR_FAN_MODES] == ["auto", "on"]
|
assert state.attributes[ATTR_FAN_MODES] == ["auto", "on"]
|
||||||
assert state.attributes[ATTR_TEMPERATURE] == 20 # celsius
|
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.state is STATE_UNKNOWN
|
||||||
assert state.attributes[ATTR_TEMPERATURE] is None
|
assert state.attributes[ATTR_TEMPERATURE] is None
|
||||||
assert state.attributes[ATTR_CURRENT_TEMPERATURE] == 21.1 # celsius
|
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):
|
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])
|
await setup_platform(hass, CLIMATE_DOMAIN, devices=[buggy_thermostat])
|
||||||
state = hass.states.get("climate.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):
|
async def test_air_conditioner_entity_state(hass, air_conditioner):
|
||||||
|
@ -69,6 +69,7 @@ DEVICE_1 = {
|
|||||||
"model": "US16P150",
|
"model": "US16P150",
|
||||||
"name": "device_1",
|
"name": "device_1",
|
||||||
"overheating": False,
|
"overheating": False,
|
||||||
|
"state": 1,
|
||||||
"type": "usw",
|
"type": "usw",
|
||||||
"upgradable": False,
|
"upgradable": False,
|
||||||
"version": "4.0.42.10433",
|
"version": "4.0.42.10433",
|
||||||
@ -81,6 +82,7 @@ DEVICE_2 = {
|
|||||||
"mac": "00:00:00:00:01:01",
|
"mac": "00:00:00:00:01:01",
|
||||||
"model": "US16P150",
|
"model": "US16P150",
|
||||||
"name": "device_1",
|
"name": "device_1",
|
||||||
|
"state": 0,
|
||||||
"type": "usw",
|
"type": "usw",
|
||||||
"version": "4.0.42.10433",
|
"version": "4.0.42.10433",
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user