Error Registering for Presence Tag Events


(Matt) #1

I’m writing a SmartThings app that needs to register for Presence Tag events and I keep getting a (not so helpful) error from the simulator

heres the code from my Preferences method that prompts the user for the presence tags

//defining the people (i.e. Presence tags) that should be watched for
    section("Turn on lights for the following people..."){
    	input "presenceTags", "capability.presenceSensor", multiple: true, title: "People"

heres my Installed method

def installed() {
	//log.debug "Installed with settings: ${settings}"
	//log.debug "Current mode = ${location.mode}, people = ${people.collect{it.label + ': ' + it.currentPresence}}"
    
    //subscribing to services
    subscribe(presenceTags.presence)
    //subscribe(switches1.switch)
}

and this is the error i get

No signature of method: script13725181662551118261033.subscribe() is applicable for argument types: (java.util.ArrayList) values: [[physicalgraph.app.AttributeWrapper@209ec911, …]]
Possible solutions: subscribe(physicalgraph.app.AttributeWrapper), subscribe(physicalgraph.app.DeviceWrapper), subscribe(physicalgraph.app.InstalledSmartAppWrapper), subscribe(physicalgraph.app.LocationWrapper), subscribe(physicalgraph.app.AttributeWrapper, java.util.Map), subscribe(physicalgraph.app.DeviceWrapper, java.util.Map)

Any ideas?

When i comment out (both of) the calls to the subscribe function this error doesn’t occur…


(C Chen) #2

Try something like this

def initialize() {
    subscribe(presenceTags, "presence", logStuff)
}

def logStuff(event) { 
    log.debug "LOG: $event.value"
}

(Matt) #3

Thanks C.Chen - I figured it out!