addChildApp how to pass properties, and where do they go in the child

Does anyone have an example of passing these parameters?

SmartApp — SmartThings Classic Developer Documentation (scroll down to addChildApp)

DeviceWrapper addChildDevice(String namespace, String typeName, String deviceNetworkId, hubId, Map properties)

In SmartThings you could use things like:

addChildApp("mynamespace", "my app", "My app label", [settings:[var1:["type":"bool", "value":true]]])

To fill in settings. I assume state was similar form (I used settings).

I have tried a bunch of permutations without success...sometimes there is an error of cannot save, so something go in but barfed...

Sorry we have not documented the use of those methods yet, however the signatures are documented here:

App Method Documentation

Currently for the last parameter "properties" we do not support any values that are passed in. I've just added a ticket to support settings in the future however.

1 Like

On App Object | Hubitat Documentation

Is the following signature still misleading - i.e., are supplied properties still ignored when creating the Child App?

InstalledAppWrapper addChildApp(
    String namespace,
    String name,
    String label,
    Map properties = null

Are there plans (is there a ticket #) for implementing passed properties?

In the mean time...

Is this approach the best alternative?

  1. Create the new child without passing in properties.
  2. Reference the child by it's unique Id OR ensure the child's label is unique,
    e.g., keep only the latest child app (unique Id) per child app label.
  3. Have the child call a parent method,
    e.g., LinkedHashMap parent.getPropertiesMap(String childAppLabel).
  4. Expect said method to return the properties map that would have been supplied to addChildApp().

Create the child app, then call a child app method, passing whatever you want to it.