I’m trying to adapt a standard ‘Momentary Button Tile’ so that there is a 5 second delay between the ‘on’ sendEvent being triggered, and the off event being triggered. This is how the main workings of the DTH look like:
def push() {
sendEvent(name: "switch", value: "on", isStateChange: true, displayed: false)
sendEvent(name: "switch", value: "off", isStateChange: true, displayed: false)
sendEvent(name: "momentary", value: "pushed", isStateChange: true)
}
def on() {
push()
}
def off() {
push()
}
Reading up on various posts it seems I need to use the delay function so I’ve tried adding…
def push() {
sendEvent(name: "switch", value: "on", isStateChange: true, displayed: false, delay: 5000)
sendEvent(name: "switch", value: "off", isStateChange: true, displayed: false)
sendEvent(name: "momentary", value: "pushed", isStateChange: true)
}
But it’s not playing ball - can anyone help point me in the right direction?