Disable auto reload/refresh of the Webview item

Hi there to you all,

I am currently working with openHAB 2.1.0 and a Webview item. More precisely, I am trying to develop some kind of “file browser” which I will later use in my homemade multiroom audio setup managed via openHAB (in its Android version).

Now, to my problem: I have noticed the Webview element does refresh itself automatically every 30 seconds or so (although I did not measure it). This is very frustrating because, as you can imagine, this forbids every interaction in which the user clicks on a link in the Webview page and changes its URL (URL does indeed change, but just until the next automatic reload which “resets” the Webview page to the original location as specified in the sitemap configuration).

I use Webviews for a bunch of other things too (real time video camera feeds, for example) and the automatic refresh is not very much of a hassle in there, but for this very specific need it is quite annoying.

Now the question: is there some kind of parameter I am missing (I read the docs thoroughly, I searched the forum and the Internet), some kind of configuration I can apply to disable the automatic reload feature of the Webview item?

This applies on the computer browser (using the Basic UI) as well as on my (and others) Android smartphones using Android 7 or 8 and the latest openHAB App available on the Play Store at this time.

Thank you all very much for your time and patience.

Andrea.

I know of no way to change this. Based on the description of what you are trying to do, you might have better luck using HABPanel and a custom widget.

Hi Rich and thank you very much for your reply.

Habpanel might in fact be a solution, but in my case I need to provide integration with the existing configuration used in every smartphone in the house.

I have already built a full integration with my house KNX system so we can manage all the light switches, door and gate opening, heating and cooling and so on. Now, with the multiroom audio system we built, we need to be able to browse available songs and manage playback using always our smartphones.

Because of this, I am building a php driven system which controls a few mpd instances on a computer in our network. Also, the file browser is handled by php in this web page. No problem on this end but, when I link my work to an openHAB Webview, I get the auto refresh which is very frustrating.

Unfortunately, habpanel is not a solution in my case pretty much because only the smartphone is used for management as of right now, so I have no direct way that I know of to integrate a custom habpanel widget inside the official Android application without the need to manually open the browser and point to it.

What I would like to know instead, maybe from the developers, is why this feature is implemented this way and, if I can make a suggestion, please allow us to disable it in some way (with a parameter of the specific item or a global configuration).

Thanks again Rich, I am although still open to suggestions because I would very much like to find a solution to this.

Greetings to you all,
Andrea

You can always make a suggestion by filing an issue. In this case it would need to be on the ESH repo as that is where BasicUI is implemented. But note that this will also likely require changes to both of the phone APPs as well.

Finally, I’ll point out that both Android and iOS support putting an icon on the desktop and within the app drawer (in Android’s case) that is a link to a web page. On Android at least, it comes up in kiosk mode so the fact you are in the browser is mostly transparent. I haven’t played with iOS much on this.

Ultimately, unless you are willing to dig in and make the changes to OH/ESH yourself, which would be welcomed, it is going to be an unacceptably long wait for you. To get this to work for you in a timely manner I see you have three options:

  • make the changes to BasicUI and the phone apps yourself
  • find a way to make HABPanel work for you and implement a custom widget
  • implement your interface external to the OH UI

Hi there and sorry for the delay, unfortunately I was busy with work (yeah, it seems like I also need that to live :wink: )

I had time to do some thinking though, and I would like to hear your opinion about the following.

For the record, we are talking about the Android application from now on, which is now my primary interest more than BasicUI itself.

I actually thought that it is not the Webview component which refresh itself automatically every 30 seconds, but it is actually the whole current page which gets redesigned. That’s why we “see” the Webview refreshing.

If my thought is indeed correct, and there we get to your more-than-valid suggestion to implement the changes myself, we crash upon the real problem… I actually looked at the Android app source code in Android Studio, but given the fact I am not that skilled in Java programming, I was not able to find (if it exists) some piece of code which tells the app “ok, 30 seconds elapsed, reload the current UI fragment)” in order to disable it.

I can handle myself around code, so a short suggestion to begin with would be very much accepted (if you have one).

If you don’t and think an issue would be the right way to proceed, please let me know and I will do so.

Ultimately, about that:

I know, but the problem is I would like to provide full integration directly within the openHAB app and nothing else. I do not care about iOS right now because it is never used in my scenario.

For now, I really do thank you for your time and patience.

You can always file an issue and the other developers will comment on whether what you are after is viable . I’ve never looked at the code so can’t say one way or the other. However, I would caution that the refresh is almost certainly there for a reason. Any changes to the behavior needs to take into account the reason it was implemented in the first place.

But here is the thing. You don’t care about anything else but sitemaps need to work consistently across ALL the interfaces. That means it needs to work the same in Android, iOS, BasicUI, and ClassicUI. You can’t just focus on Android and ignore the rest. I’m all but positive that if you did your efforts would be rejected as incomplete.

Hi there,

I did open an issue just a few minutes ago in the HABDroid Github explaining the situation, we will see how it goes from there.

I also did further investigation on the matter: I can now confirm that the “auto reload” does NOT happen in the BasicUI, hence making it an “Android-only” problem from my perspective. I noted that in the issue, and I am currently waiting for a feedback over there.

I will update this thread if something comes up in the future.

Thanks again.