Add icon template to modern template sensor created in UI

Hi,

I’m trying to add an icon template to a template sensor I’ve created using the UI.

I’ve tried putting my template in the icon field, which doesn’t seem to work:

It doesn’t give me any errors, it just results in the entity having no icon.

Note the “if true” is just to test if the template is working, obviously I actually want to change the icon based on the state of an entity.

I’ve tried with and without double quotation marks surrounding the template.

Is it supposed to be possible to enter a template in the icon field via the UI? If so, what I am I doing wrong with the syntax?

Or do I need to directly edit the YAML? If so, how do I access the YAML for a template sensor created via the UI?

Or do I need to create the template sensor in the configuration.yaml file (not via the UI)?

Thanks in advance!

1 Like

No.

You need to use YAML only.

You can vote here: Add "icon_template" in Helpers Template Sensor

Thanks @tom_l

Is it possible to edit the YAML for a template sensor created via the UI?

Or do I need to create the template sensor in the configuration.yaml file (not via the UI)?

You have to create it all in YAML.

1 Like