Ok I am totally new to making a smart app. But here is what I want to do. If I have a virtual switch turn on. I want it to run for 1 minute then turn off. Seem simple enough. But I am having no luck. I tried to use a templet code app and change it. But it not working.
definition(
name: “Turn It On For 1 Minutes”,
namespace: “smartthings”,
author: “SmartThings”,
description: “A switch will be turned on, and then turned off after 1 minutes.”,
category: “Switch timer”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/Meta/light_contact-outlet.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/Meta/light_contact-outlet@2x.png”
)
preferences {
section(“Turn on a switch for 1 minutes…”){
input “switch1”, “capability.switch”
}
}
def turnOnSwitch() {
switch1.on()
def OneMinuteDelay = 60
runIn(OneMinuteDelay, turnOffSwitch)
}
def turnOffSwitch() {
switch1.off()
}
Any help would be much appreciated.