mirror of
https://github.com/esphome/esphome.git
synced 2025-08-07 02:47:47 +00:00
Merge branch 'reduce_main_loop' into integration
This commit is contained in:
commit
3980339868
@ -63,19 +63,22 @@ async def test_defer_fifo_simple(
|
|||||||
test_result_future: asyncio.Future[bool] = loop.create_future()
|
test_result_future: asyncio.Future[bool] = loop.create_future()
|
||||||
|
|
||||||
def on_state(state: EntityState) -> None:
|
def on_state(state: EntityState) -> None:
|
||||||
if isinstance(state, Event):
|
if not isinstance(state, Event):
|
||||||
if state.key == test_complete_entity.key:
|
return
|
||||||
if (
|
|
||||||
state.event_type == "test_finished"
|
if (
|
||||||
and not test_complete_future.done()
|
state.key == test_complete_entity.key
|
||||||
):
|
and state.event_type == "test_finished"
|
||||||
test_complete_future.set_result(True)
|
and not test_complete_future.done()
|
||||||
elif state.key == test_result_entity.key:
|
):
|
||||||
if not test_result_future.done():
|
test_complete_future.set_result(True)
|
||||||
if state.event_type == "passed":
|
return
|
||||||
test_result_future.set_result(True)
|
|
||||||
elif state.event_type == "failed":
|
if state.key == test_result_entity.key and not test_result_future.done():
|
||||||
test_result_future.set_result(False)
|
if state.event_type == "passed":
|
||||||
|
test_result_future.set_result(True)
|
||||||
|
elif state.event_type == "failed":
|
||||||
|
test_result_future.set_result(False)
|
||||||
|
|
||||||
client.subscribe_states(on_state)
|
client.subscribe_states(on_state)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user