this post was submitted on 28 Sep 2023
21 points (95.7% liked)

homeassistant

15575 readers
4 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.

Home Assistant can be self-installed on ProxMox, Raspberry Pi, or even purchased pre-installed: Home Assistant: Installation

Discussion of Home-Assistant adjacent topics is absolutely fine, within reason.
If you're not sure, DM @GreatAlbatross@feddit.uk

founded 2 years ago
MODERATORS
 

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 %}
you are viewing a single comment's thread
view the rest of the comments
[–] nottelling@lemmy.world 2 points 2 years ago

This looks like the right answer, since OP's jinja is correct.

OP, you can go to developer tools to test your template syntax against the live data in HA.