OH3: floorplan problems

  • Platform information:
    • Hardware: Raspi 4, 2 GB RAM, 16 GB SD card
    • OS: openhabian (OH3)
    • Java Runtime Environment: openjdk version “11.0.11” 2021-04-20 LTS
    • openHAB version: 3.1.0 - Release Build

Issue of the topic:

I created a floor plan page. On a Raspi 3 running pi-hole (a webserver is included) I stored a simple index.html and the plan as img0.jpg. The file index.html is

< html>
< img src=“img0.jpg”>
< /html>

(I needed to add a blank between the < and the first character otherwise it is not displayed here. In the file there is no blank.)

When I open on my PC http://192.168.1.107/oh_files the browser (Firefox) shows the floor plan. When I use this URL in the field Image URL openhab does not show the floor plan. Why does my browser resolve the URL and show the image and openhab does not?

I tried to directly address the image and put into the field the URL http://192.168.1.107/oh_files/img0.jpg. Surprisingly the floor plan is now displayed. (Well, you need to adjust width and heigth because OH is using 1000 by default regardless of the pixels of the image)

Here the code without the marker sections (they work fine anyway):
config:
label: House 1st floor
sidebar: true
order: “”
imageUrl: http://192.168.1.107/oh_files/img0.jpg
imageWidth: 1024
imageHeight: 724

In the end I got it working but I thought it is just a workaround. Any thoughts why the index.html does not produce the intended effect?

Günther

The imageURL setting is not rendering a html resource that you point it to, it is using the raw resource (and it is expecting an image). When you point it to the index.html resource it tries to interpret that html file as an image and fails.

Thanks for clarification. I was confused that you only have the option to use an URL to the image and concluding that you need to have a file index.html and the image.

Is there a possibility to have the image file on the OpenHAB server? Installing Apache on the same machine? Would this work? (I know: looks like a lot of resources just to display the image of a floorplan).

If you put the image on the OH server here:
/etc/openhab/html/

Then you can go to: http://your-OH-IP-address:8080/static/your-graphic.png

1 Like

For files in your OH html finder, you don’t even need the absolute address; relative address will work just fine (and be future-proof against server changes).

ImageURL: /static/your-image.png
1 Like