Display content from a text file ( or link to local html-file)?

I collect some data in write them into a file (10 lines, ~40 chars per line).
How can i display these “lines” in oH? Like a text box …

If needed, I also can create a short html file with this content instead the text file.
Than: How can I create an “item” (or icon (with a hyperlink)) which only “point” to html-file (which is located on the oH server (Raspberry)).

Actuell i use the BasicUI to show/display my items I have.

You could use the webview widget to display a html file. As you will need a web server, you will have to put the file in afaik /etc/openhab2/html/

1 Like

OK, if there is no other solution …
A simple “Text Box” will be nice, or the option to use a local stored html file (future request :wink: )

I installed lighttpd and, works! (file placed under /var/www/html/<myfile.html>)

You don’t need to install lighttpd, as jetty will also serve this file :slight_smile:

Oh, I see, I should read the readme.txt … while my tests I don’t use the subfolder “static” !

Webview url=“http://openhabianpi:8080/static/tv_prime.html” height=6 => works
(and the file is located under /etc/openhab2/html)

So lighttpd was removed again…

I just found some “strange” issue with the usage from a html file under /etc/openhab2/static/filename.html

If I modify or replace the Html-file, the new content will not displayed when opening the oH webpage:
(the html-file was build in with the webview url …)
Also will not update the content.

When opening the html-file “direct” using:
the actuall (correct) content is shown.
And after this, also the other link (via sitemap) is shown the actual content.

Is there any settings I must do?
Any hint for this behaviour?

Or do I need another apache server, instead jetty the lighttpd ?

I add in html meta a refresh, but this did not solve the problem.

Here I see another “solution” and I think this is not my problem because this user have a “selection” (switch) problem.

My used webview -line is simple this:

Webview url="http://MYIP:8080/static/tv_prime.html" height=22

I see the same, it is a caching problem of the browser. If I use “shift-reload” at the browser all is fine.

I don’t belive so, in my case it will not solve.
PC (Chrome) : Strg-F5 will not fix, also on mobile (sliding down the page - refresh) still show the old content when try this IP:

Using the file in the html/static -folde rshow correct content (after refreshing the page) !


I use this:

Webview url="/static/events.txt" height=8

Just put the textfile in html folder and with Strg-F5 it will reload and shown correct. Not tested with native html-file.

Good hint, I remove the full name/path to my html file, now it seems to work.

I already at the …meta … refresh -code, this refresh the page, but always with old content.


Webview url="http://MYIP:8080/static/tv_prime.html" height=22


Webview url="/static/tv_prime.html" height=22

For one thing on my sitemap I have no explanation:
On the top, before the (correct) webview -content is shown, there is broken symbol from a icon (see picture, red cycle).
I don’t know the reason or “source”.
(the used html-file is correct, there is no broken icon vissible, only simple table …)

I copy the picture-URL, this is the content:


I found out that the “png” appear after I changed in the Paper-UI the default icon-format from svg tp png (before the same broken icon, but with "…format=svg)


The code in the sitemap is:

           Text item=gTelevision
              Webview url="/static/tv_prime.html" height=22

OK, found it:
If I add (i.e.) icon=screen, the broken icon is replaced by the screen-icon (for example):

Webview icon=screen url="/static/tv_prime.html" height=22

That’s an unexpected fix.

On the broken icon, note that current snapshot has broken default icons.

If it seems that that webview.xxx is really missing from the default ‘classic’ icon set - there is an ongoing gitub issue related to deliberately omitting an icon, Maybe worth adding comment to that.