Trigger automation only if the physical switch is turned on

Hi, I did some research and i think i can trigger automation if the physical switch is turned on. in fact if in home assistant I turn on the switch I want it to do something and if i turn on the physical switch on the wall i want to do something else.

I think i can dot it with events ? but i’m a little bit lost

thanks. ( I don’t know if it’s a important information but it’s a tuya switch )

You need to use the context data:

Wow, Thanks for the answer ! the issue is it even more complicated that I expected…

I will try to figure out thanks again.

One variable…what is the switch?

It’s a Tuya wall switch named switch.lampe_chambre

in tuya integration I saw that : Smart Switch (la5v5qkk4saxjtx8)

It Worked thanks !!