Passing Variable to ifttt via automation tool

I’m trying to pass a variable to ifttt. When I swap the variable for a number in the automation, it runs and works, so my issue is simply having the variable be rendered as such rather than a string. My suspicion is that I should be using ‘data_template’ instead of ‘data’. My question is whether this is even possible in the automation tool or whether to achieve this I have to edit my automations.yaml directly (which I’d rather not do as it seems to make it uneditable in the tool).

Below is what the tool has created in my automations.yaml file.

- id: '1566187680918'
  alias: Set Upstairs Shade Position
  trigger:
  - entity_id: input_number.upstairs_shades
    platform: state
  condition: []
  action:
  - data:
      event: upstairs_shades
      value1: '{{ input_number.upstairs_shades }}'
    service: ifttt.trigger

I can’t answer about the automation UI editor because I don’t use it. However, I can tell you you do need to use data_template, and your template isn’t correct. The automation needs to be (assuming everything else is correct):

- id: '1566187680918'
  alias: Set Upstairs Shade Position
  trigger:
  - entity_id: input_number.upstairs_shades
    platform: state
  condition: []
  action:
  - data_template:
      event: upstairs_shades
      value1: '{{ states("input_number.upstairs_shades") }}'
    service: ifttt.trigger

Thanks Phil!!! Worked a charm.

1 Like