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

@ -25,26 +25,20 @@ CONFIG_SCHEMA = vol.Schema(
async def async_setup(hass, config):
"""Set up the Freebox component."""
conf = config.get(DOMAIN)
if conf is None:
return True
for freebox_conf in conf:
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_IMPORT},
data=freebox_conf,
"""Set up the Freebox integration."""
if DOMAIN in config:
for entry_config in config[DOMAIN]:
hass.async_create_task(
hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_IMPORT}, data=entry_config
)
)
)
return True
async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry):
"""Set up Freebox component."""
"""Set up Freebox entry."""
router = FreeboxRouter(hass, entry)
await router.setup()