tl;dr - The platform update scheduled for the week of April 17, 2017, will include limits to the maximum number of child Devices or SmartApps (or a combination of) that SmartApps or Device Handlers may have. This limit will be a maximum of 500 children.
SmartApps and Device Handlers may themselves have child SmartApps or child Devices. For example, Smart Lighting consists of a parent SmartApp (the SmartApp you install from the marketplace), and each Lighting Automation is an instance of a child SmartApp. Every different Lighting Automation you create in Smart Lighting is creating a new instance of the child SmartApp.
Similarly, SmartApps may create child Devices; this is a common pattern used for LAN- or Cloud-Connected Devices, where the Connect or Service Manager SmartApp discovers and creates the child devices. The new Composite Devices feature allows Device Handlers to spawn child devices as well.
The next platform update will introduce a limit on the number of children each installed SmartApp or Device Handler may have. These limits will be put in place to prevent scenarios where a rogue SmartApp or Device Handler creates an unbounded number of children, causing a poor user experience and unnecessary platform strain.
The details follow.
What
Each installed SmartApp will be limited to having a combined maximum of 500 child SmartApps and Devices.
Each installed Device Handler will be limited to have a maximum of 500 child Devices.
(These limits apply to the total number of children the parent has, regardless of the specific type of the child SmartApp or Device.)
When
We will introduce this limit in the next platform deploy, currently scheduled for the week of April 17, 2017 (the exact date of the deploy is subject to change based on regular ongoing regression testing). We will follow up on this thread when the deploy is complete.
End-user impact
In the highly unlikely event that an end-user attempts to exceed the limit, for example by creating 501 Lighting Automations in Smart Lighting, an error will occur in the mobile app. Our analysis of current child installation data shows this to be an extremely unlikely scenario.
Developer impact
The limit of 500 is one that is extremely unlikely to be encountered through any non-error scenario, and thus typically does not require any coding workaround by the developer. More likely it could be reached if there is some faulty looping logic to create child SmartApps or Devices. A SizeLimitExceededException
will be thrown if attempting to add more than 500 children.
If you would like to know the number of children a SmartApp or Device Handler has, you can do the following:
For a SmartApp:
def childrenCount = getChildApps().size() + getChildDevices().size()
log.debug "This installed app has $childrenCount children"
For a Device Handler:
def childrenCount = getChildDevices().size()
log.debug "This installed device has $childrenCount child devices"
Future limit adjustments
The limit of 500 is being put in place to prevent runaway SmartApps or Device Handlers that create an unbounded number of children, typically inadvertently. We will be monitoring child install data, as well as an analysis of platform performance as the number of children grow.
If our analysis shows that a further reduction to the limit is necessary to increase platform performance or reliability, the limit may be reduced in the future. Any future decrease in the limit will be communicated two weeks prior to the reduction, unless an unforeseen and severe platform performance or reliability issue necessitates an immediate reduction (this is not expected!).
Please let us know if you have any questions, thank you!