Use a GPIO to turn an amplifier on when audio is being played

Is there any way to do this? Not sure if it’s a task for Kodi or OSMC, but it would be very useful. Ideally it would stay on for a definable period before automatically turning the amp off.

You could probably do this with CEC.

Can you elaborate? I was thinking along the lines of a script checking for audio output and setting a GPIO pin. I don’t see how CEC over HDMI helps here.

Monitor the GPIO pin you’re using (assume it’s a button or something)
Send a CEC wake-up request

Perhaps I should have explained more fully. I want to use a GPIO pin as an output to control a relay and turn on an amp. I want Kodi/OSMC to act when media is being played, to trigger the output pin.

You may be able to use the Kodi Callbacks add-on to trigger an outside script or something you make on your own to provide this function.

1 Like

Thanks, that sounds promising.