Just want to make sure it not me

I swear this was working fine the other day. Is it me or is the IDE on heavy drugs?

Those brackets may be holding you up, try if (motionState.value.contains(“inactive”)) instead

Changed the code to contains. That did the trick.
Im still confused to why the if (motionState.value == “inactive”) {} just stopped working. You can even see the output is “inactive”… Oh well

From what i see the output is [inactive] and [inactive] != inactive and i can’t see enough code to determine why the brackets are there.

1 Like

“multiple: true” on your motion sensor input variable will cause the state to be an array.

2 Likes

That’s was it!! Changing the multiple to false got it working again. how do you grab something from the array?
Array[0]
Array[1]
???

just an example:

def checkDoors(){
def openDoors = doors.findAll{ it → it.currentValue(“contact”) == “open” }
return openDoors
}

There are other ways of doing it…

def fibList = [1, 1, 2, 3, 5]

fibList.each { println it } // prints all of the numbers in the list
assert fibList.any { it == 3 }
assert fibList.every { it > 0 }
assert fibList.collect { it - 1 } == [0, 0, 1, 2, 4]
assert fibList.findAll { it > 1 && it < 5 } == [2, 3]
assert fibList.find { it > 1 } == 2
assert fibList.inject("fib: ") { str, val → str << val }.toString() == “fib: 11235”

Thanks Ron! Now if I can just get them to fix the app (The actual Smartthings App) to save “Modes” in custom apps. (Opened a ticket 6month or more ago)
Recently they update then smartthings app and now I cant switch modes via the app. So I have to use a smart app button to switch it… UGH!

I am sure they will once the madness settles. :slight_smile: