Best way to send message to only certain contacts depending on conditions?


#1

1) Give a description of the problem

I have a few pistons that send various messages and some of them aren’t important if you aren’t home. I’m looking for a way to send the message to contacts that are only home, unless everyone is away then send it to everyone. I’d really rather not go through each contact and say IF home THEN blah blah blah, just trying to be more efficient. Thanks!


#2

If you’re using contact book… this might help:

You have to extract the contact ID’s though, as described here:


#3

Otherwise just write a series of IF’s…

IF
Robin is home
Then
Send message to Robin

IF
Abby is home
Then
Send message to abby


#4

I kind of wanted to avoid that but I guess it’s doable.


#5

The principle in the piston I linked to (for contacts) can also apply to SMS if you put each phone number in the variable and change the notification action to SMS.

define
device deviceList = Robin, Wanyu, Abby
string numberList = Robin’s number, Wanyu’s number, Abby’s number

For each device in deviceList
IF
$device is present
send SMS to {numberList[$index]}