Help For Beginner

I am trying to learn to write a simple app. I want to monitor a switch for a given light and turn on another light based on the original switch. The code is shown below. For a while I got nothing to happen at all. Now, I can save my code and publish “For Me”. The app shows up on my iPhone and I can try to install it. After setting “theInputSwitch”, “theOutputSwitch”, and the name of the app, I hit done and get … Access is denied

Any clues? This is frustrating for a beginner. Note, I know this is like the app “BigSwitch”. I was just using it as an example to begin to understand the development process and what is possible.



  • LightsOffAfterTime
  • Copyright 2015 Jack (Butch) Griffin,
  • Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at:
  • Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
  • on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
  • for the specific language governing permissions and limitations under the License.

name: “LightsOffAfterTime”,
namespace: “sjcbulldog”,
author: "",
description: “Turn off lights a fixed amount of time after they were turned off, either manually or via a smartthings app.”,
category: “My Apps”,
iconUrl: “”,
iconX2Url: “”,
iconX3Url: “”)

preferences {
section(“The Input Switch To Monitor …”) {
input “theInputSwitch”, “capability.switch”
section(“The Output Switch To Control …”) {
input “theOutputSwitch”, “capability.switch”

def installed() {
subscribe(“theInputSwitch”, “switch.on”, switchOnHandler)

def updated() {
log.debug(“Bwg Lights App - Updated”)

def switchOnHandler(evt) {
log.debug(“BWG Lights App - Handling Switch On Event”)
theOutputSwitch.on([delay: 1000])

1 Like

The problem is in

subscribe("theInputSwitch", "switch.on", switchOnHandler)

It should be this instead

subscribe(theInputSwitch, "switch.on", switchOnHandler)
1 Like