Bug description
task.wait_until() appears to ignore the condition expression.
- Without a timeout, it returns immediately even though the condition is false.
- With a timeout, it waits until the timeout expires even if the condition becomes true before then.
Environment
- Pyscript version: 2.0.1 (also tried on 2.0.0) via HACS
- Installation method: Home Assistant OS
- Core: 2026.5.0
- Supervisor: 2026.04.2
- Operating System: 17.3
- Frontend: 20260429.3
Reproduction
Create an input_boolean helper named input_boolean.test1.
Then use this pyscript:
@state_trigger("input_boolean.test1 == 'on'")
def test_wait_until():
log.warning("input_boolean.test1 toggled on")
result = task.wait_until("input_boolean.test1 == 'off'")
log.warning(
"test1 toggled off? %r %r",
result,
input_boolean.test1,
)
Actual behavior
When input_boolean.test1 is turned on, the second log message appears immediately even though the condition is still false.
Log output:
2026-05-07 14:16:29.595 WARNING (MainThread) [custom_components.pyscript.file.waittest.test_wait_until] input_boolean.test1 toggled on
2026-05-07 14:16:29.595 WARNING (MainThread) [custom_components.pyscript.file.waittest.test_wait_until] test1 toggled off? {'trigger_type': 'none'} 'on'
Expected behavior
task.wait_until() should block until input_boolean.test1 == 'off'.
Timeout behavior
If I instead use:
@state_trigger("input_boolean.test1 == 'on'")
def test_wait_until():
log.warning("input_boolean.test1 toggled on")
result = task.wait_until(
"input_boolean.test1 == 'off'",
timeout=30,
)
log.warning(
"test1 toggled off? %r %r",
result,
input_boolean.test1,
)
and then:
- Turn
input_boolean.test1 on
- Wait 10 seconds
- Turn it back off
the call still waits the full 30 seconds before returning.
Log output:
2026-05-07 14:19:35.877 WARNING (MainThread) [custom_components.pyscript.file.waittest.test_wait_until] input_boolean.test1 toggled on
2026-05-07 14:20:05.879 WARNING (MainThread) [custom_components.pyscript.file.waittest.test_wait_until] test1 toggled off? {'trigger_type': 'timeout'} 'off'
Expected behavior
The wait should end as soon as the condition becomes true, rather than waiting for the timeout to expire.
Bug description
task.wait_until()appears to ignore the condition expression.Environment
Reproduction
Create an
input_booleanhelper namedinput_boolean.test1.Then use this pyscript:
Actual behavior
When
input_boolean.test1is turned on, the second log message appears immediately even though the condition is still false.Log output:
Expected behavior
task.wait_until()should block untilinput_boolean.test1 == 'off'.Timeout behavior
If I instead use:
and then:
input_boolean.test1onthe call still waits the full 30 seconds before returning.
Log output:
Expected behavior
The wait should end as soon as the condition becomes true, rather than waiting for the timeout to expire.