Help with Boolean intergration


#1

1) Give a description of the problem
Looking to integrate a true/false device state for my alarm. When house routine to arm is ran, check devices and if any of them are open/active set boolean which then stops the arming feature and notifies.

2) What is the expected behaviour?
To help me identify windows or doors open

3) What is happening/not happening?
I have not found proper documentation on boolean implantation in this usage so just looking for guidance/verification.

**4) Post a Green Snapshot of the piston!

5) Attach logs after turning logging level to Full
no logs yet

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

I didn’t look at the logic of the piston itself, just pointing out item(s) that needs to be adjusted.

You need an Expression to set OpenDevices to true/false.
OpenDevices = count(DevicesToCheckThatFailed) > 0 ? true : false

Instead of $location, just use Location which if I remember correctly is the default device in the dropdown selection.


#3

Thats where I am stuck with. Any more guidance as to the implementation of the expression and its use in the piston?

Edit. also the $location is the one that I can use thats on the bottom of the list under system variables. The first one listed is a virtual device that can no longer be clicked once I have chosen anything from the drop down list. Does this sound right? And just our of curiosity why is one better than the other?


#4

Something like this…

And this is what I was referring to about Location. If you don’t select a device, Location is the default.
image


#5

Changed the location as you suggested and edited the expression line. See final result below. I like to understand this so that in the future I dont have to keep bugging people :slight_smile: the expression compares the count of the variable and if its greater then 1 in this case, it will set the value to true, correct? So if thats correct you can enter any number instead of 1 should that be needed and also for example run a less then instead of greater then calculation?


#6

Yes, you can use your own number for whatever evaluation you need.


#7

Perfect, any other glaring issue with this piston? It is ok that the variable to write for open/active devices is listed under the first if? Syntax seems a bit weird to me when reading top to bottom but otherwise appears functional?


#8

As long as you’re not defining a static value to variables up top, the piston will populate it with values as you defined down the rest of the piston. One thing I’m thinking might be an issue is your motion sensors, do you think it will have reset to inactive by the time you trigger the Routine?


#9

Currently using the SmartThings SMH to turn alarm on and off as they intended to do. Motion sensors are incorporated there as well in the same fashion and have not given me an issue yet. So unless stock SMH has a delay or clearing feature on the motion sensors it stands to reason it should work?


#10

Also seeing as how helpful you have been, any chance you can point me in the right direction with my other piston? :slight_smile:


#11

Will take a look when I get a chance in a few.