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

How do I pass data from service call to a template in a script?

$
0
0

@xescure wrote:

smart_toggle:
  sequence:
    service_template: >
      {% if is_state("group.bedroom", "on") %}
        homeassistant.turn_off
      {% else %}
        homeassistant.turn_on
      {% endif %}
    data_template:
      entity_id: "{{ entity_id }}"

In this script I have already successfully pulled the entity_id that was put in as an argument for the script’s service call, but I would like to also use it in the service_template. Like this: {% if is_state("{{ entity_id }}", "on") %} However that doesn’t seem to work.

Any ideas?

Posts: 4

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 96121

Trending Articles



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