Common Composite (Child) Device Handlers

So I recently added some functionality to a device handler of mine that required several child handlers to be used. I though, “this is going to be a pain for the community to install all of these” (especially if they don’t have github integration setup). So I had a thought that it would be a good idea for community developers to use a common set of child device handlers. At least until SmartThings releases their own. This would make things a lot easier for developers and users utilizing this new functionality. Here is a list with links for all the composite handlers I have created. Anyone is free to use them if they would like as well as add any missing capabilities by posting in this thread.

Child Device Handlers:

Contact Sensor
Metering Switch
Smoke Alarm
Water Sensor
Carbon Monoxide Sensor
Carbon Dioxide Sensor
Motion Sensor



I really appreciate you posting these Child Device Handlers here. Great idea for everyone to share a common pool. Thank you!

One thing I have noticed is that it appears the Parent DH and the Child DH must be in the same namespace. Otherwise, the Parent DH fails to add the child device. I simply copied and pasted your code into a new DH. When it kept failing on the addChildDevice() call, I tried changing the namespace and author in the definition to match my values in my parent DH. Afterwards, the addChildDevice() call succeeded.


1 Like

So when creating a child device from a SmartApp you can specify a name space. Haven’t tried it yet with a composite device but will when I get a chance. If it doesn’t work that would be too bad as that would mean you couldn’t even use a common set of SmartThings provided child handlers. This is the command that I use in one of my apps:

def child = addChildDevice(“erocm123”, “SmartLife RGBW Virtual Switch”, getDeviceID(i), null, [name: getDeviceID(i), label: switchName, completedSetup: true])

There are obviously some variables in there so it isn’t a complete explanation, but just a demonstration that it can be done (in a SmartApp).

1 Like

@ogiewon Ok, so I just verified and if you put the name space in front of the Device Handler name, then you can use handlers that don’t have matching namespaces. For example:

addChildDevice(“erocm123”, “Metering Switch Child Device”, “${device.deviceNetworkId}-ep${i}”, null,
[completedSetup: true, label: “${device.displayName} (Q${i})”,
isComponent: false, componentName: “ep$i”, componentLabel: “Output $i”])


Thanks for the solution! I appreciate you taking the time to figure this out.

Eric, how about a dimmer switch? We have one on the Zigbee Ceiling Fan/Light controller. I am sure you must have one in mind because the H801 uses it right? What do you recommend we change below to fit in best with the new unofficial composite standards?

Yeah, I definitely am working on bringing child devices to the H801. My plan was to use a “Dimmer Child Device” that would look a lot like that one minus the custom icons. So I’m not sure if you want to make any changes to it. I could maybe list it in the original post as an alternative that some could use.

Thanks for the reply. OK , Anyone of course can grab the code. In my case I do want to use the custom icons because it is matching the icons of this specific product hardware controller. So go ahead and pick a dimming light bulb icon to make it compatible for your composite library.

@ogiewon Ok, so I just verified and if you put the name space in front of the Device Handler name, then you can use handlers that don’t have matching namespaces. For example:

addChildDevice(“erocm123”, “Metering Switch Child Device”, “${device.deviceNetworkId}-ep${i}”, null,
[completedSetup: true, label: “${device.displayName} (Q${i})”,
isComponent: false, componentName: “ep$i”, componentLabel: “Output $i”])
this is giving me hard time it continues to fail whatcan be the issue

I did this too buy ddnt work

I ended up making a complete set of Child Device handlers for my ST_Anything project, using my own namepsace and stored in my Github repository. I did this primarily to allow users of my project to simply use the ST IDE Github integration for ST_Anything, making adding and maintaining the custom DH’s much simpler for everyone. Feel free to take a look at my parent and child device handlers to see how I have chosen to implement the Composite Device Handler. I implemented an automatic child creation mechanism within the parent DH, which allows the user to customize their Arduino sketch to include whatever “devices” they’d like and have the corresponding children automagically created. Users of ST_Anything do NOT need to customize the DH groovy code at all (unless they want to customize the child devices to their liking.)

1 Like

this one is a bit complicated for my level. is there a step by step on how to install it. I have tried installing ST_Anything aswellwith the documented Child Device handlers but didnt win at all

The ReadMe on my Github is a set of step by step instructions.

What are you trying to accomplish? Knowing that would help us to be able to help you.

I bought this device Fibaro Double Switch 2 fgs-223 EU v3.2 and trying to get it to work with my smartthings hub. I have a double switch on my wall controliing two light. in short am trying to have a one switch that splits into two once i enter it. eg kitchen------->switch1---------Switch2

SmartThingsPublic/devicetypes/erocm123/metering-switch-child-device.src/metering-switch-child-device.groovy this was probably the closest but couldnt get the parent to call it out.

Since you’re trying to use a Fibaro device, neither my code nor @erocm1231’s is going to work without some changes.

Personally, I would recommend you start with the example code highlighted in the following post. This appears to be very similar to what you’re trying to accomplish.

thank your for your reply this worked. it shows 5 channels at the moment and am only using the first two. thank you.

1 Like

I have a handler created for that device that uses the composite device scheme. Have you tried it?

Also, I’m really surprised that putting the namespace in the addChildDevice call didn’t work. In my testing, it allowed me to use other people’s namespaces:

addChildDevice("erocm123", "Metering Switch Child Device", "${device.deviceNetworkId}-ep${i}", null,
[completedSetup: true, label: "${device.displayName} (Q${i})",
isComponent: false, componentName: "ep$i", componentLabel: "Output $i"])
1 Like

thank you for the time you put working in these things. I tried your code earlier but it didnt work I tried it now again and its working just fine. do youhave any thing for the fibaro roller shutter fgr222eu2.5

Sorry, I do not.