Addon to add external links to openHAB dashboard

If we can have a list in JSON, this would be my favorite (as YAML obviously is no option)

If the numbers need to stay there, the individual options approach would be best in terms of readability IMHO

The comma-separated approach breaks easily, I assume, and looks awful as well :grin:

@pauli_anttila thank you so much for the enhancement!
Looks great!

Here’s my configuration file for anyone interested :slight_smile:

$openhab-config/services/dashboard.cfg

frontail.link-name=openHAB Log Viewer
frontail.link-url=http://home:9001
frontail.link-imageurl=../static/frontail.png

nodered.link-name=Node-RED
nodered.link-url=http://home:1880
nodered.link-imageurl=../static/nodered.png

grafana.link-name=Grafana
grafana.link-url=http://home:3000
grafana.link-imageurl=../static/grafana.png

And in this album you can find the images to be placed in $openhab-config/html/.

Here’s how it looks like:

Note: I’m using openHAB 2.2.0 Build #1031.

7 Likes

@pauli_anttila & @kubawolanin Would one of you like to add a sentence about that feature to https://github.com/openhab/openhab-distro/wiki/Draft-for-openHAB-2.2-Release-Notes#new-and-noteworthy, possibly just linking to @kubawolanin’s post here?

hey guys, would it possible to hide the paperui page via this method? thanks

I am wondering whether these *link-url will work through myopenhab,org or remotely (proxied through)? Or it is just for local network usage only. Thanks

Just for local use. myopenhab.org does not provide a generic proxy for all the web applications on your LAN, just openHAB’s REST API.

Above just puts a link on your dashboard.

1 Like

Hi i just tried to add my own links by editing the dashboard.cfg, but then my dashboard stopped working. Now i restored my dashboard.cfg but it still doesn’t work. How can i fix it?

Here is what the browser shows:

HTTP ERROR 500

Problem accessing /start/index. Reason:

    Server Error

Caused by:

java.lang.NullPointerException
	at java.util.regex.Matcher.quoteReplacement(Matcher.java:701)
	at org.openhab.ui.dashboard.internal.DashboardServlet.lambda$1(DashboardServlet.java:208)
	at org.openhab.ui.dashboard.internal.DashboardServlet.replaceKeysWithFunction(DashboardServlet.java:217)
	at org.openhab.ui.dashboard.internal.DashboardServlet.replaceKeysFromMap(DashboardServlet.java:207)
	at org.openhab.ui.dashboard.internal.DashboardServlet.serveDashboard(DashboardServlet.java:96)
	at org.openhab.ui.dashboard.internal.DashboardServlet.doGet(DashboardServlet.java:80)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584)
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
	at org.eclipse.jetty.server.Server.handle(Server.java:534)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
	at java.lang.Thread.run(Thread.java:748)

Try restarting openhab and if that doesn’t work, post your dashboard.cfg here.

Tried restarting and updating OH without success

The dashboard.cfg i have now (need to shorten the image part):

grafana.link-name=Grafana
grafana.link-url=http://192.168.1.20/grafana/?orgId=1
grafana.link-imageurl=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV4AAADkCAMAAADn07yPAAAABGdBTUEAALGPC[...]

frontail.link-name=openHAB Log Viewer
frontail.link-url=http://HausPi:9001
frontail.link-imageurl=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV4AAADqCAMAAADd2d3/AAAABGdBTUEAALGPC/xhBQAAAwBQTFRFaWJdYGFlZGl5bXN/dmppcmx3dHl+Y22CaHyMbH6YdHuGZ3z[...]

openhabiandocs.link-name=openHABian Help
openhabiandocs.link-url=https://docs.openhab.org/installation/openhabian.html
openhabiandocs.link-imageurl=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV4AAADmCAMAAACqGx2EAAAABGdBTUEAALGPC[...]

And here is the one that “broke” it:

