[SOLVED] Displaying elements of OpenHAB interface in HTML

Hello,
I can display an entire sitemap in another application using an iframe, and just point the URL to the OpenHAB sitemap.

But that pulls in the entire sitemap page, including the header for that sitemap. If I just one a single button from that sitemap, is there a way to pull in just that button and its attendant functionality from OpenHAB’s UI into an app that allows HTML?

the BasicUI is, what you can access via the sitemap-file(s). So, you have two main possibilities:

  1. use a dedicated sitemap with just that button - you still have to remove header and footer in your WebApp
  2. use the REST API and rework the button within your WebApp

ad 1)
just place the item with the button in a dedicated sitemap-file - you can have more than one sitemap file in your sitemap folder!
but still: you have to remove everything around the button, if you only like to have a button elsewhere.

ad 2)
use REST API - and have a your button rebuild in your WebApp using simple HTML/JS (aka AJAX) features.
more on REST:
https://docs.openhab.org/configuration/restdocs.html

afaik there’s no “just give me the BasicUI for a button without header/footer and stuff”-functionality.

but if your App is configurable and can make use of a simple REST API - you won’t need that HTML-part…

1 Like