Add custom words to Speech-to-Phrase

Hey,
as shown in the Speech-to-Phrase documentation, it is possible to add custom sentences.
The shown example is a perfect fit for what I would like to achieve:

language: "en"
lists:
  todo_item:
    values:
      - "apples"  # make sure to use quotes!
      - "bananas"

But this snippet is not working when it’s the only code inside config/custom_sentences/en/sentences.yaml
It shows the following error: Missing property “intents”
In my understading, this syntax only works when it’s added via the command shown in the documentation:

python3 -m speech_to_phrase ... --custom-sentences-dir /path/to/custom_sentences

But in my case, I’m running speech-to-phrase inside home assistant and can’t simply execute this command.

I want to achieve, whats already said in the documentation:

This would allow you to say “add apples to my shopping list” if you have a todo entity in Home Assistant exposed with the name “shopping list”.

Home Assistant already has a file which contains exactly the intents I’d like to use.
And speech-to-phrase also already has the phrases to add items to lists.

How can I extend these phrases by items (like apples or bananas) in home assistant?

I’d appreciate any help :slight_smile:

Update:
I have found the sentences.yaml that speech-to-phrase uses when installed as an HA addon:
/share/speech-to-phrase/train/{your language}/sentences.yaml

Maybe that’s what HA configures as the /path/to/custom_sentences for speech-to-phrase?

When adding custom todo_item values they don’t get automatically recognized and “trained” by speech-to-phrase. But when restarting the speech-to-phrase addon, the sentences.yaml gets rewritten and the custom values are lost.

My current idea:
Somehow check the docker config of speech-to-phrase and check if the –custom-sentences-dir is already set to /share/speech-to-phrase/train/{your language}/sentences.yaml, or still free to use.
If it’s not set yet, set it to a new yaml file and that might be it :pray:

The documentation of Speech-to-Phrase in the HA addon store (not GitHub!) says

You can add custom sentences to /share/speech-to-phrase/custom_sentences/<language>/sentences.yaml where <language> is…

Furthermore there is a documentation for voice control as well (but maybe not compatible with S2P):

You ever figure this out?

It seems like if you have that yaml you referenced if you located it in a file here:

/config/custom_sentences/en/todo.yaml

Speech-to-phrase should pick it up at that directory should be loaded as mentioned here (though it doesn’t seem to work): Setting up custom sentences in configuration.yaml - Home Assistant

I just figured it out. Put this file here instead and it works:

/share/speech-to-phrase/custom_sentences/en/todo.yaml