Template as image URL in picture elements card

I’m trying to use the state of this sensor,

{{states('sensor.jewish_calendar_day_of_the_omer')}}

to show different images on this picture elements card.

It doesn’t seem to work, even though in developer tools the template renders as expected. Does anyone know why?

1 Like

As you haven’t shown us the card config who knows? Posting a picture is useless, particularly if there are parts hidden! yaml please!

Also, the word ‘template’ is not found on this page Picture Elements Card - Home Assistant so I am not sure it is even templatable.

It is not. At least not without Ian’s third party “card”:

type: picture-elements
image: /local/sefira/backround light.jpg
elements:
  - type: image
    image: /local/sefira/day/{{states('sensor.jewish_calendar_day_of_the_omer')}}.gif
    style:
      top: 11%
      left: 50%
      tranform: none
      width: 75%
      transform: translate(-50%,-50%)
  - type: image
    image: >-
      /local/sefira/midah/{{states('sensor.jewish_calendar_day_of_the_omer')}}
      (1).gif
    style:
      top: 84%
      left: 63%
      width: 37%
      transform: translate(-100%,0%)

I’ll check that out. Thank you!