Wait until another condition is met?


#1

I’m trying to generate a notification when a condition is met and then send it to someone. However, if that someone is not present I’d like to wait until they are present to send that notification, and even take it one step further and wait until a door has opened after that person has become present.

I can generate the notification just fine. And I can send it, but it’s waiting to send it that I’m having trouble with.

Thank you all in advance!


#2

The way I do this, and this might be a bad way of doing it, is setting up a “WHILE” loop.


#3

Does your line 47-53 behave like, as your motion sensor is inactive it will continue to wait 20 seconds until it is active, then it will post?


#4

Correct. That’s the motion sensor closest to the door I always come in.


#5

I’d do it by setting your message as a variable (so it can be sent later if nobody is present).

IF condition is met
THEN
IF
X or Y is present
Send message to recipient (no need to store as a variable unless you’d like to)
ELSE
Set variable to intended message
Set variable ‘messageHolding’ to true

IF
X or Y changes to present
AND
messageHolding is true
THEN
Send message to recipient
Set variable ‘messageHolding’ to false


#6

That’s another way of doing it…I didn’t want to do it based on presence since that can happen before the person is actually in range of the speaker though, when I’m still backing the car in. So, I would use a contact sensor or motion sensor as the trigger but it would still work.


#7

I think your way, @Ryan780 is how I’ll go about it. The message could go to any of 3 people so I would have to have several variables for each person. Thank you for showing me how the while loop works!

Edit: I was able to get a screen shot of what I’ve been working on. Disregard the rest of the crap but take a look at lines 58-83. Specifically 58-76 as I’m just going copy this for each individual contact. Will this work? It seems to me like the structure of the piston isn’t quite like yours but I’m not sure how to change it.


#8

I wouldn’t use the presence sensor with a while loop. I would use the variable method to store the message if you’re going to do by presence. And yes, you would need a variable for each person if you only want each one to get the notification once but you can do it with boolean variables instead of text variables. Ultimately, what are you trying to accomplish? If you’re doing what I was using it for, notifications when the wash is done, I think you’re getting REALLY complicated about it. Do you want every person in the house to get a notification when they come home if the dryer is available?


#9

I’ve got an old cell phone in my laundry room with action tiles on it with 6 buttons. These are all simulated switches. 1 for all 3 people in my house for both the washer and dryer.

My thought is, when a load goes in the wash, person A will hit their corresponding washing machine button. When the washing machine is done, it will send person A (or whoever’s switch is on) a message saying the washer is finished. Unless they aren’t home. In which I’d like the message to be sent when they arrive.

We mostly walk through the laundry room when arriving and there is a contact sensor on the outside door (and the garage door that we come through) and a motion sensor in the laundry room. However, I didn’t really want to use these like you did in case someone else walks into the laundry (or even past it will trigger the motion sensor).

Why do you suggest to not use the while loop with presence? I’m guessing it has to do with being gone a long time and constantly running that loop over and over and backing things up?


#10

Backing things up? No, the while loop is there so that the notification doesn’t go off while I’m not home. So, if the wash finished when i’m gone, it waits for me to arrive to send the notification which i do through a speaker. If you are sending sms or push then you don’t have to us the wait for motion part, just wait until they arrive to send the sms or push.