(09-28-2021, 07:56 PM)Tim Curtis Wrote: The challenge is that there are many different scenarios for Amp On/Off. For example below is a script that can handle 2 Amps. IIRC it was run from some selections on the main Menu. Other users want the Amp to turn off when Menu, Power, Shutdown. Other requests I've seen are to turn the Amp off after a delay when music has stopped playing or turn it off based on Clock Radio off time.
... and amps are all different. If you want to get the power state of mine, you need to send #01,1\r over a serial line (9600 baud), read the response and then flag the "power button" as on if the amp sends #02,1,01 as reponse, and off if the response is #02,1,0\r
On top you could read out the input source selector, which adds 10 additional responses to a command...
I don't see a chance to implement any amp steering software into the frontend of moode, because as said: too many options. The web page for steering mine (still working on it) currently looks the following way:
It still lacks the power button to shut down the pi on command and to display the current state (on/off) and will run as webserver on an ESP8266 with the required connectors. The idea is to use the ESP to turn on/off the amp, mute it, change the input source and either automatically shutdon the pi when I turn the amp off (by constantly monitoring the power state of the amp or override this shutdown if I enable a yet to be defined switch, or shut it down on command (another power button).
Side note: as I have no clue if the ESP can run the (async) webserver pluse the constant monitoring loops and handle the shutdown protection flag, I might have to use another SBC as man in the middle to forward the software requests to the amp (2x serial data in/out) and the pi monitoring/shutdown. An arduino pro mini 3.3V looks promising, even without sleep commands it only adds 13mA/3.3V to the total power consumption of around 75ma/3.3V the ESP requires - which by the way is way lower than the 200mA/5V a pi draws even when shut down.