Parent/child app

I believe that parent/child apps are not currently supported.

Is there a plan to add this so we can easily port ST parent/child apps across?

Andy

1 Like

Not sure how that rumor got started, we support parent child apps.

3 Likes

Yippeeeeee! :slight_smile:

Thanks for the reply Mike

Note: Parent / Child Device Drivers (not apps) are not yet available on Hubitat.

1 Like

Ah!
That’s where the confusion came from - thanks

I helped that rumor along :smiling_imp: and will make it my life’s mission to squash it :skull_and_crossbones:

1 Like

@mike.maxwell while there is support for parent/child it does work a little differently in Hubitat. I believe you guys should post a couple of guidelines before developers and users start porting apps regularly.

For instance:
Using the built in Button Controller as my guide, I configured the ABC app to force you to click done (only the first time it is loaded) to ensure the parent app was completely installed before configuring any child apps. If this is not done, Hubitat saves the child app before saving the parent app which breaks their link. The orphan child can only then be found by opening the device page (for any device configured in the App) and looking for the “In Use By” section.

A quick Best Practices on this will avoid a bunch of post regarding “lost” child apps.

Just my 2c worth.

When I left ST, this is how it worked also. Perhaps they fixed it? If so, what did they do? Remove all the orphans if the parent is abandoned? Or install the parent anyway?

I’m not sure. The flow was a little different on ST too.

In SmartThings:

  • App would open to the parent main page

  • Click to setup new child

  • Configure child

  • Hit Done

  • You would then be dropped back to the PARENT MAIN page

  • Click save

  • Child and parent were installed and linked.

Hubitat using same code:

  • App would open to the parent main page

  • Click to setup new child

  • Configure child

  • Hit Done

  • You would then be dropped back to APP LIST page

  • Child installed but not linked to parent

Ah, there is a bug about going back to the App List instead of back to the parent. I think we may have that fixed in next release. Will check.

2 Likes

Can you share the code you are using to replicate this? This is not how it should work. I recreated a simple parent / child app and after adding the child, it returned to the parent.

Great…I happen to like the way your built in apps force the parent to initialize and install before allowing any child confiigs. May I be so bold as to recommend this be a best practice (even when the above is fixed). It’s intuitive and really easy to include in existing code.

I did it using a state variable…there’s probably a better way, but I have to resort to my very limited programming skills.

I added the following at the beginning of my parent mainPage

if(!state.abcInstalled) {
            section("Hit Done to install ABC App!") {
        }

And added this to my install method:

def installed() {
    state.abcInstalled = true
	initialize()
}
https://community.hubitat.com/t/beta-advanced-button-controller-abc?source_topic_id=534

If you remove the 2 changes I described in the post above, you should see what I’m referring to.

We use a state variable also. No other way to remember it.

So, if I remove the SubmitOnChange:true from your first input of your child device, it functions properly.

So it seems its a deeper issue with a child submitting on change before the parent is installed.

Right now, your workaround will solve this.

If parent/child is supported, why is my BigTalker code just repeating the setup process for the parent app?
Parent and child code are listed here: BigTalker2/smartapps/rayzurbock at master · rayzurbock/BigTalker2 · GitHub

Hubitat took the code, but when I go through the setup process, I expected to go back in and be able to setup groups (child apps); however it just went through the initial process again.

I cannot find any documentation on the development process for the Hubitat environment? Is there documentation somewhere?

Also, is there a cross reference somewhere? ST <> Hubitat?
Such as instead of physicalgraph.device.HubAction() in ST use hubitat.device.HubAction() in Hubitat?

Are you talking about after hitting Done in a child app? There is a bug about to be fixed where doing that kicks you out to the Apps list. The way to get around it is to hit Done on the Parent before creating any child apps. Then go back in. It’s supposed to take you back to the parent, but for the bug.

You just authored the cross reference. That, plus no tiles or simulator in drivers. A few minor differences in cloud urls and json.

2 Likes

I think it was my bad this time @stephack… oops.