I see callbacks for installed(), updated(), initialize(), but is there any way to clean up if your app is uninstalled()? I create a virtual device to allow it to track an overall app state, but if you uninstall the app this virtual device is just left as an orphan.
See OpenDoorAlert.groovy here:
definition(
name: "Open Door Alerts",
namespace: "hubitat",
author: "Justin Eltoft",
description: "Alert if a set of Doors/Contacts is open for N minutes (with repeat)",
category: "Convenience",
iconUrl: "",
iconX2Url: "")
preferences {
page(name: "mainPage")
}
def mainPage() {
dynamicPage(name: "mainPage", title: " ", install: true, uninstall: true) {
section {
input "thisName", "text", title: "Name this Open Door Alert", submitOnChange: true, required: true
if(thisName) app.updateLabel("$thisName")
input "contactSensors", "capability.contactSensor", title: "Select Contact Sensors", submitOnChange: true, required: true, multiple: true
input "alertMessage", "text", title: "Alert Message", defaultValue: "Open Door Alert!", required: true
This file has been truncated. show original