I’m trying to write an automation to determine what turned a device off. Specifically I have switch.valve and I’m trying to determine what was responsible for it being turned off.
AFAIK a switch can be turned off by the actions switch.turn_off and switch.toggle. Additionally a switch can turn itself off as I’ve learned with my smart water valve, which does so after 30 minutes of being “on”.
Is there a way to catch when the switch actions are called? What about the last case where it’s turning itself off. Is there a way to catch that?