Merge pull request #13975 from home-assistant/rc

0.67.1
This commit is contained in:
Paulus Schoutsen 2018-04-17 23:19:45 -04:00 committed by GitHub
commit 2cb9e2dc7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 53 additions and 56 deletions

View File

@ -20,7 +20,7 @@ from homeassistant.const import (
CONF_PASSWORD, CONF_USERNAME, TEMP_CELSIUS, TEMP_FAHRENHEIT, CONF_PASSWORD, CONF_USERNAME, TEMP_CELSIUS, TEMP_FAHRENHEIT,
ATTR_TEMPERATURE, CONF_REGION) ATTR_TEMPERATURE, CONF_REGION)
REQUIREMENTS = ['evohomeclient==0.2.5', 'somecomfort==0.5.0'] REQUIREMENTS = ['evohomeclient==0.2.5', 'somecomfort==0.5.2']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -18,37 +18,26 @@ SECTIONS = ('core', 'customize', 'group', 'hassbian', 'automation', 'script',
ON_DEMAND = ('zwave',) ON_DEMAND = ('zwave',)
@asyncio.coroutine async def async_setup(hass, config):
def async_setup(hass, config):
"""Set up the config component.""" """Set up the config component."""
yield from hass.components.frontend.async_register_built_in_panel( await hass.components.frontend.async_register_built_in_panel(
'config', 'config', 'mdi:settings') 'config', 'config', 'mdi:settings')
@asyncio.coroutine async def setup_panel(panel_name):
def setup_panel(panel_name):
"""Set up a panel.""" """Set up a panel."""
panel = yield from async_prepare_setup_platform( panel = await async_prepare_setup_platform(
hass, config, DOMAIN, panel_name) hass, config, DOMAIN, panel_name)
if not panel: if not panel:
return return
success = yield from panel.async_setup(hass) success = await panel.async_setup(hass)
if success: if success:
key = '{}.{}'.format(DOMAIN, panel_name) key = '{}.{}'.format(DOMAIN, panel_name)
hass.bus.async_fire(EVENT_COMPONENT_LOADED, {ATTR_COMPONENT: key}) hass.bus.async_fire(EVENT_COMPONENT_LOADED, {ATTR_COMPONENT: key})
hass.config.components.add(key) hass.config.components.add(key)
tasks = [setup_panel(panel_name) for panel_name in SECTIONS]
for panel_name in ON_DEMAND:
if panel_name in hass.config.components:
tasks.append(setup_panel(panel_name))
if tasks:
yield from asyncio.wait(tasks, loop=hass.loop)
@callback @callback
def component_loaded(event): def component_loaded(event):
"""Respond to components being loaded.""" """Respond to components being loaded."""
@ -58,6 +47,15 @@ def async_setup(hass, config):
hass.bus.async_listen(EVENT_COMPONENT_LOADED, component_loaded) hass.bus.async_listen(EVENT_COMPONENT_LOADED, component_loaded)
tasks = [setup_panel(panel_name) for panel_name in SECTIONS]
for panel_name in ON_DEMAND:
if panel_name in hass.config.components:
tasks.append(setup_panel(panel_name))
if tasks:
await asyncio.wait(tasks, loop=hass.loop)
return True return True
@ -86,11 +84,10 @@ class BaseEditConfigView(HomeAssistantView):
"""Set value.""" """Set value."""
raise NotImplementedError raise NotImplementedError
@asyncio.coroutine async def get(self, request, config_key):
def get(self, request, config_key):
"""Fetch device specific config.""" """Fetch device specific config."""
hass = request.app['hass'] hass = request.app['hass']
current = yield from self.read_config(hass) current = await self.read_config(hass)
value = self._get_value(hass, current, config_key) value = self._get_value(hass, current, config_key)
if value is None: if value is None:
@ -98,11 +95,10 @@ class BaseEditConfigView(HomeAssistantView):
return self.json(value) return self.json(value)
@asyncio.coroutine async def post(self, request, config_key):
def post(self, request, config_key):
"""Validate config and return results.""" """Validate config and return results."""
try: try:
data = yield from request.json() data = await request.json()
except ValueError: except ValueError:
return self.json_message('Invalid JSON specified', 400) return self.json_message('Invalid JSON specified', 400)
@ -121,10 +117,10 @@ class BaseEditConfigView(HomeAssistantView):
hass = request.app['hass'] hass = request.app['hass']
path = hass.config.path(self.path) path = hass.config.path(self.path)
current = yield from self.read_config(hass) current = await self.read_config(hass)
self._write_value(hass, current, config_key, data) self._write_value(hass, current, config_key, data)
yield from hass.async_add_job(_write, path, current) await hass.async_add_job(_write, path, current)
if self.post_write_hook is not None: if self.post_write_hook is not None:
hass.async_add_job(self.post_write_hook(hass)) hass.async_add_job(self.post_write_hook(hass))
@ -133,10 +129,9 @@ class BaseEditConfigView(HomeAssistantView):
'result': 'ok', 'result': 'ok',
}) })
@asyncio.coroutine async def read_config(self, hass):
def read_config(self, hass):
"""Read the config.""" """Read the config."""
current = yield from hass.async_add_job( current = await hass.async_add_job(
_read, hass.config.path(self.path)) _read, hass.config.path(self.path))
if not current: if not current:
current = self._empty_config() current = self._empty_config()

