I’ve created a parent/child app. I’d like to calculate the app name (which appears in the listing in the parent app) based on what’s been set.
The “Smart Lighting” app does this. It’s smart enough to know that the child app name should default to something useful, like: “Turn on Front Porch Light at sunset”.
Here’s what I’m seeing:
When the child app runs, at the bottom it prompts: “Assign a name”.
A name can be entered manually, and that’s what’s listed in the parent app.
If I leave it blank, it uses the “name” value in the definition block for the child app. That same name is used over and over, if I create multiple instances of the child app.
Does anybody know how I can set the child app name to a sensible value, if the user chooses not to enter a value?
Were you able to actually get this working?
When I try to assign to the label property, it throws an exception like:
groovy.lang.ReadOnlyPropertyException: Cannot set readonly property: label for class: physicalgraph.app.InstalledSmartAppWrapper
I’ve tried direct assignment:
app.label=“New SmartApp Label”
Calling a mutator:
setLabel(“New SmartApp Label”)
Nothing I have tried works. I even tried specifying a “default” in the label statement, which seems to be ignored. Interestingly, the “description” parameter will display in the input field for the label, but vanishes as soon as anything is typed.
How exactly have you been able to programmatically assign a value to the label property? I’m stumped.
App.updateLabel() which is in the docs
Thank you! I swear I’ve read the parent/child smartapp page many many times and never saw the use of updateLabel. Now, of course, it jumps right out at me. But - thank you thank you thank you. I’ve been going through chemo for 4 years as of last November and my brain and memory don’t work the same anymore.