I need to Pass a Sensor State to put as an image URL

Hello guys,
I’ve a sensor: sensor.deebot_last_clean_image that has per state a URL:
https://portal-eu.ecouser.net/api/lg/image/XXXXXXX

I tried to create an image card with the following syntax:

‘’’
entity: sensor.deebot_last_clean_image
image: ‘${states[’‘sensor.deebot_last_clean_image’’].state}’
type: ‘custom:hui-image-element’
‘’’

But it doesn’t load anything :confused:

Is there anyone that could help me out please?

Thanks a lot!

Know how to use backticks? I think you meant this:

entity: sensor.deebot_last_clean_image
image: ‘${states[’‘sensor.deebot_last_clean_image’’].state}’
type: ‘custom:hui-image-element’

Not this:
‘’’
entity: sensor.deebot_last_clean_image
image: ‘${states[’‘sensor.deebot_last_clean_image’’].state}’
type: ‘custom:hui-image-element’
‘’’
Try this:

image: ‘{{ states('sensor.deebot_last_clean_image') }}’
type: picture

Hi KTibow,
thanks for answering me :slight_smile:

I tried it but this is the result:

Any clues?

Thanks!

Ooops, I messed up my quotes. Remove the weird quotes at the start and end and it should work.

Hi KTibow,
and thanks again for replying me :slight_smile:

I tried :

image: ‘states('sensor.deebot_last_clean_image')’
type: picture

and

image: ‘{ states('sensor.deebot_last_clean_image') }’
type: picture

and

image: { states('sensor.deebot_last_clean_image') }
type: picture

But nothing, any suggestions?

Thanks!

And what about this

image: {{ states('sensor.deebot_last_clean_image') }}
type: picture

Hi pepe59,
still nothing, I got this:

Let me know and thanks!

Try testing the template in the template editor
{{ states('sensor.deebot_last_clean_image') }}

1 Like

Hi pepe59,
in the template editor it works:

How shall I do to let it work too in the picture’s card?

Thanks!

What happens if you right-click on the image icon in the picture card and open it in a new tab?

I cannot right-click on it, but when I open the URL direclty (https://portal-eu.ecouser.net/api/lg/image/XXXX) an image is downloaded.

Could this help?

Sorry for the noobie that I am :smiley:

Thanks

Really? I was meaning right-clicking on this thing:
image

Yes, it’s not possible to right click on it :confused:

OK, I fixed it creating a downloader.download_file service to download the image in a local folder and then call it from a picture card in lovelace.

Thaks all for your help! Most likely is not possible directly from the picture card to use this kind of options.

You can do a markdown card with:

![Image]({{states.deebot_last_clean_image.state }})

2 Likes