For vizio integration, set unique ID early to prevent multiple zeroconf discovery items for the same device to appear (#31686)

* set unique ID early to prevent multiple zeroconf discovery items for the same device to appear

* add test
This commit is contained in:
Raman Gupta authored and GitHub committed 2020-02-10 14:54:52 -08:00
1 parent 454e63b69e
commit 284fd46ea8
2 files changed
+31

No files matched your search

@@ -205,6 +205,11 @@ class VizioConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
) -> Dict[str, Any]:
"""Handle zeroconf discovery."""
# Set unique ID early to prevent device from getting rediscovered multiple times
await self.async_set_unique_id(
unique_id=discovery_info[CONF_HOST].split(":")[0], raise_on_progress=True
)
discovery_info[
CONF_HOST
] = f"{discovery_info[CONF_HOST]}:{discovery_info[CONF_PORT]}"