HABPanelViewer 0.9.25

android
habpanel
Tags: #<Tag:0x00007f1e5b7493e0> #<Tag:0x00007f1e5b7492a0>
(Volker Bier) #542

This might be possible, but I am not doing it. Feel free to implement it and create a pull request.

0 Likes

(Daniel) #543

Hello Volker

fist of all - thank you for the HPV app. It really works well for my wall mounted tablets.
The only problem I have, is that it doesn´t connect - so everything works fine, control is possible, status are ok but there seems to be something with your so called SSE connection. I tested it on four different tablets - starting from Android 4.4 to Android 8. Always the same. In the connection I use a direct URL: http://xxx.xxx.xxx.xxx:8080 and also the one from the intro.
As not all of my tablet support tap to unlock, I would really appriciate if I can make use of the SCREEN_ON command.
I tested it also in the chrome browesr with the following result:
http://xxx.xxx.xxx.xxx:8080/rest/events?topics=smarthome/Command_Lenovo_E7/command

leads to the following message

{“error”:{“message”:“HTTP 404 Not Found”,“http-code”:404,“exception”:{“class”:“javax.ws.rs.NotFoundException”,“message”:“HTTP 404 Not Found”,“localized-message”:“HTTP 404 Not Found”}}}

As I cant find any other setting, I have really no clue what to change anymore - maybe you or someone else can give me a hint.
BR
Daniel

0 Likes

(Sid Amos) #544

Thanks for this great app. It’s extremely useful for showing Habpanel on an Android tablet.

I am using it with openHAB 2.4.0 on an Amazon Fire HD 10 tablet. Unfortunately, with the disadvantage that the webview is older and the screen lock guard cannot be easily disabled.

It is working pretty good, but I have some questions about some small things, maybe someone has an idea.

  1. After running for a while, one of the knob widgets stops updating sometimes and also camera snapshot does not work anymore. The screenshot command is still working OK.
    1a.
    Sending the UPDATE_ITEMS command does not refresh the affected widget. I did not observe that yet when Habpanel was running on the Chrome desktop browser. It should not be a problem with the connection, because the other widgets are always updating fine, as far as I can see.
    1b.
    Regarding the camera problem, the command log says “Fehler beim Setzen der Vorschau Oberfläche”. However I have not enabled camera preview.

I am not saying that this is the fault of the app, could also be the fault of FireOS. I can fix both problems if I send the RESTART command every now and then, but I would prefer a better fix.

  1. I am sending SCREEN_DIM when no one is at home (I do not lock the screen because of the FireOS screen lock guard). It should dim the screen, but I think it only makes the screen black. Because when I send SET_BRIGHTNESS 0 afterwards, it gets still darker. Workaround is to send both commands and reverse both when someone comes home.

Edit:
Info screen says webview 71 and user agent 59. Don’t know, if this is up-to-date then.

0 Likes

(Pali) #545

I have also performance problems with HABPanelViever. I have pretty busy system and in the beginning my system had ~10-20 item updates per second. HABPanelViever was fully jammed. I made some changes to some bindings, so that items/channels are updated only if data have been changed and implemented throttle support, so that bindings will ignore some incoming messges, e.g every 5 messages is passed. Now my system have 1-5 item updates per second and HABPanelViever is working much better.

I have a time widget on my page and still some second updates are missed. Some times seconds are updateded every third second and sometimes it’s much worse (during item update peak). If i open same HABPanel page on chrome, time widget is updated smoothly. If i monitor CPU utilization, chrome takes 25% CPU and HABPanelViever takes 40-90% CPU. If i stop some bindings, which cause most item updates, HABPanelViever start to run smoothy as well.

I run HABPanelViever v0.9.22 on HP Slate 21 which have android 4.4.2. Webview user agent v30.0.0.0

0 Likes

(Volker Bier) #546

If you can send commands to HPV and it reacts, then everything is okay with the SSE connection.

You have to use the correct URL: http://xxx.xxx.xxx.xxx:8080/rest/events?topics=smarthome/items/Command_Lenovo_E7/command

Have you enabled HW acceleration? HPV does not even get all your updates, as it only subscribes to the command item. If CPU usage is high, than this is most likely caused be the old webview and there is nothing I can do about this.

