Event Handler Not Responding?

@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") }

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

Switch works fine.

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

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”.

4 Likes

@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.

2 Likes