Hm, yeah, I am making strongly use of mosquitto and my mosquitto-frontend (and openHab) and I do something similar.
It works like this, openhab turns on the speakers by a let’s say mosquitto-heartbeat-message.
Five minutes after last the heartbeat-message the speakers/amplifier are turned off.
So you have to send the heartbeat-message e.g. every minute to keep them turned on!
This is what my frontend does - it sends a message every 30 seconds when state is playing to keep the amplifier turned on.
Of course you don’t have to use openHab. A simple python script should do the job.
If you are interested in such a solution, let me know.
Nevertheless this is how my openHab config looks like:
rule "Server Speaker Mopidy Keep Alive"
Item Mopidy_Speaker_Keep_Alive received update
rule "Server Speakers auto timer"
Item PCSpeakersServer received command ON
# set the timeout back to 5 mins
serverSpeakersTimeout= 60 ; // 5 min --> 300 / 5secs = 60
logInfo("SrvSpkrs","Started timeout ")
rule "Every 5 seconds"
Time cron "0/5 0/1 * 1/1 * ? *"
if (serverSpeakersTimeout > 0)
serverSpeakersTimeout = serverSpeakersTimeout - 1