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.
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
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.