SmartThings Community

Universal Smartthings Web Service


#1

OK.

I love my Smartthings and have build a couple of simple web hooks to connect lights to (for example) flic button presses. But doing this has made me realise that there isn’t (as far as I can find) one single, simple, universal web service for an installation that people can build (for example) Python libraries around.

What I would like is to do is have an endpoint that accepts JSON, and which responds accordingly.

So:
{‘authorisation-key’: ‘sdsdasd32434’, ‘device-name’: ‘bedroom lamp’, ‘state: on’} would be the world’s simplest example.

Or to get a list of devices you could pass it an appropriate JSON command and get JSON in response.

People could then write Python, C#, etc. libraries to run at home that could easily execute commands, trigger automations, etc.

Or am I being dumb, and does something like this exist already?

Thanks,

Robert


(Chris) #2

CoRE gets close to this. It can receive web requests using the IFTTT Maker capability, and can make web requests to internal or external endpoints. The main problem right now is that it doesn’t encode internal requests or create a request body, but the developer has indicated that he plans to fix this in the future. You could enable it now by editing the smartapp code (see here for details). I’ve gotten around this by making FORM/GET requests and passing variables as part of the URL query.

For example, I have CoRE set up to be like a gateway between the internet and my internal network. I can make a request from IFTTT using JSON (it doesn’t have to come from IFTTT either, that capability just gives you an endpoint that anything can access), save incoming body parameters to variables in CoRE, then turn around and make an internal web request to a Harmony hub, for example, passing the variables along as part of the URL. This is how I got my GH to control button presses on my Harmony hub. The use case is probably different for you, but the details of how it works and how the web requests are set up are here:


#3

Thanks for this.

To be honest, I’m tempted to just commit the two weeks needed to write a proper wrapper around Smartthings. (If only I didn’t also have a job, and loads of other things to do :smile:)


#4

Different community members have done different variations on this idea. I would agree that at this point core could probably do everything and would be the most versatile approach.

But you might also check the miscellaneous quick browse lists in both the device type handler and smart app sections in the community – created wiki. For Example, there is one there that is an MQTT bridge. And there’s this:

To explore others:

http://thingsthataresmart.wiki/index.php?title=How_to_Quick_Browse_the_Community-Created_SmartApps_Forum_Section


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #5

Do a forum search on Event Ghost / EventGhost …

At least a couple of SmartApps have been written to interface with it … via http.