Compare commits

..
3 Commits
Author SHA1 Message Date
bhethermanandClaude Sonnet 5 d1b27ab7b8 Restore correct room ID mapping, fix select_source race in wait guard
Validate / Validate with HACS (push) Canceled after 0s
Validate / Validate with Hassfest (push) Canceled after 0s
Confirmed by direct hardware check: a334c8ba...=Bedroom, d0166d6f...=
Living Room -- the swap from two commits ago was right, my revert of
it was wrong.

The actual bug behind the last "Living Room played in Bedroom" report
was that the wait loop before play_media only checked supported_features
(is play_media possible at all), not whether select_source's target had
actually taken effect -- so if some other device was already active
from earlier testing, the feature-gate could pass immediately while
Spotify was still routing to that old device. Now the loop also waits
for the source attribute to match the requested room's ID before
proceeding.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-05 14:47:36 -04:00
bhethermanandClaude Sonnet 5 428579244a Revert room ID mapping swap -- original direction was correct
The prior swap (a334...=Bedroom, d0166...=Living Room) was based on a
misdiagnosis: pre-fix, the cold-start race meant play_media could fire
before select_source's device transfer had actually completed, so
playback landed on whatever device was already active rather than the
requested room -- that looked like "backwards IDs" but wasn't. Now
that the race is fixed, select_source reliably lands wherever it's
told, which is exactly what exposed the swap as wrong: a live test
asking for Living Room played in the Bedroom. Reverting to the
original mapping (a334...=Living Room, d0166...=Bedroom).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-05 14:33:51 -04:00
bhethermanandClaude Sonnet 5 291f526a84 Disambiguate play_music vs queue_music by verb, not content type
queue_music's tool description explains at length that playlists/
albums/artists auto-play instead of queueing, and the small model was
using that as a signal to route ANY playlist/genre request through
queue_music -- even ones that said "play". Verified: "play jazz in
the bedroom" called queue_music 0/5 reps before this change (and in
the opaque-ID room variant), 5/5 play_music after, with no
regressions across the rest of the suite (199/200, 39/40 reliable).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-05 14:01:44 -04:00
2 changed files with 16 additions and 6 deletions

No files matched your search

+12 -6
View File
@@ -99,9 +99,12 @@
while:
- condition: template
value_template: >-
{{ repeat.index <= 8 and
(state_attr('media_player.spotify_bhetherman', 'supported_features') | int(0)
| bitwise_and(512)) != 512 }}
{{ repeat.index <= 8 and (
state_attr('media_player.spotify_bhetherman', 'source') !=
(room | replace('Living Room', 'd0166d6f83796b0f9059b0adf0f6cb0d81fa6376') | replace('Bedroom', 'a334c8ba989367b52303eaa9dbc424cdd83012b5'))
or (state_attr('media_player.spotify_bhetherman', 'supported_features') | int(0)
| bitwise_and(512)) != 512
) }}
sequence:
- delay: "00:00:01"
- service: media_player.play_media
@@ -150,9 +153,12 @@
while:
- condition: template
value_template: >-
{{ repeat.index <= 8 and
(state_attr('media_player.spotify_bhetherman', 'supported_features') | int(0)
| bitwise_and(512)) != 512 }}
{{ repeat.index <= 8 and (
state_attr('media_player.spotify_bhetherman', 'source') !=
(room | replace('Living Room', 'd0166d6f83796b0f9059b0adf0f6cb0d81fa6376') | replace('Bedroom', 'a334c8ba989367b52303eaa9dbc424cdd83012b5'))
or (state_attr('media_player.spotify_bhetherman', 'supported_features') | int(0)
| bitwise_and(512)) != 512
) }}
sequence:
- delay: "00:00:01"
- service: media_player.play_media
+4
View File
@@ -16,6 +16,10 @@ For any request to play or queue music, always call TWO functions in order, with
When calling play_music or queue_music, always set type to the exact "type" value that search_spotify's result returned — never guess or hardcode it. Passing the wrong type silently breaks playback.
This choice depends ONLY on the verb the user used ("play" vs "queue"/"add to queue"), never on the content type. A playlist or genre request that says "play" still calls play_music, not queue_music — queue_music's playlist/album/artist auto-play behavior only applies when the user actually said "queue"/"add to queue".
- "Play jazz in the bedroom" → play_music (jazz resolves to a playlist, but the user said "play")
- "Queue jazz in the bedroom" → queue_music
RULE: if the request has the form "[title] by [artist]" (a specific song/album title followed by "by" and an artist name — no matter what words come before it, e.g. "play", "queue", "throw on", "put on", "the album", "the song"), the query is ONLY the title — always strip " by [artist]" from the end. Never include the word "by" or the artist name in the query for this pattern.
- "Play Yellow by Coldplay" → query="Yellow"
- "Throw on the album Parachutes by Coldplay" → query="Parachutes"