HABPanelViewer

android
habpanel
Tags: #<Tag:0x00007fd314967e10> #<Tag:0x00007fd314967988>

(Webfeger) #282

additionally: config menu displays

habpanel not connected


(Volker Bier) #283

What does the connection statistics in the Shem information screen show? Does it connect and then loses the connection, or does it not connect at all?


(Webfeger) #284

i take a screenshot with all details


(Volker Bier) #285

It looks like the app can not connect at all to the server. The most obvious reason would be:

  • the URL is wrong (you wrote you used http:rpi.fritz.box:8080, which is missing the two slashes behing http: )
  • the app is not allowed to communicate with the server (that also might be the reason for the not working discovery), because of settings in the router

Both of these problems can be ruled out if you copy the server URL from the settings page and paste it into the chrome browser on your tablet. If this works and you see the openHAB start page, then the URL is correct and HTTP access is allowed by the router.

When the server URL is correct, then there has to be some other problem regarding the SSE connection.
The app opens a connection to the following URL:
server URL/rest/events?topics=smarthome/items/name of an openHAB item/statechanged

So next replace server URL and name of an openHAB item with correct values and try to open the URL with chrome on your tablet. This should look as if the page is loading. If you now set a value to the item, you should see it in the browser.


(Francesco) #286

Hello, I have a problem with HABPanelViewer, I am not able to visualize my Graphana plots. They work pretty well on my laptop but not within the HABPanelViewer.

Francesco


(Volker Bier) #287

Come on people, in case you want help, at least take a little time to provide some details. What does “I am not able to visualize my plots” mean? Do you get broken links, do you get pictures of Donald Trump instead or are the values wrong?

Please describe the problem in more detail or add screen shots, as otherwise I can not help. I have sold my crystal ball last week.

Have you tried to open the page with chrome on your tablet? Does it work there?


(Webfeger) #288

Hello,

I posted the wrong url, but already used the correct url. Its all on the Same Subnet, so Router is not required. - only for Internet Access.

Here are some screenshots with test results. Openhab Apps on Mobile Phones in same network works fine.

Screenshot 1: running Habpanel on Chrome
Screenshot 2: OpenHAB URL in HabPanelViewer
Screenshot 3: Connection Status still not connected
Screenshot 4: Testresult with successfully state change
Screenshot 5: URL of Startpage in HabpanelViewer

Regards, Web

Edit: i already unchecked HTPS Connection, but Server still not discovered. I changed the System Language after this Screenshot to english because Habpanelviewer displays in current configured language.


(Volker Bier) #289

Okay, this looks like everything is set up correctly on your side. Can you install the apk i linked a few posts back and send me the part of the adb log showing the app start? You can as well open an issue in the github project and add the needed information there.

BTW. The router is in the loop regardless of this is LAN or internet, as the tablet most likely has no ad-hoc network with the openHAB server. There are settings in the router to control if devices in the LAN can communicate with each other.


(Francesco) #290

Hello, ok sorry,

I’m using version 0.9.18. In the pictures you can see the same page using Google Chrome and HABPanelViewer. It looks like it cannot load the plots links from Grafana.

I use JavaScript to call the link using this code:

<div oc-lazy-load="['http://192.168.1.22:8080/static/temp-plot/plot_solar_local.js']" >
  <div ng-app="myApp" ng-controller="dummy">
    <table>
    	<tr>
        <th> <button type="button" ng-click="change1h()" style="color: teal">1h</button></th>
        <th> <button type="button" ng-click="change1d()" style="color: teal">1d</button></th>
        <th> <button type="button" ng-click="change1w()" style="color: teal">1w</button></th>
        <th> <button type="button" ng-click="change1m()" style="color: teal">1m</button></th>
        <th> <button type="button" ng-click="change6m()" style="color: teal">6m</button></th>
      </tr>
    </table>
    <p></p> 
    <iframe ng-src="{{url}}" width="500" height="330" frameborder="0"></iframe>
  </div>
</div>

and the .js file here: https://raw.githubusercontent.com/FrancescoTalotta/openhab/master/html/temp-plot/plot_solar_local.js

Thank you

Francesco


(Webfeger) #291

Hi,
i tried to install hpv-debug.apk but i got follor error:

App not installed
The package appears to be corrupt.


(Volker Bier) #292

This is interesting. I just installed it on my phone without problems.


(Volker Bier) #293

Is the 192.168.1.22 the ip address of the openHAB server or is this another machine? I will try to reproduce this tomorrow.


(Webfeger) #294

now i removed Habpanelviewer and tried it again. now it was able to install


(Volker Bier) #295

Please create an issue in the github project and let us continue there so we do not clutter this thread.


(Webfeger) #296

okay, i created an issue on githup and used the debug version. but i can’t find the debug log file


(Francesco) #297

Yes it is the my openhab address. I’m not an expert about javascript, but maybe is something related to the Webview? See https://github.com/grafana/grafana/issues/7129

Thank you

Francesco


(Volker Bier) #298

I have answered in the issue.


(Volker Bier) #299

Do you use https for the start page? If i do this and try to link grafana charts with an http url, I see the described problem as well (loading of http content in frames of https pages is blocked by webview). Switching the start page to http might help (or setting up grafana to use https, which would be the better way).

I have simplified your use case and only created a HabPanel page with a frame widget using a Grafana chart URL and this works once you are logged in to Grafana. So it does not seem to be a WebView problem.

Edit: I just saw that I added a settings that allows mixed content, so you could try that as well if you use https.


(Francesco) #300

Hello,

thank you for your help. Actually I use the http not the https. Could you share your /etc/grafana/grafana.conf. Maybe I have to change some settings there…

Thank you

Francesco


(Volker Bier) #301

I have not changed grafana configuration by hand. At least not that I can remember.

Can you create a panel with a frame widget and use http://192.168.1.22:3000/dashboard-solo/db/home?orgId=1&panelId=1&from=now-1d&to=now as url. Make the frame big enough so you see the page content in case you are not logged in to grafana. Please check if that works, and make sure you do not use http in the “Start Page” URL.

Edit: I just took the time to look at this again and copied your javascript approach. I can see errors in the log that the webview prohibits loading of the referenced javascript file due to Content Security Policy defined in HABPanels index.html. If I remove the metatag from HABPanels index.html, the page loads fine. @ysc, I have no idea what this is for and if it is needed by HABPanel, can you give us any insights?