How to use signal level icons?

I see some icons here which have different variants representing different signal levels, namely signal and qualityofservice.
I have an item reporting wi-fi signal strength in % - how can I have the icon changing depending on the item value?

Make sure your Item is a Number Item and use BasicUI.

Both are numbers and switching to basic have no result.

Number	ESP1rssi "ESP #1 RSSI [%d %%]" <signal> { mqtt="<[broker:esp1/rssi/:state:JS(db2percent.js)]" }
Number	Sonoff1rssi "Sonoff #1 RSSI [%d %%]" <qualityofservice> { mqtt="<[broker:tele/sonoff1/RSSI:state:default]" }

From the console:

openhab> items list ESP1rssi
ESP1rssi (Type=NumberItem, State=60.0, Label=ESP #1 RSSI, Category=signal)
openhab> items list Sonoff1rssi
Sonoff1rssi (Type=NumberItem, State=56, Label=Sonoff #1 RSSI, Category=qualityofservice)
openhab>

This is just a shot in the dark, but try removing the %% (the space and the percent signs).

There was recently a kerfuffle over the fact that BasicUI is using the transformed/mapped value created in the label to pick icons instead of the Item’s raw state. If I’m right, it is trying to use 83 % to pick the icon (and failing) instead of 83.

does not help

I’m afraid I’m out of ideas then.

That’s ok. This time I can live with the static icons :wink:
Thanks!

I figured out how to do this, but the result is that you get a pretty icon and basically useless values. I am displaying the RSSI values of a number of MQTT devices, and, in order to get the icon to work, you have to map the RSSI to a 1-4 scale to represent the signal-1, signal-2, etc… icons. So now, rather than showing me the RSSI = 50% I get RSSI = 2 and the signal-2 icon is displayed.

rssi.scale file in the transform directory:

[0,25]=1
[25,50]=2
[50,75]=3
[75,100]=4

Yes, there would be a flaw if I got a reading of exactly 25, 50, or 75, but I always seem to be a few percent higher or lower, so I don’t have a problem. I am not sure which icon would get picked if that happened.

Then, in my Items file:

Number item_rssi "Item RSSI: [SCALE(rssi.scale):%s]" <signal> (gRSSI) { mqtt=........}

I also have the transform done at the MQTT binding, so I wonder if that is actually what is working. I guess it might depend on the binding as to which value controls the icon. My guess is that the state that is stored because of the binding is what is controlling it, not the display text.

Theoretically, you should be able to create new copies of the signal icons with -20, -50, and -75 in place of the -1, -2, -3, -4. Then you can keep using a reasonable value and get the icon state changes you desire.

You’re a genius. I have no idea why I never thought of that! Thanks for the tip. I just tried it quickly and it worked like a charm.

Hello friends.
As it is done to put a dynamic icon name.
Example <qualityofservice_x>
where x is SCALE (wifi.scale) that returns 0, 1, 2, 3, 4
Thank you very much.