Multiple Devices on One Shield

Just to +1 this topic, me and my project partner are working to develop an Arduino/8-Relay ST project. Our goals being to keep the project all 12 volt DC based and we’ll be switching 12 VDC loads in a mobile platform - an RV. Not sure where we’re at as I have the easy part - coming up with the concepts. My project partner is the brains on the HW/SW side. Be nice if we can all collaborate by sharing where we’re at with our projects and what were stuck on.


I’m sorta in the same boat as @twack - I built a garage door controller/monitor/temp/humidity thing for my garage, which works great, but the limitation of only being able to have one main tile means that to actuate the other door, I have to drill down into the device.

As a kludge, I could install a virtual switch tile and use an app to make it follow the state of the second door (and of course actuate it too), but that their “high priority device” that requires parent-child relationships isn’t too far away so we can see how to do it.

@urman hinted to me that a solution to this is only weeks away, not months, but for those of you looking for an immediate solution, I think I have this worked out. As hinted by @stevesell, the solution is in a custom SmartApp.

I’ve built an Arduino-controlled 8-way relay board and like most of you managed to get it set up as a single device with multiple tiles for each relay. It exposes multiple custom capabilities. The problem is how to control each relay from regular smart apps. The next step is to add multiple ‘virtual’ switches. These do nothing but send an event when they are toggled on/off. The clever part is a small SmartApp which subscribes to events from these virtual switches and sends the appropriate custom commands to my Arduino/relay device.


Code here:

Here’s a snapshot of the virtual switch:

