SmartApp event handlers fire only once per subscribe() call

Hey all,

A few days ago all of my smartapps started having problems reliably reacting to events from subscribed devices. It might coincide with the 27.8 firmware update (I have a hub v2) but im not sure. It looks like after calling subscribe(), the smartapp’s event handler will run fine only for the first event, after which the handler will no longer run for any subsequent events. Calling subscribe() again fixes the issue but also for only one event.

This issue is affecting all my smartapps for all event types such as contact sensor, switches, buttons etc. One of my smartapps affected is very simple and looks something like this:

def installed() {
	initialize()
}

def updated() {
	unsubscribe()
	initialize()
}

def initialize() {
    subscribe(button, "button.pushed", buttonPushHandler)
}

def buttonPushHandler(evt) { 
	log.debug "BUTTON PUSHED"
}

For the above smartapp, pushing the button the first time will trigger the handler, but the handler will not fire again for any subsequent pushes until I “reconfigure” the app which calls the subscribe() inside updated(). I can see from the button device event log that the pushed event is being fired each time.

Is anyone else seeing similar problems? Any help would be appreciated.

have you tryed
subscribe(button, “pushed”, buttonPushHandler)

I tried that, but then no event is received by the smartapp.

After some more testing, it seems like every 2 in 3 events or so are being dropped and not delivered to the smartapp. I tested this by opening and closing a door 3 times. In the sensor event list I can see the open event 3 times, but the smartapp only receives 1 out of those 3 events.

This seems to be a problem with the SmartThings platform. I don’t know if any of their staff frequents this forum so I’ll try to contact support.

If a different device is not logging events might be a weak z-wave mesh

I’m seeing the same exact problem with ArloPilot, which subscribes to SHM mode changes. It used to work flawlessly, but since a couple of days ago it seems that the handler is not being called consistently. I bet a recent firmware upgrade broke this.

Here’s a quick sample code that reproduces this issue:

def installed() {
	initialize()
}

def updated() {
	unsubscribe()
	initialize()
}

def initialize() {
	subscribe(location, "alarmSystemStatus", alarmSystemStatusChanged)
}

def alarmSystemStatusChanged(evt) {
	log.debug "SHM mode changed to: ${evt.value}"
}

For the past two days all of my smartapps are only seeing around 1 out of 5 mode changes with the usual

subscribe(location, “mode”, modeChangedHandler)

So smartthings is effectively down for me :frowning:

Something has to still be wrong on the smartthings side. This has been going on for a couple days now. I’d say only 20% of events are currently being handled by my smartapps or even by smartapps integrated into smartthings such as Alexa, Ring and IFTTT. Who knows what’s happening to the rest.

For instance, I have a contact I’m using to test. When I open the contact, smartthings immediately detects it. I see the events in the logs through the IDE. I then have a smartapp that subscribes to this contact for open/close and opens a url. I’m logging all events that are detected by this smartapp. At this point, this should all be occurring in the smartthings cloud, yet I’m lucky to receive 1 in 5 events.

This is very frustrating.

Its been driving me crazy, glad I am not the only one. Having problems with apps that subscribe to motion subscribe(motion1, "motion", motionHandler)

Its not reliably getting the active and inactive, for a couple of days now

Anyone else still having problems? My smart app just failed to receive yet another SHM mode change event this morning.

It would be really nice to get confirmation from SmartThings staff that they are aware of this issue and working on a fix.

Still having problems with receiving events reliably. Haven’t had a chance to contact support yet

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.