use case 1:
A light-switch can be switched manually and via automation. In case of the manual switching I want the light to stay on until I manually switch it off. When the switch is switched on by an automation, a specific automation can switch it off.
In my case: I have a motion-sensor in the toilet that switches the ventilation system on and it is switched off after 5m. In the bathroom I have humidity-sensor which switches the ventilation on when humidity > 80% and an other automation that switches it of when humidity <= 80%. In order to get it to work correctly I had to store who triggered the ventilation in a separate variable.
use case 2:
For one switch there are multiple automations that can switch it on or off. If I want to debug why the light was switched, I have no way of knowing what triggered it.
Of course for every switch an alternative variable could be written from each automation that alters it state, but that becomes unmanageable quickly as your automation system grows.
proposed feature:
switch.<name>.attributes.triggered_by = mqtt|automation1|automation2
I hope you guys can see value in this addition. Please subscribe, share and like. It makes a huge difference.