Switch press for 2 seconds

Hi all,

I have a domotic system with switches that I can press then release. I would like to create some scenarios where it does a sequence of actions if I press it for 2 seconds and another if I press 3 seconds.

Could you please guide me in the right direction where I can find how to do this?

Thanks.