Apply condition to a tap action card

Hi all i want is to send different action depending of the state of an entity. Here’s my code that doesn’t work:

type: custom:mushroom-template-card
primary: |-
  {% if is_state('remote.harmony_hub', 'off') %}
    Allumer télévision
  {% elif is_state('remote.harmony_hub', 'on') %}
    Éteindre télévision
  {% endif %}
secondary: ''
icon: |-
  {% if is_state('remote.harmony_hub', 'off') %}
    mdi:television-off
  {% elif is_state('remote.harmony_hub', 'on') %}
    mdi:television
  {% endif %}
icon_color: |-
  {% if is_state('remote.harmony_hub', 'off') %}
    red
  {% elif is_state('remote.harmony_hub', 'on') %}
    green
  {% endif %}
tap_action:
  action: call-service
  service: remote.turn_on
  data:
    activity: |-
      {% if is_state('remote.harmony_hub', 'off') %}
        '50655420'
      {% elif is_state('remote.harmony_hub', 'on') %}
        '-1'
      {% endif %}
  target:
    entity_id: remote.harmony_hub

Icon and title switch according to the state but the call don’t send the activity.
i checked on the forum without any succes sorry

Thanks in advance
Mike

OK got it now, need to create a script with 2 condition and then call it from the automation.
Thanks