Change the picture based on a template

I have setup a picture-elements card with a bathtub showing how hot is the water in the heater. It shows a percentage using a state-label. What I am trying to achieve is to change the picture of the bathub into something else when the water is very hot or very cold. Can this be done?
Here is an example of what I have now.

3

    cards:
      - type: picture-elements
        image: /local/images/frontend/bathtubdark.png
        elements:
          - type: state-label
            entity: sensor.water_temperature
            style:
              top: 70%
              left: 50%
              color: white
              font-weight: bold
              transform: scale(5)
1 Like

You could achieve the same effect with two Conditional cards – one for hot, one for cold.

An input_boolean could serve as the condition variable.

Ah! Thats a fantastic idea! I will try it and see if I like it! Thank you!

1 Like

I’m switching between light and dark map cards for day/night and it’s been working great. :slight_smile:

Now that I am thinking of it, what if I want to use more than 2 states?
For example: Hot, warm, cold, frozen. I am not saying that the water would be frozen, but I could use this for other things too…

Oh yeah, good idea! You could use an input_select for that.