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

Template in script not behaving as expected

$
0
0

@FutureTense wrote:

I have the following script, and I’m passing in my_entity_id The script calls a notification script and the title is showing the entity_id I passed in. So far so good. However message is incorrect. I want to send the same entity_id value for the message. The {% set entity = '{{my_entity_id}}' %} isn’t working as expected because the variable entity is blank. So the notification I’m getting has the correct title, but a blank body. Eventually, I want to do some string manipulation to entity but I can’t do that with a blank variable.

I’m stumped.

save_activity_state:
  sequence:
    - service: script.conditional_notify
      data_template: 
        boolean: binary_sensor.allow_automation
        title: "{{my_entity_id}}"
        message: >
          {% set entity = '{{my_entity_id}}' %}
           (manipulating entity code not shown)
          "{{entity}}"

Posts: 9

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles