Any device handler that can pull data from an API and display as a single tile?


(Casper) #1

I’m pulling some temperature values from ThingSpeak and would like to post the latest value to Smartthings.

What I’m looking for is a device handler that can send a HTTP GET every minute, get the new data, and update the ST tile.

(Ben W) #2

You will need a smartApp to power this. You could do it with just a device handler, but will need to do force polling with pollster.

Are you planning to take action on the temps or is it just for reference? If its for reference you maybe able to do it in a DH and have it update on load.

Where is thingspeak getting the temps from?

(Casper) #3

Thanks for your input @desertblade, I was thinking to create a Device Handler and just have a loop to pull data from ThingSpeak API, so you’re saying I also need a smartapp to handle the updated values?

I’d like this to be a trigger for other devices as well, like sending alerts if temp too high or turning off devices…

on a NodeMCU + DHT22 sensor

(Ben W) #4

Device Handlers don’t always run in the background.

You have two options:

  1. Create a smartApp that calls the API every minute and sends the information to a Device handler
  2. Create a Device Handler that you can hit refresh/poll to call the API. Then run the smartApp pollster to force poll every minute.

You can also take thingspeak out of it. ST can communicate to devices on you network.

Some Primer links:

(Casper) #5

Haha thanks for the links, actually 2 out those threads are mine :smile:

I’m using ThingSpeak because it has a nice diagram with history and some other features (like IFTTT).

I’m looking into Pollster now.

(Ben W) #6

Ha, missed that. I would still take thingspeak out of thr loop. I believe St can listen for network traffic and update the dh.

(Casper) #7

I’ve been looking into Pollster but it doesn’t have anything I can use, no option to get data from an API and the temperature sensor device type isn’t supported.

I might go with this solution, are you aware of any available or similar smartapp that does this?

(Ben W) #8

Pollster just causes the device handler to refresh, you will need to create all the logic in the device handler. Device Handlers don’t run in the background and need something to push updates to them.

Here is the basic structure of a smartapp calling an external service. You will also have to deal with authentication and passing the information to the device handler.

The old Nest Protect DH is close to what you want. But does not poll automatically (that is were pollster comes in) I would start with just a DH and once that is knocked out determine whether its worth it to make a smartApp.