I set up openhab2 on my main homeserver a few weeks ago and am slowly expanding it. Now I ran into a little problem. When I go to HABPanel, it stays empty and shows "Connection lost! Trying to reconnect…"
The browser console shows a few messages which might indicate what the problem is:
Content Security Policy: The page’s settings blocked the loading of a resource at self (“script-src http://nostromo:8080 ‘sha256-5hvlzGKhlKhafFjW6G/cRVpM/e+JewYxe/pLpQ5Kj9M=’”). Source: call to eval() or related function blocked by CSP.
[…]
window.controllers is deprecated. Do not use it for UA detection.
[…]
Service worker not registered (not using HTTPS?): SecurityError: The operation is insecure. index.html:27:21
openHAB 2 service configuration loaded openhab.service.js:252:17
Error loading openHAB items… retrying in 5 seconds openhab.service.js:48:17
Error loading openHAB items… retrying in 5 seconds openhab.service.js:48:17
[…]
When I restart openhab, I get back in for a couple of hours and then it’s gone again. Any idea where to look for the problem?
As far as I understand this post, their habpanels aren’t working at all. Mine is working for some time after restarting the server instance and then suddenly stops working. I also checked already (read that post before writing mine ) and I’m not using any map transformations with %d - or any other for that matter.
The JS error I’m getting points to some other problem entirely but I’m not deep enough inside the code to understand where it might come from.
Number OPprogress {mqtt="<[broker:octoprint/progress/printing:state:JSONPATH($.progress)"}
Number OPtempBed {mqtt="<[broker:octoprint/temperature/bed:state:JSONPATH($.actual)"}
Number OPtempBedT {mqtt="<[broker:octoprint/temperature/bed:state:JSONPATH($.target)"}
Number OPtempExtr {mqtt="<[broker:octoprint/temperature/tool0:state:JSONPATH($.actual)"}
Number OPtempExtrT {mqtt="<[broker:octoprint/temperature/tool0:state:JSONPATH($.target)"}
(assuming you use Chrome)
When the connection drops, open the developers tools (F12) and go to the Network tab - you should see a bunch of failed calls (red) to “events”. Click one and post what you see in the “Response” tab.
Meeting the Requirements: As a first step, please verify, that your system meets the prerequisites. You may want to install Zulu, a fully certified Java build as a package or manually.
I use firefox but I will check next time it fails. I just restarted the server again. I put a few messages in my opening post, in case you didn’t see that :).
We can’t really help you if you don’t go to the Network tab and give us the actual response of your failed requests like I told you. It’s basically the same in Chrome and Firefox - click on one the requests with a 500 status and look what’s reported in the Response tab.
2017-10-03 20:12:50.277 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for 'B1_1_CT’
2017-10-03 20:12:50.282 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for 'B1_1_CT’
2017-10-03 20:12:50.325 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for 'B1_1_Sw’
2017-10-03 20:12:50.325 [WARN ] [b.core.events.EventPublisherDelegate] - given new state is NULL, couldn’t post update for ‘B1_1_Dim’
Could this be the reason for the NullPointerException? IIRC, the issues started, when I added the B1 channels to my items.
Those last messages are likely to be the problem.
Afraid I don’t really know much more. Which binding/devices are these? Maybe you could search “given new state couldn’t post update” on the forum, or repost those messages in one of those categories:
with your configuration and specify which devices those “B1” items are. There are likely knowledgeable people who monitor these categories and could offer more advice.
(of course with appropriate values). It also answers with this to the cmnd/CT command which sets the color temperature. If you want the color temperature in a reply, you have to send an empty cmnd/CT and you will get something like this.
b1-1/stat/RESULT {“CT”:500}
Now, JSONPATH returns NULL if it can’t find the path item you are asking for, and as both the standard as well as the CT reply use the RESULT path, there’s always something going to be NULL. If you send a regular command, CT will be NULL and if you ask for CT, POWER, Dimmer and Color will be NULL.
Thanks for the hint with the Network tab…! As I wrote, I have never debugged a web app before and that was very helpfull :).
It’s definitely the JSON issue. When I issue a request for CT by hand, HABpanel goes dark. As soon as I issue a request which makes the B1 return the full RESULT, HABpanel comes back.