Make sure all discovery flows are using the helper (#76641)

This commit is contained in:
J. Nick Koston 2022-08-12 03:25:23 -10:00 committed by GitHub
parent a86397cc10
commit eeb9a9f058
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 132 additions and 117 deletions

View file

@ -39,7 +39,11 @@ from homeassistant.const import (
STATE_PLAYING,
)
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import config_validation as cv, entity_platform
from homeassistant.helpers import (
config_validation as cv,
discovery_flow,
entity_platform,
)
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.device_registry import format_mac
from homeassistant.helpers.dispatcher import (
@ -99,16 +103,15 @@ async def start_server_discovery(hass):
"""Start a server discovery task."""
def _discovered_server(server):
asyncio.create_task(
hass.config_entries.flow.async_init(
DOMAIN,
context={"source": SOURCE_INTEGRATION_DISCOVERY},
data={
CONF_HOST: server.host,
CONF_PORT: int(server.port),
"uuid": server.uuid,
},
)
discovery_flow.async_create_flow(
hass,
DOMAIN,
context={"source": SOURCE_INTEGRATION_DISCOVERY},
data={
CONF_HOST: server.host,
CONF_PORT: int(server.port),
"uuid": server.uuid,
},
)
hass.data.setdefault(DOMAIN, {})