Stopping music in my office automatically when I get a phone call or join an audio/video call

I have an Intel NUC in my office, using mpd, to play music on some speakers.

I control this via either mpc or ncmpcpp, depending on what I want to do.

Since I worked out how to add Internet radio streams to mpd, I’m rather enjoying that.

But if I get a phone call, or go on an audio/video call on my computer, I want the music to pause automatically.

I already have things set up, on my machines, and with Home Assistant, to detect and handle me being on the phone or taking a video call.

It just needed me to integrate mpd with Home Assistant, and then to have it pause the music when an automation is triggered.


(And if I didn’t have Home Assistant, or didn’t want to use a system like that, I could just trigger a script which uses mpc to pause the player. That work cover calls from my laptop easily, but would’t be so straightforward for phone calls.)

Adding mpd to Home Assistant

There is no GUI integration for adding mpd to Home Assistant; it is some yaml in the configuration file:

# Example configuration.yaml entry
  - platform: mpd
    host: IP_ADDRESS
    name: officenuc

To get this to work, I had to allow the box running Home Assistant to be able to talk to the box running mpd.

This is sub-optimal, as they are on separate VLANs, so I wonder if I need to think about moving boxes around the VLANs, to keep things isolated. But, for now, it works.

Once I’d done that, and restarted Home Assistant, there is a controller in the Home Assistant GUI, letting me pause, and change volume (and not much more).

Pausing mpd when I get a phone call / join an audio/video call

I extended the automations that I had already in place in Home Assistant for handling when I get a phone call / go onto a video call.

To do that, I added a new Action of “Call a service”.

The service is media_player:media_pause.

Under “Choose entity”, I selected the mpd option for my server.

And that was it.

Now, if you ring me, or if I join a video/audio call from my computer, my music stops automatically.