Merge pull request #2688 from home-assistant/hotfix-0-25-1

Hotfix 0 25 1
This commit is contained in:
Paulus Schoutsen 2016-07-31 17:34:34 -07:00 committed by GitHub
commit c608740382
7 changed files with 41 additions and 29 deletions

View File

@ -8,6 +8,7 @@ import logging
# Because we do not compile openzwave on CI # Because we do not compile openzwave on CI
# pylint: disable=import-error # pylint: disable=import-error
from threading import Timer
from homeassistant.components.light import ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, \ from homeassistant.components.light import ATTR_BRIGHTNESS, ATTR_COLOR_TEMP, \
ATTR_RGB_COLOR, DOMAIN, Light ATTR_RGB_COLOR, DOMAIN, Light
from homeassistant.components import zwave from homeassistant.components import zwave
@ -108,7 +109,22 @@ class ZwaveDimmer(zwave.ZWaveDeviceEntity, Light):
"""Called when a value has changed on the network.""" """Called when a value has changed on the network."""
if self._value.value_id == value.value_id or \ if self._value.value_id == value.value_id or \
self._value.node == value.node: self._value.node == value.node:
if self._refreshing:
self._refreshing = False
self.update_properties() self.update_properties()
else:
def _refresh_value():
"""Used timer callback for delayed value refresh."""
self._refreshing = True
self._value.refresh()
if self._timer is not None and self._timer.isAlive():
self._timer.cancel()
self._timer = Timer(2, _refresh_value)
self._timer.start()
self.update_ha_state() self.update_ha_state()
@property @property

View File

@ -53,7 +53,8 @@ class KodiDevice(MediaPlayerDevice):
self._url = url self._url = url
self._server = jsonrpc_requests.Server( self._server = jsonrpc_requests.Server(
'{}/jsonrpc'.format(self._url), '{}/jsonrpc'.format(self._url),
auth=auth) auth=auth,
timeout=5)
self._turn_off_action = turn_off_action self._turn_off_action = turn_off_action
self._players = list() self._players = list()
self._properties = None self._properties = None

View File

@ -58,6 +58,7 @@ def execute(q):
This method also retries a few times in the case of stale connections. This method also retries a few times in the case of stale connections.
""" """
import sqlalchemy.exc import sqlalchemy.exc
try:
for _ in range(0, RETRIES): for _ in range(0, RETRIES):
try: try:
return [ return [
@ -66,6 +67,8 @@ def execute(q):
if row is not None] if row is not None]
except sqlalchemy.exc.SQLAlchemyError as e: except sqlalchemy.exc.SQLAlchemyError as e:
log_error(e, retry_wait=QUERY_RETRY_WAIT, rollback=True) log_error(e, retry_wait=QUERY_RETRY_WAIT, rollback=True)
finally:
Session().close()
return [] return []

View File

@ -1,7 +1,7 @@
# coding: utf-8 # coding: utf-8
"""Constants used by Home Assistant components.""" """Constants used by Home Assistant components."""
__version__ = "0.25.0" __version__ = "0.25.1"
REQUIRED_PYTHON_VER = (3, 4) REQUIRED_PYTHON_VER = (3, 4)
PLATFORM_FORMAT = '{}.{}' PLATFORM_FORMAT = '{}.{}'

View File

@ -4,7 +4,7 @@ pyyaml>=3.11,<4
pytz>=2016.6.1 pytz>=2016.6.1
pip>=7.0.0 pip>=7.0.0
jinja2>=2.8 jinja2>=2.8
voluptuous==0.9.1 voluptuous==0.8.9
typing>=3,<4 typing>=3,<4
sqlalchemy==1.0.14 sqlalchemy==1.0.14

View File

@ -16,7 +16,7 @@ REQUIRES = [
'pytz>=2016.6.1', 'pytz>=2016.6.1',
'pip>=7.0.0', 'pip>=7.0.0',
'jinja2>=2.8', 'jinja2>=2.8',
'voluptuous==0.9.1', 'voluptuous==0.8.9',
'typing>=3,<4', 'typing>=3,<4',
'sqlalchemy==1.0.14', 'sqlalchemy==1.0.14',
] ]

View File

@ -1,15 +1,10 @@
"""Test discovery helpers.""" """Test discovery helpers."""
import os
from unittest.mock import patch from unittest.mock import patch
from homeassistant import loader, bootstrap, config as config_util from homeassistant import loader, bootstrap
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
from tests.common import (get_test_home_assistant, get_test_config_dir, from tests.common import get_test_home_assistant, MockModule, MockPlatform
MockModule, MockPlatform)
VERSION_PATH = os.path.join(get_test_config_dir(), config_util.VERSION_FILE)
class TestHelpersDiscovery: class TestHelpersDiscovery:
@ -17,15 +12,12 @@ class TestHelpersDiscovery:
def setup_method(self, method): def setup_method(self, method):
"""Setup things to be run when tests are started.""" """Setup things to be run when tests are started."""
self.hass = get_test_home_assistant() self.hass = get_test_home_assistant(1)
def teardown_method(self, method): def teardown_method(self, method):
"""Stop everything that was started.""" """Stop everything that was started."""
self.hass.stop() self.hass.stop()
if os.path.isfile(VERSION_PATH):
os.remove(VERSION_PATH)
@patch('homeassistant.bootstrap.setup_component') @patch('homeassistant.bootstrap.setup_component')
def test_listen(self, mock_setup_component): def test_listen(self, mock_setup_component):
"""Test discovery listen/discover combo.""" """Test discovery listen/discover combo."""
@ -105,14 +97,15 @@ class TestHelpersDiscovery:
def component_setup(hass, config): def component_setup(hass, config):
"""Setup mock component.""" """Setup mock component."""
discovery.load_platform(hass, 'switch', 'test_circular') discovery.load_platform(hass, 'switch', 'test_circular', 'disc',
config)
component_calls.append(1) component_calls.append(1)
return True return True
def setup_platform(hass, config, add_devices_callback, def setup_platform(hass, config, add_devices_callback,
discovery_info=None): discovery_info=None):
"""Setup mock platform.""" """Setup mock platform."""
platform_calls.append(1) platform_calls.append('disc' if discovery_info else 'component')
loader.set_component( loader.set_component(
'test_component', 'test_component',
@ -123,13 +116,12 @@ class TestHelpersDiscovery:
MockPlatform(setup_platform, MockPlatform(setup_platform,
dependencies=['test_component'])) dependencies=['test_component']))
bootstrap.from_config_dict({ bootstrap.setup_component(self.hass, 'test_component', {
'test_component': None, 'test_component': None,
'switch': [{ 'switch': [{
'platform': 'test_circular', 'platform': 'test_circular',
}], }],
}, self.hass) })
self.hass.pool.block_till_done() self.hass.pool.block_till_done()
assert 'test_component' in self.hass.config.components assert 'test_component' in self.hass.config.components