grafana.link-name=Grafana
grafana.link-url=http://192.168.1.20/grafana/?orgId=1
grafana.link-imageurl=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV4AAADkCAMAAADn07yPAAAABGdBTUEAALGPC[...]

frontail.link-name=openHAB Log Viewer
frontail.link-url=http://HausPi:9001
frontail.link-imageurl=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV4AAADqCAMAAADd2d3/AAAABGdBTUEAALGPC/xhBQAAAwBQTFRFaWJdYGFlZGl5bXN/dmppcmx3dHl+Y22CaHyMbH6YdHuGZ3z[...]

openhabiandocs.link-name=openHABian Help
openhabiandocs.link-url=https://docs.openhab.org/installation/openhabian.html
openhabiandocs.link-imageurl=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAV4AAADmCAMAAACqGx2EAAAABGdBTUEAALGPC[...]

homegear.link-name=Homegear RPC Server
homegear.link-url=http://192.168.1.20:2001/
homegear.link-imageurl=../static/homegear.png

cups.link-name=CUPS Printserver
cups.link-url=https://192.168.1.20:631/admin
cups.link-imageurl=../static/cups.png

homegear.png and cups.png are in [OHconfdir]/html

Thanks :slight_smile:

Start of this message deleted Seems that I was wrong in my interpretation of that stack trace. But is this a bug that should be reported.

I searched for the original file but didn’t find it. While those are string items I’m not sure do they need quotes around them. In dashboards readme that I found there’s an example that is without quotes. You can try this one out by adding them like this:

grafana.link-imageurl="../static/grafana.png"
grafana.link-name="Grafana"
grafana.link-url="http://openhab:3000"

Ping @pauli_anttila, didn’t you create this feature? How is it?

Quotes shouldn’t be used.

@andirs, I quickly tested you “broken” configuration, but I didn’t meet any problems.

That’s odd :frowning:

The only thing i can further contribute else is that this

2018-01-21 17:07:11.009 [WARN ] [eclipse.jetty.servlet.ServletHandler] - /start/index

java.lang.NullPointerException: null

	at java.util.regex.Matcher.quoteReplacement(Matcher.java:701) ~[?:?]

	at org.openhab.ui.dashboard.internal.DashboardServlet.lambda$1(DashboardServlet.java:208) ~[189:org.openhab.ui.dashboard:2.3.0.201801141430]

	at org.openhab.ui.dashboard.internal.DashboardServlet.replaceKeysWithFunction(DashboardServlet.java:217) [189:org.openhab.ui.dashboard:2.3.0.201801141430]

	at org.openhab.ui.dashboard.internal.DashboardServlet.replaceKeysFromMap(DashboardServlet.java:207) [189:org.openhab.ui.dashboard:2.3.0.201801141430]

	at org.openhab.ui.dashboard.internal.DashboardServlet.serveDashboard(DashboardServlet.java:96) [189:org.openhab.ui.dashboard:2.3.0.201801141430]

	at org.openhab.ui.dashboard.internal.DashboardServlet.doGet(DashboardServlet.java:80) [189:org.openhab.ui.dashboard:2.3.0.201801141430]

	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [31:javax.servlet-api:3.1.0]

	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [31:javax.servlet-api:3.1.0]

	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848) [88:org.eclipse.jetty.servlet:9.3.22.v20171030]

	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584) [88:org.eclipse.jetty.servlet:9.3.22.v20171030]

	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [191:org.ops4j.pax.web.pax-web-jetty:6.0.7]

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [87:org.eclipse.jetty.server:9.3.22.v20171030]

	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [85:org.eclipse.jetty.security:9.3.22.v20171030]

	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [87:org.eclipse.jetty.server:9.3.22.v20171030]

	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [87:org.eclipse.jetty.server:9.3.22.v20171030]

	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284) [191:org.ops4j.pax.web.pax-web-jetty:6.0.7]

	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [88:org.eclipse.jetty.servlet:9.3.22.v20171030]

	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [87:org.eclipse.jetty.server:9.3.22.v20171030]

	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [87:org.eclipse.jetty.server:9.3.22.v20171030]

	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [87:org.eclipse.jetty.server:9.3.22.v20171030]

	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [191:org.ops4j.pax.web.pax-web-jetty:6.0.7]

	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [87:org.eclipse.jetty.server:9.3.22.v20171030]

	at org.eclipse.jetty.server.Server.handle(Server.java:534) [87:org.eclipse.jetty.server:9.3.22.v20171030]

	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333) [87:org.eclipse.jetty.server:9.3.22.v20171030]

	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [87:org.eclipse.jetty.server:9.3.22.v20171030]

	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) [79:org.eclipse.jetty.io:9.3.22.v20171030]

	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) [79:org.eclipse.jetty.io:9.3.22.v20171030]

	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [79:org.eclipse.jetty.io:9.3.22.v20171030]

	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [90:org.eclipse.jetty.util:9.3.22.v20171030]

	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [90:org.eclipse.jetty.util:9.3.22.v20171030]

	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [90:org.eclipse.jetty.util:9.3.22.v20171030]

	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [90:org.eclipse.jetty.util:9.3.22.v20171030]

	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [90:org.eclipse.jetty.util:9.3.22.v20171030]

	at java.lang.Thread.run(Thread.java:748) [?:?]

