zBernie
(Bernie)
November 9, 2025, 4:54pm
1
The code below plays the Sonos 80’s rock radio station on the office and living room speakers. The problem is that sometimes different music plays in the two rooms. Is there any way to ensure the same music plays in both rooms?
-Thanks
action: media_player.play_media
metadata: {}
data:
media:
media_content_id: FV:2/17
media_content_type: favorite_item_id
metadata:
title: 80s Greatest Hits
thumbnail: >-
https://content-images.p-cdn.com/images/public/int/1/9/1/1/9355974061191_90W_90H.jpg
media_class: genre
children_media_class: null
navigateIds:
- {}
- media_content_type: favorites
media_content_id: ""
- media_content_type: favorites_folder
media_content_id: object.item.audioItem.audioBroadcast
browse_entity_id: media_player.office
target:
entity_id:
- media_player.living_room_2
- media_player.office
afsy_d
November 9, 2025, 11:17pm
2
Can you check the trace or logs if it ran well? It might make two separate calls and if the music is on shuffle mode, that might explain why they will play different songs.
zBernie
(Bernie)
November 9, 2025, 11:52pm
3
If it is making two separate calls, how could you prevent that? It’s not in shuffle mode, it’s a Sonos radio station and plays various songs.
Here’s the entire automation:
alias: Aqara Elvis Button - Held
description: ""
triggers:
- device_id: 1e19dc07991c1c8251498548f759da9a
domain: zha
type: remote_button_long_press
subtype: remote_button_long_press
trigger: device
conditions: []
actions:
- if:
- condition: state
entity_id: input_boolean.music_switch
state: "off"
then:
- action: input_boolean.turn_on
metadata: {}
data: {}
target:
entity_id: input_boolean.music_switch
- action: media_player.volume_set
metadata: {}
data:
volume_level: 0.25
target:
entity_id:
- media_player.living_room_2
- media_player.office
- action: media_player.play_media
metadata: {}
data:
media:
media_content_id: FV:2/17
media_content_type: favorite_item_id
metadata:
title: 80s Greatest Hits
thumbnail: >-
https://content-images.p-cdn.com/images/public/int/1/9/1/1/9355974061191_90W_90H.jpg
media_class: genre
children_media_class: null
navigateIds:
- {}
- media_content_type: favorites
media_content_id: ""
- media_content_type: favorites_folder
media_content_id: object.item.audioItem.audioBroadcast
browse_entity_id: media_player.office
target:
entity_id:
- media_player.living_room_2
- media_player.office
else:
- action: media_player.media_stop
metadata: {}
data: {}
target:
entity_id:
- media_player.office
- media_player.living_room_2
- action: input_boolean.turn_off
metadata: {}
data: {}
target:
entity_id: input_boolean.music_switch
mode: restart
-Thanks
afsy_d
November 10, 2025, 8:14am
4
Ok, and check the traces log of the automation: Troubleshooting automations - Home Assistant
You might consider some of these, as I do not have the issue, these are simple trial and error options:
Grouping the players and sending the same command to the group (not sure of it is going to help)
Perhaps use music assistant to send the command
Ensure both of the media players do not have the shuffle command on
zBernie
(Bernie)
November 10, 2025, 1:00pm
5
Thanks, I’ll check it out.