I have a custom DTH that uses the Air Conditioner Mode capability. All works fine in the classic app and it does work in the new app as well. But in the new app, I also get a brief popup error message: “[SA] undefined event, screen [undefined], rt [x.com.st.mode.airconditioner], event [default]” whenever I click on one of the mode buttons.
I have tried a fair variety of things to make the message go away without success. Any suggestions? I’m new to the new app UI so it might be something pretty simple I have missed.
Screen grab of the error:
I’ve also pared down the code to this (which includes the classic code). This code generates the error message in the new app). Edited to add installed(), updated() and init().
// ACTest
metadata {
definition (name: "ACTest", namespace: "FurballUniverse", author: "Dan") {
// tried an assortment of ofcDeviceType, vid and mnmn
capability "Air Conditioner Mode"
}
simulator {
}
tiles {
// for classic app
standardTile("ACmode", "device.airConditionerMode") {
state "cool", action: "airConditionerMode.setAirConditionerMode"
state "heat", action: "airConditionerMode.setAirConditionerMode"
state "fanOnly", action: "airConditionerMode.setAirConditionerMode"
}
}
main"ACmode"
details(["ACMode"])
}
def setAirConditionerMode(mode) {
log.debug "setAirConditionerMode(${mode})"
if (mode) {
String newACMode = mode
switch ( mode ) {
case "auto":
case "dry":
case "dryClean":
case "notSupported":
newACMode = "notSupported"
break
case "cool":
case "coolClean":
newACMode = "cool"
break
case "heat":
case "heatClean":
newACMode = "heat"
break
case "fanOnly":
newACMode = "fanOnly"
break
}
log.debug "..newAC=${newACMode}"
sendEvent(name: "airConditionerMode", value: newACMode)
} else {
stepAirConditionerMode()
}
}
def acModes() {
["cool", "heat", "fanOnly"]
}
def stepAirConditionerMode() {
def currentMode = device.currentValue("airConditionerMode")
log.debug "stepAirConditionerMode() was ${currentMode}"
def modes = acModes()
def i = modes.indexOf(currentMode)
def next = i >= 0 && i < modes.size() -1 ? i + 1 : 0
log.debug " switch to ${modes[next]}"
sendEvent(name: "airConditionerMode", value: modes[next])
}
def parse(String description) {
}
// edited and added the following after suggestion by mvevitsis
def installed() {
log.debug "installed()"
init()
}
def updated() {
log.debug "updated()"
init()
}
def init() {
log.debug "init()"
sendEvent(name: "airConditionerMode", value: "cool")
}