Send variable/attribute to script through IFTTT/JSON

Thanks to your help, I managed to “debug” the code! :smiley:

First of all, the URL in IFTTT was incorrect: the correct one was http://url:port/api/services/script/change_kitchen_channel?api_password=pass, and not http://url:port/api/services/script/turn_on?api_password=pass (even if, with scripts that don’t need variables, this URL works).

Now the code:

    change_kitchen_channel:
      alias: "Change kitchen channel"
      sequence:
        - service: media_player.play_media
          data_template:
            entity_id: media_player.kitchen
            media_content_id: >
              {% if (channel == "1") %}
                http://iptv/link/1
              {% elif (channel == "2") %}
                http://iptv/link/1
              {% endif %}
            media_content_type: video
1 Like