From 921efbdfef1e6d419b654a28f4219084c1bc5847 Mon Sep 17 00:00:00 2001 From: starkillerOG Date: Tue, 19 Feb 2019 06:31:42 +0100 Subject: [PATCH] Philips Hue: Add bridge update prompt (#21119) * Add a prompt if bridge update is available. * Change logger warning for light update The self.light.swupdatestate only checks for updates of that specific light, it does not check for updates of the bridge. Theirfore the warning message schould be updated. * add space * fix tests * rename to swupdate2_bridge_state * update aiohue to v1.9.1 * update aiohue to v1.9.1 * update aiohue to v1.9.1 --- homeassistant/components/hue/__init__.py | 14 ++++++++++---- homeassistant/components/hue/light.py | 4 ++-- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- tests/components/hue/test_init.py | 6 ++---- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/hue/__init__.py b/homeassistant/components/hue/__init__.py index 104965b7b8f..8f5c27f6516 100644 --- a/homeassistant/components/hue/__init__.py +++ b/homeassistant/components/hue/__init__.py @@ -14,7 +14,7 @@ from .bridge import HueBridge # Loading the config flow file will register the flow from .config_flow import configured_hosts -REQUIREMENTS = ['aiohue==1.9.0'] +REQUIREMENTS = ['aiohue==1.9.1'] _LOGGER = logging.getLogger(__name__) @@ -121,11 +121,17 @@ async def async_setup_entry(hass, entry): }, manufacturer='Signify', name=config.name, - # Not yet exposed as properties in aiohue - model=config.raw['modelid'], - sw_version=config.raw['swversion'], + model=config.modelid, + sw_version=config.swversion, ) + if config.swupdate2_bridge_state == "readytoinstall": + err = ( + "Please check for software updates of the bridge " + "in the Philips Hue App." + ) + _LOGGER.warning(err) + return True diff --git a/homeassistant/components/hue/light.py b/homeassistant/components/hue/light.py index 7518a5a381f..0725c86bd95 100644 --- a/homeassistant/components/hue/light.py +++ b/homeassistant/components/hue/light.py @@ -227,8 +227,8 @@ class HueLight(Light): _LOGGER.debug("Color gamut of %s: %s", self.name, str(self.gamut)) if self.light.swupdatestate == "readytoinstall": err = ( - "Please check for software updates of the bridge " - "and/or the bulb: %s, in the Philips Hue App." + "Please check for software updates of the %s " + "bulb in the Philips Hue App." ) _LOGGER.warning(err, self.name) if self.gamut: diff --git a/requirements_all.txt b/requirements_all.txt index 455d4216037..f4390c43800 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -118,7 +118,7 @@ aioharmony==0.1.5 aiohttp_cors==0.7.0 # homeassistant.components.hue -aiohue==1.9.0 +aiohue==1.9.1 # homeassistant.components.sensor.iliad_italy aioiliad==0.1.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 9f43a8dc552..82a5e4ba8b6 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -41,7 +41,7 @@ aioautomatic==0.6.5 aiohttp_cors==0.7.0 # homeassistant.components.hue -aiohue==1.9.0 +aiohue==1.9.1 # homeassistant.components.unifi aiounifi==4 diff --git a/tests/components/hue/test_init.py b/tests/components/hue/test_init.py index 6c89995a1a1..cdad8e02d25 100644 --- a/tests/components/hue/test_init.py +++ b/tests/components/hue/test_init.py @@ -97,10 +97,8 @@ async def test_config_passed_to_config_entry(hass): mock_bridge.return_value.api.config = Mock( mac='mock-mac', bridgeid='mock-bridgeid', - raw={ - 'modelid': 'mock-modelid', - 'swversion': 'mock-swversion', - } + modelid='mock-modelid', + swversion='mock-swversion' ) # Can't set name via kwargs mock_bridge.return_value.api.config.name = 'mock-name'