@scottinpollock I think what @snbaker is saying is that they can call a
subscribe(device, attributeName, eventHandler) which subscribes to the changing of a specific attribute on a device. The
unsubscribe(device) unsubscribes ALL subscriptions for the device and I think @snbaker is looking for something closer to
unsubscribe(device, attributeName) which doesn’t appear to exist.
I would imagine their use case involves allowing the user to subscribe to multiple attributes and they may want to unsubscribe to only a single attribute at a time.
//STEP 1: subscribe to the switch event of the light switch
subscribe(myLightSwitch, 'switch', lightHandler)
//STEP 2: subscribe to the level event of the light switch
subscribe(myLightSwitch, 'level', levelHandler)
//STEP 3: only unsubscribe from the switch, leaving the level subscription in place
unsubscribe(myLightSwitch, 'switch'); // <---theoretical command
After a bit of testing, I noted that there was a signature for
and when I passed that a subscription ID, it would allow me to unsubscribe from a particular subscription (eg. device/attribute pair), but further testing seems to indicate this wants a handler as the string.
groovy.lang.MissingMethodException: No signature of method: unsubscribe() is applicable for argument types: (physicalgraph.app.EventSubscriptionWrapper)
Possible solutions: unsubscribe(), unsubscribe(java.lang.String), unsubscribe(java.util.Collection), unsubscribe(physicalgraph.app.DeviceWrapper), subscribe(physicalgraph.app.AttributeWrapper), subscribe(physicalgraph.app.DeviceWrapper) @ line 311