View File

@ -11,7 +11,7 @@ import voluptuous as vol
from homeassistant.components.cover import ( from homeassistant.components.cover import (
CoverDevice, SUPPORT_OPEN, SUPPORT_CLOSE) CoverDevice, SUPPORT_OPEN, SUPPORT_CLOSE)
from homeassistant.const import ( from homeassistant.const import (
CONF_USERNAME, CONF_PASSWORD, STATE_CLOSED, STATE_UNKNOWN, CONF_USERNAME, CONF_PASSWORD, STATE_CLOSED,
CONF_IP_ADDRESS, CONF_NAME) CONF_IP_ADDRESS, CONF_NAME)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
@ -50,7 +50,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
add_devices(MyGogogate2Device( add_devices(MyGogogate2Device(
mygogogate2, door, name) for door in devices) mygogogate2, door, name) for door in devices)
return
except (TypeError, KeyError, NameError, ValueError) as ex: except (TypeError, KeyError, NameError, ValueError) as ex:
_LOGGER.error("%s", ex) _LOGGER.error("%s", ex)
@ -60,7 +59,6 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
''.format(ex), ''.format(ex),
title=NOTIFICATION_TITLE, title=NOTIFICATION_TITLE,
notification_id=NOTIFICATION_ID) notification_id=NOTIFICATION_ID)
return
class MyGogogate2Device(CoverDevice): class MyGogogate2Device(CoverDevice):
@ -72,7 +70,7 @@ class MyGogogate2Device(CoverDevice):
self.device_id = device['door'] self.device_id = device['door']
self._name = name or device['name'] self._name = name or device['name']
self._status = device['status'] self._status = device['status']
self.available = None self._available = None
@property @property
def name(self): def name(self):
@ -97,24 +95,22 @@ class MyGogogate2Device(CoverDevice):
@property @property
def available(self): def available(self):
"""Could the device be accessed during the last update call.""" """Could the device be accessed during the last update call."""
return self.available return self._available
def close_cover(self, **kwargs): def close_cover(self, **kwargs):
"""Issue close command to cover.""" """Issue close command to cover."""
self.mygogogate2.close_device(self.device_id) self.mygogogate2.close_device(self.device_id)
self.schedule_update_ha_state(True)
def open_cover(self, **kwargs): def open_cover(self, **kwargs):
"""Issue open command to cover.""" """Issue open command to cover."""
self.mygogogate2.open_device(self.device_id) self.mygogogate2.open_device(self.device_id)
self.schedule_update_ha_state(True)
def update(self): def update(self):
"""Update status of cover.""" """Update status of cover."""
try: try:
self._status = self.mygogogate2.get_status(self.device_id) self._status = self.mygogogate2.get_status(self.device_id)
self.available = True self._available = True
except (TypeError, KeyError, NameError, ValueError) as ex: except (TypeError, KeyError, NameError, ValueError) as ex:
_LOGGER.error("%s", ex) _LOGGER.error("%s", ex)
self._status = STATE_UNKNOWN self._status = None
self.available = False self._available = False

View File

@ -40,7 +40,7 @@ def setup_scanner(hass, config, see, discovery_info=None):
attributes = {} attributes = {}
if rssi is not None: if rssi is not None:
attributes['rssi'] = rssi attributes['rssi'] = rssi
see(mac="{}_{}".format(BT_PREFIX, mac), host_name=name, see(mac="{}{}".format(BT_PREFIX, mac), host_name=name,
attributes=attributes, source_type=SOURCE_TYPE_BLUETOOTH) attributes=attributes, source_type=SOURCE_TYPE_BLUETOOTH)
def discover_devices(): def discover_devices():

