mirror of
https://github.com/mtan93/SmartThingsPublic.git
synced 2026-03-08 21:02:56 +00:00
CREX-1094 Delete stale device subscriptions on IFTTT app update
This commit is contained in:
@@ -98,6 +98,15 @@ def installed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def updated() {
|
def updated() {
|
||||||
|
def currentDeviceIds = settings.collect { k, devices -> devices }.flatten().collect { it.id }.unique()
|
||||||
|
def subscriptionDevicesToRemove = app.subscriptions*.device.findAll { device ->
|
||||||
|
!currentDeviceIds.contains(device.id)
|
||||||
|
}
|
||||||
|
subscriptionDevicesToRemove.each { device ->
|
||||||
|
log.debug "Removing $device.displayName subscription"
|
||||||
|
state.remove(device.id)
|
||||||
|
unsubscribe(device)
|
||||||
|
}
|
||||||
log.debug settings
|
log.debug settings
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user