Installed and Update both called when a Smartapp is installed

@vlad @kleneau @slagle another issues I found a few weeks ago:

When a new SmartApp is installed (in particular Parent-Device Child relationship SmartApps but have also seen with regular smartapps) and also DH’s, the platform calls the installed() function immediately followed by the updated() function. This is causing problem because the initialize is barely done with it’s z-wave commands and suddenly updated is called. The variables get messed up and the device commands got nuts.
E.g. lock manager, on installed it clears the device and then programs it. Now updated is called immediately and it starts reprogramming the locks, no matter how many synchronization mutexes I use, it still creates confusion.

It should not be calling updated() when installed.

2 Likes

I can validate that as well. When developing changes for the FortrezZ water meter and an associated SmartApp I noticed that too. At first I thought I was doing something wrong, so I just removed it. Thanks for posting this @RBoy, at least I know it’s not me.

1 Like

Well this isn’t the funkiest thing I’ve reported. Here’s the doozie I had reported to @slagle

In the Foscam DH I have, there’s an updated() method defined and some custom commands. When a SmartApp calls the custom command the platform executes the updated() function!!! Now that’s causing some serious issues :slight_smile:

Everytime a custom command is called, it executes updated() :)))

1 Like

This “feature” isn’t new, it has been there since day one…

Which one? I reported 2 above

Sa calling updated and installed on initial install.

1 Like

I am reasonably sure for a while in between it didn’t. I can’t say it did initially but sometime ago it didn’t and then it started. Maybe it was fixed and broke again, can’t say.

Not suprising…
For most apps it’s just needless extra load on the platform.

The issue for me is more than load, it’s functionality being broken because of race conditions and network issues (overlapping commands)

3 Likes

I’m still experiencing this a year later. My installed and updated methods are both being called when installing a SmartApp.

1 Like