Dynamic images from other item source

I have the above section in my basic UI. The Heating Pow (power mode) uses a dynamic image for On (Green) Off (white) or Schedule (blue - this image was demonstrating a problem).

This does work well…but I’d like to extend it somewhat.
Off and On are fine with the white/green.
But for the Schedule, I’d like it to be blue when another item (the central heating switch) is off, and green when the central heating switch is on.

Is there anyway to do this with dynamic icons, or do I play with a Visibility Tag in a sitemap to effect what I want?

Since there is no way to tell a widget to use iconx if this condition or icony if that condition, you’ll have to go the visibility way.

Or re-think your Item states, which appear to number four rather than three.

So I’ve set a new item and set the visibility and icon off that with:

Switch item=heating_powermode mappings=[ "On"="ON", "Off"="OFF", "Schedule"="SCHEDULE"] icon="radiator2-schedule-on" visibility=[ heating_icon=="radiator2-schedule-on"]
Switch item=heating_powermode label="Schedule" mappings=[ "On"="ON", "Off"="OFF", "Schedule"="SCHEDULE"] icon="radiator2-schedule" visibility=[ heating_icon=="radiator2-schedule"]
Switch item=heating_powermode label="on" mappings=[ "On"="ON", "Off"="OFF", "Schedule"="SCHEDULE"] icon="radiator2-on" visibility=[ heating_icon=="radiator2-on"]
Switch item=heating_powermode label="off" mappings=[ "On"="ON", "Off"="OFF", "Schedule"="SCHEDULE"] icon="radiator2-off" visibility=[ heating_icon=="radiator2-off"]

I’ve added the label just for diagnosing the issue, that the radiator2-schedule-on is working, but everything else defaults to the icon for radiator2-on Even though the label is taking effect to show me the correct visibility clause is working.

Hyphen is a “forbidden character” in an icon filename. Because it is used by the dynamic icon picker mechanism. You can see the above setting for example could get into situations like looking for file
which would likely fail and deliver instead the default radiator2.png

You can’t really force things this way. I’d guess your icon picker is looking for radiator2-on-radiator2-on.png

1 Like