Fix Hue error logging (#13616)

This commit is contained in:
Paulus Schoutsen 2018-04-01 09:03:01 -07:00 committed by GitHub
parent cd96d7b2ec
commit eb763764b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -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(

View file

@ -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