SmartApp UI Customization Questions

I am relatively new to the SmartThings environment. I have a general understanding that a Device communicates with the SmartThings cloud (and SmartThings Hub) by virtue of its Device Handler. I have also noticed that the IDE can be employed to change Device Handlers (eg, to use a custom device handler so something like the ZWaveTweaker device handler).

I noticed that changing the Device Handler for a particular device not only changes the functionality (to some limited extent), but also the user interface (eg, the screen that appears in the Classic App when you select the particular device associated with that device handler). The simplest example is ZWaveTweaker, which provides a “custom” interface for changing a device’s parameters.

I am wondering how (and the extent to which) the device handler can control the user interface that shows up in the Classic App. Can someone point me to the place in the Smartthings documentation that explains the APIs or other mechanisms for controlling not only device functionality/communication, but also the UI in the classic app?

Tagging @krlaframboise , just because he’s written a bunch of them. :wink:

2 Likes

https://docs.smartthings.com/en/latest/device-type-developers-guide/tiles-metadata.html covers the device handler ‘tiles’ - the UI for the Classic SmartApp and you can explore from there to get a grasp of how device handlers and smartapps work in the ‘classic’ environment.

2 Likes

I see. Does the code in the device handler get executed in the SmartThings cloud (or on a local Hub), or is some or all of that device handler code sent to and executed by the App itself (eg, on an iPhone client)?

Both. Like any client-server situation.

Changes a bit in the New SmartThings App, but there’s still split and sharing of duties.

1 Like

Does that mean the App (Classic or New) can interpret Groovy code, or are there just API calls (whether or not published) governing the communication between the App and the SmartThings cloud or hub?

I also just noticed that the new App appears to be adding back much of the functionality found in the Classic app (and more). It seemed a bit on the slow side, but I only tried it briefly. I had been ignoring it due to a lack of functionality, but maybe it’s worth giving another look at this point.

No.

The Groovy Code in legacy Device Type Handlers contains a “metadata” section which the platform translates into whatever data structures are used by the Classic App to render UI elements.

The New App offers an HTML5-type of descriptive language for custom device UI plug-ins. But that’s all detailed in the online developer documentation.

1 Like

The built-in groovy device type handlers in the SmartThingsPublic repository are required for all hub connected devices whether you’re using the new or classic mobile app so I wouldn’t consider them legacy handlers, but the “tiles” and “preferences” sections of the metadata are only used by the classic app.

The “vid” attribute in the metadata definition determines which UI it should display in the new mobile app and the “tiles” section of the metadata allows you to define all the tiles that should be displayed in the classic mobile app.

1 Like

I think there are plenty of device types which do not have source code in the public repo.

And I presume there is a growing number of device types (even for Hub connected) which are only written using the new, non-Groovy, legacy deprecated API.

It’s only a matter of time, no?

Can you name one z-wave or zigbee handler that isn’t in the public repository?

I agree that they’ll probably get rid of the groovy code base at some point, but I’m pretty sure that all z-wave and zigbee devices require a groovy handler in order to work in either mobile app.

I’m basing that off of the publication process for hub connected devices in the new developer workspace and the way they’re using that vid attribute to tie the device code to the UI, but I could be wrong…

No. Perhaps there aren’t any - yet.

© 2019 SmartThings, Inc. All Rights Reserved. Terms of Use | Privacy Policy

SmartThings; SmartApps®; Physical Graph; Hello, Home; and Hello, Smart Home are all trademarks of the SmartThings, Inc.