Helpers -> Template Image generates error

I cannot even start to enter a helper for template image: I get this error message:

    [140518544229696] Error handling message: Unknown error (unknown_error) phil from 192.168.0.192 (Mozilla/5.0 (X11; Linux x86_64; rv:137.0) Gecko/20100101 Firefox/137.0)

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 237, in async_handle
    handler(self.hass, self, schema(msg))
    ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/template/config_flow.py", line 810, in ws_start_preview
    preview_entity = CREATE_PREVIEW_ENTITY[template_type](
                     ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
KeyError: <EntityPlatforms.IMAGE: 'image'>

And it shows in the helper as

I can enter a template image entry into configuration.yaml, no problem - is there something wrong with my config? How would I trace this issue?

Difficult to say when you have not shared what you are attempting to put into the UI.

I haven’t put in anything yet, the message appears as soon as the template helper opens. I tried it on Android as well, same message, same error in the logs. I also up-versioned the core and the os, and restarted my server, with the same result.

It is not going to be able to preview anything until you specify a URL template.

Share what you are attempting to put there.

I copied a successful template from my configuration.yaml, gave it a different name, hit submit (success), but no image shows up. However,

the template:
http://192.168.0.34:8123/local/MoonPhaseImages/Moon{{ states(‘number.age_of_moon’) | int(0) | string }}small.jpg”

and the error message is still there

But now, the error message is:

Logger: homeassistant.components.image
Source: components/image/init.py:252
integration: Image (documentation, issues)
First occurred: 6:58:35 PM (8 occurrences)
Last logged: 7:04:12 PM

image.moon_phase_local_image: Error getting new image from “http://192.168.0.34:8123/local/MoonPhaseImages/Moon19small.jpg”: Request URL is missing an ‘http://’ or ‘https://’ protocol.

So, I removed the “” around the template. And now it works. Geez. What a waste of several hours…

Remove the quotes from around your template. Not required for the UI.

Here is the working helper - thanks for walking me through it.

1 Like