Last picture from server

need some help here. i have pics in server as follows:
http://xxx.xxx.xxx.xxx/SIILSD.20201019_005121.jpg
http://xxx.xxx.xxx.xxx/SIILSD.20201019_005620.jpg
http://xxx.xxx.xxx.xxx/SIILSD.20201019_005952.jpg
http://xxx.xxx.xxx.xxx/SIILSD.20201019_010123.jpg

how to get last image to show in generic camera?

Maybe this can be of use?

maybe not. first sentence " Browse jpg photos in your Home Assistant www/images folder."
i have pics outside ha

Sorry, mistook the x’s in your post as your HA server.

Not sure what you mean by “generic camera”. Are you referring to the Picture card in the Lovelace UI?

What about using a python script to populate a sensor that contains the value of the desired URL? And then having the Picture card load that URL?

i mean smthg like this

  - platform: generic
    still_image_url: http://xxx.xxx.xxx.xxx/SIILSD.{{ now().strftime("%Y%m%d_%H%M%S") }}.jpg
    name: pic

is python script only way?

Ah, I see. So, that docs say that templates are supported for the URL. Did your example above not work? Is the filename of the jpg predictable or random?

not working. name of the jpg is random, for example beginning with SIILSD. and then timestamp as %Y%m%d_%H%M%S

Got it. So, I’m not an expert, but I think this happens because there is no state change forcing the template to re-evaluate. This is briefly mentioned here:

Note that templates that depend on time (now()) and do not use any entities will not be updated as it only happens on entity state changes. For more information and examples refer to template sensor documentation

The docs recommend a different approach based on the time_date platform. I was able to replicate your template, although I have no way to test it. The page gives an example at the bottom, but here is what I did to match yours:

http://xxx.xxx.xxx.xxx/SIILSD.{{ as_timestamp(states(‘sensor.date_time_iso’)) | timestamp_custom(‘%Y%m%d_%H%M%S’) }}.jpg

nope, this solution not working still. i solved it, by sending last file name my mqtt, making mqtt sensor in ha and tied it together in generic camera template. anyways - thank you.