Custom Sentences with multiple languages

I have used the examples in the Home Assistant documentation to create a custom sentence.

# Example config/custom_sentences/en/media.yaml
language: "en"
intents:
  SetVolume:
    data:
      - sentences:
          - "(set|change) {media_player} volume to {volume} [percent]"
          - "(set|change) [the] volume for {media_player} to {volume} [percent]"
lists:
  media_player:
    values:
      - in: "living room"
        out: "media_player.living_room"
  volume:
    range:
      from: 0
      to: 100

The example is used for the English version and I’ve added a Dutch version in the nl-directory.
In the configuration.yaml, I’ve added the response from the example.

# Example configuration.yaml
intent_script:
  SetVolume:
    action:
      service: "media_player.volume_set"
      data:
        entity_id: "{{ media_player }}"
        volume_level: "{{ volume / 100.0 }}"
    speech:
      text: "Volume changed to {{ volume }}"

It works for English and Dutch input, but as the response is in the configuration.yaml, it has only English output. I also want a Dutch response. The HA documentation shows an example for customizing existing responses. I used this to alter my custom sentence with the following code in the responses.yaml in the nl directory:

language: "nl"
responses:
  intents:
    SetVolume:
      default: "Volume gewijzigd naar {{ volume }}"

But this does not work. It still answers in English to my Dutch questions. Has anybody an idea how to create custom response to a custom sentence/intent (multilingual)?

1 Like