View File

@ -84,7 +84,8 @@ CONF_IGNORE = 'ignore'
CONFIG_SCHEMA = vol.Schema({ CONFIG_SCHEMA = vol.Schema({
vol.Required(DOMAIN): vol.Schema({ vol.Required(DOMAIN): vol.Schema({
vol.Optional(CONF_IGNORE, default=[]): vol.Optional(CONF_IGNORE, default=[]):
vol.All(cv.ensure_list, [vol.In(SERVICE_HANDLERS)]) vol.All(cv.ensure_list, [
vol.In(list(CONFIG_ENTRY_HANDLERS) + list(SERVICE_HANDLERS))])
}), }),
}, extra=vol.ALLOW_EXTRA) }, extra=vol.ALLOW_EXTRA)

View File

@ -708,7 +708,7 @@ class XiaomiAirHumidifier(XiaomiGenericDevice):
def __init__(self, name, device, model, unique_id): def __init__(self, name, device, model, unique_id):
"""Initialize the plug switch.""" """Initialize the plug switch."""
from miio.airpurifier import OperationMode from miio.airhumidifier import OperationMode
super().__init__(name, device, model, unique_id) super().__init__(name, device, model, unique_id)
@ -748,6 +748,7 @@ class XiaomiAirHumidifier(XiaomiGenericDevice):
self._available = False self._available = False
_LOGGER.error("Got exception while fetching the state: %s", ex) _LOGGER.error("Got exception while fetching the state: %s", ex)
@property
def speed_list(self) -> list: def speed_list(self) -> list:
"""Get the list of available speeds.""" """Get the list of available speeds."""
return self._speed_list return self._speed_list

View File

@ -21,7 +21,7 @@ from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle from homeassistant.util import Throttle
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['pyfido==2.1.0'] REQUIREMENTS = ['pyfido==2.1.1']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -21,7 +21,7 @@ from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle from homeassistant.util import Throttle
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['pyhydroquebec==2.2.1'] REQUIREMENTS = ['pyhydroquebec==2.2.2']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)

View File

@ -18,7 +18,7 @@ from homeassistant.const import (
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle, slugify from homeassistant.util import Throttle, slugify
REQUIREMENTS = ['pypollencom==1.1.1'] REQUIREMENTS = ['pypollencom==1.1.2']
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
ATTR_ALLERGEN_GENUS = 'primary_allergen_genus' ATTR_ALLERGEN_GENUS = 'primary_allergen_genus'

View File

@ -19,7 +19,7 @@ from homeassistant.const import (
CONF_COMMAND_OFF, CONF_COMMAND_ON, CONF_FRIENDLY_NAME, CONF_HOST, CONF_MAC, CONF_COMMAND_OFF, CONF_COMMAND_ON, CONF_FRIENDLY_NAME, CONF_HOST, CONF_MAC,
CONF_SWITCHES, CONF_TIMEOUT, CONF_TYPE) CONF_SWITCHES, CONF_TIMEOUT, CONF_TYPE)
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.util import Throttle from homeassistant.util import Throttle, slugify
from homeassistant.util.dt import utcnow from homeassistant.util.dt import utcnow
REQUIREMENTS = ['broadlink==0.8.0'] REQUIREMENTS = ['broadlink==0.8.0']
@ -187,7 +187,7 @@ class BroadlinkRMSwitch(SwitchDevice):
def __init__(self, name, friendly_name, device, command_on, command_off): def __init__(self, name, friendly_name, device, command_on, command_off):
"""Initialize the switch.""" """Initialize the switch."""
self.entity_id = ENTITY_ID_FORMAT.format(name) self.entity_id = ENTITY_ID_FORMAT.format(slugify(name))
self._name = friendly_name self._name = friendly_name
self._state = False self._state = False
self._command_on = b64decode(command_on) if command_on else None self._command_on = b64decode(command_on) if command_on else None
@ -257,7 +257,7 @@ class BroadlinkSP1Switch(BroadlinkRMSwitch):
def __init__(self, friendly_name, device): def __init__(self, friendly_name, device):
"""Initialize the switch.""" """Initialize the switch."""
super().__init__(friendly_name, device, None, None) super().__init__(friendly_name, friendly_name, device, None, None)
self._command_on = 1 self._command_on = 1
self._command_off = 0 self._command_off = 0
@ -313,7 +313,7 @@ class BroadlinkMP1Slot(BroadlinkRMSwitch):
def __init__(self, friendly_name, device, slot, parent_device): def __init__(self, friendly_name, device, slot, parent_device):
"""Initialize the slot of switch.""" """Initialize the slot of switch."""
super().__init__(friendly_name, device, None, None) super().__init__(friendly_name, friendly_name, device, None, None)
self._command_on = 1 self._command_on = 1
self._command_off = 0 self._command_off = 0
self._slot = slot self._slot = slot

