How to use input_text and input_select as action data in an automation

Hi, I’m trying to create an automation that, after I press a button on my dashboard, performs an action to retrieve the cheapest gas station based on the start and destination zip code and the fuel type. I created three helpers for this, two input_text and one input_select. I want to use these in my automation, passing their values as data for the action. I did this

input_text:
  from_postalcode:
    name: Start Location postal code
    initial: "10000"
  to_postalcode:
    name: End Location postal code
    initial: "11000"

input_select:
  fuel_type:
    name: Fuel Type
    options:
      - super95
      - super98
      - diesel
    initial: super95
- id: "1737580964309"
  alias: "Carbu trigger "
  description: ""
  triggers:
    - trigger: state
      entity_id:
        - input_button.find_cheapest_fuel_station
  conditions: []
  actions:
    - action: carbu_com.get_lowest_fuel_price_on_route
      data:
        fuel_type: "{ { states('input_select.fuel_type') } }"
        country: IT
        from_postalcode: "{ { states('input_text.from_postalcode') } }"
        to_postalcode: "{ { states('input_text.to_postalcode') } }"
  mode: single

Like this it does not work, if I manually set the action data without using the helpers it works as intended, so there must be something wrong with the helpers.

Thanks in advance to anyone who will be willing to help me

Wherever you have this:

{ {

Change it to this:

{{

Same for } } change it to }}

Because as you have it now, none of those templates is understood to be an actual template (just a text string).

1 Like