Detect "switch press to turn on lights" vs. "lights turned on by automation"

I want to perform slightly different actions when the “switch [on a MOES Tuya Zigbee Smart Light LED Dimmer Switch Module] press to turn on lights” vs. “lights turned on by automation”.

Looking at the logbook, I see different entries:

  • kitchen lights d01a turned on
    vs
  • kitchen lights d01a turned off triggered by service scene.turn_on

How do I run an automation for the first event, but not the second?

Two ideas:

(1) Check the logs and filter the event. There are some links below, but some further tips on how to find the right entities etc would be helpful.

(2) Run an automation on lights turned on/off, and then add a condition?

Background: Basically, the Tuya module has both a switch contact as well as zigbee control. A long press on the switch dims the lights (up/down). With the led lights I’ve got, it’s easily possible to leave the lights dimmed down so that they are actually off. Then, with short presses, the switch cycles between on (but dimmed so that lights are effectively off) and off. Therefore, when the switch is pressed, I’d like to make sure that the lights are dimmed to a certain minimum level. I appreciate that I could flash the firmware on the module, which might make it more user friend, but that’s a little beyond me at this moment.

Similar posts: Using events to trigger actions, Unable to get input_number.set_value ,automation and templates help, Automation Event Trigger from RFXCOM (Doorbell)