View File

@ -60,6 +60,8 @@ class VeSyncSwitchHA(SwitchDevice):
def __init__(self, plug): def __init__(self, plug):
"""Initialize the VeSync switch device.""" """Initialize the VeSync switch device."""
self.smartplug = plug self.smartplug = plug
self._current_power_w = None
self._today_energy_kwh = None
@property @property
def unique_id(self): def unique_id(self):
@ -74,12 +76,12 @@ class VeSyncSwitchHA(SwitchDevice):
@property @property
def current_power_w(self): def current_power_w(self):
"""Return the current power usage in W.""" """Return the current power usage in W."""
return self.smartplug.get_power() return self._current_power_w
@property @property
def today_energy_kwh(self): def today_energy_kwh(self):
"""Return the today total energy usage in kWh.""" """Return the today total energy usage in kWh."""
return self.smartplug.get_kwh_today() return self._today_energy_kwh
@property @property
def available(self) -> bool: def available(self) -> bool:
@ -102,3 +104,5 @@ class VeSyncSwitchHA(SwitchDevice):
def update(self): def update(self):
"""Handle data changes for node values.""" """Handle data changes for node values."""
self.smartplug.update() self.smartplug.update()
self._current_power_w = self.smartplug.get_power()
self._today_energy_kwh = self.smartplug.get_kwh_today()

View File

@ -2,7 +2,7 @@
"""Constants used by Home Assistant components.""" """Constants used by Home Assistant components."""
MAJOR_VERSION = 0 MAJOR_VERSION = 0
MINOR_VERSION = 67 MINOR_VERSION = 67
PATCH_VERSION = '0' PATCH_VERSION = '1'
__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, 5, 3) REQUIRED_PYTHON_VER = (3, 5, 3)

View File

@ -756,7 +756,7 @@ pyenvisalink==2.2
pyephember==0.1.1 pyephember==0.1.1
# homeassistant.components.sensor.fido # homeassistant.components.sensor.fido
pyfido==2.1.0 pyfido==2.1.1
# homeassistant.components.climate.flexit # homeassistant.components.climate.flexit
pyflexit==0.3 pyflexit==0.3
@ -780,7 +780,7 @@ pyhiveapi==0.2.11
pyhomematic==0.1.40 pyhomematic==0.1.40
# homeassistant.components.sensor.hydroquebec # homeassistant.components.sensor.hydroquebec
pyhydroquebec==2.2.1 pyhydroquebec==2.2.2
# homeassistant.components.alarm_control_panel.ialarm # homeassistant.components.alarm_control_panel.ialarm
pyialarm==0.2 pyialarm==0.2
@ -882,7 +882,7 @@ pyotp==2.2.6
pyowm==2.8.0 pyowm==2.8.0
# homeassistant.components.sensor.pollen # homeassistant.components.sensor.pollen
pypollencom==1.1.1 pypollencom==1.1.2
# homeassistant.components.qwikswitch # homeassistant.components.qwikswitch
pyqwikswitch==0.6 pyqwikswitch==0.6
@ -1185,7 +1185,7 @@ smappy==0.2.15
snapcast==2.0.8 snapcast==2.0.8
# homeassistant.components.climate.honeywell # homeassistant.components.climate.honeywell
somecomfort==0.5.0 somecomfort==0.5.2
# homeassistant.components.sensor.speedtest # homeassistant.components.sensor.speedtest
speedtest-cli==2.0.0 speedtest-cli==2.0.0

View File

@ -174,7 +174,7 @@ rxv==0.5.1
sleepyq==0.6 sleepyq==0.6
# homeassistant.components.climate.honeywell # homeassistant.components.climate.honeywell
somecomfort==0.5.0 somecomfort==0.5.2
# homeassistant.components.recorder # homeassistant.components.recorder
# homeassistant.scripts.db_migrator # homeassistant.scripts.db_migrator