Wait to start emulated_hue until the started event (#112477)

This commit is contained in:
J. Nick Koston 2024-03-05 22:25:11 -10:00 committed by GitHub
parent 8770a50859
commit 72ac2f127f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ from homeassistant.components.network import async_get_source_ip
from homeassistant.const import ( from homeassistant.const import (
CONF_ENTITIES, CONF_ENTITIES,
CONF_TYPE, CONF_TYPE,
EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STARTED,
EVENT_HOMEASSISTANT_STOP, EVENT_HOMEASSISTANT_STOP,
) )
from homeassistant.core import Event, HomeAssistant from homeassistant.core import Event, HomeAssistant
@ -153,6 +153,6 @@ async def async_setup(hass: HomeAssistant, yaml_config: ConfigType) -> bool:
"""Start the bridge.""" """Start the bridge."""
await start_emulated_hue_bridge(hass, config, app) await start_emulated_hue_bridge(hass, config, app)
hass.bus.async_listen_once(EVENT_HOMEASSISTANT_START, _start) hass.bus.async_listen_once(EVENT_HOMEASSISTANT_STARTED, _start)
return True return True

View File

@ -12,7 +12,7 @@ from homeassistant.components.emulated_hue.config import (
Config, Config,
) )
from homeassistant.components.emulated_hue.upnp import UPNPResponderProtocol from homeassistant.components.emulated_hue.upnp import UPNPResponderProtocol
from homeassistant.const import EVENT_HOMEASSISTANT_START from homeassistant.const import EVENT_HOMEASSISTANT_STARTED
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component from homeassistant.setup import async_setup_component
from homeassistant.util import utcnow from homeassistant.util import utcnow
@ -145,7 +145,7 @@ async def test_setup_works(hass: HomeAssistant) -> None:
spec=UPNPResponderProtocol spec=UPNPResponderProtocol
) )
assert await async_setup_component(hass, "emulated_hue", {}) assert await async_setup_component(hass, "emulated_hue", {})
hass.bus.async_fire(EVENT_HOMEASSISTANT_START) hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED)
await hass.async_block_till_done() await hass.async_block_till_done()
assert len(mock_create_upnp_datagram_endpoint.mock_calls) == 1 assert len(mock_create_upnp_datagram_endpoint.mock_calls) == 1