Been away too long. Simple question - Presence state


(Doug ) #1

I cant remember how to get the state of a presence sensor.

Basically i am trying to check the presence when motion is detected, This is for a individual room

When there is motion it fires and then checks to see if the said person is present or note. I am having issues getting that info. Thanks Guys


(Chris) #2

Should be a case of just getting the current value:

def isPresent = presenceDevice.currentValue("presence") == "present"


(Doug ) #3

I am getting “dd97c193-52a9-424a-a0c3-7ca9f4943f77 9:03:51 AM: error java.lang.NullPointerException: Cannot invoke method currentValue() on null object @ line 60”


(Doug ) #4

NM, My mistake. that worked thanks!