Icons for cistern-level


i check with a python-script the water level in a cistern.


Thing exec:command:CheckWasserProz [command=“python /etc/openhab2/scripts/checkWasser Proz.py”, interval=2, timeout=20, autorun=false]
Thing exec:command:CheckWasserLiter [command=“python /etc/openhab2/scripts/checkWasser Liter.py”, interval=2, timeout=20, autorun=false]


String WasserStand “Füllstand Frischwasser: [%s]”
Number WasserProzent “” { channel=“exec:command:CheckWasserProz:output”}
Number WasserLiter “” { channel=“exec:command:CheckWasserLiter:output”}


   Text    item=WasserStand	icon="measurecup"		labelcolor=[!=1="black"] valuecolor=[!=1="green"]


rule “update WasserStand”
Item WasserProzent received update or
Item WasserLiter received update
WasserStand.postUpdate(WasserProzent.state.toString+" % / “+ WasserLiter.state.toString+” L")

I found Icons (cistern-0 … cistern-100). what i have to chanage so i can see the icon depending on WasserProzent???


You cannot base a dynamic icon for a sitemap widget assigned to one Item, on the state of some other Item.

The closest effect you can get to what you are trying to do -
Use a Number Item, and update it with your 0-100 level so that it can be used with the dynamic icons. Suppress the state display if you like.
In your updating rule, do not postUpdate your combination text to the Item.
Instead, assign your text as the Item label.
someItem.label = "my text " + "more text []"

Because the UIs are not intended to work with dynamic labels, the refresh may not be very good.

If you had only a few icons you wanted to show, you could instead use the visibility= option in your sitemap widget, to show one of a number of similar widgets with different icons. The visibility= parameter can involve a different Item to the main Item of the widget.

Thx for helping. Not its working.

Took the special cistern-icon und a string and a number item and a little rule to convert the shell-returnable.

Now the icon is dynamic and i can control the valuecolor etc.