Network Binding in a Sitemap, icon color changes after OH3 > OH4 upgrade

Hi, I have a sitemap that uses Network Binding to display current ping state of various devices. Under OH 3.2 it worked as described below (I changed the image URLs from my localhost to OH demo)

I’m using text definitions:

Things

Thing network:pingdevice:ping_212 "212" @ "xLAN_IoT"[ hostname="192.168.1.212", retry=1, timeout=2000, refreshInterval=6012 ]

Items

Switch Xlan_iot_212_online <network> (gPingItems) { channel="network:pingdevice:ping_212:online" }
DateTime Xlan_iot_212_lastseen <time> (gPingItems) { channel="network:pingdevice:ping_212:lastseen" }

Sitemap

Text item=Xlan_iot_212_online label="212 [%s]" icon="network" valuecolor=[ON="green", OFF="red"] visibility=[Xlan_iot_212_online == "ON"]
Text item=Xlan_iot_212_lastseen label="212 [%1$td.%1$tm.%1$tY %1$tH:%1$tM]" icon="network" valuecolor=[ON="green", OFF="red"] visibility=[Xlan_iot_212_online == "OFF"]

After upgrading to 4.1.2, the sitemap shows grey icon for OFF instead of the red one.
https://demo.openhab.org/icon/network?iconset=classic&format=svg&anyFormat=true&state=UNDEF

When I’m checking the item’s current state in Main UI it says OFF, as it should, since the target ping device is offline. I created a dummy button to test the state display in this sitemap and it works correctly, showing green icon for ON and the red one for OFF.
It seems that when using Network Binding “valuecolor” only affects the item’s displayed state (the [%s] part), but not the actual icon. Adding UNDEF=“red” to “valuecolor” doesn’t work either.

In what UI ? Basic UI ? Android app ? iOS app ?

I’m using Main UI and textual definitions.

Is your value properly rendered in red ?
With your visibility condition, you should not see the widget when the state is not ON. So I am not sure when you expect to see the red icon.

So why are you introducing sitemap stuff in your explanations ? They are irrelevant if your problem is only in Main UI.

And in Main UI, in what page do you see the wrong icon ?

In OH 3.2 offline devices on my sitemap were shown as

/icon/network?iconset=classic&format=svg&anyFormat=true&state=OFF

In OH 4.1.2 offline devices on my sitemap are shown as

/icon/network?iconset=classic&format=svg&anyFormat=true&state=UNDEF

Online devices were (OH 3.2.0) and still are (OH 4.1.2) displayed correctly using

/icon/network?iconset=classic&format=svg&anyFormat=true&state=ON

When the state is ON, the label next to green icon says ON
When the state is OFF, the label shows the date and time when the item was last seen on.
This all works as planned, the only thing I can’t figure out is the icon’s color

Why am i introducing “sitemap stuff” in a topic describing my problem with sitemap? Is that a trick question? :smirk:

I never said I see a wrong icon in the Main UI.

So if the wrong icon is in sitemap, what UI are you using to display sitemap ? basic UI or Android app or iOS app?
You previously answered Main UI, this is what introduced the confusion to me as Main UI doesn’t show sitemaps.

I’m not sure how to check that. The sitemap sits at \localhost\openHAB-conf\sitemaps. I’m accessing it using Chrome browser on a PC. Now I see there’s a “basicui” in the URL, so that’s probably what you’re asking.

Sorry for the confusion, but when you create something in a text file and access it directly through a browser, there’s no clear indication on what UI are you using.

Anyway, accessing this sitemap through an OpenHAB Android app yields the same result - icon with UNDEF state instead of the OFF one.

Yes, this is Basic UI if in a WEB browser.
As your first sitemap element is hidden when the item state is OFF, I assume you are talking about the second sitemap element linked to a date. The icon for this one will be grey because the value is a date

Thanks, so the sitemap working differently in OH pre-4 was just a bug that is now fixed?

Sorry, I really doubt this was different in OH3.

If you want the red icon, just replace icon=“network” by icon=“network-off”.

A change was done for this icon to have grey instead of black, not to replace red by grey.

That works too. Thank you very much for your help.