Determine how a switch (Shelly 1) was turned on?

Have a look at this: Work with "Triggered by" in automations - #8 by 123.