Monitor Switch/Contact Sensors Status - need help


#1

1) Give a description of the problem
Need to monitor all the switch / contact sensor status (50+ devices) while status is away. Sometimes accidentally toggle the switch to ON or forgot to switch off or SmartThings failed to switch off completely when i leave my house.

2) What is the expected behavior?
to get details notification every 12 hours when there is a switch is “ON” state and status is away.
e.g.

  • Living Room spotlight is “ON”
  • Dinner lights is “ON”
  • Front Door is “Open”

Need help for above. Thanks :slight_smile:


#2

Just thinking through the use case … wouldn’t it be better to do
On Change to Away
Check status
Alert for any of X devices that are “On” or “Open”

at the office so cant play too much but perhaps using this battery monitor as a starting point for ideas?


#3

Define
device allLights (all your lights here)
device lightsOn (empty)
device allDoors (all your contacts)
device openDoors (empty)
string message (empty)

Every 12 hours
If mode is away
Then
If any of allLights are on
Save matching device list to lightsOn
Then
Set variable message = "The {lightsOn} are on."
End if
If any of allContacts are open
Save matching device list to openDoors
Then
Set variable message = "{message} The {openDoors} are open.”
End if
End if
End every


List of all opened doors
#4

Converted your guide to piston, is this correct?


#5

Looks good.

Edit: only thing i forgot to add was after sending the notification you will want to clear the variable.


#6

I assume the reason I have a loop is because the variable isnt cleared? How would you clear the variable after the notification is run?

I saw this: https://community.webcore.co/t/stuffing-a-list-all/1368/3 but wasn’t sure how to add it to the piston above.


#7

Could you give a little more detail and include your piston share image


#8

Sure please see below. A few things with this piston number 1 is I have three speak do commands because I’m testing three different speakers so it’s going to look like an issue but it’s just for testing and then below that the location if off I was working on a way to turn off the Piston or pause the Piston but I realized that was not going to be the way to clear out the variables.


#9

I would ditch the for loop. Otherwise your message if you have multiple contacts open will end up looking like
These sensors contact 1 and contact 2 are Open. These sensors contact 1 and contact 2 are Open.

It will repeat itself for each contact that is open. So if you have 5 contacts open, for example, the message would repeat itself 5 times.

As for clearing out the txt variable just use a set variable txt = “” after the speak commands.

Also idk what switch 3 is but you have that as a trigger. So the piston will only fire after this gets turned on. I would need to know what this switch is to better understand how you are structuring this


#10

Got it. The Switch 3 is just for testing. It is a virtual switch.