mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Migrate start helper to use run_immediately (#115055)
This commit is contained in:
parent
3ef2c464ac
commit
c4b5a7c027
@ -47,9 +47,7 @@ def _async_at_core_state(
|
|||||||
if unsub:
|
if unsub:
|
||||||
unsub()
|
unsub()
|
||||||
|
|
||||||
unsub = hass.bus.async_listen_once(
|
unsub = hass.bus.async_listen_once(event_type, _matched_event, run_immediately=True)
|
||||||
event_type, _matched_event, run_immediately=False
|
|
||||||
)
|
|
||||||
return cancel
|
return cancel
|
||||||
|
|
||||||
|
|
||||||
|
@ -1206,7 +1206,7 @@ async def test_delta_values(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("sensor.energy_bill")
|
state = hass.states.get("sensor.energy_bill")
|
||||||
assert state.attributes.get("status") == PAUSED
|
assert state.attributes.get("status") == COLLECTING
|
||||||
|
|
||||||
now += timedelta(seconds=30)
|
now += timedelta(seconds=30)
|
||||||
with freeze_time(now):
|
with freeze_time(now):
|
||||||
@ -1249,7 +1249,7 @@ async def test_delta_values(
|
|||||||
state = hass.states.get("sensor.energy_bill")
|
state = hass.states.get("sensor.energy_bill")
|
||||||
assert state is not None
|
assert state is not None
|
||||||
|
|
||||||
assert state.state == "9"
|
assert state.state == "10"
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
@ -1316,7 +1316,7 @@ async def test_non_periodically_resetting(
|
|||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("sensor.energy_bill")
|
state = hass.states.get("sensor.energy_bill")
|
||||||
assert state.attributes.get("status") == PAUSED
|
assert state.attributes.get("status") == COLLECTING
|
||||||
|
|
||||||
now += timedelta(seconds=30)
|
now += timedelta(seconds=30)
|
||||||
with freeze_time(now):
|
with freeze_time(now):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user