Lametric, icon set with if-statemant

Hi, new here and have used HASS for a couple of months now.
Having lots of fun :slight_smile: But, i ran into an problem with LaMetric wifi-clock and setting icons with IF statements.
First of i’m not sure that HASS accepts IF statements? I have working IF statements elsewhere so i’m pretty sure i’m doing it right? The automation works and the text shows, just not the icon. I have also tested it with dev tools and templates, and got the icon-id correctly. so i’m lost with my troubleshooting.
Here is my code (automations.yaml, and i’m using hassio 0.82.1):

- alias: "LaMetric - Vad spelar Chromecast"
  trigger:
    platform: state
    entity_id: media_player.sovrum
    to: playing
  action:
    service: notify.lametricsovrum
    data:
      message: "Chromecast sovrummet spelar: {{ states.media_player.sovrum.attributes.media_title }}"
      data:
        icon: >-
          {% if is_state_attr('media_player.sovrum', 'app_name', 'YouTube') %} a7320
          {% elif is_state_attr('media_player.sovrum', 'app_name', 'Twitch Chromecast Player') %} a4741
          {% elif is_state_attr('media_player.sovrum', 'app_name', 'Plex') %} a15185
          {% elif is_state_attr('media_player.sovrum', 'app_name', 'Spotify') %} a12676
          {% elif is_state_attr('media_player.sovrum', 'app_name', 'Netflix') %} a1442
          {% else %} a15626
          {% endif %}
        cycles: 3
        priority: 'warning'

Perhaps i have my answer that icon won’t accept this kind of IF statement.
Maybe someone can confirm or help me with faults in my code.

Thanks in advance :slight_smile:

solved it through bash-commands and some ugly sed, cat and curl commands, along with notify to file.