appears in my log every time i try to access the dashboard…

Edit: Ah ok it is the same the browser is showing…

I enjoy exactly the same problem, but with openHAB 2.0.1. :frowning:

ava.lang.NullPointerException
	at java.util.regex.Matcher.quoteReplacement(Matcher.java:701)
	at org.openhab.ui.dashboard.internal.DashboardServlet.lambda$1(DashboardServlet.java:208)
	at org.openhab.ui.dashboard.internal.DashboardServlet.replaceKeysWithFunction(DashboardServlet.java:217)
	at org.openhab.ui.dashboard.internal.DashboardServlet.replaceKeysFromMap(DashboardServlet.java:207)
	at org.openhab.ui.dashboard.internal.DashboardServlet.serveDashboard(DashboardServlet.java:96)
	at org.openhab.ui.dashboard.internal.DashboardServlet.doGet(DashboardServlet.java:80)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:848)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:584)
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:284)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
	at org.eclipse.jetty.server.Server.handle(Server.java:534)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:333)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108)
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
	at java.lang.Thread.run(Thread.java:748)

I wanted to include some stuff in the dashboard. As noticed it didn’t work i reverted dashboard.cfg to my previous version. But the exception stays, and the dashboard is unavailable. So, the dashboard.cfg itself is not the problem, but changing it triggerd something which stays corrupt.

sudo rm -rf /var/lib/openhab2/cache/*
sudo rm -rf /var/lib/openhab2/tmp/*

… did not help as well.

So did

sudo apt-get remove openhab2
sudo apt-get install openhab2

Any ideas anybody?

OK, found it by myself. A copy of dashboard.cfg is stored in

/var/lib/openhab2/config/org/openhab/

If this one contains something, dashboard is not happy about, dashboard is inaccessible.
Deleting that file made the dashboard work again.

3 Likes

Adding things to the dashboard was not available until OH 2.2.

Sorry. Typing error. 2.2.0-1 :frowning:

Did you test with the latest snapshot, I just found this merged PR:

Where do I find the dashboard.cfg file? or do I have to create it myself?
for openhab 2.3 and 2.4?

My openhab is a docker container in synology

Hi,

I setup the same recently so you just have to create a new dashboard.cfg file under /etc/openhab/services.

I dont use docker but assume the same folder structures and configuration folders exist.

K

1 Like

Is anyone doing this successfully with OH2 Private Cloud and behind NGINX?

I have a hosts with various services on my network. I, nor a few others havent been able to get this working.

Whilst I can get the tiles to display I think the issue more relates to that of NGINX configuration.

Just keen to see if anyone had success.