Calling for device status using API Endpoints


(Csader) #1

Many of you are familiar with the work that’s been done to get Tasker working with ST using the API Endpoints.

Endpoint Tutorial
My Tasker Demo

What I want to figure out next is how to ping the ST hub to get the status of various devices. That is, using Tasker, I’d like to hit a URL and have it return the status of a given switch, for example.

Any ideas on where to start?


Query Z-Wave Device Status from a local web server?
(Im Brian) #2

From what I understand, the ST hub is rather dumb - I could be wrong, but I suspect it is used almost solely as a Zigbee/Z-wave to network interface for devices. Port scanning it, it appears that it’s got a telnet port open:

brian@gibson:~$ nmap -Pn 192.168.1.108

Starting Nmap 6.00 ( http://nmap.org ) at 2013-10-06 00:29 PDT
Nmap scan report for SmartThings (192.168.1.108)
Host is up (0.00019s latency).
Not shown: 999 filtered ports
PORT   STATE SERVICE
23/tcp open  telnet

That seems pretty interesting, but I’m assuming it has a globally set password - anyone happen to know what that might be? Or what good telnet’ing in might do us?

Back on track - you may have better luck writing an app that simply grabs states from each device and make a REST request with the parts you deem important and create the interface on your own server. I believe they’re working on a prettier web interface, but if you just wanted to know the state of a switch and don’t mind the delay associated with polling, I’d just cron it and host it off-site.


(Im Brian) #3

My hope was that you could have a script somehow grab device states from telnet’ing into the hub, but it appears that is not an option:
http://build.smartthings.com/forums/topic/zwave-troubleshooting/#post-1654


(Juan J) #4

Are API endpoints something you have to define yourself within an app? or are there standard endpoints that I can call directly? I don’t mean to hijack your thread, but it sounds like you’re familiar with what I’m looking for. The documentation is kind of all over the place still…

also, your “enpoint tutorial” link is 404ing… ;/


(Csader) #5

Not sure why it’s 404’ing. http://build.smartthings.com/blog/tutorial-creating-a-custom-rest-smartapp-endpoint/


(Csader) #6

@ImBrian, have you messed around with the Endpoints API much? I really think there’s a way to make a call to an Endpoint URL and have it return status, but I’m just not sure how to make it happen.


(Csader) #7

So @ImBrian, I feel a little stupid for not knowing this, but if I take the Endpoint URL for toggling one of my switches, and I remove the “/toggle” portion of the URL, it returns the device’s status in this form:

{"id":"xxxxx-xxxxx-xx-xxx-xxxxx","label":"Master Light","value":"off","unitTime":1381759097186,"type":"switch"}

Now I’m assuming I could have Tasker (or whatever app) periodically hit this URL, read the “value” state and trigger actions based off of that? Maybe that’s what you meant above when you said “create the interface on your own server”…sorry if I missed that before.


(Csader) #8

This totally works in Tasker. As a Proof-of-Concept, the following Task setup flashes the current switch status on-screen.

Now to figure out exactly what I want to do with this knowledge. :slight_smile:


(Juan J) #9

Cool thanks!


(Csader) #10

Did you get it figured out @juanjaramillo?