Stuck with mediaplayer inside configuration.yaml

I stuck with my Setup, before i can turn on my TV i need to check if the socket in front of it is turned on, if not i need to turn it on, wait about 2-5 seconds, then turn on the TV.

sadly my config isn’t working (check config faild)

media_player:
  - platform: universal
    name: Samsung TV
    children:
      - media_player.samsung_ue40f6700
    commands:
      turn_on: >
          {% if is_state("switch.medialeiste", "on") %}
          {% else %}
            service: switch.turn_on
            target:
              entity_id: switch.medialeiste
          {% endif %}
          service: remote.send_command
          entity_id: remote.wohnzimmer
          data:
            device: TV
            command: PowerToggle 
      turn_off:
        service: remote.send_command
        entity_id: remote.wohnzimmer
        data:
          device: TV
          command: PowerToggle