Automation to mute receiver when Sonos starts playing?

So I’m new to Home Assistant but I’m looking to do something that seems pretty easy. I just want my Yamaha Receiver to mute when my Sonos (media_player.greatroom) starts playing. I have a script that uses my Logitech Harmony remote to mute the receiver and it works fine. I just can’t seem to get the automation working to run the script when the Sonos state goes to Playing. This is what I currently have in the automations file:

- id: '1591655461806'
  alias: Mute Yamaha when Sonos Plays
  description: Mutes Yamaha Receiver when Sonos starts playing
  - entity_id: media_player.great_room
    platform: state
    to: Playing
  - data: {}
    entity_id: remote.harmony_elite_hub_lr
    service: script.mute_yamaha_receiver

What does your script look like. seems like the automation is ok.

The script works fine when I run it by itself.

# Mute Yamaha Receiver from Logitech Harmony One
      alias: Mute Yamaha Receiver
        - service: remote.send_command
            entity_id: remote.harmony_elite_hub_lr
                - Mute
            device: 50230690

Ok so the text for your “to” state trigger has to be an exact match. I believe it should be playing with a small p.

Also the data and entity_id lines aren’t required by your script so likely could be removed.

I’ll give that a shot. I couldn’t find what the valid states for the Sonos are anywhere.

Media_player typical states are idle, paused, playing, off. I’ve also seen unknown and likely there are others. If you use off make sure you put quotes around it to avoid matching issues.

The dashboard shows the Sonos is paused when not playing and playing when there is something playing. I’ve tried using the from tag as well but that didn’t work either.

Did you get rid of the data and entity_id in the script service call? Does the log (Developer Tools/Logs) show any errors?

Using the lowercase p seems to have fixed it. I removed the data and entity_id as well.

Thanks for your help!

1 Like