diff --git a/tests/components/emulated_kasa/test_init.py b/tests/components/emulated_kasa/test_init.py index 36eaa749f116..33ac147bf6d7 100644 --- a/tests/components/emulated_kasa/test_init.py +++ b/tests/components/emulated_kasa/test_init.py @@ -180,6 +180,7 @@ async def test_float(hass: HomeAssistant) -> None: await hass.services.async_call( SWITCH_DOMAIN, SERVICE_TURN_ON, {ATTR_ENTITY_ID: ENTITY_SWITCH}, blocking=True ) + await hass.async_block_till_done() switch = hass.states.get(ENTITY_SWITCH) assert switch.state == STATE_ON @@ -195,6 +196,7 @@ async def test_float(hass: HomeAssistant) -> None: await hass.services.async_call( SWITCH_DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: ENTITY_SWITCH}, blocking=True ) + await hass.async_block_till_done() plug_it = emulated_kasa.get_plug_devices(hass, config) plug = next(plug_it).generate_response() @@ -260,6 +262,7 @@ async def test_template(hass: HomeAssistant) -> None: {ATTR_ENTITY_ID: ENTITY_FAN, ATTR_PERCENTAGE: 33}, blocking=True, ) + await hass.async_block_till_done() fan = hass.states.get(ENTITY_FAN) assert fan.state == STATE_ON @@ -278,6 +281,7 @@ async def test_template(hass: HomeAssistant) -> None: {ATTR_ENTITY_ID: ENTITY_FAN, ATTR_PERCENTAGE: 100}, blocking=True, ) + await hass.async_block_till_done() plug_it = emulated_kasa.get_plug_devices(hass, config) plug = next(plug_it).generate_response() assert nested_value(plug, "system", "get_sysinfo", "alias") == ENTITY_FAN_NAME @@ -288,6 +292,7 @@ async def test_template(hass: HomeAssistant) -> None: await hass.services.async_call( FAN_DOMAIN, SERVICE_TURN_OFF, {ATTR_ENTITY_ID: ENTITY_FAN}, blocking=True ) + await hass.async_block_till_done() plug_it = emulated_kasa.get_plug_devices(hass, config) plug = next(plug_it).generate_response() assert nested_value(plug, "system", "get_sysinfo", "alias") == ENTITY_FAN_NAME @@ -441,6 +446,7 @@ async def test_multiple_devices(hass: HomeAssistant) -> None: {ATTR_ENTITY_ID: ENTITY_FAN, ATTR_PERCENTAGE: 66}, blocking=True, ) + await hass.async_block_till_done() # All of them should now be on switch = hass.states.get(ENTITY_SWITCH)