Allow zeroconf name change if there is another Home Assistant running on the local network (#53476)

* Allow zeroconf name change if there is another Home Assistant running on the local network

* Remove unused try/except
This commit is contained in:
J. Nick Koston 2021-07-26 02:27:49 -05:00 committed by GitHub
parent 3b96085716
commit 25229a9670
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,12 +11,7 @@ import socket
from typing import Any, TypedDict, cast
import voluptuous as vol
from zeroconf import (
InterfaceChoice,
IPVersion,
NonUniqueNameException,
ServiceStateChange,
)
from zeroconf import InterfaceChoice, IPVersion, ServiceStateChange
from zeroconf.asyncio import AsyncServiceInfo
from homeassistant import config_entries
@ -242,12 +237,7 @@ async def _async_register_hass_zc_service(
)
_LOGGER.info("Starting Zeroconf broadcast")
try:
await aio_zc.async_register_service(info)
except NonUniqueNameException:
_LOGGER.error(
"Home Assistant instance with identical name present in the local network"
)
await aio_zc.async_register_service(info, allow_name_change=True)
class FlowDispatcher: