Programatically delete a child smartapp?

I’m trying to make it easier to uninstall my SmartApp when there are Child SmartApps being used. (Not that I want folks to uninstall but sometimes it is just necessary or wanted).

When I use the “Delete” option in the parent SmartApp it complains that there are devices still using it (which are really the SmartApps). So I wanted to go ahead and delete the children apps in the uninstalled() function. But to my surprise, I’m not finding a deleteChildApps() (or similar) in the API Docs.

Am I missing something, or is there really no way to programatically remove a child app?

1 Like

Anyone? Bueller? @slagle?

Am I missing something here or is there really no way to programatically delete Child SmartApps from the parent?

Child apps are automatically uninstalled when you uninstall the parent app. No need for a programmatic way to remove the child app in uninstalled. It’s taken care of for you.

Just like Smart Lights. Not sure which “delete” method you are using. But if you go to the parent app and Smart Lights, and hit the uninstall button it removes all the automations (child apps)

1 Like

I am using the built in delete using the red “Remove” button at the bottom of the app.

But if I have any children apps I get this error:

“Device still in use. Remove from any SmartApps or Dashboards, then try again.”

I have to then go in manually and delete the Child SmartApp to be able to delete the parent.

I should note that the Child SmartApp does has selected Thermostats that it uses in its settings (to determine which thermostats to act upon). So I suspect that it is this selection that causes the problems. But the Parent SmartApp I’m trying to delete is the one that manages said thermostats (Ecobee (Connect) SmartApp).

So I’d really like to be able to programatically delete those children SmartApps since it won’t let me delete the parent when they are installed.

Sounds like your ecobee connect app isn’t remove the child devices. I assume it is adding child devices as part of being a “connect” app?

What i assume is happening is you have the connect app install a device. you then use a child app of that connect app to control the thermostat installed by the connect app.

So you are running into something like this.

Uninstall connect app>Try to remove devices>devices have apps associated to them>can’t remove device because device has app>fail

Right, that is also my guess. I am currently using the automatic device delete (which works fine when no child apps are installed).

So how do I fix this situation if I can’t programmatically remove the child apps??? Perhaps the backend needs to change the order that it executed the deletes? First it needs to delete child apps, then it would delete child devices.

Btw, the majority of the basic functions are in the main Ecobee (Connect) app and the Device Handler. The Child SmartApps are for more specialized functionality such as hooking into the Hello Modes (Routines), for example.

ill see what I can do for the backend. For now, Bring the childapps in question out of the connect app

For now, I’ll just manually delete the child apps. It will be fewer people uninstalling the app than there will be using it on a day-to-day basis. I’d rather cater towards the regular user here since having the apps integrated will give a much better user experience.

And if you need a fuel for the fire, just remind the devs that there is an API method for deleting child devices already, so makes sense to also have a method for deleting child apps as well.

Thanks for your help!