Recent Platform Update Broke Parse Method Response/Result (April 2017)

Update: After a lot more testing, the initial issue I explained below always existed, but manually applying the response command to each item in the list didn’t always work either so I think there’s a larger issue with the way the parse result is being handled.

The one thing I do know is that if you use sendHubCommand and sendEvent instead of returning items from the parse method, everything will work the way it’s supposed to…


A few days ago most of my devices started reporting that they were offline and I tracked the problem down to SmartThings ignoring the events being returned from the WakeUpNotification event handler.

I ended up changing all of my device handlers to use sendEvent instead of using createEvent and that solved the problem, but it didn’t explain why it was only effecting my sleeping devices.

I’ve also been noticing some configuration changes not sticking and users have been reporting issues with the delay features in my siren handlers. There have also been a number of users reporting random problems on the forum this week.

It looks like a recent update changed the response command so that it no longer works with lists that have delays in them and I think that’s the source of all these problems.

Example 1:

This used to work fine, but now the commands don’t get sent to the device:

def cmds = delayBetween([
	someCmd().format(),
	anotherCmd().format()
], 50)
return response(cmds)

Example 2:

This also used to work fine, but now the commands don’t get sent to the device and the events get ignored.

def result = []
result += response([
	someCmd().format(),
    "delay 100",
	anotherCmd().format()])
result << createEvent(...)
return result

No exceptions are thrown for either example…

2 Likes

Several threads on individual devices that are having problems, which I suspect are all because of this.

1 Like

Has SmartThings acknowledged the problem?

So do you think this is the same problem which is causing the off-line reports?

Or is that something different? Based on the forum posts, the Device is off-line issue started several weeks ago, while the refresh issue seems to have started in the last couple of days.

Individual members have reported getting responses from support basically saying that other people were also having problems, but I don’t think anyone has gotten a response from support saying that it was because of this specific Commandset.

@slagle @erocm1231

Tagging @rboy just in case, because he’s been tracking a different problem having to do with locks, and I’m just wondering if it comes from the same platform update. But that might be altogether different.

1 Like

This is what caused the offline problem for 12 of the DTHs I’ve created so it’s possible…

1 Like

It’s just that the timing is weird. Some people started reporting problems about 19 days ago, including the following

But then on April 20, a lot of different people reported that devices which had previously worked suddenly stopped working on that day, specifically multi channel devices and two different kinds of thermostats. And those devices definitely were OK a week ago.

So maybe two different problems?

I’m tagging a couple of people here just in case they have anything to contribute, but it might not be in their area. @posborne @nastevens

The Health Check feature has never worked right and I’ve been having random devices go offline occasionally so it’s probably not related to that post.

It’s most likely the cause of that problem for users that just started seeing it happen and are seeing it repeatedly for the same device.

I’ve noticed that some of the ST DTHs allow the device to skip checking in 4 times before reporting offline so I plan on doing the same with mine to see if that completely eliminates the preexisting offline issue.

I’m just hoping SmartThings fixes this new issue soon because it’s most likely causing problems in all the device handlers I’ve created.

1 Like

I also noticed delayBetween blew up for me as well.

@JDRoberts @krlaframboise

1 Like

Testing became really unreliable so I’ve revised my original post.

I’m not sure, it is very hard to distinguish the two. My best guess as a Software Engineer would be that the "offline’ feature has a bug (obviously), and that can cause some devices to appear offline. Turn that feature off, and some of the devices return to life, but some remains stuck in some internal mode as ‘offline’. Since I am not familiar with the internal Smartthings SW Architecture it’s hard to say. I imagine that are two or more bugs here that in some circumstances can accentuate each other.

The fact that I have to manually go and ‘re-activate’ devices implies there is something fundamentally wrong with the hub in my opinion. And now I got some devices back, it remains to be seen if they stay active or not.

