Local API

Are any of these endpoints documented. My hub was in a 500 error right now and was looking for this command and could not find it handy anywhere. I ended up pulling the plug.

Not at this time. These are internal methods and probably won't be documented vs improving the ui to be able to handle things better.

1 Like

Ok just making sure - thought there might be a simple a url to enter in the browser or such.
Thanks for the response...

Not sure what you are asking for? If your hub is at a hard stop and every page is loading a 500 error, grabbing a database backup would have that issue in it. The hub stores 5 days worth of backups.

Are you looking to restore a specific day / database? A reboot is meant to fix a database issue on startup.

If you just have an app throwing a 500 error, you can always go into settings, backup / restore and restore the last known good db.

Honestly I was interested in a remote command to tell the hub to reboot.

I was playing with some code and caused some kind of meltdown - I could access the location page but everything else was returning a 500 error.

My thought was maybe if there was a command available I could tell the hub to reboot rather than pulling the plug. There is a good chance this command would fail as well I guess. I just did not know without being able to try.

I though I had seen talk of some sort of endpoint being available to do this sort of thing. Not a big deal, just figured I would ask in order to be armed for next time.

Some sort of remote reboot method could be beneficial in some cases?

Edit: I saved the code in case anyone wants to try it. - Past logs showed a cool error I had never seen before.


Check out this thread. You can remotely reboot the hub in a variety of ways but the web service would need to be running.

1 Like

@stephack YES!!

This is the thread I was thinking about - I just could not seem to come search it out.

And this post in particular...

Thank you so much

You what's really funny. I walked into my house right after sharing this and none of my automations ran. I was able to ping the hub but could not bring up the web interface. Popped the reboot url in the browser and voila. Hub rebooted..talk about instant use case.


Probably not posting this in the right spot. I am new to Hubitat and looking to support a device that sends events via an HTTP post. Can anyone point me to an example of how to approach this?

If you mention what device it is maybe someone has exact experience with it

There is a Hubitat app called Maker API that accepts commands and there is also the ability for rule actions to send http requests outbound but you’re not clear at all on what you are trying to do or even what direction you’re truly to send the request, that would help others help you

This is for RoomMe. I have searched Hubitat and nobody has experience with it yet.

RoomMe has a simple facility to enable integrations. It send a JSON object via an HTTP post call. Thus I am looking for a way to write a hubitat device driver that can receive an HTTP post and deal with the payload.

RoomMe is configured simply with the endpoint to receive the HTTP posts.

Here's a GET. You can look at what it's doing and how JSON is parsed into a Map.

def pollSunRiseSet() {
    currDate = new Date().format("yyyy-MM-dd", TimeZone.getDefault())
    log.info("DarkSky.net Weather Driver - INFO: Polling Sunrise-Sunset.org")
    def requestParams = [ uri: "https://api.sunrise-sunset.org/json?lat=" + location.latitude + "&lng=" + location.longitude + "&formatted=0" ]
    if (currDate) {requestParams = [ uri: "https://api.sunrise-sunset.org/json?lat=" + location.latitude + "&lng=" + location.longitude + "&formatted=0&date=$currDate" ]}
    LOGINFO("Poll Sunrise-Sunset: $requestParams")
    asynchttpGet("sunRiseSetHandler", requestParams)

def sunRiseSetHandler(resp, data) {
	if(resp.getStatus() == 200 || resp.getStatus() == 207) {
		sunRiseSet = resp.getJson().results
		updateDataValue("sunRiseSet", resp.data)
        LOGINFO("Sunrise-Sunset Data: $sunRiseSet")
    } else {
		log.warn "Sunrise-Sunset api did not return data"

Please correct me if I am wrong but this is making a call from Hubitat to a remote device/service. I need the reverse. I need my Hubitat device driver to receive an HTTP post from RoomMe.

I was looking at the Hubitat dev docs and was surprised to see websockets and associated events but not rest. A simple hubitat http event would do the trick.

That's the mechanism for you, I suspect. :slight_smile:

I looked at Maker but all I found was statefull connections. Didn’t see a way to just listen for http posts. Maybe I missed it. I am surprised as what I am looking for is so simple makes me think I’ve missed it in my searches.

Is RoomMe a local device or cloud service?

The traditional method for integrating a HTTP type of device like this is to write an OAuth2 Application. These apps expose an HTTP endpoint which can easily be used to integrate both LAN and CLOUD connections, and are secure.

If the device is LAN connected, there is another fairly simple option to have a Device Driver receive unsolicited HTTP posts which avoids the OAuth2 complexities.

It is strictly local with no oauth support (at this point with V1). The unsolicited posts device driver sounds perfect. Could you please point me to an example? Thanks for your help.

Not exactly on point, but the UDP listener in Lifx might add some depth to the options.

Nothing is more 'unsolicited' than UDP :smiley:

Very interesting. Please forgive me if I am wrong but from what you said ad looking at the code I surmised that Hubitat is listening on 39501 and routes http calls to a device with the ID of the http sender IP. When a match is found it calls the parse method on the device.

Is this correct? If so could I ask where you found this documented? I’ve searched poorly it seems.

You have the basic concept correct. As for where it is documented....:thinking:

SmartThings listened on port 39500 in the same way. I don’t think they documented it either.

1 Like