# Composite Device Handler with ThingShield

**URL:** <https://community.smartthings.com/t/composite-device-handler-with-thingshield/85833>\
**Category:** Writing Device Types\
**Tags:** childdevice, thingshield, composite\
**Created:** [April 26, 2017, 3:40am UTC](https://community.smartthings.com/t/composite-device-handler-with-thingshield/85833 "2017-04-26T03:40:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ogiewon](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/ogiewon/32/13743_2.png) [@ogiewon](https://community.smartthings.com/u/ogiewon)\
**Post date:** [April 26, 2017, 3:40am UTC](https://community.smartthings.com/t/composite-device-handler-with-thingshield/85833/1 "2017-04-26T03:40:45Z")

</div>

@bflorian, @rajk

Bob,

Quick question… I know the ThingShield is no longer supported. However, it still works pretty well for the users who already have them, like myself. I have been working on porting my ST\_Anything project over to use the new Composite Device Handlers. This works great with my LAN-to-HUB connected devices. However, I appear to have an issue using the ThingShield in conjunction with the Composite DH.

The ThingShield is able to send updates to ST which are handled properly by my Parent DH’s parse() routine, which in turn updates the child devices. So far, so good…

The issue I have is when I try to use a Child Device (like a Switch) to call a Parent function to send data to ThingShield. The Parent function is called properly by the child device, however the zigbee.smartShield() function appears to do absolutely nothing, as the Arduino never receives any data.

Here is an example that does **not** work. (Note: I even tried commenting out all of the lines below, and uncommenting the one one line that is commented to determine if the issue was related to passing the string into the call. Still, no joy.)

```
void childOn(String dni) {
    def name = dni.split("-")[-1]
	log.debug "childOn($dni), name = ${name}"
    zigbee.smartShield(text: "${name} on").format()
    //zigbee.smartShield(text: "switch1 on").format()
}

```

And here is another function, in the same Parent DH, that only works if called by Parent Refresh Tile.

```
def refresh() {
	log.debug "Executing 'refresh()'"
	zigbee.smartShield(text: "refresh").format()
}

```

Am I doing something wrong? Or is the zigbee.smartShield() function just not compatible with the new Composite Device Handlers? I am hoping it is something simple that is easily corrected on my end.

Thanks,

Dan

---

<div class="post-metadata">

**Author:** ![bflorian](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/bflorian/32/89251_2.png) [@bflorian](https://community.smartthings.com/u/bflorian)\
**Post date:** [April 26, 2017, 5:40am UTC](https://community.smartthings.com/t/composite-device-handler-with-thingshield/85833/2 "2017-04-26T05:40:44Z")

</div>

Hi Dan,

What you need to do is explicitly send the result of the `zigbee.smartShield(text: "${name} on").format()` call to the hub using `sendHubCommand()`. Something like this:

```
void childOn(String dni) {
    def name = dni.split("-")[-1]
    def cmd = zigbee.smartShield(text: "${name} on").format()
    sendHubCommand(new physicalgraph.device.HubAction(cmd))
}

```

You don’t need to do that in the case of `refresh()` being called by the tile because the platform API automatically sends the return value of the method to the hub when that method is called in response to tapping a tile. But when the child device calls a method of it’s parent nothing special happens to the return value because the API is not involved. The result of the method is simply returned to the child.

---

<div class="post-metadata">

**Author:** ![ogiewon](https://yyz2.discourse-cdn.com/smartthings/user_avatar/community.smartthings.com/ogiewon/32/13743_2.png) [@ogiewon](https://community.smartthings.com/u/ogiewon)\
**Post date:** [April 26, 2017, 11:33am UTC](https://community.smartthings.com/t/composite-device-handler-with-thingshield/85833/3 "2017-04-26T11:33:05Z")

</div>

Bob,

Thank you very much! That was easy and makes perfect sense. I really appreciate the very quick response!

Dan
