Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion homeassistant/components/hue.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def setup(self):
self.bridge = phue.Bridge(
self.host,
config_file_path=self.hass.config.path(self.filename))
except ConnectionRefusedError: # Wrong host was given
except (ConnectionRefusedError, OSError): # Wrong host was given
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ConnectionRefusedError is a subclass of OSError.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh.

Well good thing that I am going to throw it all away when we migrate to aiohue #12830

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested it locally before committing but only tested

>>> isinstance(ConnectionRefusedError, OSError)
False

But classes are of type Type.

Instantiating did the trick:

>>> isinstance(ConnectionRefusedError(), OSError)
True

_LOGGER.error("Error connecting to the Hue bridge at %s",
self.host)
return
Expand All @@ -201,6 +201,9 @@ def setup(self):
self.host)
self.request_configuration()
return
except Exception: # pylint: disable=broad-except
_LOGGER.exception("Unknown error connecting with Hue bridge at %s",
self.host)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably return here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Will include it in my #12830 branch

# If we came here and configuring this host, mark as done
if self.config_request_id:
Expand Down