preferences {
    input("num", "number", title: "Switch number", description: "The switch (relay) number to connect to (1 to 8)", required: true)

// simulator metadata
simulator {
    status "on":  "command: 2003, payload: FF"
    status "off": "command: 2003, payload: 00"

    // reply messages
    reply "2001FF,delay 100,2502": "command: 2503, payload: FF"
    reply "200100,delay 100,2502": "command: 2503, payload: 00"

// tile definitions
tiles {
    standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
        state "on", label: '${name}', action: "", icon: "st.switches.switch.on", backgroundColor: "#79b821"
        state "off", label: '${name}', action: "switch.on", icon: "", backgroundColor: "#ffffff"

    standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") {
        state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"

    main "switch"

// handle commands
def on() {
	log.debug "On"
    sendEvent (name: "switch", value: "on")

def off() {
	log.debug "Off"
    sendEvent (name: "switch", value: "off")

As you can see, it is simply a ‘device.switch’ and sends two events via these lines:

sendEvent (name: "switch", value: "on")
sendEvent (name: "switch", value: "off")

The ‘parent’ SmartApp (excerpt):

preferences {
	section("Connect these virtual switches to the Arduino's relays") {
		input "switch1", title: "Switch for relay 1", "capability.switch"
        input "switch2", title: "Switch for relay 2", "capability.switch", required: false
        input "switch3", title: "Switch for relay 3", "capability.switch", required: false
        input "switch4", title: "Switch for relay 4", "capability.switch", required: false 
        input "switch5", title: "Switch for relay 5", "capability.switch", required: false
        input "switch6", title: "Switch for relay 6", "capability.switch", required: false
        input "switch7", title: "Switch for relay 7", "capability.switch", required: false
        input "switch8", title: "Switch for relay 8", "capability.switch", required: false
    section("Which Arduino relay board to control?") {
		input "arduino", "device.arduinoRelayBoard"

def installed() {
	log.debug "Installed with settings: ${settings}"

def updated() {
	log.debug "Updated with settings: ${settings}"

def subscribe() {
    subscribe(switch1, "switch.on", switchOn1)
    subscribe(switch1, "", switchOff1)
    subscribe(switch2, "switch.on", switchOn2)
    subscribe(switch2, "", switchOff2)
    subscribe(switch3, "switch.on", switchOn3)
    subscribe(switch3, "", switchOff3)
    subscribe(switch4, "switch.on", switchOn4)
    subscribe(switch4, "", switchOff4)
    subscribe(switch5, "switch.on", switchOn5)
    subscribe(switch5, "", switchOff5)
    subscribe(switch6, "switch.on", switchOn6)
    subscribe(switch6, "", switchOff6)
    subscribe(switch7, "switch.on", switchOn7)
    subscribe(switch7, "", switchOff7)
    subscribe(switch8, "switch.on", switchOn8)
    subscribe(switch8, "", switchOff8)

def switchOn1(evt)
    log.debug "switchOn1($ $evt.value: $evt.deviceId)"

def switchOff1(evt)
    log.debug "switchOff1($ $evt.value: $evt.deviceId)"


When installed, the SmartApp needs to be configured with the virtual switches it should listen to along with the Arduino Relay Board:


I hope that is useful to somebody!

Cheers, Jonathan


So I understand Jonathan’s post utilizing a SmartApp to emulate 8 switch inputs, and that is a solution.

I have a one-switch solution working now with my Arduino and 8-relay board using switch.on and from the Switch On/Off example. I found I can add 7 more standardTiles of type switch and have them show up in my app (as sub-tiles to the primary one), but apparently the only things they will all do is still just call the single On() and Off() functions, correct?

@urman Any update on availability of the Parent/Child Device Capability? I am working on a custom device using an Arduino Thing Shield and this would be very nice to have. It’s been about three months since this thread was updated. Perhaps the capability was announced elsewhere and I just haven’t found it yet?


It has not been released yet. The last two months have been focused on platform stability and optimization. Unfortunately this has not taken highest priority :frowning:

Any update on this? I have my thing shield and 8 way relay. Hoping to construct some automated mini-blinds next weekend.

BTW, I used this schema for my TV lift controller. Abstracting three separate vertical positions into on/off switch devices that harmony can understand and control.

I have been following this thread since March and awaiting the solution to this. Looks like the last update was almost 5 months ago. Has the project been abandoned?

I can’t see picture you attached
can show the demo of this ?

I think it is very useful if we can control multiple devices (relay) with one Arduino, because the ST shield is not cheap :smiley:


Sorry, SmartThings archived all my projects when they moved to their new forum software. I spent soooo much time trying to get this working reliably I’ve now given up. It works, just, most of the time, but I’m not prepared to invest any more time - this was supposed to make my life easier and it ended up being a support nightmare.

For a later project I abandoned the ST hardware entirely and used the SmartThings iOS app → SparkCore → 8-way Relay board. This was much more reliable.

The code is still available at jwsf (Jonathan Wilson) · GitHub but I’ve not looked at upgrading it to match any new SmartThings infrastructure updates for a long time now.

Cheers, Jonathan

1 Like



You may want to check out my ST_Anything project, as well as the ST_Anything_Doors projects which I have shared with the community. The Doors version includes the virtual device types and what I call a “Multiplexer” Smart App which provides an example of the capability you’re looking for. It would be great if ST fully implemented the feature mentioned earlier in this thread, but I am not going to hold my breath any longer. There are also some examples of how others have used my Arduino Libraries and SmartThings Device Types and Smart Apps to implement there own projects. Take a look. It should help kick-start any ST/Arduino work you are planning.

1 Like

I take back the snarky comment about my project being archived - I now see ST added a section for stuff migrated from the old forum :wink:

Any luck getting the Arduino to talk to Lutron Homeworks. My system is an older version and can not connect to my home network. I am hopping the is a way to connect the Arduino to give strings to the Homeworks syetem via the inputs from Arduino.


1 Like

Is this dead? Is the ThingShield destined to be a single device forever?

Well, since SmartThings has decided to no longer sell the ThingShield, I would assume any possibility of ST natively supporting multiple same device capabilities on a single device are long gone as well.

That doesn’t mean you can’t use the workaround I posted above to implement this functionality. I have developed many examples where a single Arduino Device implements multiples of the same device capability using virtual devices and a smartapp. It works very well.

1 Like