Access local services via openhab cloud connector

Hi all,

Is it possible to access a local service like grafana or frontail via myopenhab?
I would expect this to be possible, i have been looking around but can not seem to find any information about this.



These are separate services to run on your local box (openHABian?) and unrelated to OH itself and it’s cloud interface.
Whatever you mean by “access” I guess would mean to log into your box, plus eventually have a (direct) web interface, and while there’s tools you can setup to use SSH or HTTP from a remote location to your box, myopenhab is none of those. Apart from that trying to do so does not make sense to me.

No, this is not possible. Myopenhab is not a complete redirection to your openHAB host, it just exposes some openHAB structures to the internet.

Maybe I first had to explain what my goal was.
What I want to accomplish is that I can display these services in my openhab dashboard.
These work fine as long as I am in the local network.


Just render it all into static files and put it into html/, then reference it through /static/ via image/webview in your sitemap, pro-tip: refresh it via sh script and exec command, works great with grafana every 5min (i render mine as transparent pngs), frontail wouldn’t be as smooth as realtime of course, maybe grep the last 100 log messages and display it with some css in a webview, add some ajax to refresh it every couple seconds. :sunglasses:

This would be a nice feature to integrate into the whole OH2 concept. Since the frontail is such a great tool and plays a central role in the users setup, It should be integrated to the openhab cloud connector. It would make it a even more complete package. JMHO…

No, it is clear what you want to do. It just cannot be done. That is not the purpose of and the cloud connector binding. Only the OH REST API gets exposed to It is not a full reverse proxy and probably never will be.

Well, frontail is not part of openHAB, nor is Grafana nor any of the dozens of external web based applications people have on their LAN and may want to access on their sitemaps. But that isn’t likely to ever happen because doing so is very challenging to do securely and would require orders of magnitude more server resources than our already somewhat stressed servers are under.

If you want to access these outside your LAN, you need to set up your own reverse proxy. You should be able to use the OH reverse proxy docs to add additional services to the reverse proxy.

Alternatively, you can set up an ssh tunnel or a personal VPN to access these services when not at home. Personally I recommened one of these approaches over the reverse proxy approach. If you don’t have the knowledge and skills to know to set up a reverse proxy already, you probably do not have the skills and knowledge to secure the reverse proxy and monitor it for compromise.

@sbrauns i actually just replaced frontail on my sitemap with this, it’s just a quick hack, needs some more functionality like syntax highlighting and testing, but it should be better than frontail, performance wise and it works with


    <script src="../static/js/jquery.min.js"></script>
            overflow: hidden;

            color: #666;

            color: #a25050a6;

            color: #ba9f669d;

            color: #aaa;
            font-family: monospace;
            font-size: 9px;
            overflow: hidden;

            white-space: pre-wrap;       /* css-3 */
            white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
            white-space: -pre-wrap;      /* Opera 4-6 */
            white-space: -o-pre-wrap;    /* Opera 7 */
            word-wrap: break-word;       /* Internet Explorer 5.5+ */

    <pre><div id="logview"></div></pre>
    <script type="text/javascript">
        $( document ).ready(function()

            var syntaxhilight = true;

                $.get( "/static/openhablog_tail.log", function( data ) 
                    if (syntaxhilight)
                        var lines = data.split("\n");
                        var out = "";
                        var class1 = "s1";
                        $.each(lines, function(n, elem) 
                            if (elem.indexOf("[ERROR]") >= 0)
                                class1 = "s2";
                            else if (elem.indexOf("[WARN ]") >= 0)
                                class1 = "s3";
                            else class1 = "s1";

                            out += "<span class=\""+class1+"\">" + elem + "</span>\n";

                        $("#logview").html(out);                    }

                    $('html, body').scrollTop($(document).height());


Thing exec:command:logtail [command="/etc/openhab2/scripts/sh/", interval=2, timeout=250]


String logtail "logtail" { channel="exec:command:logtail:output" }

tail -50 /var/log/openhab2/openhab.log > /etc/openhab2/html/openhablog_tail.log


Webview url="/static/logtail.html" height=14

really nice approach. Open door for lot of monitoring scenarios
will this work in or mobile app ?

doesn’t seem to work in the app - but neither does my google map, does the app support webviews at all?

Oh right, that is a nice way to go. I am using habpanel, I guess this would work perfectly with habpanel.
Thanks a lot for the example!

edited my post to add some simple error/warning highlighting, removed scrollbars etc, reduced output to 50 lines

Actually, i probably should put this and my other stuff on github and link it here… when time allows it. I’ve been working on the log view thing some more and i think it’s worth sharing

I got it working. The example requires:

  • jquery.min.js. I found jquery-1.11.0.min.js on my RPi installation so I used that.
  • Installing the REGEX transformation
  • Installing the EXEC binding.

The biggest issue was that it wasn’t displaying all of the end of the log. The window (height=14) is not big enough for the 50 lines. I changed it to 48 lines to fit. I later figured out the style changes needed to have the web page automatically add scroll bars when the content requires it. In the html file, replace overflow: hidden; with overflow: scroll; in the #logview parameters section.

I also decided to emulate frontail by merging the openhab and events logs. The merge takes a few seconds to complete so I increased the refresh interval to be higher than every two seconds. Here is the command that interlaces the two log files (credit):

sort -nbms -k1.1,1.4 -k1.6,1.7 -k1.9,1.10 -k1.12,1.13 -k1.15,1.16 -k1.18,1.19 -k1.21,1.23 /srv/openhab2-logs/openhab.log /srv/openhab2-logs/events.log | grep . | tail -48 > /srv/openhab2-conf/html/openhablog_tail.log

I still don’t really understand what actually triggers the .sh script to execute. I understand that Thing definition and the Item referring to the Thing. But then I don’t see that the Item is referred to… which I assume would be what gets the script to execute to generate the log segment. I’d love to understand where they get invoked. I don’t see them referenced explicitly in the HTML nor in the sitemap.