[Resolved] Having an issue with Wait for Condition duration

I have a smart switch setup to my bedroom fan, a contact senor on the sliding glass door, and a temperature sensor on the wall. I want to have the fan turn on if:

  • The room temperature is >= 75°F
  • The sliding door is opened

If either condition causes the fan to turn on (it wasn't already on by some other means), then I want it to turn off depending on the action that triggered it.

  • If it turned on because the temp is > 75, turn it off if the temp remains less than 72 for 5 minutes
  • If it turned on because the door was opened, turn off if the door is closed and remains closed for a minute

And of course, if I manually turn off the fan, leave it off and cancel any waiting conditions.

The problem I am having, is that the duration is acting more like a timeout. The wait ends at the end of the duration, even though the condition had never been met.

app:2222021-09-18 04:55:07.020 pm infoAction: END-IF
app:2222021-09-18 04:55:07.018 pm infoAction:     END-IF
app:2222021-09-18 04:55:06.252 pm infoAction:         IF (Bedroom Fan is on) Off: Bedroom Fan
app:2222021-09-18 04:55:06.223 pm infoWait over: duration
app:2222021-09-18 04:54:06.167 pm infoAction:         Wait for conditions: Bedroom Fan is off OR         Bedroom Door closed  --> duration: 0:01:00 (waiting for duration)
app:2222021-09-18 04:54:05.387 pm infoAction:         On: Bedroom Fan
app:2222021-09-18 04:54:05.384 pm infoAction:     IF (Bedroom Fan is off) THEN
app:2222021-09-18 04:54:05.366 pm infoAction: ELSE-IF (Bedroom Door open) THEN
app:2222021-09-18 04:54:05.345 pm infoAction:     END-IF (skipped)
app:2222021-09-18 04:54:05.341 pm infoAction:         IF (Bedroom Fan is on) Off: Bedroom Fan (skipped)
app:2222021-09-18 04:54:05.336 pm infoAction:         Wait for conditions: Bedroom Fan is off OR         Temperature of Bedroom Temperature/Humidity Sensor is <= 72.0  --> duration: 0:05:00 (skipped)
app:2222021-09-18 04:54:05.318 pm infoAction:         On: Bedroom Fan (skipped)
app:2222021-09-18 04:54:05.316 pm infoAction:     IF (Bedroom Fan is off) THEN (skipped)
app:2222021-09-18 04:54:05.298 pm infoAction: IF (Temperature of Bedroom Temperature/Humidity Sensor is >= 75.0) THEN (skipping)
app:2222021-09-18 04:54:05.245 pm infoBedroom Fan Triggered
app:2222021-09-18 04:54:05.235 pm infoBedroom Fan: Bedroom Door contact open
app:2222021-09-18 04:52:46.294 pm infoBedroom Fan: Bedroom Temperature/Humidity Sensor temperature 72.69

Looks like the switch state wasn't updating right away, so I added a Wait for Condition for the switch on and it is working now.

IF (Temperature of Bedroom Temperature/Humidity Sensor(72.69) is >= 75.0(F) [FALSE]) THEN
	IF (Bedroom Fan(on) is off(F) [FALSE]) THEN
		On: Bedroom Fan
		Wait for conditions: Bedroom Fan(on) is on(T) [TRUE]  --> timeout: 0:00:30
		Wait for conditions: Bedroom Fan(on) is off(F)  OR 		Temperature of Bedroom Temperature/Humidity Sensor(72.69) is <= 72.0(F) [FALSE] 
 --> duration: 0:05:00
		IF (Bedroom Fan(on) is on TRUE) Off: Bedroom Fan
	END-IF
ELSE-IF (Bedroom Door open(T) [TRUE]) THEN
	IF (Bedroom Fan(on) is off(F) [FALSE]) THEN
		On: Bedroom Fan
		Wait for conditions: Bedroom Fan(on) is on(T) [TRUE]  --> timeout: 0:00:30
		Wait for conditions: Bedroom Fan(on) is off(F)  OR 		Bedroom Door closed(F) [FALSE] 
 --> duration: 0:01:00
		IF (Bedroom Fan(on) is on TRUE) Off: Bedroom Fan
	END-IF
END-IF