#Trigger variables not getting a response from Voice PE

1 messages · Page 1 of 1 (latest)

craggy monolith
#

My situation is, that I use an automation when I say a specific sentence to my Voice PE, the variable set for that sentence, does get passed for example to a notification action, but not the "set_conversation_response".
I use the notification for testing purposes.

My final result is that it says what channel i switched to.
See the "set_conversation_response" part in the code.

Here is my code:

triggers:
  - trigger: conversation
    command: Set the channel to CNN
    variables:
      channel_name: CNN
  - trigger: conversation
    command: Set the channel to HBO
    variables:
      channel_name: HBO
  - trigger: conversation
    command: Set the channel to ESPN
    variables:
      channel_name: ESPN
conditions: []
actions:
  - set_conversation_response: Sure, here is {{ channel_name }}
  - action: notify.mobile_app_sm_s926b  # <- use your own phone for testing purposes
    data:
      message: Sure, here is {{ channel_name }}
mode: single```
If I use the code above without the variables, It does say which channel I have switched to, but of course without the variable.

The Code without variables:
```alias: TV Channels
triggers:
  - trigger: conversation
    command: Set the channel to CNN
  - trigger: conversation
    command: Set the channel to HBO
  - trigger: conversation
    command: Set the channel to ESPN
conditions: []
actions:
  - set_conversation_response: Sure, here is {{ channel_name }}
  - action: notify.mobile_app_sm_s926b  # <- use your own phone for testing purposes
    data:
      message: Sure, here is {{ channel_name }}
mode: single```

You can reproduce it yourself.
So my conclusion is that the sentence trigger does not have the ability to pass the variable to the set_conversation_response

How to solve this?
modest dust
#

Hmm, I can't get set_conversation_response to work at all

#

I just get "done" no matter what I try

#

I doubt that it's related, but I also get the following logs if I try the same in the Assist box in the web UI:

2025-02-09 11:47:18.261 INFO (MainThread) [homeassistant.components.automation.test_trigger_variables] test trigger variables: Executing step setting conversation response
2025-02-09 11:47:18.284 ERROR (MainThread) [frontend.js.modern.202502050] Uncaught error from Chrome 132.0.0.0 on macOS 10.15.7
ReferenceError: Cannot access 'i' before initialization
this.hass, (src/components/ha-assist-chat.ts:455:12)
callback (node_modules/home-assistant-js-websocket/dist/connection.js:23:33)
forEach (node_modules/home-assistant-js-websocket/dist/connection.js:15:25)
heavy blade
modest dust
#

The string only needs to be quoted if the template is at the beginning so that the leading "{" isn't interpreted as the start of a dictionary. In this case, no quotes are necessary

#

As I mentioned in the issue, I suspect that creating trigger variables is creating a variable environment that's somehow losing the conversation response that's being returned from the action.

craggy monolith
heavy blade
#

Well templates have to be quoted or designated with a > or |, so whatever you come up with...

modest dust
#

again, that is not true

#

The string only needs to be quoted if the template is at the beginning so that the leading "{" isn't interpreted as the start of a dictionary. In this case, no quotes are necessary

craggy monolith
#

unfortunately it doesn't solve the problem

modest dust
#

right, it has nothing to do with the issue

finite hare
#

you could use trigger id's instead of the variables

#

or use a wildcard

#

Trigger id's

alias: TV Channels
triggers:
  - trigger: conversation
    command: Set the channel to CNN
    id: CNN
  - trigger: conversation
    command: Set the channel to HBO
    id: HBO
  - trigger: conversation
    command: Set the channel to ESPN
    id: ESPN
conditions: []
actions:
  - set_conversation_response: Sure, here is {{ trigger.id }}
  - action: notify.mobile_app_sm_s926b  # <- use your own phone for testing purposes
    data:
      message: Sure, here is {{ trigger.id }}
mode: single