#I am playing with JLo's MA AI automation
1 messages · Page 1 of 1 (latest)
blueprint: name: Play Music on Music Assistant description: "Play any music you want on any Music Assistant speaker\nRequirements:\n \ - Media Player coming from the Music Assistant integration\n - OpenAI Conversation **configured with the prompt found [here](https://gist.github.com/jlpouffier/8d5dc8a6b94f42f4929bfd1df2f22008)**\n" domain: automation author: JLo homeassistant: min_version: 2023.8.0 input: assist_command: name: Assist Command description: "The Assist command you will use to start the music\nYou can change the overall sentence to match your style and language. \n**WARNING** you **MUST** include {query} in order to pass that variable to OpenAI.\n" default: Give me {query} on [the] {name} selector: text: {} open_ai_config_entry: name: OpenAI Configuration description: The OpenAI configuration **configured with the prompt found [here](https://gist.github.com/jlpouffier/8d5dc8a6b94f42f4929bfd1df2f22008)** selector: config_entry: integration: openai_conversation media_player: name: Media player description: Media player that will play the music selector: entity: filter: - integration: mass domain: - media_player multiple: false additional_conditions: name: Additional conditions description: "Extra conditions you may want to add to this automation \n(Example: Home occupied, Speaker on, etc)\n" default: [] selector: condition: {} source_url: https://github.com/jlpouffier/home-assistant-config/blob/master/blueprints/automation/perso/play_media_on_music_assistant.yaml
`trigger:
- platform: conversation
command: !input assist_command
condition: !input additional_conditions
action: - service: conversation.process
data:
agent_id: !input open_ai_config_entry
text: '{{trigger.slots.query}}'
response_variable: response_from_ai - service: mass.play_media
data: '{{response_from_ai.response.speech.plain.speech|from_json}}'
target:
entity_id: "{{ expand(states.media_player) | selectattr('name' , 'search', trigger.slots.name, ignorecase=true ) | select('search', 'ma_') | map(attribute='entity_id') | join }}"
mode: single`
When I typed in this: give me a song like eve of destruction on the study player the automation trace showed query was resolved as a song like eve of destructi and name resolved as on the study player
Is this a bug?
To be clear if I type give me a song like gimme shelter on study player it works perfectly
your issue is destructiON which ignores the fact that the template requires a space before on
this is almost exactly the same issue on Github https://github.com/home-assistant/hassil/issues/92
@steady cedar Thanks that answers it then - known bug.
i was kinda hoping you'd confirm it's the same issue, if possible. if so, please add a comment with your own example (as it is slightly different, using sentence triggers instead of regular sentences - built-in or custom)
I think it is definitely the same. What do you mean by "using sentence triggers instead of regular sentences"
sentence triggers are used in automations. "regular" sentences (for lack of a better word) are sentences defined as the collection of built-in sentences Assist can respond to, plus those defined in the custom_sentences folder in your config
in the default_agent code, they are treated differently
OK I think I understand...you weren't asking me to do anything different just letting me know that what I am seeing it slightly different to that reported. If that is all correct I will paste all of the above across to the issue