Is it possible to host a web app on the Hubitat

After adding a new app recently to my C7 hub it got me thinking about a new way to interface with a external system.

Simply put is it possible to write a RESTFUL API on the Hubitat and expose it to the internet to allow a external cloud system to talk to the Hubitat. Specifically my thought is around using the Hubitat with the new cloud Smartthings API to allow the systems to talk to each other.

Clearly you can create local API on the hub itself as I have seen this new app do it. The question is how far could I take it. Simply put the idea as follows.

  1. From Smartthings setup the work space and follow their process to create a Smartapp API space.
  2. Build the smartapp on the Hubitat that will expose an API and use the Smartthings API Key to communicate with the Smartthings cloud.
    a. This would end up needing to include options to basically install as a smartapp on the Smartthings side and then respond appropriately though the Smartthings install process and, setup devices as needed from the C7.
  3. Enable the C7 to be exposed to the internet with SSL only.
  4. Once connectivity is established and the devices can be retrieved figuring out a way to integrate them directly into Hubitat.

The only reason i am really thinking about this is because of the potential loss of connectivity when their old groovy IDE is phased out. I have Hubconnect working right now and it does work well, but it's remote client is written in Groovy and i suspect it depends on the Groovy IDE environment to be functional.

This question is just as much about even if i can do it, should I. I don't know how secure the Hubitat can be made. Placing it on the internet is a little bit concerning. Just because i see options for it to work with SSL doesn't really mean the webserver itself isn't vulnerable to other hacks. In my work i have had to remediate a bunch of security vulnerabilities just around HTTP and App servers outside of SSL, so it is just a good start, but not the end of the topic.

I just also see significant potential benifit to this. It would immediately bring anything supported by Smartthings into Hubitat. Though I wouldn't suggest using Zwave, or zigbee devices in this manor, Cloud services that are supported their and not here could be a nice boost i suspect.

Might take a look at the MakerAPI app

1 Like

The MakerAPI App is in away does allot of what i am talking about, but not exactly. Looking at it what Maker API does is very similar what the new Smartthings API does for Smartthings.

To interact with the Smartthings API you need a host on the internet with SSL enabled. Once that is done you also need to aquire a Key from your Smartthings Workspace that your remote app uses to talk back to Smartthings. Then when you initate setting up the connectivity with smartthings there is a layered handshake that sets up the app on the smartthings side and allows you to subscribe to devices. Once it is subscribed to the given devices, Smartthings will pass those devices activity to remote server and let it processes as needed. I had a working test app over a year ago that I could turn on lights and do some minor stuff.

I am not really worried about the ability to externalize the devices from the Hubitat C7, but weather it is reasonable for it to be able to run almost like a webserver with a restfull API that can respond properly to Smarthings.

Doubt that you're going to be able to do that directly on the hub. Might consider standing up a rPi and running something from there. Haven't thought it through completely, but thinking that using Node-Red on the rPi could be that middle-man you're looking for.

A Hubitat app can serve HTML (and similar) content from a defined "mapping"/endpoint with OAuth authentication--or use these endpoints to receive pretty much any data between the app and something else (and you can send via the regular HTTP methods available to apps). Here is a minimal example a community member made that I searched for:

If you remember how SmartTiles (precursor to ActionTiles) worked, this is basically how I remember that working, which sounds vageuly similar to what you might want. But that product is long gone. :slight_smile:

1 Like