Icon is not changing

Hey Guys,

i´ve a problem with one of my icons. It´s the humidity.png. It´s correctly displayed at the sitemap.
Now i want that the icon is changing when the humidity goes up or down. So i´ve created the icons humidity-0.png, humidity-10.png and so on, like the rollershutter icons.

I use the weather binding with this line:
Number Luftfeuchtigkeit “Luftfeuchtigkeit [%d %%]” {weather=“locationId=home, type=atmosphere, property=humidity”}

At the moment the humidity is at 71%…so icon humidity-70.png should be displayed…but it didn´t. It shows me the humidity.png.

did I forgot something?


No, it isn’t that easy. You need to do the transformation with another number item, which shows the exact state needed by the icon. (70%)

If you’re interested, I can share my rules, items, sitemaps with you.

Edit: The device shows 99% Battery status (LG G4) but MQTT has updated a few minutes ago,
therefore openhab displays 90%.
Battery usage is only accurate when i move the device (if the GPS Location changes frequently)


yes i´m very interested to see the solution :-)…especially the transformation.

First of all, you need to create a second item.
In my example mqttPowU2 is the “raw” input from the sensor.
mqttPowIconU2 is the icon-number-item (States: 0,25,50,75,100)

Could be easily adjusted to your needs (10% Steps)

rule "BatteryIcon GT S2"
	Item mqttPowU2 received update
	if (mqttPowU2.state>=0 && mqttPowU2.state<15) {
		postUpdate(mqttPowIconU2, 0)
	if (mqttPowU2.state>=15 && mqttPowU2.state<35) {
		postUpdate(mqttPowIconU2, 25)
	if (mqttPowU2.state>=35 && mqttPowU2.state<60) {
		postUpdate(mqttPowIconU2, 50)
	if (mqttPowU2.state>=60 && mqttPowU2.state<80) {
		postUpdate(mqttPowIconU2, 75)
	if (mqttPowU2.state>=80 && mqttPowU2.state<=100) {
		postUpdate(mqttPowIconU2, 100)

Add this to your sitemap (Yes, each state is another line in the sitemap file :smiley: )

Text item=mqttPowU2 icon="measure_battery-0" label="GT S2 via MQTT [%d %%]" visibility=[mqttPowIconU2==0] Text item=mqttPowU2 icon="measure_battery-25" label="GT S2 via MQTT [%d %%]" visibility=[mqttPowIconU2==25] Text item=mqttPowU2 icon="measure_battery-50" label="GT S2 via MQTT [%d %%]" visibility=[mqttPowIconU2==50] Text item=mqttPowU2 icon="measure_battery-75" label="GT S2 via MQTT [%d %%]" visibility=[mqttPowIconU2==75] Text item=mqttPowU2 icon="measure_battery-100" label="GT S2 via MQTT [%d %%]" visibility=[mqttPowIconU2==100]


nice, works great :thumbsup: …thanks.