Amplifier toggle automation when Raspberry Pi starts playing

Hi Guys,

Currently I have the following setup:
I am running Home Assistant on a Raspberry Pi 4, which I play music on through the Spotify Connect Add-On. This is not linked to a specific account, so that both my roommate and I can connect to it when connected to Wifi. I connected the Pi to my amplifier with an Aux cable and the Amplifier’s power is plugged into a smart switch. The amplifier is old and has no wifi capabilities, so the way of turning it on is through the smart plug.

What I want:
An automation that turns on the power of the amplifier as soon as the Raspberry Pi starts playing music.

What I have now:
An automation that toggles the amp when there is changes in the state of the media player of my spotify account.

This doesn’t work. Now the amp is not toggled when my roommate starts playing. And the amp ís toggled when I start playing music on my cell phone when I am not even home.

Does anyone know whether there is a way to make a sensor from the aux output of the Rasperry Pi. So that the Home Assistant notices when the Raspberry Pi emits audio?

Hi, did you ever find a solution for this? I have exactly the same problem :sweat_smile:

I did not find a way to make a sensor from the aux output of the Raspberry Pi (but I am also not sure whether it’s possible).
In the end I solved with the Spotify API, which has an endpoint that indicates the device it’s playing on, so I would place an extra condition on the device being the Raspberry Pi.

Hope this helps you.