Google Assistant addon in a different language

Is anyone of you using the Google Assistant addon (not the component) in a different language? How can I modify the intent scripts to respond with the correct language?
I tried something like:

Temperature:
    speech:
      text: >
          {%- if locale == ["en-US"] -%}
            The temperature at home is {{ states('sensor.sensore_temperature') }} degrees
          {%- elif locale == ["it-IT"] %}
            A casa ci sono {{ states('sensor.sensore_temperature') }} gradi 
          {%- else -%}
            Sorry I don't speak your language
          {%- endif -%}

but it doesn’t work

2 Likes

if in the logger i receive this line:

2017-11-16 14:49:30 DEBUG (MainThread) [homeassistant.components.dialogflow] Received Dialogflow request: {'id': '0d8b5d20-cee5-416c-a06e-c54091544fb8', 'timestamp': '2017-11-16T13:49:29.95Z', 'lang': 'en', 'result': {'source': 'agent', 'resolvedQuery': 'where is bea', 'speech': '', 'action': 'LocateIntent', 'actionIncomplete': False, 'parameters': {'User': 'Bea'}, 'contexts': [], 'metadata': {'intentId': 'd15f25a2-8187-469d-bf4c-616207d2dd15', 'webhookUsed': 'true', 'webhookForSlotFillingUsed': 'false', 'intentName': 'Locate'}, 'fulfillment': {'speech': 'Sorry but I cannot connect to your Home Assistant', 'messages': [{'type': 'simple_response', 'platform': 'google', 'textToSpeech': 'Sorry but I cannot connect to your Home Assistant'}, {'type': 0, 'speech': 'Sorry but I cannot connect to your Home Assistant'}]}, 'score': 1.0}, 'status': {'code': 200, 'errorType': 'success', 'webhookTimedOut': False}, 'sessionId': '2b83acb8-aca3-4fc8-a2aa-b86019535649'}

knowing that usually I can compare the fields inside ‘parameters’, in this case {‘User’: ‘Bea’}, is there a way to use that ‘lang’: ‘en’ field? I tried to modify the intent script like this

  Temperature:
    speech:
      text: >
          {%- if lang == ["en"] -%}
            The temperature at home is {{ states('sensor.sensore_temperature') }} degrees
          {%- elif lang == ["it"] %}
            A casa ci sono {{ states('sensor.sensore_temperature') }} gradi 
          {%- else -%}
            Sorry I don't speak your language
          {%- endif -%}

but it still doesn’t work… it keeps answering “Sorry I don’t speak your language” which is the “else” option

Maybe something like {{ trigger.event.data[“lang”] }} ?

Interested in this one as well - but it seems google ssistant doesn’t support that much of a languages now