Howdy.
I have the following helpers:
input_text.countdown_date_01_name
input_datetime.countdown_date_01_date
,input_text.countdown_date_02_name
input_datetime.countdown_date_02_date
- I want to add a couple more if I can get this to work
I want to be able to speak "how many days until X", where X is the value of either input_text.countdown_date_01_name
or input_text.countdown_date_02_name
, and have Home Assistant speak the response "there are Y days until X", where X is the value of either input_text.countdown_date_01_name
or input_text.countdown_date_02_name
, whichever was spoken.
I know how to determine the number of days until the date that is the value of input_datetime.countdown_date_01_date
or input_datetime.countdown_date_02_date
. But so far I've been unable to figure out how to configure the sentence/intent so that HA knows which one to retrieve the value of.
In config/conversations.yaml
I have:
intents:
HowManyDaysUntil:
- "how many days until {countdownname}"
In config/intents/sentences/en/_cmmon.yaml
I have:
lists:
countdownname:
values:
- '{{ states("input_text.countdown_date_01_name") }}'
- '{{ states("input_text.countdown_date_02_name") }}'
In config/intent_scripts.yaml
I have:
HowManyDaysUntil:
action:
service: automation.trigger
data:
entity_id: automation.how_many_days_until_countdown01
(this automation currently is hardocded to calculate and speak the days until input_datetime.countdown_date_01_date
)
The values of my helpers are currently:
input_text.countdown_date_01_name
= "vacation"input_datetime.countdown_date_01_date
= "6/1/2024'
When I speak "how many days until vacation" I get Unexpected error during intent recognition
.
I'd appreciate your help with this!
Thanks for the references, but at least one example from https://www.home-assistant.io/integrations/intent_script/ seems to be wrong/outdated.
From that page:
This is the code in my
conversations.yaml
:Here are the only difference I see between my code and the example above:
language: en
(but when I add it, I getInvalid config for 'conversation' at conversations.yaml, line 1: 'language' is an invalid option for 'conversation', check: conversation->language
)However, this yaml gets
Invalid config for 'conversation' at conversations.yaml, line 9: value should be a string 'conversation->intents->HowManyDaysUntil->0', got None
Perhaps I can't have intents in conversations.yaml? Or maybe not lists? I started this project by editing
config/intents/sentences/en/_cmmon.yaml
but that's a bad idea because an update would wipe my customizations. What's the appropriate place for me to add custom sentences/intents/responses/lists?i'm willing to try to help you but to be honest, it is far from my limited knowledge... and i'm also not english native so i do sometimes struggle to understand some specifc docs...
That being said, looks like exemple given at https://developers.home-assistant.io/docs/voice/intent-recognition/template-sentence-syntax/ isn't inside _common.yaml
also i just realised that this is developer document which could explain why _common.yaml modifications would be wiped out after an update.
I just had a look to the non developer doc and it suggest intent_script is to be added to configuration.yaml and intent to
custom_sentences/<language>
as shown here https://www.home-assistant.io/integrations/conversation/