Get external data from IP device with open api

Been searching the forum (without luck) for a simple device handler or smartapp which can pull data from an external device which not supported but has an open api.

What need to do is to create a new device in smartthings which present data from an external IP device (which has an open API).

Here is from the API documentation of the device.

request data from: youripadress/api/alldata

your device i will reply in JSON format example:


Highly appreciate if someone could assist with a link or code for this simple request.


Welcome to our Community, @Gustaf!
Just to clarify, please confirm/answer the following:

  • Do you want to send commands to your external device from the ST app or just show the info?
  • All the capabilities your device has, are known by the SmartThings platform? (See the capabilities document)

Hi! Thks reply.
To start with i just want to show the info.
Above is the reply i get with a httpget request. But not sure to set it up in SmartThings. “001” “002” , etc is different ‘sensors/values’. It’s a heatpump which is connected with an ip module which has an open api. RestAPI.

Later on I would also need to be able to send a post request to change some of the values.

Ok, I asked because the ST Schema Connector can help you in this case but you need to consider the following:

  1. The measures and commands accepted by your device:
    a. I guess you know how to parse the JSON received (which value corresponds to which measure), so, is there a standard capability you can use to display each one of them?, so, is there a standard capability you can use to display each of them? eg. Temperature Measurement, Heating Setpoint.
    b. If it has a manufacturer-specific capability or none of the standard ones works as you want, you can create a custom capability.
  2. As the external device is reached through an open API, you would need to create scheduled queries to get its current state (that could be done by a SmartApp or using the Connector’s State callbacks).

Is there any good example for the httpget i can use to build from? not sure if should use device handler or smartapp? all the examples i find is just small parts of an full device handler or smartapp.
The values i know what they corresponds to(different heating values/temperature measurements).

Ok, another alternative is using the SmartApp Connector directly.
A couple of important points:

  1. This uses the SmartApp SDK but is registered in the Developer Workspace as Device Integration > SmartThings Cloud Connector > SmartApp Connector
  2. The SmartApp SDK is based on the Core SDK, so, you can use the commands of the endpoints included. This is where commands like ctx.api.devices.sendEvents(..) come from.

Below you’ll find an example of a switch device, which contains:

  1. Installation callback - Creates the device, initializes the capability, and create the Schedule
  2. Command handler - This receives the commands from the ST mobile app and updates the device state. (This is where you would execute the POST requests later on)
  3. Schedule handler - This is where the HTTP GET request to the open API would be executed. According to my sample, it would be executed every 5 minutes and it’s done using the Axios library.

Let me know if you have more questions. :smiley:

Many thanks, but the smart app connector just got me even more confused…

In any case, manage to get the temperature value with a httpget request in a device handler (simulator). However, now stuck on how I update the tile in a new temperature sensor device with the value?? (tried different ways with sendevent to the Temperature tile, but no luck. )

${response.json.“0007” gives me the value of sensor 0007 which is a temperature reading.

here is my code so far:

name: “Temp HTTPGET”,
namespace: “gust”,
author: “gust”,
description: “Example”,
category: “”,
iconUrl: “”,
iconX2Url: “”,
iconX3Url: “”)

capability “Temperature Measurement”

tiles (scale: 2) {
valueTile(“Temperature”, “device.temperature”, width: 5, height: 2) {
state “val”, label:’${currentValue}’, defaultState: true


// Must include the asynchttp API to use async http api!
include ‘asynchttp_v1’

preferences {
section(“Title”) {}

def installed() {

def updated() {


  • Basic GET request
    def basicGetRequest() {
    def params = [
    uri: ‘’,
    contentType: ‘application/json’,
    query: [
    “ID”: 0007,
    asynchttp_v1.get(‘basicGetHandler’, params)


  • Response handler for basic GET request
    def basicGetHandler(response, data) {

    // GitHub returns json body
    log.debug “basic GET request json: $response.json”

log.debug “Temperature: ${response.json.“0007”/10} degrees”

// show the http status code (e.g., 200, 304, 401)
log.debug "response status: $response.status"

// all response headers are available as a map of key->value pairs
def headers = response.headers
headers.each { header, value ->
	log.debug "$header: $value"


If you get the correct value from this:

You can send the following event (in the basicGetHandler function):

def temp=response.json."0007"/10

Initialize the capability from the “installed” event. Including the units is very important, even more, if you will show the temperature at the dashboard view. Eg.

def installed() {

def initialize(){

The DTH’s “tiles” section is not considered anymore to define the device UI, that’s what the Device presentation does. A default configuration is created from the DTH.
You would need to create a custom one in case you want to change the capabilities order or use Custom Capabilities.

Remember DTHs are part of our legacy platform, that’s why my first suggestion was the SmartApp Connector.