So I have a number of GE Z-Wave in wall switches. I wrote a simple app so I can have them automatically turn off after a set amount of time when they are turned on manually.
It worked great for a long time, but a few months ago it stopped working. Has there been any API changes to events? Or did something happen to the device handler? Thanks for any help anyone can provide.
Here is the debug output from the event handler. It used to be these outputted more data, but for some reason the event is almost empty now. It used to be that “IsPhysical()” would return true when you turned on the light using the switch, now it is always false. Also, device source is always “Device”, even when you use the SmartThing app to turn on the light.
debug event display name: Pantry Light
debug the name of this event: switch
debug The value of this event is on
debug event raw description: null
debug event description: {{ linkText }} {{ name }} is {{ value }}
debug event from digital actuation? false
debug event from physical actuation? false
debug The source of this event is: DEVICE
Here is my simple code generating the data above:
preferences {
section {
input(name: "phySwitch", type: "capability.switch", title: "For these switches...", multiple: true, required: true)
input(name: "timerDelay", type: "number",title: "Turn off in... (in minutes)", required: true, defaultValue:5)
}
}
def installed() {
log.debug "Installed with settings: ${settings}"
initialize()
}
def updated() {
log.debug "Updated with settings: ${settings}"
unsubscribe()
initialize()
}
def initialize() {
subscribe(phySwitch,"switch.on",turnOffIn)
}
// TODO: implement event handlers
def turnOffIn(evt){
log.debug "the name of this event: ${evt.name}"
log.debug "event display name: ${evt.displayName}"
log.debug "The value of this event is ${evt.value}"
log.debug "event raw description: ${evt.description}"
log.debug "event from digital actuation? ${evt.isDigital()}"
log.debug "event from physical actuation? ${evt.isPhysical()}"
log.debug "The source of this event is: ${evt.source}"
log.debug "Ohh, ${evt.descriptionText} happened, lets see if I can do anything!"
if (evt.isPhysical()) {
log.debug "The event was physical, starting off timer!"
runIn(60*timerDelay,"turnOffSwitch")
} else {
log.debug "Aww, the event was digital, I don't get to do anything."
}
}
def turnOffSwitch(){
phySwitch*.off()
}