[BETA] Hub Proxy Server

App provides an endpoint to permit the use of files in the hub’s File Manager through the cloud. Primary focus was to permit dashboard background images to work when accessed via the cloud interface, but it will serve up text based files in addition.

Available through HPM or via:
https://raw.githubusercontent.com/thebearmay/hubitat/main/apps/hubProxy.groovy

Note: Requires HE 2.3.9.160+ for full functionality.

9 Likes

Well now - this is great! Thank you!

1 Like

Hmmm... And CSS files....

Thinking Think GIF by Rodney Dangerfield

3 Likes

v0.0.3 adds the getURL endpoint to the mix. The url is expected to be urlEncoded.

2 Likes

v0.0.4 adds the getAttribute endpoint which can be used with the built-in virtual URL device to allow a device attribute (think html) to be displayed in an Easy Dashboard.

Apologies for lack of understanding.
How would you use this package post installation?

Really depends on what you need to pull through the cloud interface. Originally designed to allow the classic dashboard tiles to display image files from the local file manager regardless of whether you were on your local LAN or accessing via the cloud. App has 3 end points that can be used :

Local FIles

https://cloud.hubitat.com/api/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/apps/xxx/getImage?access_token= xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx&fName=yourFileName.fileExtension

Local URL

https://cloud.hubitat.com/api/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/apps/xxx/getURL?access_token= xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx&url=urlEncodedURL

Device Attribute

https://cloud.hubitat.com/api/xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx/apps/xxx/getAttribute?access_token= xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx&dev=deviceID&attr=attributeName

Thanks for the reply @thebearmay. Much appreciated.

Would this work for getting external access to a WebCoRE graph.. if so how might it be done?

I have a local graph via http://192.168.0.205/apps/api/1133/graph/?access_token=xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx generated by WebCoRE.

Any help would be appreciated. :slight_smile:

You’ll need to URL Encode the URL for the graph and use that for the last parameter on the second cloud request format string (the one that ends in &url=…)

When I try to merge the two, I get a line such as:

https://cloud.hubitat.com/api/xxxx-xxxx-xxxx-xxxxxxxxx/apps/1134/getURL?access_token=xxxx-xxxx-xxxx-xxxxxxxxx&url=http://192.168.0.205/apps/api/1133/graph/?access_token=xxxx-xxxx-xxxx-xxxxxxxxx

The URL I add at the end is the one listed by WebCoRE for that perticular graph, but as you can see that URL includes the local IP address of Hubitat... which generates an error:

{"error":true,"type":"java.lang.Exception","message":"An unexpected error occurred."}

Clearly I must be doing something wrong.
BTW the WebCoRE graph generated URL works locally for me.

you didn’t urlEncode the graph url - you can use https://www.urlencoder.org/

1 Like

Thanks for the help, I didn't know about encoded URLs so it's good to learn something new. Outside of that I still get the same error. Perhaps this isn't possible with WebCoRE graphs?

https://cloud.hubitat.com/api/xxxx-xxxx-xxxx-xxxxxxxxx/apps/1134/getURL?access_token=xxxx-xxxx-xxxx-xxxxxxxxx&url=http%3A%2F%2F192.168.0.205%2Fapps%2Fapi%2F1133%2Fgraph%2F%3Faccess_token%3Dxxxx-xxxx-xxxx-xxxxxxxxx

Try using port 8080 on the graph URL, i.e. http://192.168.0.205:8080/apps/api/1133/graph/?access_token=xxxx-xxxx-xxxx-xxxxxxxxx and then re-encode (port 8080 is required because the hub will be calling itself and thus occupying port 80)

Recently moved a family member into an assisted living apartment. Using Ikea motion, contact sensors, switches and button controllers to be aware of activity. Writing events to a local file. This is my first instance of using Hubitat Cloud services in order to allow other family members to easily check-in. Your proxy server saved my bacon as it allowed viewing of local events file via cloud. Thank You.

1 Like