diff --git a/homeassistant/components/hue/bridge.py b/homeassistant/components/hue/bridge.py index 790831a4d6c9046cd1ba27527a8eb3173c4e13f7..8093c84971ed57897b1e0173977812e2e393ac6c 100644 --- a/homeassistant/components/hue/bridge.py +++ b/homeassistant/components/hue/bridge.py @@ -31,9 +31,14 @@ class HueBridge(object): self.available = True self.api = None + @property + def host(self): + """Return the host of this bridge.""" + return self.config_entry.data['host'] + async def async_setup(self, tries=0): """Set up a phue bridge based on host parameter.""" - host = self.config_entry.data['host'] + host = self.host try: self.api = await get_bridge( diff --git a/tests/components/light/test_hue.py b/tests/components/light/test_hue.py index d73531b1b9a17ab83599557fbe4ee8e30ccaf6d4..7b6c3a21a79ad906cbc646fae61d6a88a9aff125 100644 --- a/tests/components/light/test_hue.py +++ b/tests/components/light/test_hue.py @@ -160,7 +160,13 @@ LIGHT_RESPONSE = { @pytest.fixture def mock_bridge(hass): """Mock a Hue bridge.""" - bridge = Mock(available=True, allow_groups=False, host='1.1.1.1') + bridge = Mock( + available=True, + allow_unreachable=False, + allow_groups=False, + api=Mock(), + spec=hue.HueBridge + ) bridge.mock_requests = [] # We're using a deque so we can schedule multiple responses # and also means that `popleft()` will blow up if we get more updates