Add zeroconf discovery to Freebox (#47045)

* Add zeroconf discovery to Freebox

- remove deprecated discovery
- tried with SSDP too but the presentation URL is not the same (*.fbxos.fr for zeroconf, http://mafreebox.freebox.fr/ for SSDP)
- so config entry unique_id should be the MAC (included into SSDP, but not zeroconf, can be retrieve from `fbx.system.get_config()`)
- DHCP discovery might be added in the future too

* host and port are required on zeroconf

* cleanup in other PR
This commit is contained in:
Quentame 2021-02-25 16:50:58 +01:00 committed by GitHub
parent 5bba532dd4
commit 125206adbf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 45 additions and 17 deletions

View file

@ -105,3 +105,9 @@ class FreeboxFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
async def async_step_import(self, user_input=None):
"""Import a config entry."""
return await self.async_step_user(user_input)
async def async_step_zeroconf(self, discovery_info: dict):
"""Initialize flow from zeroconf."""
host = discovery_info["properties"]["api_domain"]
port = discovery_info["properties"]["https_port"]
return await self.async_step_user({CONF_HOST: host, CONF_PORT: port})