Icon Rules for Sitemaps

Because i didn’t find it anywhere else, here’s my solution for custom Icon Mapping in the UI via the Icon Rules Option for a text field.

Situation: i’m measuring the voltage of a 12V battery and want to map that to icons. Didn’t find any documentation anywhere, how it exactly works. Like this it does:


Here’s the code version of this:

Text item=wohnmobil_technik_voltage label="Bordspannung" icon=[wohnmobil_technik_voltage >"13.5"="energy", wohnmobil_technik_voltage >"13.0"="batterylevel-100", wohnmobil_technik_voltage >"12.76"="batterylevel-80", wohnmobil_technik_voltage >"12.52"="batterylevel-60", wohnmobil_technik_voltage >"12.28"="batterylevel-40", wohnmobil_technik_voltage >"12.04"="batterylevel-20", wohnmobil_technik_voltage >"11.8"="batterylevel-0", wohnmobil_technik_voltage <="11.8"="siren"] {

The nice thing on this way to do it is that you can use any icon for any state range. Rules are evaluated from top to bottom so be careful with the right sequence.

1 Like