Let me start by saying I’m new to this, as I’m sure will be obvious. In creating my first app, I’m having a problem. Both in the simulator and when I publish the app and try it on my phone, the initial setup does not allow me to select a device. My app should allow the user to select three devices, but the “Which” field does not have a + on the right side to allow me to select a device. Code is below.
definition(
name: "Door Alarm",
namespace: "BodaciousDrake",
author: "Stephen Jones",
description: "A switch arms a siren that sounds when a door is opened.",
category: "Family",
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 {
section("When this switch is on") {
input "toggleSwitch", "capabilty.switch", required: true, multiple: false
}
section("And this door opens") {
input "doorSensor", "capabilty.contact", required: true, multiple: false
}
section("Sound this alarm") {
input "theAlarm", "capabilty.alarm", required: true, multiple: true
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
subscribe(toggleSwitch, "switch", switchHandler)
subscribe(doorSensor, "contact", doorHandler)
}
def switchHandler(evt) {
log.debug "evt.name: $evt.value"
if (evt.value == "off") {
theAlarm.off()
}
}
def doorHandler(evt) {
log.debug "evt.name: $evt.value"
if (evt.value == "open" && toggleSwitch.switch == "on") {
theAlarm.both()
runIn(5, theAlarm.off())
}
}