Screensaver that stops music playback

Thanks for the pointers!
I am able to monitor the CEC status of my amp using echo “pow 5” | /usr/osmc/bin/cec-client -s -d 1 which gives me a status of ON or SUSPEND. Win!

I am also able to adjust the /system/peripherals.xml to add more options as per:

however can not get playback to pause or stop when either the amp is turned off (or the TV on another system).

Is there a way of poling the status of the amp and if the status is suspend, issue a STOP command to Kodi?
Likewise if there is no CEC activity (i.e. remote presses) for say, 3 hours.

Thanks.