Event Handler Not Responding?


(Eric) #1

@RBoy is this similar to your issue or am I doing something wrong? Not posting all the code, but I think you will get the jist. The “switch” event get’s called every time, but when I dim up or down the setLevel event never happens.

section("Dimmers") { input "dimmers", "capability.switchLevel", title: "Dimmers", multiple: true, required: false }

section("Lights") { input "lights", "capability.switchLevel", title: "Lights", multiple: true, required: false }

subscribe(dimmers, "switch", switchHandler)
subscribe(dimmers, "switch.setLevel", levelHandler)

def switchHandler(evt) { log("Begin switchHandler(evt).", "DEBUG") log("End switchHandler(evt).", "DEBUG") }

def levelHandler(evt) { log("Begin levelHandler(evt).", "DEBUG") log("End levelHandler(evt).", "DEBUG") }


(www.rboyapps.com - Make your home your butler!) #2

Is the switch handler being called? In wondering if the definition is causing a conflict


(Eric) #3

Switch works fine.


(Eric) #4

I’ve also tested the devices with CoRE and it get the setLevel event just fine.


(Kevin) #5

The switchLevel capability has the attribute “level” so that’s what you should be subscribing to. The command used to change the attribute is setLevel, but you subscribe to the attribute event, not the command.

Don’t prefix it with “switch.” because the switch attribute has the possible values of “on” and “off” so the only events you can subscribe to are “switch”, “switch.on” or “switch.off”.


(Eric) #6

@krlaframboise - That was it. I really appreciate it. I really need to stop working on a SmartApp and a completely unrelated device handler at the same time.