New and need help making a smart app

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.

groovy.lang.MissingPropertyException: No such property: id for class: java.lang.String

This is the error I am getting.

try looking into WebCoRE, it might be a better option for you, however be aware that this platform is going to be going under a major overall sometime soon as discussed in this thread.

WebCoRE Community Post

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.