Unsubscribing

in the main app i subscribe to some devices:

subscribe(device, "occupancy", eventHandler)

later on i call:

unsubscribe(device)

which is throwing this error:

[app:2] 2018-08-12 12:39:13.598:errorgroovy.lang.MissingMethodException: No signature of method: app15341025111211121208558.unsubscribe() is applicable for argument types: (com.hubitat.app.ChildDeviceWrapper) values: [test Room] Possible solutions: subscribe(java.lang.Object, java.lang.String, java.lang.Object) on line 1097 (unsubscribeChildDevice)

what am i doing wrong?

thank you.

Unsubscribe takes no parameters

If it's a child device use unsubscribeChildDevices, just like the error suggested.
Standard practice is to unsubscribe, then subscribe within updated

thanks @mike.maxwell.

my function name that unsubscribes to child devices is named unsubscribeChildDevice … believe thats the reference you see in the error. :slight_smile:

unsubscribeChildDevices() doesnt seem like it will work … here is the error when i tried it:

[app:2] 2018-08-12 23:33:14.684:errorgroovy.lang.MissingMethodException: No signature of method: app153414194622898920667.unsubscribeChildDevices() is applicable for argument types: (com.hubitat.app.ChildDeviceWrapper) values: [test Room] on line 1098 (unsubscribeChildRoomDevice)

i am looking to unsubscribe a single device from an app. on ST unsubscribe lets you do that. here is the link to the doc for it with the signature and params pasted below for convenience:

https://docs.smartthings.com/en/latest/ref-docs/smartapp-ref.html?highlight=unsubscribe#unsubscribe

Signature:

unsubscribe([deviceOrDevices])

Paramters:

deviceOrDevices (optional) - The device or devices for which to unsubscribe from. If not specified, all subscriptions for this installed SmartApp will be deleted.

is there an equivalent to the unsubscribe(...) function from ST?

thank you.

We just have unsubscribe, with no parameters at this point.
I've made an issue to allow an optional list.

3 Likes