Description
Hello,
I like the project and appreciate all the work that was put into it, however I must say that all the logic changes are getting very confusing. After the latest master update, state_hold_false=0 stopped working when used for task.wait_until triggers. Here's the example:
trig_info = task.wait_until(
state_trigger="binary_sensor.door_basement == 'off'", state_hold_false=0,
timeout=60
)
The door is closed when the function kicks in, so I want some things to happen only after the door is open and THEN closed again, however it doesn't work as expected (and as it did just before I updated pyscript) and instead fires off immediately. It looks like it ignores the state_hold_false parameter and since the state_check_now is True by default (which again is confusing since it's False by default when used in a decorator, but True when used in wait_until), it sees the door is already closed and sets off.
What am I doing wrong? How do I make it work as expected? Thanks!
Here's the full function if that helps:
def media_room_overhead_exit_logic():
"""Turn on media room light when motion is detected."""
log.info(f"triggered; turning on media room light")
if light.media_room_overhead != "on":
light.media_room_overhead.turn_on()
trig_info = task.wait_until(
state_trigger="binary_sensor.door_basement == 'off'", state_hold_false=0,
timeout=60
)
if trig_info["trigger_type"] == "state":
log.info(f"door closed; turning off media room light.")
light.media_room_overhead.turn_off()
and here's what I see in the logs (note the same timestamp):
2020-12-08 16:02:18 INFO (MainThread) [custom_components.pyscript.file.lighting.media_room_overhead_exit_logic] triggered; turning on media room light
2020-12-08 16:02:18 INFO (MainThread) [custom_components.pyscript.file.lighting.media_room_overhead_exit_logic] door closed; turning off media room light.