Templating icons in customize section?

I’m trying to change a script icon, based on input_select state but not succeeding.

  customize:
   script.radio538:
    friendly_name: Start Playing
    icon_template: >
            {% if is_state("input_select.radio_station", "Radio 538") %} http://snowminds.nl/wp-content/uploads/2015/03/Logo-Radio-538.png
            {% elif is_state("input_select.radio_station", "Q-Music") %} https://www.perssupport.nl/uploads/press-news-item/original/7562687e-7fe4-11e1-8543-b971b6abc044.jpg
            {% else %} mdi:play
            {% endif %}

My frontend just shows the default icon instead. There are no errors in my log file.

Is this even possible?

Update:

    entity_picture_template: >
            {% if is_state("input_select.radio_station", "Radio 538") %} http://snowminds.nl/wp-content/uploads/2015/03/Logo-Radio-538.png
            {% elif is_state("input_select.radio_station", "Q-Music") %} https://www.perssupport.nl/uploads/press-news-item/original/7562687e-7fe4-11e1-8543-b971b6abc044.jpg
            {% else %} mdi:play
            {% endif %}

Gives the same result.

Really? No one? :disappointed:

I don’t think icon_template or entity_picture_template are a thing that exists in the customize section

Also I don’t think you can mix and match entity pictures and icons like that either if there is one of those available

Thanks for your reply.

I dumped the icon and changed it for a picture. This also shows the default icon.

I would like to change the icon on a device based upon an attribute. So if someone knows if this can be done I would appreciate the help as well.

I just stumbled upon this thread because I was trying to do the same.

This can be done with customUI
customize.yaml:

input_select.next_appointment_travel_mode:
  templates:
    icon: >
      if ( state === 'Auto' ) {
        return "mdi:car";
      } else if ( state === 'Fahrrad' ) {
        return "mdi:bike"
      } else if ( state === 'Öffis' ) {
        return "mdi:bus"
      }

@ eifinger
Thank you for pointing us in the right direction. I am looking to have my icon change depending on the input_select.

Since this is quite an old post and the latest version of HA has break the default installation of customUI, @ mariusthvdb has provide a supplemental instruction with his modified custom-ui.js file.