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!

  • paf@jlai.lu
    link
    fedilink
    English
    arrow-up
    1
    ·
    4 months ago

    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

    # Example light_HassTurnOn.yaml
    language: "en"
    

    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/

    # Example configuration.yaml entry
    intent_script:
    
    # Example temperature.yaml entry
    language: "en"
    intents: