Sitemaps mappings with duplicate mappings

The following code in my sitemap:

Switch item=Beamer_Reachable mappings=[ON="Bereikbaar", OFF="Onbereikbaar", NULL="Onbereikbaar"]

gives me this output:


Is it possible to combine the OFF and NULL in 1 mapping, so I only see 1 button with ONBEREIKBAAR instead of 2?

I was thinking of using the visibility parameter but that would result in a lot of lines with code. I’m hoping for a more simplistic option.

OH 3.2M5

I’m afraid sitemaps are simplistic.
It’s only two lines

Switch item=Beamer_Reachable mappings=[ON="Bereikbaar", OFF="Onbereikbaar"] visibility=[Beamer_Reachable != NULL]
Switch item=Beamer_Reachable mappings=[ON="Bereikbaar", NULL="Onbereikbaar"] visibility=[Beamer_Reachable == NULL]

You may need to think about UNDEF state too.

My personal preference would be just the on/off buttons, leaving neither highlighted if there is a NULL or UNDEF state, so there’s a visual indication its offline or whatever.

1 Like

Thanks again for your insights. I will leave it as it is for now, which corresponds with your personal preference.

BTW those 2 lines grow to 60+ lines, I have 30+ devices :grimacing:

O well, another reason to ditch the sitemaps and unleash the full power of OH3. I just need some time.