Add SSDP integration (#24090)

* Add SSDP integration

* Fix tests

* Sort all the things

* Add netdisco to test requirements
This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2019-05-26 19:48:27 -07:00
1 parent 97b671171b
commit 9debbfb1a8
22 files changed
+436 -28

No files matched your search

+8 -3
View File
@@ -137,17 +137,22 @@ class HueFlowHandler(config_entries.ConfigFlow):
errors=errors,
)
async def async_step_discovery(self, discovery_info):
async def async_step_ssdp(self, discovery_info):
"""Handle a discovered Hue bridge.
This flow is triggered by the discovery component. It will check if the
This flow is triggered by the SSDP component. It will check if the
host is already configured and delegate to the import step if not.
"""
# Filter out emulated Hue
if "HASS Bridge" in discovery_info.get('name', ''):
return self.async_abort(reason='already_configured')
host = discovery_info.get('host')
# pylint: disable=unsupported-assignment-operation
host = self.context['host'] = discovery_info.get('host')
if any(host == flow['context']['host']
for flow in self._async_in_progress()):
return self.async_abort(reason='already_in_progress')
if host in configured_hosts(self.hass):
return self.async_abort(reason='already_configured')
@@ -6,6 +6,11 @@
"requirements": [
"aiohue==1.9.1"
],
"ssdp": {
"manufacturer": [
"Royal Philips Electronics"
]
},
"dependencies": [],
"codeowners": [
"@balloob"
+2 -1
View File
@@ -23,7 +23,8 @@
"all_configured": "All Philips Hue bridges are already configured",
"unknown": "Unknown error occurred",
"cannot_connect": "Unable to connect to the bridge",
"already_configured": "Bridge is already configured"
"already_configured": "Bridge is already configured",
"already_in_progress": "Config flow for bridge is already in progress."
}
}
}