I can't seem to find enough API information

(trac starr) #1

So forgive me if I’m missing the obvious, but I can’t seem to find details about property values and what they do. Maybe it’s specific groovy, but I’ve search google to no end.

For example, lets that the input item. We have name, title, type, required, description, etc that can be set. I’ve only managed to decipher much of this from examples, but where can I find more information about other properties, or values that can be set. What other types are there?

Same question for page and the list goes on. I just can’t seem to find details. Another one I need help with is href on a section. What are the possible states? Can I set to my own html page?

Just would like to be pointed in the right direction.


(Aaron) #2

API documentation has been an issue since ST’s beginnings. My advice is to look at the smart apps others have built that implement what you’re trying to do. Some copy & paste action into your app will help. Honestly, it’s how I learned, aside from looking at the official ST app’s code that rolled out with the system’s start.

(trac starr) #3

Thanks. That’s pretty much what I’ve been doing. And it’s painful.

(Joshua Lyon (SharpTools.io Dashboard)) #4

I would also check out the developer documentation.

(Paul) #5

I have been and are still struggling with this. I have started to document some of this as I go along. If you send me your e-mail address by PM, I will e-mail you a copy.

(Alex) #6

Welcome to the club! Half of what’s in the docs is not valid and half of API is not documented.

Good luck!

(trac starr) #7

Thanks, been there done that. It’s only marginally helpful. It doesn’t seem to be kept up to date. Would be nice if the community was able to edit easily. Perhaps ST would allow some active members to be contributors to the github repo?

(Jody) #8

ST just hired a full time documentation writer. They announced it on the last developer call last week.

(trac starr) #9

Not writing fast enough :slight_smile:

(John Fisher) #10

I’d like to add my vote for more documentation. It’s been my biggest hurdle in starting out with Smartthings.

I’m glad to hear a doc writer has been hired.

(Joe) #11

I undersand wanting to get your product out there, but when you’re selling a product that pitches the ability for people to write their own apps, don’t you think you’d want the documentation ready when the product launches? Sorry if this post seems negative but I’ve been struggling to write my on app as well and have no success without A LOT of help from the community. Needless to say I am frustrated as well.

(Aaron) #12

It’s about time they hired a document writer. This is vital stuff. On the flip-side, given how many apps we’ve all created with the zero or poor documentation, it gives a good example of how easy it can be to write apps for ST. So there is that.

(Dan) #13

I just started writing my first app this weeked, and at this point I am quite frustrated by exactly the same thing as the OP. I’ve been a professional developer for 15+ years (C, C++, C#, Java), currently doing embedded development in C#.

I’m having the hardest time with the simplest things. Maybe someone can specifically help me with what I want to do: I want to see in code whether a switch is currently on or off:

def currentOn = (switch1 == “on”)
log.debug “$switch1.currentState”

The first statement is never true, and the second statement prints null.

So, how do I get the current state of a switch?

Help would be greatly appreciated. StackOverflow needs a SmartThings section!


(Dan) #14

Some hacking resulted in switch1.currentSwitch, which seemed to work. I log.debug’ed “$switch1.supportedAttributes” to get “[power, switch]”, combined with the “reference” document currentAttributename. So at least this provides some path forward to investigate the API.

The next question is - I want to flash the light 3 times, with a second or two on/off. The light flashes, but it’s pretty much random what the period is, and whether it finally stays on or off:

if (currentOn) {

	switch1.off(delay: 2000)
    switch1.on(delay: 2000)
	switch1.off(delay: 2000)
    switch1.on(delay: 2000)
    switch1.off(delay: 2000)
    if (currentOn) {

It almost looks like the messages are not arriving in the order I specify. This is running in the simulator with a virtual switch and physical lamp.

(Joshua Lyon (SharpTools.io Dashboard)) #15

You can also use device.currentValue(attribute) where attribute is one of the attributes you identified.

This is from Docs > Reference Material > Class Definitions > Device

if (!device) {
    log.debug "Device not found"
} else {
    log.debug "device attributes ${device.supportedAttributes}"
    log.debug "device switch value ${device.currentValue("switch")}"

You can also use device.currentState(attribute) then access one of the properties of the state class. For example:

def state = device.currentState("switch")
log.debug "time: ${state.date} value: ${state.value}"

How to determine what capabilities are available?
(Paul) #16

I believe this documents the device type handler. The documentation for device class can be found here .

I wrote a small Smart App which displays the capabilities, attributes and commands of a selected device. I will post the source on GitHub later.

A good place to get information on your devices is the IDE.

(Dan) #17

That app is a great idea!

(Paul) #18

I put the code on GitHub https://github.com/orandasoft/SmartThings.git

(Cooper Lee) #19

Does anyone know how to use Cards and the sub-Tiles of Cards - can’t seem to find any documentation on this

(Cooper Lee) #20

Does anyone know the correct syntax and options for the “buttons” input would be nice to be able to fire a process from a click instead of sending the user to a next page just to activate a feature…