Just want to make sure it not me


(Doug ) #1

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


(sidjohn1) #2

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


(Doug ) #3

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


(sidjohn1) #4

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.


(Johnathan Fullman) #5

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


(Doug ) #6

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]
???


(Ron S) #7

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”


(Doug ) #8

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!


(Ron S) #9

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