Generic Camera Placeholder Image Template Problems

I can’t seem to get this template to work. I would like to have the placeholder image shown as long as the sensor state is not printing, when printing I want it to show the still image URL.

I tried using this post

This is the current attempt at making a template for this camera.

  - platform: generic
    name: voron24_350_klipper_gcode_preview
    still_image_url: >
      {% if is_state('sensor.voron24_350_state', 'printing') %} http://remotehost/server/files/gcodes/.thumbs/{{ states((‘sensor.voron24_350_current_print’)) }}-250x250.png
      {% else %} http://localhost:8123/local/placeholder.png
      {% endif %}
    scan_interval: 5
    content_type: image/png
    verify_ssl: false

However it throws this error

Invalid config for [camera.generic]: invalid template (TemplateSyntaxError: unexpected char '‘' at 114) for dictionary value @ data['still_image_url']. Got '{% if is_state(\'sensor.voron24_350_state\', \'printing\') %} http://remotehost/server/files/gcodes/.thumbs/{{ states((‘sensor.voron24_350_current_print’)) }}-250x250.png {% else %} http://localhost:8123/local/placeholder.png" {% endif %}\n'. (See ?, line ?).

Any help would be appreciated. Thank you

This is a link for where most this came from.

The answer is in the error message

TemplateSyntaxError: unexpected char '‘' at 114

Should be:

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

Dont know how you managed those symbols but those are wrong.
( ‘ ’ should be ', hard to see but its ussualy the ones below the " key)

Thank you so much! I can’t tell you how many times I looked through that code and didn’t catch that.

Np, i know how you can stare yourself blind at a problem :wink: