feat(home-assistant): look music up before playing it - #1790
Conversation
HassMediaSearchAndPlay starts the top match at once, so a misheard name plays the wrong artist - "Saint Germain" heard as "San Shuman" started Robert Schumann. A search-only script lets the model compare what was heard with what was found, and ask before playing a name that only sounds similar.
|
Claude finished @johnae's task —— View job Review: search before play
The premise is right, and the shape matches the existing Duplicates can eat the whole answer
{% for a in resultat.artists or [] %}
{% set ns.artister = ns.artister + [a.name] %}
{% endfor %}
...
{{ {'artister': (ns.artister | unique | list)[:3], ...} }}
|
Voice music requests go through
HassMediaSearchAndPlay, which plays the topsearch match immediately. When speech-to-text mishears, the wrong artist
starts: "Saint Germain" came through as "San Shuman" and played Robert
Schumann.
This adds
Sök musik, a script that searches Music Assistant withoutplaying and returns the top three artists, albums and tracks by name. The
model then compares what was heard with what was found:
A reply ending in
?keeps Home Assistant's conversation open(
ChatLog.continue_conversation), so the yes/no is heard without a wake word.The Music Assistant config entry is found with
integration_entities('music_assistant'), so no instance ID is hard-coded.Both templates were rendered through Home Assistant's template API against a
sample result and an empty one.
After deploying (runtime, not in this repo): expose
script.sok_musiktoAssist, and add the instruction to the Eris agent's prompt.
The cost is one extra search and one extra model turn per music request.
🤖 Generated with Claude Code
https://claude.ai/code/session_01XfYTVcQVjCevVeoJofu8FF