The docs say it’s not possible to rename a device except as a user via the IDE. Is this accurate?
If so, how are others dealing with child devices that may need to be renamed but are in use by other SmartApps/routines?
My use case is a SmartApp that’s creating virtual switches. I create the virtual switch when you instantiate the child app, but if the child app is renamed, the name of the virtual switch may no longer make sense.
I’m generating a unique-enough ID for each child device and could certainly use that in the name, but that’s not terribly user friendly when it comes time to choose from a bunch of devices named “SmartApp - 3090923984729”, “SmartApp - 397293847562”, etc. Alternatively, I could add a paragraph in the prefs for the device that says “Don’t rename this or stuff will get confusing”, but that’s not desirable either.
tgauchat
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
2
Don’t Devices have a distinct Label in addition to Name?
They also have an internal immutable Object Device ID, but perhaps you can still manipulate Name and let the user manage the Label or vice versa?
8:39:07 PM: error java.lang.IllegalArgumentException: argument type mismatch @ line 56
8:39:07 PM: debug New device label: New Name
8:39:07 PM: debug Child device label: [null]
The exception comes from the last line of the code above. I notice that childSwitch.label has brackets around it (even when it’s non-null). The API docs say this attribute is a String, but the exception seems to contradict that. I feel like I’m missing something data type related, but can’t quite figure out what.
tgauchat
(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy)
4
Isn’t childSwitch a collection of Devices (plural)?