How to use voice assist to set thermostat temp?

alias: Set thermostat
description: ""
triggers:
  - trigger: conversation
    command:
      - set thermostat to {{temperature}}
conditions: []
actions:
  - action: climate.set_temperature
    metadata: {}
    data:
      temperature: 72
    target:
      device_id: b9c318f80959e66b2673003636b1012d
mode: single

How do i have it set the temperature based on what i tell the voice assist?

Figured it out. Thought I would post here in case someone else gets stuck:

alias: Set thermostat
description: ""
triggers:
  - platform: conversation
    command:
      - set thermostat to {temperature}
conditions: []
actions:
  - action: climate.set_temperature
    data:
      temperature: "{{ trigger.slots.temperature | float }}"
    target:
      entity_id: climate.sensi_st55_thermostat
mode: single
1 Like

One thing to be mindful of is sometimes the responses are not numbers but strings. I donā€™t see the issue so much with higher numbers like when setting an air conditioner/thermostat, but normally with single digits.

I have a automation to pause my reticulationā€¦ so i can scream it at my phone when Iā€™m in the shower and the pressure drops off. if i say ā€œpause the sprinklers for five minutesā€ it has the word instead of the number. ie ā€œfiveā€ and not ā€œ5ā€. the automation then fails because it cant convert it directly, but the response is still ā€œdoneā€. hence i always use the conversation response to make sure it heard me properly too.

anyway, here is the post that fixes that problem https://community.home-assistant.io/t/automation-to-add-custom-number-to-counter-based-on-voiceassistant/752898
basically copy and paste the macro into a file called numerals.jinja in your custom_templates folder. then reload all yaml configuration from the developer options tab.

there is a couple of other things you can do for more flexibility in the sentence tooā€¦ square brackets are optional, and brackets with words separated by a | are alternative words - this was really useful for aussie slang as the word ā€œreticā€ is unusual and can come back many different ways.

alias: Sentence_Pause_Retic
description: ""
triggers:
  - trigger: conversation
    command:
      - >-
        Pause [the] (reticulation|sprinklers|re tick|retake|retick|retech) for
        {minutes} minutes
conditions: []
actions:
  - variables:
      mins_num: |
        {% set x = trigger.slots.minutes %}
        {%- if x is undefined %} 
          1
        {%- elif x | is_number %} 
          {{ x  }}
        {%- else %}
          {%- from 'numerals.jinja' import to_numeral -%}
          {{- to_numeral(x) }}
        {%- endif %}
  - action: opensprinkler.pause_stations
    data:
      pause_duration: "{{ mins_num * 60}}"
    target:
      entity_id: switch.opensprinkler_enabled
  - set_conversation_response: Retic has been paused for {{mins_num}} minutes
mode: single

and a snippet of setting a timer

  - action: timer.start
    target:
      entity_id:
        - timer.example_timer
    data:
      duration: 00:{{mins_num|int(0)}}
3 Likes

thanks for all the tips. I made a simple change using the bracket. that makes it more versatile.
- set [the] (temp|temperature|thermostat) to {temperature} [degrees]
and thanks for the set_conversation_response. thats so much better than ā€œdoneā€

Hi, I came here from Google trying to figure this out. Thanks for both your code snippets. Where do these go, though? At first I thought the main configuration (~/.homeassistant/configuration.yaml for me), but it kind of makes no sense to have a block with alias / description / triggers / actions / mode on the top level. Wondering if thereā€™s levels above not explicitly mentioned here, or a whole different file?

For what itā€™s worth, the following is not working. When entering ā€œset kitchen temperature to 18 degreesā€ in the assistant chat window, it answers ā€œdoneā€, but nothing happens.

The OP example initially didnā€™t work for me (I had the same ā€œDoneā€ but not done issue as you) as I was saying ā€œdegreesā€ in the voice instruction. I amended the automation to include the word ā€˜degreesā€™ and all worked fine.