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.
On App Object | Hubitat Documentation
Is the following signature still misleading - i.e., are supplied properties still ignored when creating the Child App?
Map properties = null
Are there plans (is there a ticket #) for implementing passed properties?
In the mean time...
Is this approach the best alternative?
- Create the new child without passing in properties.
- 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.
- Have the child call a parent method,
LinkedHashMap parent.getPropertiesMap(String childAppLabel).
- 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.