HABpanel blackscreen after restart (SOLVED)

Tags: #<Tag:0x00007fc8f1bef9f8>

Hi. I have openhab 2.3 running on win 10 PC as a service. I’m having strange problems as my HABpanel seem to be constantly wiped when I restart PC or openhab service, and the panel goes blackscreen. After restart if I go to paperui -> Configuration -> Services -> UI -> HABPanel -> CONFIGURE and see the “panel registry JSON”, I notice that most of the JSON-code has been wiped out.

I have working backups, but after I start a working backup, same thing still happens.

I have noticed that “habpanel.config”-file in “C:\Openhab2\userdata\config\org\openhab”, and “org.openhab.habpanel.cfg-file” in “C:\Openhab2\userdata\etc” are overwritten on every startup with these false setting.

I think it might have something to do with custom widgets, as the json-code seems to be always wiped after self made widgets appear in the code. For example currently it seems to have stopped in the middle of the custom widget setting, and wiped everything after that.
Last line is “<div class=” and after tjat there is nothong left.

If I stop the service and copy working versions of the above mentioned files (from backups), and start the service, those files get again overwritten with the broken json-code. Where does openhab pull these files at startup?

Only workaround that I found out, is that I have to copy the json-code from the working habpanel version, paperui -> Configuration -> Services -> UI -> HABPanel -> CONFIGURE “panel registry JSON” and save it as .txt-file. When I start the Openhab2 service again, and the blackscreen appears again, I copy the json from the .txt-file to the above mentioned path and it works again.

I have redd through the community but I haven’t found the same kind of problem as I’m having.

Has anyone had this kind of problem, and know the way to fix this?

Following is the spot from my broken habpanel json, where it has stopped, and wiped everything after that:

“template”: "
.buttona {
width: 100px;
background-color: Green;
border-radius: 15px 15px 15px 15px;
border: none;
color: Blue;
padding: 10px 10px 10px 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 10px 10px;
cursor: pointer;
}
.buttonb {
width: 60px;
border-radius: 15px 15px 15px 15px;
border: none;
color: Blue;
padding: 10px 10px 10px 0px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 12px;
margin: 5px 5px;
cursor: pointer;
}
.button1 {
background-color: #00f900;
color: black;
border: 2px solid #4CAF50;
float: left;
width: 150px;
}
.button1:active {
background-color: #00FA9A;;
box-shadow: 0 5px #666;
transform: translateY(10px);
}
.button2 {
background-color: #f90000;
color: blue;
border: 2px solid #4CAF50;
float: left;
width: 150px;
}
.button2:active {
background-color: #00FA9A;;
box-shadow: 0 5px #666;
transform: translateY(10px);
}
.button3 {
background-color: #e8f900;
color: blue;
border: 2px solid #4CAF50;
float: left;
width: 150px;
}
.button3:active {
background-color: #00FA9A;
box-shadow: 0 5px #666;
transform: translateY(10px);
}
.button4 {
background-color: #0000ff;
color: black;
border: 2px solid #4CAF50;
float: center;
}
.button4:active {
background-color: #ffA500;;
box-shadow: 0 5px #666;
transform: translateY(10px);
}
.button5 {
background-color: #ee82ee;
color: black;
border: 2px solid #0000FF;
width: 120px;
}
.button5:active {
background-color: #0000FF;
box-shadow: 0 5px #666;
transform: translateY(10px);
}

h1 {
display: block;
margin-top: 0.67em;
margin-bottom: 0.67em;
margin-left: 100;
margin-right: 0;
font-weight: bold;
}

_<div class="

And in the working version same spot looks like this:

“template”: "\n.buttona {\n \twidth: 100px;\n background-color: Green;\n \tborder-radius: 15px 15px 15px 15px;\n border: none;\n color: Blue;\n padding: 10px 10px 10px 10px;\n text-align: center;\n text-decoration: none;\n display: inline-block;\n font-size: 16px;\n margin: 10px 10px;\n cursor: pointer;\n}\n.buttonb {\n \twidth: 60px;\n \tborder-radius: 15px 15px 15px 15px;\n border: none;\n color: Blue;\n \tpadding: 10px 10px 10px 0px;\n \ttext-align: center;\n text-decoration: none;\n display: inline-block;\n font-size: 12px;\n margin: 5px 5px;\n cursor: pointer;\n} \n .button1 {\n background-color: #00f900; \n color: black; \n border: 2px solid #4CAF50;\n \tfloat: left;\n \twidth: 150px;\n}\n.button1:active {\n background-color: #00FA9A;;\n box-shadow: 0 5px #666;\n transform: translateY(10px);\n}\n .button2 {\n background-color: #f90000; \n color: blue; \n border: 2px solid #4CAF50;\n \tfloat: left;\n \twidth: 150px;\n}\n.button2:active {\n background-color: #00FA9A;;\n box-shadow: 0 5px #666;\n transform: translateY(10px);\n}\n .button3 {\n background-color: #e8f900; \n color: blue; \n border: 2px solid #4CAF50;\n \tfloat: left;\n \twidth: 150px;\n}\n.button3:active {\n background-color: #00FA9A;\n box-shadow: 0 5px #666;\n transform: translateY(10px);\n}\n .button4 {\n background-color: #0000ff; \n color: black; \n border: 2px solid #4CAF50;\n \tfloat: center;\n}\n.button4:active {\n background-color: #ffA500;;\n box-shadow: 0 5px #666;\n transform: translateY(10px);\n}\n .button5 {\n background-color: #ee82ee; \n color: black; \n border: 2px solid #0000FF;\n \twidth: 120px;\n}\n.button5:active {\n background-color: #0000FF;\n box-shadow: 0 5px #666;\n transform: translateY(10px);\n}\n \nh1 { \n display: block;\n margin-top: 0.67em;\n margin-bottom: 0.67em;\n margin-left: 100;\n margin-right: 0;\n \tfont-weight: bold;\n}\n\n<div class=“row”>\n <p style=“font-size:20px; text-align:left; padding:0px 0px 0px 20px;”>Olohuoneen TV

