Have some app parent/child groovy questions [Answered!]

First off thank you to @Cobra and @bptworld for your code! I've been looking at the apps etc to use as examples. Very readable and much appreciated. I am sort of new to groovy but not javascript, web dev or programming in general.

Since my HE search foo appears to be lacking and the documentation a little scattered.. I have a couple of hopefully simple questions:

  • I am developing a parent/child app and want to specify the name/title of the child app during creation - how do I do this?

  • I need each child app to have a unique identifier - I assume it's "app.id" but is this always unique? Even if I delete and recreate the child app? I am going to do some external DB things and would like to use the app id as a unique identifier so I can reference in certain subscribed events later on.

  • On the parent app I want to create a virtual switch - I think I have an example of this already but what I would REALLY like to do is be able to programmatically add it to the maker API if that app is installed. Is there a way to do this? As a followup if not then can I at least detect if the Maker API is installed?

Apologies in advance for these - I have been parsing through a lot of information and it's been slow and tedious even for simple things.

1 Like

Each app gets its own name. If your child app uses a dynamic page, then it won't automatically have an input for an app name. It could have a method to give it a name, and this method can be called by the parent. Our Groups and Scenes app does this to name a cloned Scene child app.

Every app has a unique identifier. Yes, that is app.id. These are unique, and not reused if you delete and recreate a child.

Adding something to another app is not easy, and requires both apps to cooperate in a predefined way. So it is not possible to add something to Maker API since it has no such pre-defined method of cooperation. There is a method to determine if an app is installed:

isAppInstalled(string nameSpace, string appLabel, string sysUser)

sysUser is either SYSTEM or USER to distinguish built-in apps vs user apps.


isAppInstalled("hubitat", "Maker API", "SYSTEM")


Okay great - so I can set the name during child configuration - makes sense. I just want it to be more descriptive when being displayed under my parent app.

Thank you!

First you create it, then you call a method in it.

Okay cool - method in child, call from parent after save. Can I do it in the child config instead? Guess I would just call the method then..

I don't really want the user typing in a name, would prefer to generate the name/label based on how the user configures the child - kind of like how Simple Lighting displays the user selections for the child I guess..

Hope I'm making sense..

Check out Groups and Scenes. Create a Scene. Then go back to the parent and clone it. See what happens.

1 Like

I'm not sure if this is helpful to you but below is how I control the "default" app label for my child apps.

def installed() {

def updated() {

def initialize() {
    if(!app.label || app.label == "default")app.updateLabel(defaultLabel())

def defaultLabel() {
	return "${variableName} Extra Text as needed"

This is coded in the child app and you can change "variableName" to be the app.id or whatever you need.