I’m trying to write a smartapp, but if I use a dynamicPage(…, refreshInterval:5,…) as the first preferences page, the page never refreshes.
definition(
name: "TestApp",
namespace: "raven42",
author: "David Hegland",
description: "testing",
category: "",
iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png",
iconX3Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png")
preferences {
page(name: "testFunc", title: "Test Func", content: "testFunc")
}
def testFunc() {
log.debug 'testFunc()'
dynamicPage(name: "testFunc", title: "Test Func", nextPage: "", refreshInterval: 5, install: true, uninstall: true) {
section("Example...") {
}
}
}
If I use this code, I only ever see a single testFunc() log message. I’ve tried different refreshIntervals and never see another log entry from the app.
If changed to the following:
preferences {
page(name: "init", title: "Initial page", content: "init", nextPage: "testFunc")
page(name: "testFunc", title: "Test Func", content: "testFunc")
}
def init() {
log.debug 'init()'
dynamicPage(name: "init", title: "Initial page", nextPage: "testFunc", install: false, uninstall: true) {
section("Click next to proceed.") { }
}
}
def testFunc() {
log.debug 'testFunc()'
dynamicPage(name: "testFunc", title: "Test Func", nextPage: "", refreshInterval: 5, install: true, uninstall: true) {
section("Example...") { }
}
}
Then now the second page (testFunc) does refresh correctly every 5 seconds.
However now there is another issue where now there is no cancel button to uninstall the app despite uninstall:true being set.