Skip Navigation

Seeking assistance customizing a sentence/intent with templating

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!

3
3 comments