Function not executing

Because I have different types of switches and I’d like to handle their events differently.For example, some switches turn on lights and others turn on fans. You can assume that the handleSwitchEvent from my snippet deals with Lights differently.

Are you able to reproduce my issue?

Is anyone able to help with this? Should be easy to reproduce.

The IDE is not throwing errors when they occur. Is it possible that is affecting this situation for you? I had an app where the devices were the same, but somewhere along the way how the platform executed the code in the two different functions changed. It was actuallly creating an error that was never thrown.

Thanks for your help on this but it seems to be a different issue. I’m trying to subscribe to events for 2 different groups of devices with the same capability but only one event handler is firing.

If you create a smartapp based on this situation:

input “switches”, “capability.switch”, title: “Which Switches?”, required:false, multiple: true
input “lights”, “capability.switch”, title: “Which Lights?”, required:false, multiple: true

def initialize() {
subscribe(switches, “switch”, handleSwitchEvent)
subscribe(lights, “switch”, handleLightEvent)
}

def handleSwitchEvent(evt) {
log.debug “switch event fired”
}

def handleLightEvent(evt) {
log.debug “light event fired”
}

Can anyone tell me my the event handler fires for the devices in the switch group but not the devices in the light group?

Never mind, it seems that breaking each event out into its own function, even though they are doing the same exact thing, fixed the issue. Seems like a bug but I’m good to go for now.

So if I understand what you’re saying, having two subscriptions to the same handler failed?

If so, then there was likely an error generated that wasn’t thrown such that you could see it. If this is the case, then this is really getting frustrating. And if so, then this IS the SAME problem. I hope they fix this soon!