\n <button class="buttonb button1"ng-click=“sendCmd(‘LivingRoomTV_BP’, ‘VirtaON’)”>TV päälle\n\t<button class="buttonb button2"ng-click=“sendCmd(‘LivingRoomTV_BP’, ‘VirtaOFF’)”>TV pois päältä\n\n<div class=“row”>\n <button class="buttonb button3"ng-click=“sendCmd(‘LivingRoomTV_BP’, ‘TV’)”>TV-Input\n\t<button class=“buttonb button3"ng-click=“sendCmd(‘LivingRoomTV_BP’, ‘Hdmi2’)”>HDMI2-Input\n”

The whole layout seems to be different…:pensive:

Did your try another browser
Do you have your browser to automatically delete cookies and/or cache and/or history?

The local HABpanel config is stored in the browser cache not centrally in the OH server

Hi.

I have two tablets with “Fully kiosk browser”-app that connects to the main server PC where the Openhab server is. In the PC I have Mozilla, Chrome, Edge and internet explorer. I have tried with all of these without no success.

My browsers doesn’t automatically delete cookies and/or cache and/or history?

Just about half an hour ago I stopped and restarted the Openhab2-service for few times as I made changes to my HABPanel. After every start the changes made 5min earlier were wiped out and the blackscreen was presented again.

Any idea where does the Openhab save the HABPanel settings when it is stopped (some database maybe)? It seems that it saves only the beginning of the HABPanel json when it is stopped.

In addtion to the message before, it always stopped to the same exact spot ( <div class=") and wiped everything after that.

Seems that my template widget is to be blamed, but I have no idea what is wrong with it…

After hard testing I found out the reason for the problem. It is " \ "-sign.

For example In a custom widget there is following line:

 <div class="btn-group btn-group-justified" btn-checkbox-true >

This same line is presented in HABPanel-json as follows:

"template": "<div class=\"btn-group btn-group-justified\" btn-checkbox-true >\n

As you see there is " \ "-sign added before the “btn-group” in HABPanel json. It can be used if you add it after the Openhab has started, as i did when I copied the whole HABPanel
-json after openhab service had restarted and blackscreen was noticed.

But if I restart the Openhab service again, it wipes rest of the HABPanel-json after this " \ "-sign.

I noticed this as I removed all the custom templates and imported widgets from my HABPanel, and then copied the HABPanel json before stopping the Openhab service once again. After it had started Openhab again, I noticed it still shows blackscreen. Then I copied broken HABPanel-json and compared it to the one that I copied before I stopped Openhab. I noticed that, in the broken json, there was one line more than in the one copied before the stop. The extra line was in the in-built Digital clock widget !
Digital clock was presented in the working json like this:

                    
                        "name": "Kello",
                        "sizeX": 2,
                        "sizeY": 2,
                        "item": null,
                        "type": "clock",
                        "row": 0,
                        "col": 5,
                        "mode": "Digital\n\t\t    ",
                        "analog_theme": "light",
                        "font_size": "80",
                        "digital_format": "HH:mm"
                    

But in the broken json it was shown like this:

			"name": "Kello",
                        "sizeX": 2,
                        "sizeY": 2,
                        "item": null,
                        "type": "clock",
                        "row": 0,
                        "col": 5,
                        "mode": "Digital
		    ",
                        "analog_theme": "light",
                        "font_size": "80",
                        "digital_format": "HH:mm"
                    

So in the “mode”-line there was “\n\t\t”-signs that had, after restart, disappeared and made one extra line between “mode” and “analog_theme”. This broke the json and resulted blackscreen.

At the moment I can’t use imported widgets or custom templates as all of them include " \ "-signs, and if openhab has to be restarted they will all result in blackscreen.

So does someone know is there a way to for example escape the " \ "-sign somehow in templates/widgets?

It seems strange, that only I am experiencing this problem as I think many people use custom templates and widgets, and most likely they also restart their Openhab-service every now and then?

Has anyone idea what should I do to get it working?

Any help is appreciated!

1 Like

Little update to this problem:

Changed "-sign to '-sign and removed all the line breaks and it started to work.
Little bit hard to read and write HTML in the template when it is all in one row.

Do people use some kind of HTML-editor where you can minify your HTML automatically?

Finally found out the problem:

  • Deleted the whole file “C:\Openhab2\userdata\etc\org.openhab.habpanel.cfg"

  • Changed this file C:\Openhab2\userdata\config\org\openhab\habpanel.config from this:

felix.fileinstall.filename="file:/C:/Openhab2/userdata/etc/org.openhab.habpanel.cfg"
initialPanelConfig="Koti"
lockEditing=B"false"
panelsRegistry="{(....MY PANEL SETTINGs.....)}
service.pid="org.openhab.habpanel"

To look like this:

initialPanelConfig="Koti"
lockEditing=B"false"
org.apache.karaf.features.configKey="org.openhab.habpanel"
panelsRegistry="{(....MY PANEL SETTINGs.....)}
service.pid="org.openhab.habpanel"

And so it started to work.

So the main problem was “C:\Openhab2\userdata\etc\org.openhab.habpanel.cfg " and the references to it in the “habpanel.config”-file.

Hope this helps if someone has the same problem! :smile:

2 Likes

I wanted to try HABpanel today for the first time and had the same problem.

Renaming org.openhab.habpanel.cfg to something else worked and made HABpanel start again. There was no habpanel.config on my Openhabian installation, though.