20
submitted 1 year ago* (last edited 1 year ago) by Otkaz@lemmy.world to c/homeassistant@lemmy.world

I'm trying to get a script built. I want to check if a variable exist and include it if it does. Just really struggling to figure out the formatting. Something like

script:
  sequence:
    target:
      entity_id: "{{ entity }}"
    {% if variable is defined %}
      data: "{{ variable }}"
    {% endif %}
all 11 comments
sorted by: hot top controversial new old
[-] nottelling@lemmy.world 1 points 1 year ago

{% if variable %} data: {{ variable }} {% endif %}

this post was submitted on 28 Sep 2023
20 points (95.5% liked)

homeassistant

11865 readers
44 users here now

Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io

founded 1 year ago
MODERATORS