But generally Samsung and Smartthings are a little crazy. They have a killer product, with a great development platform for the community, and then they have this pretty poorly designed app with an antiquated and impossible to use in real life “modes” (beyond rudimentary things when you have 3 devices, "modes’ need a redesign, but I have another post from 3 years ago telling Smartthings that, and how to do it right - totally ignored by the way). Their technical issues seems to be mostly ignored, probably while they try to scale, and of course most people do NOT have 50-60 devices like me. But if they would spend more time promoting smart apps that were beyond rudimentary and actual functional, they would in my opinion have a much better outlook on their business. But hey, what do I know. I LOVE this when it works, and I have developed my own apps that ARE actually functional (Like IF the light is already on then DON’T turn it on and off when something moves, but rather leave it on)…

There I go, ranting again… :slight_smile:

If a DTH implements the Health Check capability then it tells SmartThings how often it should check in and if that amount of time goes by without the device checking in, SmartThings sends a ping command.

That works great for most powered devices, but if the device sleeps then the ping command gets ignored and SmartThings marks it as offline.

You shouldn’t have to ‘re-activate’ a device that goes offline because if the device is OK the status will change back to online the next time it wakes up.

The wakeup interval can be set to anywhere from 1 second to 45 days, but the default for most devices I’ve seen is between 5 minutes and 12 hours.

The new bug introduced a few days ago prevented 12 of my DTHs from creating events when they woke up so the only time they’d change to online is when they reported something like temp or motion.

I think part of the problem with the Health Check feature is that it hasn’t been documented yet and SmartThings hasn’t been consistent with the DTHs they’ve added it to.

1 Like

You shouldn’t have to ‘re-activate’ a device that goes offline because if the device is OK the status will change back to online the next time it wakes up.

I agree with you. I really shouldn’t have to. Yet, that’s what support told me to do. :frowning:

1 Like

The thing is, the off-line problem that started about three weeks ago is being reported for mains powered switches as well, by quite a few people. So it’s not just a sleepy device issue.

But that one started a few weeks ago, and it looks like the refresh () problem just started on April 20.

So two different problems, I think, even if they may sometimes have the same symptom.

1 Like

OK, yet another twist…

@XFighter
has been researching the problem that started about three weeks ago and has discovered that it is associated with DTHs that do a frequent refresh() on mains powered devices, including GE switches.

I still don’t know why there are two distinct waves, though: the first one involved devices being reported off-line and failing to respond and started about three weeks ago.

The second wave had a very specific start date, April 20, and is the one that affected multi endpoint devices and several thermostats.

I wonder if some engineer working on the first problem made a change that created the second one… They clearly seem to be related, but also to have different timing.

Still getting this on the same switch after removing it and adding it back numerous times. Alexa will not work with it when it is like this either.

Now, if I click the X and close out the “notification” clicking the on/off button does nothing. But… Using the slider does wake it back up. Also manually touching the switch wakes it up as well.

The app just doesn’t refresh the on/off status. If I try clicking the off button after it was awoken by the slider, it just sticks on “turning off” even though it did turn off. If I back out then it says On. Therefore I can’t turn it back on unless I use the slider, but soon it will say unavailable again.

Alexa still says it is not responding.

No sure what to do.

I was starting to pull my hair out trying to send configuration to my Fibaro Motion Sensor on wakeUp event. I noticed that my other DTH that was working flawlessly up to this point (for Fibaro KryFob) also stopped sending commands to the device on wakeUp. I spent few hours debugging and found sendHubCommand command before I checked the forum…

Conclusion: I have to check this forums more often when having issues - it would have saved me a headache. :wink:

And just a day ago we were joking with @erocm1231 how SmartThings can brake the most unexpected parts of the API at any moment :smiley:

2 Likes

OK, I have coded a workaround for my SRT321 device handler.
Basically it looks like SmartThings broke HubMultiAction for sendHubCommand, as I was getting a cast error saying it was failing to cast to HubAction.

However parsing the list of zwave commands into individual sendHubCommand calls works:

	cmds.each 
    { zwaveCmd ->
            def hubCmd = []
            hubCmd << response(zwaveCmd)
            sendHubCommand(hubCmd, 1000)
    };

This is replacing the response in my ZWave Event code:
// [event, response(delayBetween(cmds, 1000))]

2 Likes

Just making sure I understand, is this the code that was causing a cast error? Can you provide the entire function so that we can reproduce?

1 Like

You can also check the first bug reports in the community – created wiki. There’s a separate section there for bugs in the developer platform.

Entries are just a very brief description and a link back to the discussion threads in this forum, but it can be a fast way to check if others are seeing problems. :sunglasses:

http://thingsthataresmart.wiki/index.php?title=Bug:_First_Reports#April_2017_5

1 Like