Device Type Capabilities and SmartApps


(Eric Magaha) #1

So I’ve have successfully written my first Device Type. Basically it is just querying a server via REST for some data, and then parsing and displaying.

It’s working great! I’m really happy that I’ve integrated SmartThings with my existing homebrew home automation system which includes a data server, Raspberry Pi, and Beaglebone Black devices. And I love Groovy also!

The JSON I am sending back contains 4 temperature readings from the various connected Raspberry Pi and Beaglebone Black devices throughout my house.

I have added the ‘Temperature Measurement’ Capability to my Device Type, as well as 3 other attributes to handle the 4 temperature values.

I have found if I want to integrate my Device Type with a SmartApp like the ‘ActiON Dashboard 4’ the only value that is available is the ‘Temperature Measurement’. I assume this is because it is a Capability.

Can I create custom Capabilities? Can I have more than 1 of the same Capability? Can I access the Attributes from the SmartApp?

Thanks!


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

Great thoughts and questions, and I’ve relayed similar concerns to SmartThings.

Conceptually, it is best to avoid creating new capabilities, since it makes old apps incompatible… The old apps only know about existing capabilities!

If you have multiple of the same capability in one physical device, it really should be multiple Things in SmartThings, but the ability to do this is not easy at the moment… Though a model example is Hue bulbs connected through a single Hue Bridge.

Let’s discuss in more detail!


(Eric Magaha) #3

I’ve re-thought this recently and figured that, as you stated, they should be separate devices. So I just ended up with multiple REST endpoints serving up one capability. Then I end up with a separate ‘device’ in SmartThings for each temperature sensor instead of one device with multiple capabilities.

I think that approach is a little cleaner, and it keeps the Groovy code simpler.


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

Excellent!

I’d love to know more about your project and whatever details and code you decide to share.

Thanks!
…Terry.