Help with multi-level nested parent/child apps

I'm trying to create an app with a multi-level nested parent/child structure.
So, (1) parent --> (2) child --> (3), child
to where child app (Level 2) can have another child app (Level 3). The issue I'm running into is:

  • when I click "Done" on child app (Level 3), it returns me correctly to the setup page for child app (Level 2).
  • But when I then click "Done" on child app (Level 2), rather than returning me to the setup page for the parent app (Level 1), it spits me back to the setup page for child app (Level 3).

I just have the typical parent/child input like this:
app(name: "anyOpenApp", appName: "Child App Name", namespace: "lnjustin", title: "Add a new Child", multiple: true)

Any idea what's up?

Add the nextPage parameter to page definition.

I am not sure a child app can have children, parent grandchildren. I cannot think of any examples either of where I have seen this. Child apps can have child devices.

Sorry, not sure what you mean. Which page definition?

Parent app has a single page:
page name: "mainPage", title: "", install: true, uninstall: false
app(name: "anyOpenApp", appName: "Child Level 1 App", namespace: "lnjustin", title: "Child Level 1 App", multiple: true)

Child Level 1 app has a single page:
page name: "child1Page", title: "", install: false, uninstall: true
app(name: "anyOpenApp", appName: "Child Level 2 App", namespace: "lnjustin", title: "Child Level 2App", multiple: true)

Child Level 2 app has a single page:
page name: "child2Page", title: "", install: true, uninstall: true

Which page definition do you mean? Even though I didn't think separate apps would know about the names of pages in other apps, I tried referring to a page in a different app, but that didn't work...

Somewhat of a related question, what do i do with the install and uninstall attributes of each app's page? Don't I want to install that child app when the user is done with it, so i should include an install: true attribute?

Button rule 5.1 :+1:t2:

4 Likes

Yeah, this was what I was thinking. I could get by with allowing multiple instances to be created. But it's so nice to have everything nested under the same parent app like in button controller.
Maybe @bravenel could shed some light on how it's done in button controller. It works nice there. Just not sure how to navigate between pages of different apps that are parent/child (especially navigating back to the parent from the child, after having just configured the grandchild app)

From parent, you can call a child page with an href.

href url: "/installedapp/configure/$child.id/selectActions", title:...

When Done in the child is hit, it returns from the href, back to the parent.

2 Likes

Download the Hubitat app