If you can update to Android L, you have the possibility to update the webview component.

  1. There have been users some time ago that complained about updates not being shown after some time. I could not reproduce the problem and tried some things that did not work out. I have no idea what else to try. If you have an idea let me know and we can see if we find something out.
    1a. UPDATE_ITEMS tells HPV to send all sensor values to openHAB. I am not sure what that has to do with your widget?
    1b. I have also seen this from time to time. Preview is needed even when it is not shown on screen, android can not take pictures without a preview. The api for taking pictures is rather complicated and throws undocumented exceptions from time to time. If you can reproduce the problem, we can try to find the cause.
  2. i could reproduce this and will look into it: https://github.com/vbier/habpanelviewer/issues/23
1 Like

(Sid Amos) #547

@vbier:
1a. Seems like I misunderstood the docs. I thought it would update my openHAB items inside Habpanel.
1b. Yes, I can reproduce it. Just have to wait a few hours. Already tried with and without Lollipop Camera API. I could try a special version with debug file output or something.
2. Thanks!

0 Likes

(Volker Bier) #548

I have updated the apk linked in the first post. It should contain a fix for the brightness not being set to 0 when SCREEN_DIM is received.

It also contains a new startup time indicator that can be set once the app has been started and a major refactoring of the camera code to make sure camera operations are no longer performed on the main thread.

@sidamos, can you test if this fixes the brightness problems? Can you also check if it makes a difference for the app becoming laggy? Have you tried if enabling / disabling hw acceleration has an impact on this?

0 Likes

(Sid Amos) #549

@vbier, the debug version does not work for me. At the point, where I normally would tell Habpanel to load the config from the server (by clicking on the gear icon), I just have a totally black screen and it says “Connection lost” or something in the lower left corner.

0 Likes

(Volker Bier) #550

Can you disable and enable javascript in the preferences and see if that makes a difference?

Edit: looks like i broke preference default values in the apk. I just fixed the bug and updated the apk once again.

0 Likes

(Sid Amos) #551

I disabled and enabled JS and also activated Desktop mode and navigated back and forth and then it worked.

Dimming the screen is fixed.

I will let you know about the camera.

I was not the one with the laggy UI. :wink:

Edit: Same thing with the updated apk. I have to disable/enable JS to make the Habpabel config page show.

0 Likes

(Daniel) #552

No you got me wrong. All commands n Habpanel work and the item status is shown correctly, but I can´t send commands to HPV or get a status of the tablet. It says “nicht verbunden” instead of the URL under the logo

I don´t see the difference in the URL - I copy pasted your URL but with the same result. I don´t understand what can be wrong - its just one setting to make - the URL. Its also no problem to find it via the discovery.

So it must have something to do with the SSE but I don´t find anything to change.

BR
Daniel

0 Likes

(Volker Bier) #553

The URL I posted in reply to your post is what HPV uses to subscribe the updates from openHAB when you set http://xxx.xxx.xxx.xxx:8080 as server URL and Command_Lenovo_E7 as Command Item. If it does not work in the browser, HPV will show “not connected”. Test
http://xxx.xxx.xxx.xxx:8080
http://xxx.xxx.xxx.xxx:8080/rest
http://xxx.xxx.xxx.xxx:8080/rest/events
Do they all give you a 404?

Do you have a reverse proxy in front of your openHAB instance? Does http://xxx.xxx.xxx.xxx:8080/start/index in a browser show you the selection of UIs?

@sidamos, I had forgot to push the changes, so you downloaded the same apk again. I have now pushed.

0 Likes

(Sid Amos) #554

@vbier, the newest version can be configured without fiddling. Also, the new start item is working great! I’ll give you feedback about the camera tomorrow. Thanks!

0 Likes

(Daniel) #555

Hi Volker

