Read Only Switch does not work // workaround realized - please check if this is the proper way

Hi everyone,
I am currently in the process of upgrading from Openhab 2 to Openhab 3 and face some issues/questions.

  • Platform information:
    • Hardware: Raspi3
    • OS: Openhabian
    • openHAB version: 3

Read Only Switch
I am connected to a service which tells me if there is a weather warning for the region (“DWD Unwetter Warnungen”). The corresponding channel is represented as a switch and I linked it to an Item. The issue now is that I added that status info to the sitemap and I can switch the status manually, which should not be the case - the switch should be read only. I already saw the option to set “Readonly” in the metadata settings for the item but that does not work unfortunately.

My workaround now is that I added mapping info inside the metadata and set up the status as a text element inside the sitemap.

That workaround works for me now… but isn’t there a proper “Read Only” Setting for switches which I overlooked?

Or did I realize already the “best practice” for this issue?

If you have a read only Item of any type, use a Text element to display it on your sitemap.

Ok, but then this means that it will not be visualized as a switch symbol anymore but just as a text with ON / OFF -or as in my case- with the mapped values. Is that right?

Correct, but in sitemaps the toggle will always be interactive. There isn’t such a thing as a read only Switch element on the sitemap.

Ok, thank you for your fast feedback!