How to switch media_player to a specific source ONLY when turning it on via Alexa

What is the easiest way to trigger an automation without tracking a state?

My task: I want to turn on and off my receiver (a media_player in HASS) via voice, and when I turn it on via Alexa, it should also be set to the source-channel of my Echo Dot. This should only happen for the voice command, not for any other way to turn the receiver on.
I implemented this using a boolean_input, which is exposed to Alexa via emulated Hue. An Automation is triggered when this boolean switches to “on”, turns on the receiver and also changes the channel. Another automation for “off” turns the receiver off.
This works, but has it’s own on/off state, which may run out of sync with reality. As soon as the receiver is turned off in some other way (for example by my TV via HDMI CEC), the boolean_input state is still “on” and doesn’t match the real on/off state of the receiver. Turning on via Alexa now does not work. (but turning off, the on does).

Is there a way to always send the on + source channel command to my receiver when I say “receiver on”, no matter what state home assistant thing the receiver is in? Or any other idea how to solve this seemingly trivial task?

Changed title and some text in hope someone has an idea :slight_smile: