From c1bb7d5cc2631bd6d80588acc57d246f80ec9853 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 10 Mar 2018 10:19:49 -0800 Subject: [PATCH 01/10] Update frontend to 20180310.0 --- homeassistant/components/frontend/__init__.py | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/frontend/__init__.py b/homeassistant/components/frontend/__init__.py index 501537e3ed3..1f5a7576302 100644 --- a/homeassistant/components/frontend/__init__.py +++ b/homeassistant/components/frontend/__init__.py @@ -24,7 +24,7 @@ from homeassistant.core import callback from homeassistant.helpers.translation import async_get_translations from homeassistant.loader import bind_hass -REQUIREMENTS = ['home-assistant-frontend==20180309.0'] +REQUIREMENTS = ['home-assistant-frontend==20180310.0'] DOMAIN = 'frontend' DEPENDENCIES = ['api', 'websocket_api', 'http', 'system_log'] diff --git a/requirements_all.txt b/requirements_all.txt index c233e528403..c4aa5da8815 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -353,7 +353,7 @@ hipnotify==1.0.8 holidays==0.9.3 # homeassistant.components.frontend -home-assistant-frontend==20180309.0 +home-assistant-frontend==20180310.0 # homeassistant.components.camera.onvif http://github.com/tgaugry/suds-passworddigest-py3/archive/86fc50e39b4d2b8997481967d6a7fe1c57118999.zip#suds-passworddigest-py3==0.1.2a diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 65e94172553..460e70cbca5 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -78,7 +78,7 @@ hbmqtt==0.9.1 holidays==0.9.3 # homeassistant.components.frontend -home-assistant-frontend==20180309.0 +home-assistant-frontend==20180310.0 # homeassistant.components.influxdb # homeassistant.components.sensor.influxdb From 266b13b3cbc714ff7b3e27a5a11d245b8c647ac9 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 10 Mar 2018 10:20:30 -0800 Subject: [PATCH 02/10] Version bump to 0.65.2 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index d2a0bc43a8d..2fee845f70a 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -2,7 +2,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 65 -PATCH_VERSION = '1' +PATCH_VERSION = '2' __short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION) __version__ = '{}.{}'.format(__short_version__, PATCH_VERSION) REQUIRED_PYTHON_VER = (3, 5, 3) From 5726159dd481cef3ebb5ebdae2c844c25ee160fe Mon Sep 17 00:00:00 2001 From: John Allen Date: Sat, 10 Mar 2018 03:52:45 -0500 Subject: [PATCH 03/10] Fix sensibo's min/max_temp properties (#12996) The super class has these as properties, not regular methods --- homeassistant/components/climate/sensibo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/climate/sensibo.py b/homeassistant/components/climate/sensibo.py index 7b4c8ed8b1b..68b5eee35ef 100644 --- a/homeassistant/components/climate/sensibo.py +++ b/homeassistant/components/climate/sensibo.py @@ -240,13 +240,13 @@ class SensiboClimate(ClimateDevice): def min_temp(self): """Return the minimum temperature.""" return self._temperatures_list[0] \ - if self._temperatures_list else super().min_temp() + if self._temperatures_list else super().min_temp @property def max_temp(self): """Return the maximum temperature.""" return self._temperatures_list[-1] \ - if self._temperatures_list else super().max_temp() + if self._temperatures_list else super().max_temp @asyncio.coroutine def async_set_temperature(self, **kwargs): From c7c47a18a9391211861a77ec39bc5dda3de3d794 Mon Sep 17 00:00:00 2001 From: Paul Tarjan Date: Sat, 10 Mar 2018 00:36:20 -0800 Subject: [PATCH 04/10] Use request.query (#13037) Fixes #13036 --- homeassistant/components/wink/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/wink/__init__.py b/homeassistant/components/wink/__init__.py index 78f3042aefb..eab67c18aed 100644 --- a/homeassistant/components/wink/__init__.py +++ b/homeassistant/components/wink/__init__.py @@ -554,7 +554,7 @@ class WinkAuthCallbackView(HomeAssistantView): from aiohttp import web hass = request.app['hass'] - data = request.GET + data = request.query response_message = """Wink has been successfully authorized! You can close this window now! For the best results you should reboot From 9a7a0f28b18af0d7f013ad9eea42b2fc03338735 Mon Sep 17 00:00:00 2001 From: Johann Kellerman Date: Sat, 10 Mar 2018 20:02:04 +0200 Subject: [PATCH 05/10] Ensure we have valid config AFTER merging packages #13015 (#13038) * Ensure we have valid config AFTER merging packages #13015 * also fix packages --- homeassistant/bootstrap.py | 10 ++++++---- homeassistant/config.py | 3 +++ homeassistant/scripts/check_config.py | 5 +++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 50d8502bbd1..34eab679581 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -113,15 +113,17 @@ def async_from_config_dict(config: Dict[str, Any], yield from hass.async_add_job(loader.prepare, hass) # Make a copy because we are mutating it. - new_config = OrderedDict() - for key, value in config.items(): - new_config[key] = value or {} - config = new_config + config = OrderedDict(config) # Merge packages conf_util.merge_packages_config( config, core_config.get(conf_util.CONF_PACKAGES, {})) + # Ensure we have no None values after merge + for key, value in config.items(): + if not value: + config[key] = {} + hass.config_entries = config_entries.ConfigEntries(hass, config) yield from hass.config_entries.async_load() diff --git a/homeassistant/config.py b/homeassistant/config.py index 5f2c6cf1625..e94fc297f48 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -562,6 +562,9 @@ def merge_packages_config(config, packages, _log_pkg_error=_log_pkg_error): continue if merge_type == 'dict': + if comp_conf is None: + comp_conf = OrderedDict() + if not isinstance(comp_conf, dict): _log_pkg_error( pack_name, comp_name, config, diff --git a/homeassistant/scripts/check_config.py b/homeassistant/scripts/check_config.py index 4e80b3c6536..641693501ff 100644 --- a/homeassistant/scripts/check_config.py +++ b/homeassistant/scripts/check_config.py @@ -326,6 +326,11 @@ def check_ha_config_file(config_dir): config, core_config.get(CONF_PACKAGES, {}), _pack_error) del core_config[CONF_PACKAGES] + # Ensure we have no None values after merge + for key, value in config.items(): + if not value: + config[key] = {} + # Filter out repeating config sections components = set(key.split(' ')[0] for key in config.keys()) From b2d8feb979874a147b6aaf731bcf7a3213a29967 Mon Sep 17 00:00:00 2001 From: Jerad Meisner Date: Sat, 10 Mar 2018 00:27:13 -0800 Subject: [PATCH 06/10] Bump pysabnzbd version (#13042) --- homeassistant/components/sensor/sabnzbd.py | 4 ++-- requirements_all.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/sensor/sabnzbd.py b/homeassistant/components/sensor/sabnzbd.py index c5dd09e0ccc..194ff71222a 100644 --- a/homeassistant/components/sensor/sabnzbd.py +++ b/homeassistant/components/sensor/sabnzbd.py @@ -19,7 +19,7 @@ from homeassistant.util import Throttle from homeassistant.util.json import load_json, save_json import homeassistant.helpers.config_validation as cv -REQUIREMENTS = ['pysabnzbd==0.0.3'] +REQUIREMENTS = ['pysabnzbd==1.0.1'] _CONFIGURING = {} _LOGGER = logging.getLogger(__name__) @@ -82,7 +82,7 @@ async def async_update_queue(sab_api): This ensures that the queue info only gets updated once for all sensors """ - await sab_api.refresh_queue() + await sab_api.refresh_data() def request_configuration(host, name, hass, config, async_add_devices, diff --git a/requirements_all.txt b/requirements_all.txt index c4aa5da8815..2d60582f46f 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -863,7 +863,7 @@ pyqwikswitch==0.4 pyrainbird==0.1.3 # homeassistant.components.sensor.sabnzbd -pysabnzbd==0.0.3 +pysabnzbd==1.0.1 # homeassistant.components.climate.sensibo pysensibo==1.0.2 From 70064e4c6942875836f2de60637dea3fe77c3a88 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Sat, 10 Mar 2018 11:07:02 +0100 Subject: [PATCH 07/10] Fix async lifx_set_state (#13045) --- homeassistant/components/light/lifx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/light/lifx.py b/homeassistant/components/light/lifx.py index 18bc39d88d2..0bb65a78c6e 100644 --- a/homeassistant/components/light/lifx.py +++ b/homeassistant/components/light/lifx.py @@ -221,7 +221,7 @@ class LIFXManager(object): tasks = [] for light in self.service_to_entities(service): if service.service == SERVICE_LIFX_SET_STATE: - task = light.async_set_state(**service.data) + task = light.set_state(**service.data) tasks.append(self.hass.async_add_job(task)) if tasks: await asyncio.wait(tasks, loop=self.hass.loop) From 5281892e693f59706f7ad5acd26a1e4483191b34 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Sat, 10 Mar 2018 18:10:50 +0100 Subject: [PATCH 08/10] Yeelight version bumped. (#13056) --- homeassistant/components/light/yeelight.py | 2 +- requirements_all.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/light/yeelight.py b/homeassistant/components/light/yeelight.py index 33c84df14be..ca10d246ce8 100644 --- a/homeassistant/components/light/yeelight.py +++ b/homeassistant/components/light/yeelight.py @@ -26,7 +26,7 @@ from homeassistant.components.light import ( Light, PLATFORM_SCHEMA) import homeassistant.helpers.config_validation as cv -REQUIREMENTS = ['yeelight==0.3.3'] +REQUIREMENTS = ['yeelight==0.4.0'] _LOGGER = logging.getLogger(__name__) diff --git a/requirements_all.txt b/requirements_all.txt index 2d60582f46f..03560ac79b0 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1292,7 +1292,7 @@ yahoo-finance==1.4.0 yahooweather==0.10 # homeassistant.components.light.yeelight -yeelight==0.3.3 +yeelight==0.4.0 # homeassistant.components.light.yeelightsunflower yeelightsunflower==0.0.8 From b98d2e24852e2df5a02a96fa01d792c0ffbf10dd Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 10 Mar 2018 10:02:16 -0800 Subject: [PATCH 09/10] Don't call async from sync (#13057) --- homeassistant/components/xiaomi_aqara.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/xiaomi_aqara.py b/homeassistant/components/xiaomi_aqara.py index b6e04d867fa..244605a7b97 100644 --- a/homeassistant/components/xiaomi_aqara.py +++ b/homeassistant/components/xiaomi_aqara.py @@ -182,19 +182,19 @@ def setup(hass, config): gateway_only_schema = _add_gateway_to_schema(xiaomi, vol.Schema({})) - hass.services.async_register( + hass.services.register( DOMAIN, SERVICE_PLAY_RINGTONE, play_ringtone_service, schema=_add_gateway_to_schema(xiaomi, SERVICE_SCHEMA_PLAY_RINGTONE)) - hass.services.async_register( + hass.services.register( DOMAIN, SERVICE_STOP_RINGTONE, stop_ringtone_service, schema=gateway_only_schema) - hass.services.async_register( + hass.services.register( DOMAIN, SERVICE_ADD_DEVICE, add_device_service, schema=gateway_only_schema) - hass.services.async_register( + hass.services.register( DOMAIN, SERVICE_REMOVE_DEVICE, remove_device_service, schema=_add_gateway_to_schema(xiaomi, SERVICE_SCHEMA_REMOVE_DEVICE)) From 42359b3b48b942c471772ed715c3116fbcf288f1 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sat, 10 Mar 2018 10:40:28 -0800 Subject: [PATCH 10/10] Convert decimals from SQL results (#13059) --- homeassistant/components/sensor/sql.py | 8 ++++++-- tests/components/sensor/test_sql.py | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/sensor/sql.py b/homeassistant/components/sensor/sql.py index 50d60bfc426..402076c6fd8 100644 --- a/homeassistant/components/sensor/sql.py +++ b/homeassistant/components/sensor/sql.py @@ -4,6 +4,7 @@ Sensor from an SQL Query. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.sql/ """ +import decimal import logging import voluptuous as vol @@ -131,17 +132,20 @@ class SQLSensor(Entity): try: sess = self.sessionmaker() result = sess.execute(self._query) + self._attributes = {} if not result.returns_rows or result.rowcount == 0: _LOGGER.warning("%s returned no results", self._query) self._state = None - self._attributes = {} return for res in result: _LOGGER.debug("result = %s", res.items()) data = res[self._column_name] - self._attributes = {k: v for k, v in res.items()} + for key, value in res.items(): + if isinstance(value, decimal.Decimal): + value = float(decimal) + self._attributes[key] = value except sqlalchemy.exc.SQLAlchemyError as err: _LOGGER.error("Error executing query %s: %s", self._query, err) return diff --git a/tests/components/sensor/test_sql.py b/tests/components/sensor/test_sql.py index 5e639b9f338..7665b5c9037 100644 --- a/tests/components/sensor/test_sql.py +++ b/tests/components/sensor/test_sql.py @@ -29,7 +29,7 @@ class TestSQLSensor(unittest.TestCase): 'db_url': 'sqlite://', 'queries': [{ 'name': 'count_tables', - 'query': 'SELECT count(*) value FROM sqlite_master;', + 'query': 'SELECT 5 as value', 'column': 'value', }] } @@ -38,7 +38,8 @@ class TestSQLSensor(unittest.TestCase): assert setup_component(self.hass, 'sensor', config) state = self.hass.states.get('sensor.count_tables') - self.assertEqual(state.state, '0') + assert state.state == '5' + assert state.attributes['value'] == 5 def test_invalid_query(self): """Test the SQL sensor for invalid queries."""