mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Wait to start emulated_hue until the started event (#112477)
This commit is contained in:
parent
8770a50859
commit
72ac2f127f
@ -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
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user