I tried all those URL with the following result:
8080–> slection of UI because start/indec was added automatically
rest–>
{"version":"1","links":[{"type":"habpanel","url":"http://xxx.xxx.xxx.xxx:8080/rest/habpanel"},{"type":"iconsets","url":"http://xxx.xxx.xxx.xxx:8080/rest/iconsets"},{"type":"voice","url":"http://xxx.xxx.xxx.xxx:8080/rest/voice"},{"type":"profile-types","url":"http://xxx.xxx.xxx.xxx:8080/rest/profile-types"},{"type":"extensions","url":"http://xxx.xxx.xxx.xxx:8080/rest/extensions"},{"type":"things","url":"http://xxx.xxx.xxx.xxx:8080/rest/things"},{"type":"discovery","url":"http://xxx.xxx.xxx.xxx:8080/rest/discovery"},{"type":"bindings","url":"http://xxx.xxx.xxx.xxx:8080/rest/bindings"},{"type":"config-descriptions","url":"http://xxx.xxx.xxx.xxx:8080/rest/config-descriptions"},{"type":"persistence","url":"http://xxx.xxx.xxx.xxx:8080/rest/persistence"},{"type":"items","url":"http://xxx.xxx.xxx.xxx:8080/rest/items"},{"type":"services","url":"http://xxx.xxx.xxx.xxx:8080/rest/services"},{"type":"inbox","url":"http://xxx.xxx.xxx.xxx:8080/rest/inbox"},{"type":"thing-types","url":"http://xxx.xxx.xxx.xxx:8080/rest/thing-types"},{"type":"links","url":"http://xxx.xxx.xxx.xxx:8080/rest/links"},{"type":"channel-types","url":"http://xxx.xxx.xxx.xxx:8080/rest/channel-types"},{"type":"sitemaps","url":"http://xxx.xxx.xxx.xxx:8080/rest/sitemaps"},{"type":"uuid","url":"http://xxx.xxx.xxx.xxx:8080/rest/uuid"},{"type":"habmin/floorplan","url":"http://xxx.xxx.xxx.xxx:8080/rest/habmin/floorplan"},{"type":"habmin/dashboards","url":"http://xxx.xxx.xxx.xxx:8080/rest/habmin/dashboards"},{"type":"habmin/rules","url":"http://xxx.xxx.xxx.xxx:8080/rest/habmin/rules"},{"type":"habmin/designer","url":"http://xxx.xxx.xxx.xxx:8080/rest/habmin/designer"},{"type":"habmin/charts","url":"http://xxx.xxx.xxx.xxx:8080/rest/habmin/charts"},{"type":"templates","url":"http://xxx.xxx.xxx.xxx:8080/rest/templates"},{"type":"rules","url":"http://xxx.xxx.xxx.xxx:8080/rest/rules"},{"type":"module-types","url":"http://xxx.xxx.xxx.xxx:8080/rest/module-types"}]}

events -->404
As I am a Mechanical Engineer, I had to google reverse proxy - so no I don´t think so.

My System runs Openhabian on a Raspberry Pi 3 and I havent changed anything that comes with the openhabian installation.

BR
Daniel

0 Likes

(Sid Amos) #556

@vbier, which webview is HBV using, when there are multiple installed? I have an Amazon Fire HD 10, which has its own system webview but I also installed Chrome and Android System Webview from the Play Store. Same for my Nexus 7 tablet with LineageOS (see attached screenshot)
Look like HBV is listing all 3 of them in the info screen, but what is it using?

0 Likes

(Volker Bier) #557

@Daniel_OH
There is something wrong with your openHAB installation, as /rest/events should be there. There was somebody else with your problem (but no solution), see here: Rest/events returning 404

@sidamos
HPV uses the only webview it can get from the system, the version is shown in the user agent. Which version that is depends on a number of factors: OS version, Developer Settings, installed Chrome version, …
See https://developer.chrome.com/multidevice/webview/overview

0 Likes

(Sid Amos) #558

@vbier, OK, so if newer versions of the webview are probably more stable regarding widget updates, I will have to get rid of the Amazon webview.

What is the common workaround for widgets that stop updating? Send RELOAD every now and then?

BTW, camera works really well so far. No failure after several hours, yet. :slight_smile:

0 Likes

(Volker Bier) #559

@sidamos, any news with the camera? Does it work more reliable now?

0 Likes

(Sid Amos) #560

@vbier, it works much much better now. It has gone for days without camera error.

This evening however, I saw that one of the widgets was not updating, so I decided to send the RELOAD command to HPV. But it did not react. So I sent RESTART, also with no effect. So, I went to the tablet and opened the command log. Those last 2 commands were not there, but I saw a failed camera snapshot from this morning. The status information still said connected, so it is strange that it did not get the commands.

Then I closed the app and restarted it and it worked and reacted to commands again. I don’t know if anything that happened was related to each other. More logging would be good, I guess.

Edit:
Seems, I spoke too soon. Today it is not working well. Just tested again 4 times without success, all 4 entries grey in the command log, saying:

  • Vorschau gestartet and one other Text I forgot (I think it was Starting Camera)
  • Vorschau gestartet
  • No extra detail
  • No extra detail

After restart of HPV it works again.

Edit 2:
In case something starts acting up, do you want adb logs?

0 Likes

(Volker Bier) #561

What is your exact usage scenario? Do you have motion detection running? Is the tablet on or off? How often do you send the CAPTURE_CAMERA command?
You can create an adb log, but i doubt that it is helpful. Most likely it will show a RuntimeException in a call to the camera API, which is not even documented. If you are willing to put some effort in this, I could create an instrumented version. But this will most likely not work the first time, so you will need to install several apks until i can see something. If I can see something at all.

0 Likes