Use wildcard in a sentence to trigger automation

Currently my thermostat can only set the temperature when it is in heat or cool mode. That means to use the voice assistant I have to say 2 sentences if the thermostat is off. The first to select the mode I want (heat/cool) and another to set the temperature.
I would like to just say “Set the temperature to 22 degrees” and then have the automation recognize the asked for temp (wildcard), compare it with the current temp of the thermostat and turn on either heat (if the asked for temp is higher) or cool and then set the temp of the thermostat.
I started with my automation but I’m sure I’m missing some pieces. I get an error when trying to save the automation like this.

alias: Voice command set thermostat
description: "Compares current temperature to asked for temp and sets temp and HVAC mode appropriately"
triggers:
  - trigger: conversation
    command: Set thermostat to {temperature} degrees
conditions:
  - condition: numeric_state
    entity_id: climate.my_thermostat
    attribute: current_temperature 
    below: 
      "{{trigger.slots.temperature}}"
actions:
  - device_id: 4cb912af675e56cc46476d1205eb6c0f
    domain: climate
    entity_id: b236a3b5df5bfb43f4021a9d6586d73f
    type: set_hvac_mode
    hvac_mode: heat
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature:
        "{{trigger.slots.temperature}}"
    target:
      device_id: 4cb912af675e56cc46476d1205eb6c0f
mode: single

You can use wildcards in intents:

The issue is your condition. You will need to use a Template condition or use the value_template configuration variable of a Numeric State condition, the former is easier.

Assuming the value for temperature is being returned as digits (“45”) and not a word (“forty-five”):

conditions:
  - condition: template
    value_template: | 
      {{ state_attr('climate.my_thermostat', 'current_temperature')|float 
      < trigger.slots.temperature | float }}

How do I do this? I’m somehow having a hard time putting this all together… Where and how do I create that template and then use it in the automation? I tried the <value_template> variable but got confused about that too…

Great! That works. I created a second automation that sets the mode to cool if the current temp is higher than requested. Is there a way to put that in a single automation? {% if … maybe?