Event not happening after WAIT


#21

The concept is basically the same, but the motion sensor is more likely to fire more frequently, thereby refreshing the current status, and causing the later part of the code to be skipped (unless TCP is set to Never).


#22

Actually, this is not the case. Notice how even me manually turning the switch off, (with no code for off anywhere), it still updated the status, and line 18 did not complete.

This is why in practice, we code “as if” the trigger only remains true for a moment, even though there are occasions where it may linger for a bit. The more complex your code is, the less you can count on those.


#23

You are right. I figured out that I was testing by not subscribing to anything, flipping the switch, hitting “test”, and flipping the switch again. In that instance, I got both messages since nothing triggered the piston before the wait timer did. I can’t believe I didn’t run a test with a normal trigger. That is rather embarrassing.


#24

Don’t sweat it.
Been there, done that, and got the Tshirt, LOL


#25

Btw, I forgot to update this. The problem is that the Bosch motion sensor goes to Inactive a few seconds after becoming Active, thus canceling the Wait and all other following tasks.

My solution is as follows:

  1. Use “becomes active” ONLY to turn the lights on and set a brightness.
  2. “Use “becomes inactive” to set a brightness, initiate the Wait period, and turn off the lights after the Wait period.

This works on multiple levels. The sensor won’t report motion for another few minutes, even if there is motion in the room. If it does report motion, (1) above fires. This cancels task (2). Then a few seconds later (2) fires again, thus re-starting the Wait period.

Thanks for the help in understanding the issue.