Multiple values for state_image input?

I’m setting up a weather tab so that the image for the weather updates with the current weather state. I had conditionals for each state, but that was SO MANY lines of code. I realized I can use the state_image in a picture elements card to make this much more efficient.

My question is, can a state_image have more than one value for the input? See code below: the first line under state_image works because there is only the state “4” but the second line fails. Is there a way to make both “40” & “46” work or do I need a separate line for each state?

- type: image
  entity: sensor.yrweathercurrent_symbol
    "4": /local/icons/weather_icons/animated/cloudy.svg
    "40", "46": /local/icons/weather_icons/animated/rainy-4.svg
1 Like

I have the same question. I’d like to use different state images based on fan speed.

I have a similar issue. I would like to show an image based on temperature.

For example ranges like: 0-30, 31-50, 51-100

Any solutions for this?