Trigger as automation condition

I’ve got an automation scenario where I would like to distinguish between a situation where a switch was turned off by a software button vs a hardware button. Specifically, I have a situation where if my Marantz receiver is turned off manually (by the IR remote or the button on the unit) I want it to trigger an automation but NOT if it was turned off by a button in home assistant or an automation.

Now, one way I could do this is by having all the automations and buttons in home assistant temporarily turn on an input_boolean before executing media_player.turn_off, and then having the other automation only execute if that input_boolean is off. But I see that the logbook tells me what has turned the receiver on or off, so I’m trying to find a way to check that information directly in my automations. Is this possible?

Possibly by using the event context id. See:

Marvellous, thank you! Sometimes it’s just a matter of knowing the key word to search for!

1 Like