Sitemaps: mapping buttons are shown one above the other instead of next to each other after visibility condition changed

  • Platform information:
    • Hardware: Pi 5
    • OS: Raspberry Pi OS Lite (Bookworm)
    • Java Runtime Environment: OpenJDK RE (build 17.0.15)
    • openHAB version: 4.3.5

I am using quite many sitemap switch mappings with visibility conditions (see generic example below)

Items:

Number		TestNumber	"TestNumber"
String		Teststring	"Teststring"

Sitemap:

Setpoint	item=TestNumber		label="TestNumber[%d]"	icon="none"		minValue=1	maxValue=4	step=1
Text		item=none
Switch		item=Teststring		label="TestString"		icon="none"		mappings=["A"="A","B"="B"]			visibility=[TestNumber=="1"]
Switch		item=Teststring		label="TestString"		icon="none"		mappings=["A"="A","C"="C"]			visibility=[TestNumber=="2"]
Switch		item=Teststring		label="TestString"		icon="none"		mappings=["C"="C","D"="D"]			visibility=[TestNumber=="3"]
Switch		item=Teststring		label="TestString"		icon="none"		mappings=["A"="A","B"="B","D"="D"]	visibility=[TestNumber=="4"]

Since some time (maybe since update to OH4 or OH4.1?) changes on the sitemap are not updated as expected anymore:

Before I change TestNumber it looks like this:

After I changed TestNumber it looks like this:

And when I reload the page manually it looks like this:

The expected behavior would be to see the buttons next to each other directly, without a manual reload of the page.

Does anybody observe the same or know what’s going wrong here?

1 Like

@jimtng for information.

Arrangement of buttons was improved over the 4.x versions.
I will try to reproduce that in OH 5.

1 Like

I just made a quick test with a clean openHABian install and was able to reproduce the unexpected behavior with OH 4.3.5 as well as OH 5.0.0.M2

Is it something specific to use of visibility?

I did some further testing and found out that the bug was introduced with OH 4.3.0-1.

The previous OH 4 versions (OH 4.2.3-1 and before) work fine.
And the subsequent versions (OH 4.3.0-1 to 5.0.0 M2) work ugly as shown above.

There was a major enhancement in 4.3 regarding rendering of this sitemap element.
As it works pretty well and better than before for all of us, we have to understand what is wrong in your case.
I retry my question: did you reproduce it without visibility condition? My idea would be that the bug is when visibility condition is involved. I have not such a case in my usual sitemap in production.

Definitely with visibility, same for me with this annoying new display regression, even when other improvements might have been introduced :wink: so not a single case with @jimmbimm

Frame when the AC is OFF

Then when COOL or FAN mode is turned on the optional fan speed is shown through visibility - with the same issue

and only after a reload of the page does it show as expected and intended

Yes, it is specific to the use of visibility. It happens only when the visibility condition changes.

It is easy to reproduce as I intended to show with my simple example.
And since I was able to reproduce it even with a fresh install with nothing but these two items and this little sitemap I assume that this is a general problem.

I agree that rendering of this sitemap element works pretty well and better as before, but unfortunately not if one wants to show different mappings depending on a visibility condition.

I made so many tests when @jimtng implemented the change but I totally forgot to test when visibility condition is involved.

Ideally a GitHub issue should be created with all necessary info. Can one of you do that?

I just created [BasicUI] changing the visibility condition leads to an incorrect visualization update of a switch with mappings and visibility · Issue #3233 · openhab/openhab-webui · GitHub.

That was my GitHub issue premiere, I hope it’s ok :slightly_smiling_face:

@jimtng proposed a fix I just merged. I have not tested it myself but you should be able to test it if you install the snapshot that will be built tomorrow.

1 Like

Hi @Lolodomo and @jimtng,

I tested with 5.0.0 (Build #4695) and everything looks great.

The mappings update after a change of the visibility condition now works automatically. No manual reload of the page required anymore.

Thanks a lot :+1: