Today SmartThings deployed a device handler for the Zooz ZEN20 Power Strip that uses the recently released Composite Devices feature of the SmartThings platform. The ZEN20 is a Z-Wave device with five separately switchable outlets. There was no published device handler for it before today, but Community members stepped up and created handlers that allowed the individual outlets to be controlled with custom commands (and we appreciate those contributions). The custom command approach worked great in allowing each outlet to be individually controlled from the device detail page, but it didn’t allow many SmartApps such as Smart Lighting to control individual outlets because those apps only work with the standard Switch capability. A custom SmartApp was required to control the individual outlets. At the time these handlers were written, there was no alternative to this approach.
Now that the platform allows devices to have child devices this limitation can be overcome. The ZEN20 device has five child devices – one for each switchable outlet. These child devices don’t appear in the Things and Rooms views, but they do appear in the list of devices when configuring the capability.switch input of a SmartApp. That lets you control individual switches from any SmartApp capable of controlling a switch. The child devices also appear in the device detail page of the parent device, allowing individual outlets to be controlled from the SmartThings mobile app.
More composite devices will be coming soon. We expect to release a composite version of the Aeon SmartStrip next week. It has four individually switchable outlets that will now appear as child devices of the strip. In general composite devices are useful when a device has multiple attributes or commands that fall under the same capability. For example, a refrigerator typically has two separate temperature sensors — one for the frozen foods compartment and the other for the main compartment. Using a child device for each of these compartments will allow generic temperature monitoring SmartApps to be used, since each child device has its own temperature attribute.
There’s information here about how to create and manage the child devices of a composite device type. We’ll be adding to it to describe how to display child devices in the parent’s device detail page. In the meantime you can look at the Zooz ZEN20 source code for an example of displaying the child outlet devices as 1x6 tiles in the parent detail page and this simulated refrigerator device type as an example of how to display more than one child device in the parent’s detail page with different tile sizes.