Send text message but only after phone becomes present

conditions
time
variables
presence

#1

1) Give a description of the problem

Ok… I’ve been searching and searching for how to accomplish this and I can’t quite get it. I’ve been using webcore with Smartthings for a few months now so I apologize if this is obvious. The goal is to send a text message after a task is complete but only after someone arrives home. Seems straight forward, but I’m still learning the system… I have the basic, but still trying to wrap my head around the more advanced aspects.

2) What is the expected behavior?

IF IFTTT executes “RoombaDock”
AND Kirby’s iPhone is present
THEN with Kirby’s iPhone
DO text “clean roomba”
ELSE
IF IFTTT executes “RoombaDock”
AND Kirby’s iPhone is NOT present
THEN with Kirby’s iPhone
WAIT until Kirby’s iPhone becomes present
THEN with Kirby’s iPhone
DO text “clean roomba”

3) What is happening/not happening?

Someone on the forum suggested using variables but I’m trying to actually understand how to use them… the wiki page didn’t help me too much in the actual setting up of a variable.
This was the suggestion:

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

Any help with how to actually execute this piston would be greatly appreciated. I’d also welcome any advice on tutorials or actual examples of variables being used and how they get set up. Thanks so much for all your help!!


#2

I would suggest you call your message piston from your other task when it completes if that is possible. Just add an execute piston command at the end of the other task. To get your message out, you need to use a global variable to save your message and message holding flag. Create the global variable in the editing page to the right there is place for global variables.

35%20PM

then your message piston could be:

If X or Y changes to present  /* this will trigger every time one of you comes home */
then
if
messageHolding is false
then
exit 'false'     /* this will exit the piston if there is no message to be delivered */
endif
endif
/* now you either have a message to deliver directly or stored */
IF
messageHolding is true
then
send messageText to recipient
set messageHolding to false
else /* no message held so generate one */
if 
X or Y is present
Send message to recipient
set messageHolding to false /* just to be sure */
ELSE
Set messageText to message
Set messageHolding to true
endif
endif

Hope this helps.


#3

Thanks Guy!

I THINK I mostly understand… I’m just still fuzzy on variables… What type of variable to select, how to actually write it out, and how it interacts with the piston.

The initial trigger for this is from IFTTT. So I’ve started with that. I’ve attached a screen shot of what I’m doing currently, it just doesn’t have the wait till I’m home function I’m looking for. If there’s any way you can spell out the variable part for me I’d be super grateful! I know once this clicks I will be off and running!


#4

Sorry for the delayed reply. I missed your message. Try this piston. you can duplicate the second if to separate the notifications for you and your wife if that is better. On variables, if you are unsure of the type, just use the default dynamic type. For yes/no, true/false you can always use boolean.