Compare commits

..

13 Commits

Author SHA1 Message Date
Paulus Schoutsen
9a79a0aa90 Merge pull request #25205 from home-assistant/rc
0.96.0
2019-07-17 16:23:24 -07:00
Khole
ccc4f628f1 Hive water heater - Remove Duplication of appending entities (#25210)
* climate_water_heater

* updated names

* Update water_heater

* Update requirements

* Updated reqirements

* Version update

* updated Versiojn

* Update device list

* Removed unused Attributes

* removed duplicate appending entities

* re-added missing hotwater

* Move call to async_added_to_hass

* Move session append to async_added_to_hass

* White space
2019-07-17 15:19:03 -07:00
cgtobi
90231c5e07 Fix schema validation for service calls (#25204)
* Fix schema validation for service calls

* No need for get

* No need for get
2019-07-17 15:19:02 -07:00
Paulus Schoutsen
ff5dd0cf42 Updated frontend to 20190717.1 2019-07-17 15:10:57 -07:00
Paulus Schoutsen
5d7f420821 Fix ecobee missing preset mode support flag (#25211) 2019-07-17 15:08:14 -07:00
Paulus Schoutsen
e4bb955498 Pin Docker to Debain Stretch (#25206)
* Pin Docker to Debain Stretch

* Update dev docker too"
2019-07-17 14:05:00 -07:00
Paulus Schoutsen
74d0e65958 Bumped version to 0.96.0 2019-07-17 13:42:32 -07:00
Paulus Schoutsen
3cfbbdc720 Only include target temp if has right support flag (#25193)
* Only include target temp if has right support flag

* Remove comma
2019-07-17 13:09:07 -07:00
David Bonnes
3d5c773670 [climate] Tweak evohome migration (#25187)
* de-lint

* use _evo_tcs instead of _evo_device for TCS

* add hvac_action to zones, remove target_temp from controller

* fix incorrect hvac_action

* de-lint
2019-07-17 13:09:06 -07:00
David F. Mulcahey
b5b0f56ae7 Fix device name customization on ZHA add devices page (#25180)
* ensure new device exists

* clean up dev reg handling

* update test

* fix tests
2019-07-17 13:09:05 -07:00
Paulus Schoutsen
c03d5f1a73 Correctly set property decorator on preset modes (#25151) 2019-07-17 13:09:05 -07:00
Paulus Schoutsen
5abe4dd1f7 Updated frontend to 20190717.0 2019-07-17 13:08:13 -07:00
Pascal Vizeli
9548345ed0 Update azure-pipelines-wheels.yml for Azure Pipelines 2019-07-15 15:23:08 +02:00
17 changed files with 90 additions and 76 deletions

View File

@@ -2,7 +2,7 @@
# When updating this file, please also update virtualization/Docker/Dockerfile.dev
# This way, the development image and the production image are kept in sync.
FROM python:3.7
FROM python:3.7-stretch
LABEL maintainer="Paulus Schoutsen <Paulus@PaulusSchoutsen.nl>"
# Uncomment any of the following lines to disable the installation.

View File

@@ -31,7 +31,7 @@ from .const import (
SERVICE_SET_HVAC_MODE, SERVICE_SET_PRESET_MODE, SERVICE_SET_SWING_MODE,
SERVICE_SET_TEMPERATURE, SUPPORT_AUX_HEAT, SUPPORT_FAN_MODE,
SUPPORT_PRESET_MODE, SUPPORT_SWING_MODE, SUPPORT_TARGET_HUMIDITY,
SUPPORT_TARGET_TEMPERATURE_RANGE)
SUPPORT_TARGET_TEMPERATURE_RANGE, SUPPORT_TARGET_TEMPERATURE)
from .reproduce_state import async_reproduce_states # noqa
DEFAULT_MIN_TEMP = 7
@@ -176,14 +176,16 @@ class ClimateDevice(Entity):
ATTR_MAX_TEMP: show_temp(
self.hass, self.max_temp, self.temperature_unit,
self.precision),
ATTR_TEMPERATURE: show_temp(
self.hass, self.target_temperature, self.temperature_unit,
self.precision),
}
if self.target_temperature_step:
data[ATTR_TARGET_TEMP_STEP] = self.target_temperature_step
if supported_features & SUPPORT_TARGET_TEMPERATURE:
data[ATTR_TEMPERATURE] = show_temp(
self.hass, self.target_temperature, self.temperature_unit,
self.precision)
if supported_features & SUPPORT_TARGET_TEMPERATURE_RANGE:
data[ATTR_TARGET_TEMP_HIGH] = show_temp(
self.hass, self.target_temperature_high, self.temperature_unit,

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
CURRENT_HVAC_COOL, SUPPORT_PRESET_MODE
)
from homeassistant.const import (
ATTR_ENTITY_ID, STATE_ON, ATTR_TEMPERATURE, TEMP_FAHRENHEIT, TEMP_CELSIUS)
@@ -66,7 +66,7 @@ RESUME_PROGRAM_SCHEMA = vol.Schema({
vol.Optional(ATTR_RESUME_ALL, default=DEFAULT_RESUME_ALL): cv.boolean,
})
SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE |
SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE |
SUPPORT_AUX_HEAT | SUPPORT_TARGET_TEMPERATURE_RANGE |
SUPPORT_FAN_MODE)

View File

@@ -9,6 +9,7 @@ import evohomeclient2
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,
SUPPORT_TARGET_TEMPERATURE, SUPPORT_PRESET_MODE)
from homeassistant.const import PRECISION_TENTHS
@@ -183,6 +184,17 @@ class EvoZone(EvoClimateDevice):
is_off = self.target_temperature <= self.min_temp
return HVAC_MODE_OFF if is_off else HVAC_MODE_HEAT
@property
def hvac_action(self) -> Optional[str]:
"""Return the current running hvac operation if supported."""
if self._evo_tcs.systemModeStatus['mode'] == EVO_HEATOFF:
return CURRENT_HVAC_OFF
if self.target_temperature <= self.min_temp:
return CURRENT_HVAC_OFF
if self.target_temperature <= self.current_temperature:
return CURRENT_HVAC_HEAT
return CURRENT_HVAC_IDLE
@property
def current_temperature(self) -> Optional[float]:
"""Return the current temperature of the evohome Zone."""
@@ -221,7 +233,7 @@ class EvoZone(EvoClimateDevice):
return self._evo_device.setpointCapabilities['maxHeatSetpoint']
def set_temperature(self, **kwargs) -> None:
"""Set a new target temperature for an hour."""
"""Set a new target temperature."""
until = kwargs.get('until')
if until:
until = parse_datetime(until)
@@ -268,7 +280,7 @@ class EvoController(EvoClimateDevice):
@property
def hvac_mode(self) -> str:
"""Return the current operating mode of the evohome Controller."""
tcs_mode = self._evo_device.systemModeStatus['mode']
tcs_mode = self._evo_tcs.systemModeStatus['mode']
return HVAC_MODE_OFF if tcs_mode == EVO_HEATOFF else HVAC_MODE_HEAT
@property
@@ -278,44 +290,18 @@ class EvoController(EvoClimateDevice):
Controllers do not have a current temp, but one is expected by HA.
"""
temps = [z.temperatureStatus['temperature']
for z in self._evo_device.zones.values()
for z in self._evo_tcs.zones.values()
if z.temperatureStatus['isAvailable']]
return round(sum(temps) / len(temps), 1) if temps else None
@property
def target_temperature(self) -> Optional[float]:
"""Return the average target temperature of the heating Zones.
Controllers do not have a target temp, but one is expected by HA.
"""
temps = [z.setpointStatus['targetHeatTemperature']
for z in self._evo_device.zones.values()]
return round(sum(temps) / len(temps), 1) if temps else None
@property
def preset_mode(self) -> Optional[str]:
"""Return the current preset mode, e.g., home, away, temp."""
return TCS_PRESET_TO_HA.get(self._evo_device.systemModeStatus['mode'])
return TCS_PRESET_TO_HA.get(self._evo_tcs.systemModeStatus['mode'])
@property
def min_temp(self) -> float:
"""Return the minimum target temperature of the heating Zones.
Controllers do not have a min target temp, but one is required by HA.
"""
temps = [z.setpointCapabilities['minHeatSetpoint']
for z in self._evo_device.zones.values()]
return min(temps) if temps else 5
@property
def max_temp(self) -> float:
"""Return the maximum target temperature of the heating Zones.
Controllers do not have a max target temp, but one is required by HA.
"""
temps = [z.setpointCapabilities['maxHeatSetpoint']
for z in self._evo_device.zones.values()]
return max(temps) if temps else 35
def set_temperature(self, **kwargs) -> None:
"""The evohome Controller doesn't have a targert temperature."""
return
def set_hvac_mode(self, hvac_mode: str) -> None:
"""Set an operating mode for the Controller."""
@@ -330,7 +316,7 @@ class EvoController(EvoClimateDevice):
def update(self) -> None:
"""Get the latest state data."""
pass
return
class EvoThermostat(EvoZone):
@@ -344,8 +330,6 @@ class EvoThermostat(EvoZone):
super().__init__(evo_broker, evo_device)
self._name = evo_broker.tcs.location.name
self._icon = 'mdi:radiator'
self._preset_modes = [PRESET_AWAY, PRESET_ECO]
@property
@@ -353,8 +337,8 @@ class EvoThermostat(EvoZone):
"""Return the device-specific state attributes."""
status = super().device_state_attributes['status']
status['systemModeStatus'] = getattr(self._evo_tcs, 'systemModeStatus')
status['activeFaults'] += getattr(self._evo_tcs, 'activeFaults')
status['systemModeStatus'] = self._evo_tcs.systemModeStatus
status['activeFaults'] += self._evo_tcs.activeFaults
return {'status': status}
@@ -369,9 +353,9 @@ class EvoThermostat(EvoZone):
@property
def preset_mode(self) -> Optional[str]:
"""Return the current preset mode, e.g., home, away, temp."""
if self._evo_tcs.systemModeStatus['mode'] == EVO_AUTOECO:
if self._evo_device.setpointStatus['setpointMode'] == EVO_FOLLOW:
return PRESET_ECO
if self._evo_tcs.systemModeStatus['mode'] == EVO_AUTOECO and \
self._evo_device.setpointStatus['setpointMode'] == EVO_FOLLOW:
return PRESET_ECO
return super().preset_mode

View File

@@ -135,6 +135,7 @@ class FritzboxThermostat(ClimateDevice):
if self._target_temperature == self._eco_temperature:
return PRESET_ECO
@property
def preset_modes(self):
"""Return supported preset modes."""
return [PRESET_ECO, PRESET_COMFORT]

View File

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

View File

@@ -35,7 +35,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
climate = HiveClimateEntity(session, discovery_info)
add_entities([climate])
session.entities.append(climate)
class HiveClimateEntity(ClimateDevice):
@@ -52,7 +51,6 @@ class HiveClimateEntity(ClimateDevice):
self.data_updatesource = '{}.{}'.format(
self.device_type, self.node_id)
self._unique_id = '{}-{}'.format(self.node_id, self.device_type)
self.session.entities.append(self)
@property
def unique_id(self):
@@ -145,6 +143,11 @@ class HiveClimateEntity(ClimateDevice):
"""Return a list of available preset modes."""
return SUPPORT_PRESET
async def async_added_to_hass(self):
"""When entity is added to Home Assistant."""
await super().async_added_to_hass()
self.session.entities.append(self)
def set_hvac_mode(self, hvac_mode):
"""Set new target hvac mode."""
new_mode = HASS_TO_HIVE_STATE[hvac_mode]

View File

@@ -34,7 +34,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
water_heater = HiveWaterHeater(session, discovery_info)
add_entities([water_heater])
session.entities.append(water_heater)
class HiveWaterHeater(WaterHeaterDevice):
@@ -50,7 +49,6 @@ class HiveWaterHeater(WaterHeaterDevice):
self.device_type, self.node_id)
self._unique_id = '{}-{}'.format(self.node_id, self.device_type)
self._unit_of_measurement = TEMP_CELSIUS
self.session.entities.append(self)
@property
def unique_id(self):
@@ -99,6 +97,11 @@ class HiveWaterHeater(WaterHeaterDevice):
"""List of available operation modes."""
return SUPPORT_WATER_HEATER
async def async_added_to_hass(self):
"""When entity is added to Home Assistant."""
await super().async_added_to_hass()
self.session.entities.append(self)
def set_operation_mode(self, operation_mode):
"""Set operation mode."""
new_mode = HASS_TO_HIVE_STATE[operation_mode]

View File

@@ -28,7 +28,7 @@ SERVICE_CREATE_TASK = 'create_task'
SERVICE_SCHEMA_CREATE_TASK = vol.Schema({
vol.Required(CONF_LIST_NAME): cv.string,
vol.Required(CONF_NAME): cv.string,
vol.Optional(CONF_STARRED): cv.boolean,
vol.Optional(CONF_STARRED, default=False): cv.boolean,
})
@@ -42,7 +42,10 @@ def setup(hass, config):
_LOGGER.error("Invalid credentials")
return False
hass.services.register(DOMAIN, 'create_task', data.create_task)
hass.services.register(
DOMAIN, 'create_task', data.create_task,
schema=SERVICE_SCHEMA_CREATE_TASK
)
return True
@@ -68,9 +71,9 @@ class Wunderlist:
def create_task(self, call):
"""Create a new task on a list of Wunderlist."""
list_name = call.data.get(CONF_LIST_NAME)
task_title = call.data.get(CONF_NAME)
starred = call.data.get(CONF_STARRED)
list_name = call.data[CONF_LIST_NAME]
task_title = call.data[CONF_NAME]
starred = call.data[CONF_STARRED]
list_id = self._list_by_name(list_name)
self._client.create_task(list_id, task_title, starred=starred)
return True

View File

@@ -90,8 +90,8 @@ async def async_setup_entry(hass, config_entry):
# pylint: disable=W0611, W0612
import zhaquirks # noqa
zha_gateway = ZHAGateway(hass, config)
await zha_gateway.async_initialize(config_entry)
zha_gateway = ZHAGateway(hass, config, config_entry)
await zha_gateway.async_initialize()
device_registry = await \
hass.helpers.device_registry.async_get_registry()

View File

@@ -15,7 +15,7 @@ import traceback
from homeassistant.components.system_log import LogEntry, _figure_out_source
from homeassistant.core import callback
from homeassistant.helpers.device_registry import (
async_get_registry as get_dev_reg)
CONNECTION_ZIGBEE, async_get_registry as get_dev_reg)
from homeassistant.helpers.dispatcher import async_dispatcher_send
from ..api import async_get_device_info
@@ -46,13 +46,14 @@ EntityReference = collections.namedtuple(
class ZHAGateway:
"""Gateway that handles events that happen on the ZHA Zigbee network."""
def __init__(self, hass, config):
def __init__(self, hass, config, config_entry):
"""Initialize the gateway."""
self._hass = hass
self._config = config
self._devices = {}
self._device_registry = collections.defaultdict(list)
self.zha_storage = None
self.ha_device_registry = None
self.application_controller = None
self.radio_description = None
hass.data[DATA_ZHA][DATA_ZHA_GATEWAY] = self
@@ -62,14 +63,16 @@ class ZHAGateway:
}
self.debug_enabled = False
self._log_relay_handler = LogRelayHandler(hass, self)
self._config_entry = config_entry
async def async_initialize(self, config_entry):
async def async_initialize(self):
"""Initialize controller and connect radio."""
self.zha_storage = await async_get_registry(self._hass)
self.ha_device_registry = await get_dev_reg(self._hass)
usb_path = config_entry.data.get(CONF_USB_PATH)
usb_path = self._config_entry.data.get(CONF_USB_PATH)
baudrate = self._config.get(CONF_BAUDRATE, DEFAULT_BAUDRATE)
radio_type = config_entry.data.get(CONF_RADIO_TYPE)
radio_type = self._config_entry.data.get(CONF_RADIO_TYPE)
radio_details = RADIO_TYPES[radio_type][RADIO]()
radio = radio_details[RADIO]
@@ -147,11 +150,10 @@ class ZHAGateway:
for entity_ref in entity_refs:
remove_tasks.append(entity_ref.remove_future)
await asyncio.wait(remove_tasks)
ha_device_registry = await get_dev_reg(self._hass)
reg_device = ha_device_registry.async_get_device(
reg_device = self.ha_device_registry.async_get_device(
{(DOMAIN, str(device.ieee))}, set())
if reg_device is not None:
ha_device_registry.async_remove_device(reg_device.id)
self.ha_device_registry.async_remove_device(reg_device.id)
def device_removed(self, device):
"""Handle device being removed from the network."""
@@ -241,6 +243,14 @@ class ZHAGateway:
if zha_device is None:
zha_device = ZHADevice(self._hass, zigpy_device, self)
self._devices[zigpy_device.ieee] = zha_device
self.ha_device_registry.async_get_or_create(
config_entry_id=self._config_entry.entry_id,
connections={(CONNECTION_ZIGBEE, str(zha_device.ieee))},
identifiers={(DOMAIN, str(zha_device.ieee))},
name=zha_device.name,
manufacturer=zha_device.manufacturer,
model=zha_device.model
)
if not is_new_join:
entry = self.zha_storage.async_get_or_create(zha_device)
zha_device.async_update_last_seen(entry.last_seen)
@@ -322,7 +332,11 @@ class ZHAGateway:
)
if is_new_join:
device_info = async_get_device_info(self._hass, zha_device)
device_info = async_get_device_info(
self._hass,
zha_device,
self.ha_device_registry
)
async_dispatcher_send(
self._hass,
ZHA_GW_MSG,

View File

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

View File

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

View File

@@ -610,7 +610,7 @@ hole==0.3.0
holidays==0.9.10
# homeassistant.components.frontend
home-assistant-frontend==20190715.0
home-assistant-frontend==20190717.1
# homeassistant.components.zwave
homeassistant-pyozw==0.1.4

View File

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

View File

@@ -5,6 +5,8 @@ from homeassistant import config_entries
from homeassistant.components.zha.core.const import (
DOMAIN, DATA_ZHA, COMPONENTS
)
from homeassistant.helpers.device_registry import (
async_get_registry as get_dev_reg)
from homeassistant.components.zha.core.gateway import ZHAGateway
from homeassistant.components.zha.core.registries import \
establish_device_mappings
@@ -24,7 +26,7 @@ def config_entry_fixture(hass):
@pytest.fixture(name='zha_gateway')
async def zha_gateway_fixture(hass):
async def zha_gateway_fixture(hass, config_entry):
"""Fixture representing a zha gateway.
Create a ZHAGateway object that can be used to interact with as if we
@@ -37,8 +39,10 @@ async def zha_gateway_fixture(hass):
hass.data[DATA_ZHA].get(component, {})
)
zha_storage = await async_get_registry(hass)
gateway = ZHAGateway(hass, {})
dev_reg = await get_dev_reg(hass)
gateway = ZHAGateway(hass, {}, config_entry)
gateway.zha_storage = zha_storage
gateway.ha_device_registry = dev_reg
return gateway

View File

@@ -2,7 +2,7 @@
# Based on the production Dockerfile, but with development additions.
# Keep this file as close as possible to the production Dockerfile, so the environments match.
FROM python:3.7
FROM python:3.7-stretch
LABEL maintainer="Paulus Schoutsen <Paulus@PaulusSchoutsen.nl>"
# Uncomment any of the following lines to disable the installation.