Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95468

Run script based on value of variable x

$
0
0

@ScottS wrote:

How may I write the below properly? I will send a REST event to HA and would like to run a script and select the outcome based on the value of a variable passed on to it. BTW, I still have yet to figure out how to write the REST as well.

light_scene:
  sequence:
    data_template:
      entity_id: >-
        {% if variable x = blue %}
          trigger ifttt recipe b
        {% elif variable x = green %}
          trigger ifttt recipe c
        {% elif variable x = orange %}
          trigger ifttt recipe d
        {% elif variable x = purple %}
          trigger ifttt recipe e
        {% else %}
          script.noop
        {% endif %}

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 95468

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>