Best way to handle a multi-channel device for ST integration


(Daniel Kurin) #1

Hello All,

I’m in the middle of writing a Device Handler for the FortrezZ MIMO, which is a multi-channel device (it has two inputs and two outputs). I can communicate with the device without any trouble, where I am having some trouble is figuring out what events to send to the ST system so that potential SmartApps can consume the data.

Here’s the question: How can I send events from the device handler using the standard capabilities whilst differentiating between Signal 1 and Signal 2? Similarly, how can I receive standard events (on/off) and determine which relay to turn on and off? I would like to avoid a situation where every SmartApp using the second channel needs to be hard coded to accept the right events.

Thanks for your help!

Dan Kurin


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

Unless I’m missing something, the typical way to handle this is to use a Virtual Device (or child devices) to represent the second channel (and keep it in sync with a SmartApp).

One excellent example is Hue Bulbs via the Hue Bridge. Technically the Hue Bridge is a single “Device”, but the Hue (Connect) SmartApp spawns and maintains sync with all the lightbulbs connected to the Bridge.


#3

You can use the quick browse list in the community created wiki and view device type handlers in the “miscellaneous” category and you’ll see several multi end point devices there. There are also some in the relay category. As @tgauchat said, it’s usually done with virtual child devices.

http://thingsthataresmart.wiki/index.php?title=How_to_Quick_Browse_the_Community-Created_SmartApps_Forum_Section


(Daniel Kurin) #4

I wasn’t even aware of Child Devices, so I’ll check that out. Is this the best documentation of this feature? http://docs.smartthings.com/en/latest/cloud-and-lan-connected-device-types-developers-guide/building-cloud-connected-device-types/building-the-service-manager.html

@JDRoberts Thanks, I wasn’t aware of this wiki either. I guess I need to spend more time on the forums rather than just reading the official docs.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #5

As you noted… the “best” documentation is likely in this Community or Wiki or whatever.

But, if in doubt, I always go back to the official http://docs.smartthings.com and moan and complain if they are out of date.