You need to use an Event trigger. ZHA-specific details can be found here
The simplest way to get it up and working quickly is to use one of the available Blueprints for the Sonoff button from the Blueprint Exchange. There are options for both ZHA and Zigbee2MQTT.