Show oh3 item status in html file

under openhab 2.5 this command line displayed the current item status in an HTML file:

<td align=center>{{itemValue('GWC_PWS_Oben')}}</td>

At the moment I’m in the process of designing a gas station map under oh3.2. For example, I use the following command to insert an image into the HTML file:

<td style="min-width:50px" align="center"><img src="https://198.126.198.2:8453/static/bilder/jet_png.svg" width="32" height="32"></img></td>

In order to be able to display the appropriate command line in this HTML file (it is part of a widget), I need the “translation to oh3.2”. The first command worked very well on openhab 2.5. However, I don’t know if there is an alternative for OH3.2.

I cannot help with your initial question, but have you considered to use map or floorplan widgets, where you can out of the box show an item state within a map or image?

Hello,

No I have not. The widget works in principle, I would like to modify it a little. It is a gas station card with the binding “Tankerkoenig”.

The ability to refer to an Item like that was something only implemented by the Weather 1.x binding. The way the Weather 1.x binding enabled that is not allowed for 2.x bindings (bindings should not know about Items, just Channels and Links). So that itemValue feature is not supported in OH 3 at all since no 1.x bindings are supported.

You’ll need to use a MainUI Widget which can gather and display information from multiple Items in one widget, or implement some JavaScript in your HTML file to make the XmlHttpRequests to the openHAB REST API to get the states of the Items.

Note, I moved this to a more appropriate category. Tutorials and Solutions is a place to post tutorials and solutions, not a place to ask for one.

Sorry I’m only getting back to you now. I was away for a few days.
Your answer has increased my knowledge of openhab yet again. So I find z. B. a MainUI widget is very interesting. However, I don’t know how something like this is structured, can you read about it somewhere?
A solution with JavaScript would make the most sense, however, since the existing HTML file is already structured in this way. Unfortunately, with my modest knowledge, I fail at the hurdle of integrating an article status. Maybe there is someone else who can help me.
So far I’ve solved the problem by creating a widget next to the HTML file. In the ad, I aligned the HTML file and the widget side-by-side. However, the alignment of the lines is not exact, you can see the difference.

The getting started tutorial UI section: Pages - Introduction | openHAB

The UI Docs starting at Building Pages - Components & Widgets | openHAB

Thanks very much! Maybe I can still find help to fill the already working HTML part with some javascript.